Skip to content

Commit

Permalink
feat: initial client with pre-auth/auth draft 11, 13 and 14 support (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra authored Oct 23, 2024
1 parent bf6e37a commit d530a02
Show file tree
Hide file tree
Showing 70 changed files with 5,530 additions and 17 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ All packages are placed in the [`packages/`](./packages) directory.
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| [`@animo-id/oid4vci`](./packages/oid4vci) | [![@animo-id/oid4vci version](https://img.shields.io/npm/v/@animo-id/oid4vci)](https://npmjs.com/package/@animo-id/oid4vci) | Implementation of the OpenID for Verifiable Credential Issuance specification |

## Environments

This library is platform agnostic and support Node.JS, React Native and browsers out of the box. However because of this it is required to provide some callbacks for simple things like hashing, generate random bytes, etc.

## Contributing

Is there something you'd like to fix or add? Great, we love community
Expand Down
6 changes: 5 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
"linter": {
"enabled": true,
"rules": {
"recommended": true
"recommended": true,
"correctness": {
"recommended": true,
"noUnusedImports": "error"
}
}
},
"vcs": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@changesets/cli": "^2.27.9",
"msw": "^2.4.13",
"tsup": "^8.3.0",
"typescript": "^5.6.3",
"vitest": "^2.1.3"
Expand Down
7 changes: 7 additions & 0 deletions packages/oid4vci/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,12 @@
},
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts --clean --sourcemap"
},
"dependencies": {
"buffer": "^6.0.3",
"valibot": "^0.42.1"
},
"devDependencies": {
"jose": "^5.9.6"
}
}
107 changes: 107 additions & 0 deletions packages/oid4vci/src/__tests__/__fixtures__/bdr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
export const bdrDraft13 = {
credentialOffer:
'openid-credential-offer://?credential_offer=%7B%22credential_issuer%22%3A%22https%3A%2F%2Fdemo.pid-issuer.bundesdruckerei.de%2Fc%22%2C%22credential_configuration_ids%22%3A%5B%22pid-sd-jwt%22%2C%20%22pid-mso-mdoc%22%5D%2C%22grants%22%3A%7B%22authorization_code%22%3A%7B%7D%7D%7D',
credentialOfferObject: {
credential_issuer: 'https://demo.pid-issuer.bundesdruckerei.de/c',
credential_configuration_ids: ['pid-sd-jwt', 'pid-mso-mdoc'],
grants: { authorization_code: {} },
},
authorizationServerMetadata: {
issuer: 'https://demo.pid-issuer.bundesdruckerei.de/c',
authorization_endpoint: 'https://demo.pid-issuer.bundesdruckerei.de/c/authorize',
token_endpoint: 'https://demo.pid-issuer.bundesdruckerei.de/c/token',
pushed_authorization_request_endpoint: 'https://demo.pid-issuer.bundesdruckerei.de/c/par',
require_pushed_authorization_requests: true,
token_endpoint_auth_methods_supported: ['none'],
response_types_supported: ['code'],
code_challenge_methods_supported: ['S256'],
dpop_signing_alg_values_supported: [
'RS256',
'RS384',
'RS512',
'PS256',
'PS384',
'PS512',
'ES256',
'ES256K',
'ES384',
'ES512',
'EdDSA',
'Ed25519',
'Ed448',
],
},
credentialIssuerMetadata: {
credential_issuer: 'https://demo.pid-issuer.bundesdruckerei.de/c',
credential_endpoint: 'https://demo.pid-issuer.bundesdruckerei.de/c/credential',
display: [
{
name: 'Bundesdruckerei GmbH',
locale: 'de-DE',
},
{
name: 'Bundesdruckerei GmbH',
locale: 'en-US',
},
],
credential_configurations_supported: {
'pid-sd-jwt': {
scope: 'pid',
cryptographic_binding_methods_supported: ['jwk'],
credential_signing_alg_values_supported: ['ES256'],
proof_types_supported: {
jwt: {
proof_signing_alg_values_supported: ['ES256'],
},
},
vct: 'https://example.bmi.bund.de/credential/pid/1.0',
format: 'vc+sd-jwt',
},
'pid-mso-mdoc': {
scope: 'pid',
cryptographic_binding_methods_supported: ['cose_key'],
credential_signing_alg_values_supported: ['ES256'],
proof_types_supported: {
jwt: {
proof_signing_alg_values_supported: ['ES256'],
},
},
doctype: 'eu.europa.ec.eudi.pid.1',
format: 'mso_mdoc',
},
},
},
pushedAuthorizationResponse: {
request_uri: 'urn:ietf:params:oauth:request_uri:hvbhS1BHhHZzZbwEbBwK2Y',
expires_in: 60,
},
authorizationRequestUrl:
'https://demo.pid-issuer.bundesdruckerei.de/c/authorize?request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3AhvbhS1BHhHZzZbwEbBwK2Y&client_id=76c7c89b-8799-4bd1-a693-d49948a91b00',
accessTokenResponse: {
access_token: 'yvFUHf7pZBfgHd6pkI1ktc',
token_type: 'DPoP',
expires_in: 3600,
c_nonce: 'sjNMiqyfmBeD1qioCVyqvS',
c_nonce_expires_in: 3600,
},
credentialResponse: {
credential:
'eyJ4NWMiOlsiTUlJQ2REQ0NBaHVnQXdJQkFnSUJBakFLQmdncWhrak9QUVFEQWpDQmlERUxNQWtHQTFVRUJoTUNSRVV4RHpBTkJnTlZCQWNNQmtKbGNteHBiakVkTUJzR0ExVUVDZ3dVUW5WdVpHVnpaSEoxWTJ0bGNtVnBJRWR0WWtneEVUQVBCZ05WQkFzTUNGUWdRMU1nU1VSRk1UWXdOQVlEVlFRRERDMVRVRkpKVGtRZ1JuVnVhMlVnUlZWRVNTQlhZV3hzWlhRZ1VISnZkRzkwZVhCbElFbHpjM1ZwYm1jZ1EwRXdIaGNOTWpRd05UTXhNRGd4TXpFM1doY05NalV3TnpBMU1EZ3hNekUzV2pCc01Rc3dDUVlEVlFRR0V3SkVSVEVkTUJzR0ExVUVDZ3dVUW5WdVpHVnpaSEoxWTJ0bGNtVnBJRWR0WWtneENqQUlCZ05WQkFzTUFVa3hNakF3QmdOVkJBTU1LVk5RVWtsT1JDQkdkVzVyWlNCRlZVUkpJRmRoYkd4bGRDQlFjb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bQC03eVHP1qTit37OOCIg4',
crv: 'P-256',
d: 'PBsZ0X1NnZrXqr1X77TtVQM2BVM2yxjq-FolyGd4EYM',
},
}
Loading

0 comments on commit d530a02

Please sign in to comment.