-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(openid4vc): v11 metadata type and transformation (#1983)
Signed-off-by: Timo Glastra <timo@animo.id>
- Loading branch information
1 parent
a093150
commit 35a04e3
Showing
9 changed files
with
167 additions
and
112 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,5 @@ | ||
--- | ||
'@credo-ts/openid4vc': patch | ||
--- | ||
|
||
fix v11 metadata typing and update v11<->v13 tranformation logic accordingly |
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
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
77 changes: 77 additions & 0 deletions
77
packages/openid4vc/src/shared/__tests__/issuerMetadataUtils.test.ts
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,77 @@ | ||
import type { Wallet } from '@credo-ts/core' | ||
|
||
import { KeyType } from '@credo-ts/core' | ||
|
||
import { getAgentContext } from '../../../../core/tests' | ||
import { credentialsSupportedV11ToV13, credentialsSupportedV13ToV11 } from '../issuerMetadataUtils' | ||
|
||
const agentContext = getAgentContext({ | ||
wallet: { | ||
supportedKeyTypes: [KeyType.Ed25519, KeyType.P256], | ||
} as Wallet, | ||
}) | ||
|
||
describe('issuerMetadataUtils', () => { | ||
describe('credentialsSupportedV13toV11', () => { | ||
test('should correctly transform from v13 to v11 format', () => { | ||
expect( | ||
credentialsSupportedV13ToV11({ | ||
'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: 'urn:eu.europa.ec.eudi:pid:1', | ||
format: 'vc+sd-jwt', | ||
}, | ||
}) | ||
).toEqual([ | ||
{ | ||
id: 'pid-sd-jwt', | ||
scope: 'pid', | ||
cryptographic_binding_methods_supported: ['jwk'], | ||
cryptographic_suites_supported: ['ES256'], | ||
vct: 'urn:eu.europa.ec.eudi:pid:1', | ||
format: 'vc+sd-jwt', | ||
}, | ||
]) | ||
}) | ||
}) | ||
|
||
describe('credentialsSupportedV11toV13', () => { | ||
test('should correctly transform from v11 to v13 format', () => { | ||
expect( | ||
credentialsSupportedV11ToV13(agentContext, [ | ||
{ | ||
id: 'pid-sd-jwt', | ||
scope: 'pid', | ||
cryptographic_binding_methods_supported: ['jwk'], | ||
cryptographic_suites_supported: ['ES256'], | ||
vct: 'urn:eu.europa.ec.eudi:pid:1', | ||
format: 'vc+sd-jwt', | ||
}, | ||
]) | ||
).toEqual({ | ||
'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: 'urn:eu.europa.ec.eudi:pid:1', | ||
format: 'vc+sd-jwt', | ||
order: undefined, | ||
display: undefined, | ||
claims: undefined, | ||
}, | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.