Skip to content

Commit 62ede25

Browse files
committed
fix(openid4vci): align wallet nonce handling with 1.0
1 parent d434d1b commit 62ede25

18 files changed

Lines changed: 753 additions & 99 deletions

File tree

waltid-libraries/protocols/waltid-openid4vc-wallet-server/src/main/kotlin/id/walt/wallet2/server/handlers/Wallet2RouteHandler.kt

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,30 @@ object Wallet2RouteHandler {
119119
*/
120120
getAccountId: (suspend RoutingCall.() -> String?)? = null,
121121
attestationAssembler: ClientAttestationAssembler? = null,
122+
) = registerWallet2Routes(
123+
resolver = resolver,
124+
getAccountId = getAccountId,
125+
attestationAssembler = attestationAssembler,
126+
allowInsecureHttpForTests = false,
127+
)
128+
129+
/**
130+
* Test/development variant for local issuer fixtures whose nonce endpoint cannot use HTTPS.
131+
* Production callers must use the strict overload above.
132+
*/
133+
fun Route.registerWallet2Routes(
134+
resolver: WalletResolver,
135+
getAccountId: (suspend RoutingCall.() -> String?)?,
136+
attestationAssembler: ClientAttestationAssembler?,
137+
allowInsecureHttpForTests: Boolean,
122138
) {
123139
route("/wallet") {
124-
registerWalletManagementRoutes(resolver, getAccountId, attestationAssembler)
140+
registerWalletManagementRoutes(
141+
resolver = resolver,
142+
getAccountId = getAccountId,
143+
attestationAssembler = attestationAssembler,
144+
allowInsecureHttpForTests = allowInsecureHttpForTests,
145+
)
125146
}
126147
route("/stores", { tags = listOf("Named Store Management") }) {
127148
registerNamedStoreRoutes(resolver)
@@ -136,6 +157,7 @@ object Wallet2RouteHandler {
136157
resolver: WalletResolver,
137158
getAccountId: (suspend RoutingCall.() -> String?)?,
138159
attestationAssembler: ClientAttestationAssembler?,
160+
allowInsecureHttpForTests: Boolean,
139161
) {
140162

141163
post("", Wallet2OpenApiDocs.createWallet()) {
@@ -546,6 +568,7 @@ object Wallet2RouteHandler {
546568
wallet = wallet,
547569
request = req,
548570
attestationAssembler = attestationAssembler,
571+
allowInsecureHttpForTests = allowInsecureHttpForTests,
549572
)
550573
call.respond(result)
551574
} catch (e: Exception) {
@@ -585,6 +608,20 @@ object Wallet2RouteHandler {
585608
)
586609
}
587610

611+
post("/request-nonce", {
612+
summary = "Isolated: obtain a fresh credential proof nonce"
613+
request { pathParameter<String>("walletId"); body<RequestNonceRequest>() }
614+
response { HttpStatusCode.OK to { body<RequestNonceResult>() } }
615+
}) {
616+
val req = call.receive<RequestNonceRequest>()
617+
call.respond(
618+
WalletIssuanceHandler.requestNonce(
619+
request = req,
620+
allowInsecureHttpForTests = allowInsecureHttpForTests,
621+
)
622+
)
623+
}
624+
588625
post("/sign-proof", {
589626
summary = "Isolated: sign a proof-of-possession JWT"
590627
request { pathParameter<String>("walletId"); body<SignProofRequest>() }

0 commit comments

Comments
 (0)