fix signing tests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Emil Lerch 2022-01-20 12:53:29 -08:00
parent d4c9f22316
commit 7967d7e3ab
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -739,14 +739,14 @@ test "canonical request" {
.method = "GET", .method = "GET",
.headers = headers.items, .headers = headers.items,
}; };
const access_key = try allocator.dupe(u8, "AKIDEXAMPLE");
const secret_key = try allocator.dupe(u8, "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY");
const credential = auth.Credentials.init(allocator, access_key, secret_key, null);
defer credential.deinit();
const request = try createCanonicalRequest(allocator, req, .{ const request = try createCanonicalRequest(allocator, req, .{
.region = "us-west-2", // us-east-1 .region = "us-west-2", // us-east-1
.service = "sts", // service .service = "sts", // service
.credentials = .{ .credentials = credential,
.access_key = "AKIDEXAMPLE",
.secret_key = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY",
.session_token = null,
},
.signing_time = 1440938160, // 20150830T123600Z .signing_time = 1440938160, // 20150830T123600Z
}); });
defer allocator.free(request.arr); defer allocator.free(request.arr);
@ -805,16 +805,16 @@ test "can sign" {
// _ = try std.io.getStdErr().write("\n"); // _ = try std.io.getStdErr().write("\n");
// } // }
const access_key = try allocator.dupe(u8, "AKIDEXAMPLE");
const secret_key = try allocator.dupe(u8, "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY");
const credential = auth.Credentials.init(allocator, access_key, secret_key, null);
defer credential.deinit();
// we could look at sigv4 signing tests at: // we could look at sigv4 signing tests at:
// https://github.com/awslabs/aws-c-auth/blob/ace1311f8ef6ea890b26dd376031bed2721648eb/tests/sigv4_signing_tests.c#L1478 // https://github.com/awslabs/aws-c-auth/blob/ace1311f8ef6ea890b26dd376031bed2721648eb/tests/sigv4_signing_tests.c#L1478
const config = Config{ const config = Config{
.region = "us-east-1", .region = "us-east-1",
.service = "service", .service = "service",
.credentials = .{ .credentials = credential,
.access_key = "AKIDEXAMPLE",
.secret_key = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY",
.session_token = null, // TODO: add session token. I think we need X-Amz-Security-Token for that. Also, x-amz-region-set looks like part of v4a that will need to be dealt with eventually
},
.signing_time = 1440938160, // 20150830T123600Z .signing_time = 1440938160, // 20150830T123600Z
}; };
// TODO: There is an x-amz-content-sha256. Investigate // TODO: There is an x-amz-content-sha256. Investigate