Skip to content

Commit 3c51852

Browse files
Thomas Lenztlenz
authored andcommitted
fix(openId4VP): change input data for calculating transaction_data_hashes
Reason: there was a discussion in openID4VP about how transaction_data_hashes have to be calculated. Agreement to use text from v23, see openid/OpenID4VP#621
1 parent 177bca7 commit 3c51852

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Release 5.7.0:
88
- OpenID for Verifiable Credential Issuance:
99
- Expose `oauth2Client` in `WalletService`
1010
- Remove code elements deprecated in `5.6.3` in `OpenId4VciClient`
11+
- Update transaction_data_hashes according to result from https://github.com/openid/OpenID4VP/pull/621
1112
- Holder:
1213
- Replace `keyPair` with `keyMaterial`
1314
- Functions:

openid-data-classes/src/commonMain/kotlin/at/asitplus/openid/TransactionData.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package at.asitplus.openid
22

33
import at.asitplus.signum.indispensable.io.Base64UrlStrict
44
import io.ktor.util.*
5+
import io.ktor.utils.io.charsets.*
6+
import io.ktor.utils.io.core.*
57
import io.matthewnelson.encoding.core.Decoder.Companion.decodeToByteArray
68
import kotlinx.serialization.ContextualSerializer
79
import kotlinx.serialization.PolymorphicSerializer
@@ -19,7 +21,7 @@ import okio.ByteString.Companion.toByteString
1921
typealias TransactionDataBase64Url = JsonPrimitive
2022

2123
fun TransactionDataBase64Url.sha256(): ByteArray =
22-
this.content.decodeToByteArray(Base64UrlStrict).toByteString().sha256().toByteArray()
24+
this.content.toByteArray(Charsets.UTF_8).toByteString().sha256().toByteArray()
2325

2426
/**
2527
* OID4VP Draft 24: OPTIONAL. Array of strings, where each string is a base64url encoded JSON object that contains a typed parameter

0 commit comments

Comments
 (0)