Skip to content

Commit

Permalink
fix: did web resolution from identifier was not taking keys into acco…
Browse files Browse the repository at this point in the history
…unt that had no purpose set
  • Loading branch information
nklomp committed Jul 16, 2024
1 parent 980075b commit 8447426
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/did-utils/src/did-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,20 +644,20 @@ export function toDidDocument(
...((opts?.use === undefined || opts?.use?.includes(JwkKeyUse.Signature)) &&
identifier.keys && {
assertionMethod: identifier.keys
.filter((key) => key?.meta?.purpose === undefined || key?.meta?.purpose === 'assertionMethod')
.filter((key) => key?.meta?.purpose === undefined || key?.meta?.purpose === 'assertionMethod' || key?.meta?.purpose?.includes('assertionMethod'))
.map((key) => {
return `${did}#${key.kid}`
}),
authentication: identifier.keys
.filter((key) => key?.meta?.purpose === undefined || key?.meta?.purpose === 'authentication')
.filter((key) => key?.meta?.purpose === undefined || key?.meta?.purpose === 'authentication' || key?.meta?.purpose?.includes('authentication'))
.map((key) => {
return `${did}#${key.kid}`
}),
}),
...((opts?.use === undefined || opts?.use?.includes(JwkKeyUse.Encryption)) &&
identifier.keys && {
keyAgreement: identifier.keys
.filter((key) => key.type === 'X25519' || key?.meta?.purpose === 'keyAgreement')
.filter((key) => key.type === 'X25519' || key?.meta?.purpose === 'keyAgreement' || key?.meta?.purpose?.includes('keyAgreement'))
.map((key) => {
if (key.kid.startsWith(did) && key.kid.includes('#')) {
return key.kid
Expand All @@ -667,7 +667,7 @@ export function toDidDocument(
} &&
identifier.keys && {
capabilityInvocation: identifier.keys
.filter((key) => key.type === 'X25519' || key?.meta?.purpose === 'capabilityInvocation')
.filter((key) => key.type === 'X25519' || key?.meta?.purpose === 'capabilityInvocation' || key?.meta?.purpose?.includes('capabilityInvocation'))
.map((key) => {
if (key.kid.startsWith(did) && key.kid.includes('#')) {
return key.kid
Expand All @@ -677,7 +677,7 @@ export function toDidDocument(
} &&
identifier.keys && {
capabilityDelegation: identifier.keys
.filter((key) => key.type === 'X25519' || key?.meta?.purpose === 'capabilityDelegation')
.filter((key) => key.type === 'X25519' || key?.meta?.purpose === 'capabilityDelegation' || key?.meta?.purpose?.includes('capabilityDelegation'))
.map((key) => {
if (key.kid.startsWith(did) && key.kid.includes('#')) {
return key.kid
Expand Down

0 comments on commit 8447426

Please sign in to comment.