File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -207,20 +207,55 @@ async function _setup({
207
207
mandatoryPointers
208
208
} )
209
209
} ) ) ) ;
210
+ credentials . set ( 'noTypeOrCryptosuite' ,
211
+ await issueCloned ( _generateNoTypeCryptosuite ( {
212
+ signer,
213
+ suiteName,
214
+ credential,
215
+ mandatoryPointers,
216
+ selectivePointers
217
+ } ) ) ) ;
210
218
return credentials ;
211
219
}
212
220
213
221
async function _generateNoTypeCryptosuite ( {
214
222
signer,
223
+ suiteName,
215
224
credential,
216
225
mandatoryPointers,
217
226
selectivePointers
218
227
} ) {
228
+ const { suite, selectiveSuite} = getSuites ( {
229
+ signer,
230
+ suiteName,
231
+ selectivePointers,
232
+ mandatoryPointers
233
+ } ) ;
219
234
const {
220
235
invalidProofType,
221
236
invalidCryptosuite
222
237
} = generators ?. mandatory ;
223
238
const noType = invalidProofType ( {
239
+ credential : structuredClone ( credential ) ,
240
+ suite : stubUnsafe ( suite ) ,
241
+ selectiveSuite : stubUnsafe ( selectiveSuite ) ,
242
+ proofType : ''
243
+ } ) ;
244
+ return invalidCryptosuite ( { ...noType , cryptosuiteName : '' } ) ;
245
+ }
224
246
247
+ function stubUnsafe ( suite ) {
248
+ if ( typeof suite !== 'object' ) {
249
+ return suite ;
250
+ }
251
+ return new Proxy ( suite , {
252
+ get ( target , prop ) {
253
+ if ( prop === 'canonize' ) {
254
+ return function ( doc , options ) {
255
+ return suite . canonize ( doc , { ...options , safe : false } ) ;
256
+ } ;
257
+ }
258
+ return Reflect . get ( ...arguments ) ;
259
+ }
225
260
} ) ;
226
261
}
You can’t perform that action at this time.
0 commit comments