-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(openid4vc-client): pre-authorized (#1243)
This PR adds support for the `pre-authorized` OpenID for Verifiable Credentials issuance flow to the new `openid4vc-client` module. Here are some highlights of the work: - Allows the user to execute the entire `pre-authorized` flow by calling a single method. - Adds a happy-flow test - HTTP(S) requests and responses are mocked using a network mocking library called [nock](https://github.com/nock/nock) - Because the JSON-LD credential that is received is expanded by the `W3cCredentialService`, I've added a few new contexts to our test document loader. - Not-so-happy-flow tests will be added later on. If you have any suggestions for edge cases that deserve testing, feel free to drop a comment. - Modifies the `JwsService` - The `JwsService` was geared towards a very specific use case. I've generalized its API so it's usable for a wider range of applications. - All pre-existing tests and calls to the `JwsService` have been updated. It's worth noting that I have had to add some `@ts-ignore` statements here and there to get around some incomplete types in the `OpenID4VCI-Client` library we're using. Once these issues have been resolved in the client library, they will be removed. **Work funded by the government of Ontario** --------- Signed-off-by: Karim Stekelenburg <[email protected]> Co-authored-by: Timo Glastra <[email protected]>
- Loading branch information
1 parent
7f65ba9
commit 3d86e78
Showing
29 changed files
with
1,352 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface Jwk { | ||
kty: 'EC' | 'OKP' | ||
crv: 'Ed25519' | 'X25519' | 'P-256' | 'P-384' | 'secp256k1' | ||
x: string | ||
y?: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
export { Jwk } from './JwkTypes' | ||
export { JwsService } from './JwsService' | ||
|
||
export * from './jwtUtils' | ||
|
||
export { KeyType } from './KeyType' | ||
export { Key } from './Key' | ||
|
||
export * from './signing-provider' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export const jwtKeyAlgMapping = { | ||
HMAC: ['HS256', 'HS384', 'HS512'], | ||
RSA: ['RS256', 'RS384', 'RS512'], | ||
ECDSA: ['ES256', 'ES384', 'ES512'], | ||
'RSA-PSS': ['PS256', 'PS384', 'PS512'], | ||
EdDSA: ['Ed25519'], | ||
} | ||
|
||
export type JwtAlgorithm = keyof typeof jwtKeyAlgMapping | ||
|
||
export function isJwtAlgorithm(value: string): value is JwtAlgorithm { | ||
return Object.keys(jwtKeyAlgMapping).includes(value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.