feat: Digestをhexからbase64に変更

This commit is contained in:
usbharu 2023-03-31 17:17:45 +09:00
parent 29174615a7
commit 6df3c1a670
1 changed files with 2 additions and 1 deletions

View File

@ -61,8 +61,9 @@ val httpSignaturePlugin = createClientPlugin("HttpSign", ::HttpSignaturePluginCo
if (request.bodyType?.type == String::class) {
println(body as String)
println("Digest !!")
// UserAuthService.sha256.reset()
val digest =
hex(UserAuthService.sha256.digest((body as String).toByteArray(Charsets.UTF_8)))
Base64.getEncoder().encodeToString(UserAuthService.sha256.digest(body.toByteArray(Charsets.UTF_8)))
request.headers.append("Digest", "sha-256="+digest)
}