@@ -129,15 +129,15 @@ export async function sign({
129129 ( { name} ) => ( { cryptosuite : name } ) ) ;
130130 }
131131
132- // FIXME: profile signer needs to be selected based on `acceptedProofTypes `,
132+ // FIXME: profile signer needs to be selected based on `acceptedCryptosuites `,
133133 // so this needs to be passed into `getProfileSigner`; until then, the
134- // signer `type` should be checked against `acceptedProofTypes ` and rejected
135- // if there's no match
134+ // signer `type` should be checked against `acceptedCryptosuites ` and
135+ // rejected if there's no match
136136 const {
137137 invocationSigner : signer
138138 } = await profileManager . getProfileSigner ( { profileId} ) ;
139139
140- // pick a suite from the accepted proof types , initialized to a special
140+ // pick a suite from the accepted cryptosuites , initialized to a special
141141 // backwards compatibility case (or `undefined` if it does not apply)
142142 let suite = _handleLegacyDraftCryptosuites ( { presentation} ) ;
143143 if ( ! suite && Array . isArray ( acceptedCryptosuites ) &&
@@ -246,6 +246,11 @@ async function _deriveCredentials({
246246 return ;
247247 }
248248
249+ // normalize `acceptedCryptosuites` to `[{cryptosuite}, ...]` to handle
250+ // backwards-compatibility where an array of strings was used
251+ acceptedCryptosuites = acceptedCryptosuites . map (
252+ ac => typeof ac === 'object' ? ac : ( { cryptosuite : ac } ) ) ;
253+
249254 // convert `vprQuery.credentialQuery.example` to JSON pointers, modulo
250255 // `@context` field (the `@context` field is assumed to already have been
251256 // matched during prior processing); any VCDM mandatory pointers will be
@@ -271,7 +276,8 @@ async function _deriveCredentials({
271276 // otherwise generate a derived VC for each SD proof that is both understood
272277 // by the wallet and in `credentialQuery.acceptedCryptosuites`, setting
273278 // match.derived[<cryptosuite>] = derived VC
274- const acceptedCryptosuiteSet = new Set ( acceptedCryptosuites ) ;
279+ const acceptedCryptosuiteSet = new Set ( acceptedCryptosuites
280+ . map ( ac => ac ?. cryptosuite ) ) ;
275281 for ( const match of matches ) {
276282 const { record : { content : verifiableCredential } } = match ;
277283 match . derived = [ ] ;
@@ -308,7 +314,7 @@ async function _deriveCredentials({
308314 // in some way would be useful; need to signal to UIs selective disclosure
309315 // (data minimization) and unlinkability likelihood -- also unlinkability for
310316 // verifiers vs. for regulators and similar for well-known VC types vs. via
311- // proof types
317+ // proof types (cryptosuites)
312318}
313319
314320async function _getLocalMatches ( { vprQuery, credentialStore} ) {
@@ -588,7 +594,7 @@ function _pruneShallowPointers(pointers) {
588594
589595function _checkSignerCryptosuite ( { acceptedCryptosuites, signer} ) {
590596 const supported = SUPPORTED_CRYPTOSUITES . get ( signer . type ) ;
591- const accepted = new Set ( acceptedCryptosuites . map ( ac => ac . cryptosuite ) ) ;
597+ const accepted = new Set ( acceptedCryptosuites . map ( ac => ac ? .cryptosuite ) ) ;
592598 if ( accepted . intersection ( supported ) . size === 0 ) {
593599 const names = [ ...accepted ] . join ( ', ' ) ;
594600 throw new Error (
0 commit comments