Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ yarn-debug.log*
yarn-error.log*

.vscode
/.idea
64 changes: 7 additions & 57 deletions guides/updating/versions/0.4-to-0.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,65 +294,15 @@ const data = 'openid-credential-offer://?credential_offer_uri=...'

const resolvedCredentialOffer = await agent.modules.openId4VcHolder.resolveCredentialOffer(data)

await agent.modules.openId4VcHolder.acceptCredentialOfferUsingPreAuthorizedCode(
// First parameter is now the resolved credential offer
const token = await holder.modules.openId4VcHolderModule.requestToken({
resolvedCredentialOffer,
{
// has been renamed from proofOfPossessionVerificationMethodResolver to credentialBindingResolver
credentialBindingResolver: async ({
supportedDidMethods,
keyType,
supportsAllDidMethods,
// supportsJwk now also passed
supportsJwk,
credentialFormat,
}) => {
// NOTE: example implementation. Adjust based on your needs
// Return the binding to the credential that should be used. Either did or jwk is supported

if (supportsAllDidMethods || supportedDidMethods?.includes('did:key')) {
const didResult = await agent.dids.create<KeyDidCreateOptions>({
method: 'key',
options: {
keyType,
},
})

if (didResult.didState.state !== 'finished') {
throw new Error('DID creation failed.')
}

const didKey = DidKey.fromDid(didResult.didState.did)

// you now need to return an object instead of VerificationMethod instance
// and method 'did' or 'jwk'
return {
method: 'did',
didUrl: `${didKey.did}#${didKey.key.fingerprint}`,
}
}

// we also support plain jwk for sd-jwt only
if (supportsJwk && credentialFormat === OpenId4VciCredentialFormatProfile.SdJwtVc) {
const key = await agent.wallet.createKey({
keyType,
})

// you now need to return an object instead of VerificationMethod instance
// and method 'did' or 'jwk'
return {
method: 'jwk',
jwk: getJwkFromKey(key),
}
}
userPin: '1234',
});

throw new Error('Unable to create a key binding')
},

verifyCredentialStatus: false,
allowedProofOfPossessionSignatureAlgorithms: [JwaSignatureAlgorithm.EdDSA, JwaSignatureAlgorithm.ES256],
}
)
const credentials = await holder.modules.openId4VcHolderModule.requestCredentials({
resolvedCredentialOffer,
token,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of the parameters are removed which are still used. Also these methods were only introduced in later 0.5 versions so we might want to add this to 0.6 migration guide?

});
```

<!--/tabs-->
Expand Down
Loading