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

34 lines
867 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 {
for (self.secret_key) |_, i| self.secret_key[i] = 0;
self.allocator.free(self.access_key);
self.allocator.free(self.secret_key);
if (self.session_token) |t| self.allocator.free(t);
}
};