aws-sdk-for-zig/src/aws_authentication.zig

34 lines
864 B
Zig
Raw Normal View History

2022-01-20 20:18:47 +00:00
const std = @import("std");
pub const Credentials = struct {
access_key: []const u8,
2022-01-20 20:18:47 +00:00
secret_key: []u8,
session_token: ?[]const u8,
// uint64_t expiration_timepoint_seconds);
2022-01-20 20:18:47 +00:00
allocator: std.mem.Allocator,
const Self = @This();
pub fn init(
allocator: std.mem.Allocator,
access_key: []const u8,
secret_key: []u8,
session_token: ?[]const u8,
) Self {
return .{
.access_key = access_key,
.secret_key = secret_key,
.session_token = session_token,
.allocator = allocator,
};
}
pub fn deinit(self: Self) void {
2022-02-09 06:37:20 +00:00
std.crypto.utils.secureZero(u8, self.secret_key);
2022-01-20 20:18:47 +00:00
self.allocator.free(self.secret_key);
2022-02-09 06:37:20 +00:00
self.allocator.free(self.access_key);
2022-01-20 20:18:47 +00:00
if (self.session_token) |t| self.allocator.free(t);
}
};