Skip to content

Commit 06c016f

Browse files
committed
docs(changeset): apu and apv in JWE encryptor are now base64 encoded values, to align with JOSE
Signed-off-by: Timo Glastra <[email protected]>
1 parent 864e3ae commit 06c016f

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.changeset/cruel-pants-search.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@openid4vc/openid4vp": minor
3+
"@openid4vc/oauth2": minor
4+
---
5+
6+
apu and apv in JWE encryptor are now base64 encoded values, to align with JOSE

packages/oauth2/src/common/jwt/z-jwt.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ export type JwtSignerWithJwk = JwtSigner & { publicJwk: Jwk }
7171

7272
export type JweEncryptor = JwtSignerJwk & {
7373
enc: string
74+
75+
/**
76+
* base64-url encoded apu
77+
*/
7478
apu?: string
79+
80+
/**
81+
* base64-url encoded apv
82+
*/
7583
apv?: string
7684
}
7785

packages/openid4vp/src/authorization-response/create-authorization-response.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
Oauth2ServerErrorResponseError,
88
fetchJwks,
99
} from '@openid4vc/oauth2'
10-
import { dateToSeconds } from '@openid4vc/utils'
10+
import { dateToSeconds, encodeToBase64Url } from '@openid4vc/utils'
1111
import { addSecondsToDate } from '../../../utils/src/date'
1212
import type { Openid4vpAuthorizationRequest } from '../authorization-request/z-authorization-request'
1313
import type { Openid4vpAuthorizationRequestDcApi } from '../authorization-request/z-authorization-request-dc-api'
@@ -163,8 +163,8 @@ export async function createOpenid4vpAuthorizationResponse(
163163
? {
164164
method: 'jwk',
165165
publicJwk: clientMetaJwks.encJwk,
166-
apu: jarm.encryption?.nonce,
167-
apv: authorizationRequestPayload.nonce,
166+
apu: jarm.encryption.nonce ? encodeToBase64Url(jarm.encryption.nonce) : undefined,
167+
apv: encodeToBase64Url(authorizationRequestPayload.nonce),
168168
alg: supportedJarmMetadata.client_metadata.authorization_encrypted_response_alg,
169169
enc: supportedJarmMetadata.client_metadata.authorization_encrypted_response_enc,
170170
}

0 commit comments

Comments
 (0)