github.com/storacha/go-ucanto@v0.7.2/principal/absentee/absentee.go (about)

     1  package absentee
     2  
     3  import (
     4  	"github.com/storacha/go-ucanto/did"
     5  	"github.com/storacha/go-ucanto/ucan"
     6  	"github.com/storacha/go-ucanto/ucan/crypto/signature"
     7  )
     8  
     9  type absentee struct {
    10  	id did.DID
    11  }
    12  
    13  func (a absentee) DID() did.DID {
    14  	return a.id
    15  }
    16  
    17  func (a absentee) Sign(msg []byte) signature.SignatureView {
    18  	return signature.NewSignatureView(signature.NewNonStandard(a.SignatureAlgorithm(), []byte{}))
    19  }
    20  
    21  func (a absentee) SignatureAlgorithm() string {
    22  	return ""
    23  }
    24  
    25  func (a absentee) SignatureCode() uint64 {
    26  	return signature.NON_STANDARD
    27  }
    28  
    29  // From creates a special type of signer that produces an absent signature,
    30  // which signals that verifier needs to verify authorization interactively.
    31  func From(id did.DID) ucan.Signer {
    32  	return absentee{id}
    33  }