Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.

Commit b63bef1

Browse files
committed
Split off and store disclosures with the SD-JWT
1 parent 07587e7 commit b63bef1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/kotlin/id/walt/service/SSIKit2WalletService.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,15 @@ class SSIKit2WalletService(accountId: UUID, walletId: UUID) : WalletService(acco
328328
val addableCredentials: List<WalletCredential> = credentialResponses.map { credentialResp ->
329329
val credential = credentialResp.credential!!.jsonPrimitive.content
330330

331-
val credentialJwt = credential.decodeJws()
331+
val credentialJwt = credential.decodeJws(withSignature = true)
332332

333333
when (val typ = credentialJwt.header["typ"]?.jsonPrimitive?.content?.lowercase()) {
334334
"jwt" -> {
335335
val credentialId = credentialJwt.payload["vc"]!!.jsonObject["id"]?.jsonPrimitive?.content?.takeIf { it.isNotBlank() }
336336
?: randomUUID()
337337

338+
println("Got JWT credential: $credentialJwt")
339+
338340
WalletCredential(
339341
wallet = walletId,
340342
id = credentialId,
@@ -348,7 +350,11 @@ class SSIKit2WalletService(accountId: UUID, walletId: UUID) : WalletService(acco
348350
val credentialId = credentialJwt.payload["id"]?.jsonPrimitive?.content?.takeIf { it.isNotBlank() }
349351
?: randomUUID()
350352

353+
println("Got SD-JWT credential: $credentialJwt")
354+
351355
val disclosures = credentialJwt.signature.split("~").drop(1)
356+
println("Disclosures (${disclosures.size}): $disclosures")
357+
352358
val disclosuresString = disclosures.joinToString("~")
353359

354360
WalletCredential(

0 commit comments

Comments
 (0)