feat: Digestをhexからbase64に変更

This commit is contained in:
usbharu 2023-03-31 17:17:45 +09:00
parent 1d9fbb76d1
commit 33324e724c
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
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)
}