File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed
packages/oauth2/src/common/jwt Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @openid4vc/oauth2 " : patch
3+ ---
4+
5+ feat: add ` kid ` to the JwtSigner interface
Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ export function jwtSignerFromJwt({
124124 alg : header . alg ,
125125 method : 'x5c' ,
126126 x5c : header . x5c ,
127+ kid : header . kid ,
127128 } ,
128129 } )
129130 }
@@ -208,6 +209,7 @@ export function jwtSignerFromJwt({
208209 return {
209210 method : 'custom' ,
210211 alg : header . alg ,
212+ kid : header . kid ,
211213 }
212214 }
213215
Original file line number Diff line number Diff line change @@ -7,31 +7,62 @@ export type JwtSignerDid = {
77 method : 'did'
88 didUrl : string
99 alg : string
10+
11+ /**
12+ * The key id that should be used for signing. You need to make sure the kid actuall matches
13+ * with the key associated with the didUrl.
14+ */
15+ kid ?: string
1016}
1117
1218export type JwtSignerJwk = {
1319 method : 'jwk'
1420 publicJwk : Jwk
1521 alg : string
22+
23+ /**
24+ * The key id that should be used for signing. You need to make sure the kid actuall matches
25+ * with the key associated with the jwk.
26+ *
27+ * If not provided the kid can also be extracted from the `publicJwk`. Providing it here means the `kid` won't
28+ * be included in the JWT header.
29+ */
30+ kid ?: string
1631}
1732
1833export type JwtSignerX5c = {
1934 method : 'x5c'
2035 x5c : string [ ]
2136 alg : string
37+
38+ /**
39+ * The key id that should be used for signing. You need to make sure the kid actuall matches
40+ * with the key associated with the leaf certificate.
41+ */
42+ kid ?: string
2243}
2344
2445export type JwtSignerFederation = {
2546 method : 'federation'
2647 trustChain ?: [ string , ...string [ ] ]
2748 alg : string
49+
50+ /**
51+ * The key id that should be used for signing. You need to make sure the kid actuall matches
52+ * with a key present in the federation.
53+ */
2854 kid : string
2955}
3056
3157// In case of custom nothing will be added to the header
3258export type JwtSignerCustom = {
3359 method : 'custom'
3460 alg : string
61+
62+ /**
63+ * The key id that should be used for signing.
64+ */
65+ kid ?: string
3566}
3667
3768export type JwtSigner = JwtSignerDid | JwtSignerJwk | JwtSignerX5c | JwtSignerFederation | JwtSignerCustom
You can’t perform that action at this time.
0 commit comments