@@ -11,7 +11,6 @@ import (
1111
1212 "github.com/fil-forge/ucantone/did"
1313 "github.com/fil-forge/ucantone/ipld/datamodel"
14- "github.com/fil-forge/ucantone/principal/absentee"
1514 "github.com/fil-forge/ucantone/principal/ed25519"
1615 "github.com/fil-forge/ucantone/principal/secp256k1"
1716 "github.com/fil-forge/ucantone/testutil"
@@ -447,78 +446,6 @@ func TestValidate(t *testing.T) {
447446 )
448447 require .Error (t , err )
449448 })
450-
451- t .Run ("with non-standard signature in chain" , func (t * testing.T ) {
452- subject := testutil .RandomSigner (t )
453- alice := absentee .From (testutil .Must (did .Parse ("did:mailto:web.mail:alice" ))(t ))
454- bob := testutil .RandomSigner (t )
455-
456- del1 , err := delegation .Delegate (subject , alice .DID (), subject .DID (), crankWidget )
457- require .NoError (t , err )
458- // del2 is "signed" by alice, who is an absentee signer and produces a
459- // non-standard signature.
460- del2 , err := delegation .Delegate (alice , bob .DID (), did .Undef , crankWidget )
461- require .NoError (t , err )
462-
463- inv , err := invocation .Invoke (
464- bob ,
465- subject .DID (),
466- crankWidget ,
467- datamodel.Map {},
468- invocation .WithProofs (del1 .Link (), del2 .Link ()),
469- )
470- require .NoError (t , err )
471-
472- resolveProof := validator .ProofsFromContainer (
473- container .New (container .WithDelegations (del1 , del2 )),
474- )
475-
476- t .Run ("rejects by default" , func (t * testing.T ) {
477- err = validator .ValidateInvocation (
478- t .Context (),
479- inv ,
480- validator .WithProofResolver (resolveProof ),
481- validator .WithDIDVerifierResolvers (validator.VerifierResolverMap {
482- "key" : validator .ResolveDIDKeyVerifier ,
483- "mailto" : func (ctx context.Context , d did.DID ) (ucan.Verifier , error ) {
484- require .Fail (t , "shouldn't try to resolve a verifier for a non-standard signature" )
485- return nil , nil
486- },
487- }),
488- )
489- require .ErrorContains (t , err , "no non-standard signature verifier configured" )
490- })
491-
492- t .Run ("rejects according to non-standard signature verifier" , func (t * testing.T ) {
493- err = validator .ValidateInvocation (
494- t .Context (),
495- inv ,
496- validator .WithProofResolver (resolveProof ),
497- validator .WithNonStandardSignatureVerifier (
498- func (ctx context.Context , token ucan.Token , meta ucan.Container ) error {
499- require .Equal (t , del2 .Link (), token .Link (), "should be asked to verify the non-standard signature for the correct token" )
500- return errors .New ("non-standard error failed as expected" )
501- },
502- ),
503- )
504- require .ErrorContains (t , err , "non-standard error failed as expected" )
505- })
506-
507- t .Run ("validates according to non-standard signature verifier" , func (t * testing.T ) {
508- err = validator .ValidateInvocation (
509- t .Context (),
510- inv ,
511- validator .WithProofResolver (resolveProof ),
512- validator .WithNonStandardSignatureVerifier (
513- func (ctx context.Context , token ucan.Token , meta ucan.Container ) error {
514- require .Equal (t , del2 .Link (), token .Link (), "should be asked to verify the non-standard signature for the correct token" )
515- return nil
516- },
517- ),
518- )
519- require .NoError (t , err )
520- })
521- })
522449}
523450
524451func TestResolveDIDKeyVerifier (t * testing.T ) {
0 commit comments