@@ -12492,6 +12492,9 @@ sloppyConst FetchFromEnv, AWS_ACCESS_KEY_ID
1249212492sloppyConst FetchFromEnv, AWS_SECRET_ACCESS_KEY
1249312493sloppyConst BakeIntoBinary, AWS_REGION
1249412494sloppyConst FetchFromEnv, AWS_ACCOUNT_ID
12495+ type
12496+ XAmz = enum
12497+ SecurityToken = "X-Amz-Security-Token", ContentSha256 = "X-Amz-Content-Sha256"
1249512498proc atozSign(recall: var Recallable; query: JsonNode; algo: SigningAlgo = SHA256) =
1249612499 let
1249712500 date = makeDateTime()
@@ -12515,8 +12518,8 @@ proc atozSign(recall: var Recallable; query: JsonNode; algo: SigningAlgo = SHA25
1251512518 normal = PathNormal.Default
1251612519 recall.headers["Host"] = url.hostname
1251712520 recall.headers["X-Amz-Date"] = date
12521+ recall.headers[$ContentSha256] = hash(recall.body, SHA256)
1251812522 let
12519- algo = SHA256
1252012523 scope = credentialScope(region = region, service = awsServiceName, date = date)
1252112524 request = canonicalRequest(recall.meth, $url, query, recall.headers, recall.body,
1252212525 normalize = normal, digest = algo)
@@ -12531,9 +12534,6 @@ proc atozSign(recall: var Recallable; query: JsonNode; algo: SigningAlgo = SHA25
1253112534 recall.headers.del "Host"
1253212535 recall.url = $url
1253312536
12534- type
12535- XAmz = enum
12536- SecurityToken = "X-Amz-Security-Token", ContentSha256 = "X-Amz-Content-Sha256"
1253712537method atozHook(call: OpenApiRestCall; url: Uri; input: JsonNode): Recallable {.base.} =
1253812538 ## the hook is a terrible earworm
1253912539 var headers = newHttpHeaders(massageHeaders(input.getOrDefault("header")))
@@ -12550,6 +12550,5 @@ method atozHook(call: OpenApiRestCall; url: Uri; input: JsonNode): Recallable {.
1255012550 let session = getEnv("AWS_SESSION_TOKEN", "")
1255112551 if session != "":
1255212552 headers[$SecurityToken] = session
12553- headers[$ContentSha256] = hash(text, SHA256)
1255412553 result = newRecallable(call, url, headers, text)
1255512554 result.atozSign(input.getOrDefault("query"), SHA256)
0 commit comments