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({
207207 mandatoryPointers
208208 } )
209209 } ) ) ) ;
210+ credentials . set ( 'noTypeOrCryptosuite' ,
211+ await issueCloned ( _generateNoTypeCryptosuite ( {
212+ signer,
213+ suiteName,
214+ credential,
215+ mandatoryPointers,
216+ selectivePointers
217+ } ) ) ) ;
210218 return credentials ;
211219}
212220
213221async function _generateNoTypeCryptosuite ( {
214222 signer,
223+ suiteName,
215224 credential,
216225 mandatoryPointers,
217226 selectivePointers
218227} ) {
228+ const { suite, selectiveSuite} = getSuites ( {
229+ signer,
230+ suiteName,
231+ selectivePointers,
232+ mandatoryPointers
233+ } ) ;
219234 const {
220235 invalidProofType,
221236 invalidCryptosuite
222237 } = generators ?. mandatory ;
223238 const noType = invalidProofType ( {
239+ credential : structuredClone ( credential ) ,
240+ suite : stubUnsafe ( suite ) ,
241+ selectiveSuite : stubUnsafe ( selectiveSuite ) ,
242+ proofType : ''
243+ } ) ;
244+ return invalidCryptosuite ( { ...noType , cryptosuiteName : '' } ) ;
245+ }
224246
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+ }
225260 } ) ;
226261}
You can’t perform that action at this time.
0 commit comments