Documentation ¶
Index ¶
- Constants
- func GetBBSPlusSignatureSuite() cryptosuite.CryptoSuite
- type BBSPlusSignature2020Proof
- type BBSPlusSignatureProofSuite
- func (BBSPlusSignatureProofSuite) CanonicalizationAlgorithm() string
- func (BBSPlusSignatureProofSuite) Canonicalize(marshaled []byte) (*string, error)
- func (b BBSPlusSignatureProofSuite) CreateDeriveProof(inputProofDocument any, revealDocument map[string]any) (*DeriveProofResult, error)
- func (b BBSPlusSignatureProofSuite) CreateVerifyHash(doc map[string]any, proof crypto.Proof, opts *cryptosuite.ProofOptions) ([]byte, error)
- func (BBSPlusSignatureProofSuite) Digest(tbd []byte) ([]byte, error)
- func (BBSPlusSignatureProofSuite) ID() string
- func (BBSPlusSignatureProofSuite) Marshal(data any) ([]byte, error)
- func (BBSPlusSignatureProofSuite) MessageDigestAlgorithm() gocrypto.Hash
- func (BBSPlusSignatureProofSuite) RequiredContexts() []string
- func (b BBSPlusSignatureProofSuite) SelectivelyDisclose(v BBSPlusVerifier, p cryptosuite.WithEmbeddedProof, ...) (map[string]any, error)
- func (BBSPlusSignatureProofSuite) SignatureAlgorithm() cryptosuite.SignatureType
- func (BBSPlusSignatureProofSuite) Type() cryptosuite.LDKeyType
- func (b BBSPlusSignatureProofSuite) Verify(v cryptosuite.Verifier, p cryptosuite.WithEmbeddedProof) error
- type BBSPlusSignatureSuite
- func (BBSPlusSignatureSuite) CanonicalizationAlgorithm() string
- func (BBSPlusSignatureSuite) Canonicalize(marshaled []byte) (*string, error)
- func (b BBSPlusSignatureSuite) CreateVerifyHash(doc map[string]any, proof crypto.Proof, opts *cryptosuite.ProofOptions) ([]byte, error)
- func (BBSPlusSignatureSuite) Digest(tbd []byte) ([]byte, error)
- func (BBSPlusSignatureSuite) ID() string
- func (BBSPlusSignatureSuite) Marshal(data any) ([]byte, error)
- func (BBSPlusSignatureSuite) MessageDigestAlgorithm() gocrypto.Hash
- func (BBSPlusSignatureSuite) RequiredContexts() []string
- func (b BBSPlusSignatureSuite) Sign(s cryptosuite.Signer, p cryptosuite.WithEmbeddedProof) error
- func (BBSPlusSignatureSuite) SignatureAlgorithm() cryptosuite.SignatureType
- func (BBSPlusSignatureSuite) Type() cryptosuite.LDKeyType
- func (b BBSPlusSignatureSuite) Verify(v cryptosuite.Verifier, p cryptosuite.WithEmbeddedProof) error
- type BBSPlusSigner
- func (s *BBSPlusSigner) GetKeyID() string
- func (s *BBSPlusSigner) GetPayloadFormat() cryptosuite.PayloadFormat
- func (s *BBSPlusSigner) GetProofPurpose() cryptosuite.ProofPurpose
- func (*BBSPlusSigner) GetSignatureType() cryptosuite.SignatureType
- func (*BBSPlusSigner) GetSigningAlgorithm() string
- func (s *BBSPlusSigner) SetPayloadFormat(format cryptosuite.PayloadFormat)
- func (s *BBSPlusSigner) SetProofPurpose(purpose cryptosuite.ProofPurpose)
- func (s *BBSPlusSigner) Sign(tbs []byte) ([]byte, error)
- type BBSPlusVerifier
- func (v BBSPlusVerifier) DeriveProof(messages [][]byte, sigBytes, nonce []byte, revealedIndexes []int) ([]byte, error)
- func (v BBSPlusVerifier) GetKeyID() string
- func (v BBSPlusVerifier) Verify(message, signature []byte) error
- func (v BBSPlusVerifier) VerifyDerived(message, signature, nonce []byte) error
- type BLSKey2020
- type DeriveProofResult
Constants ¶
const ( BBSSecurityContext string = "https://w3c.github.io/vc-di-bbs/contexts/v1" BBSPlusSignature2020 cryptosuite.SignatureType = "BbsBlsSignature2020" BBSPlusSignatureSuiteID string = "https://w3c-ccg.github.io/ldp-bbs2020/#the-bbs-signature-suite-2020" BBSPlusSignatureSuiteType = cryptosuite.BLS12381G2Key2020 BBSPlusSignatureSuiteCanonicalizationAlgorithm string = "https://w3id.org/security#URDNA2015" // BBSPlusSignatureSuiteDigestAlgorithm uses https://www.rfc-editor.org/rfc/rfc4634 BBSPlusSignatureSuiteDigestAlgorithm gocrypto.Hash = gocrypto.BLAKE2b_384 )
const ( G1 jws2020.CRV = "BLS12381_G1" G2 jws2020.CRV = "BLS12381_G2" )
const (
BBSPlusSignatureProof2020 cryptosuite.SignatureType = "BbsBlsSignatureProof2020" // #nosec
)
Variables ¶
This section is empty.
Functions ¶
func GetBBSPlusSignatureSuite ¶
func GetBBSPlusSignatureSuite() cryptosuite.CryptoSuite
Types ¶
type BBSPlusSignature2020Proof ¶
type BBSPlusSignature2020Proof struct { Type cryptosuite.SignatureType `json:"type,omitempty"` Created string `json:"created,omitempty"` VerificationMethod string `json:"verificationMethod,omitempty"` ProofPurpose cryptosuite.ProofPurpose `json:"proofPurpose,omitempty"` ProofValue string `json:"proofValue,omitempty"` Nonce string `json:"nonce,omitempty"` RequiredRevealStatements []int `json:"requiredRevealStatements,omitempty"` }
func BBSPlusProofFromGenericProof ¶
func BBSPlusProofFromGenericProof(p crypto.Proof) (*BBSPlusSignature2020Proof, error)
BBSPlusProofFromGenericProof accepts either a slice with exactly one element, or a single element and creates a BBSPlusSignature2020Proof by unmarshaling the JSON marshaled representation of the element found in `p`.
func (*BBSPlusSignature2020Proof) SetProofValue ¶
func (b *BBSPlusSignature2020Proof) SetProofValue(proofValue string)
type BBSPlusSignatureProofSuite ¶
type BBSPlusSignatureProofSuite struct{}
func GetBBSPlusSignatureProofSuite ¶
func GetBBSPlusSignatureProofSuite() *BBSPlusSignatureProofSuite
func (BBSPlusSignatureProofSuite) CanonicalizationAlgorithm ¶
func (BBSPlusSignatureProofSuite) CanonicalizationAlgorithm() string
func (BBSPlusSignatureProofSuite) Canonicalize ¶
func (BBSPlusSignatureProofSuite) Canonicalize(marshaled []byte) (*string, error)
func (BBSPlusSignatureProofSuite) CreateDeriveProof ¶
func (b BBSPlusSignatureProofSuite) CreateDeriveProof(inputProofDocument any, revealDocument map[string]any) (*DeriveProofResult, error)
CreateDeriveProof https://w3c-ccg.github.io/vc-di-bbs/#create-derive-proof-data-algorithm
func (BBSPlusSignatureProofSuite) CreateVerifyHash ¶
func (b BBSPlusSignatureProofSuite) CreateVerifyHash(doc map[string]any, proof crypto.Proof, opts *cryptosuite.ProofOptions) ([]byte, error)
CreateVerifyHash https://w3c-ccg.github.io/data-integrity-spec/#create-verify-hash-algorithm augmented by https://w3c-ccg.github.io/ldp-bbs2020/#create-verify-data-algorithm
func (BBSPlusSignatureProofSuite) Digest ¶
func (BBSPlusSignatureProofSuite) Digest(tbd []byte) ([]byte, error)
func (BBSPlusSignatureProofSuite) ID ¶
func (BBSPlusSignatureProofSuite) ID() string
func (BBSPlusSignatureProofSuite) Marshal ¶
func (BBSPlusSignatureProofSuite) Marshal(data any) ([]byte, error)
func (BBSPlusSignatureProofSuite) MessageDigestAlgorithm ¶
func (BBSPlusSignatureProofSuite) MessageDigestAlgorithm() gocrypto.Hash
func (BBSPlusSignatureProofSuite) RequiredContexts ¶
func (BBSPlusSignatureProofSuite) RequiredContexts() []string
func (BBSPlusSignatureProofSuite) SelectivelyDisclose ¶
func (b BBSPlusSignatureProofSuite) SelectivelyDisclose(v BBSPlusVerifier, p cryptosuite.WithEmbeddedProof, toDiscloseFrame map[string]any, nonce []byte) (map[string]any, error)
SelectivelyDisclose takes in a credential (parameter `p` that's WithEmbeddedProof) and a map of fields to disclose as an LD frame, and produces a map of the JSON representation of the derived credential. The derived credential only contains the information that was specified in the LD frame, and a proof that's derived from the original credential. Note that a requirement for `p` is that the property `"proof"` must be present when it's marshaled to JSON, and it's value MUST be an object that conforms to a `BBSPlusProof`.
func (BBSPlusSignatureProofSuite) SignatureAlgorithm ¶
func (BBSPlusSignatureProofSuite) SignatureAlgorithm() cryptosuite.SignatureType
func (BBSPlusSignatureProofSuite) Type ¶
func (BBSPlusSignatureProofSuite) Type() cryptosuite.LDKeyType
func (BBSPlusSignatureProofSuite) Verify ¶
func (b BBSPlusSignatureProofSuite) Verify(v cryptosuite.Verifier, p cryptosuite.WithEmbeddedProof) error
Verify verifies a BBS Plus derived proof. Note that the underlying value for `v` must be of type `*BBSPlusVerifier`. Bug here: https://github.com/w3c-ccg/ldp-bbs2020/issues/62
type BBSPlusSignatureSuite ¶
type BBSPlusSignatureSuite struct{}
func (BBSPlusSignatureSuite) CanonicalizationAlgorithm ¶
func (BBSPlusSignatureSuite) CanonicalizationAlgorithm() string
func (BBSPlusSignatureSuite) Canonicalize ¶
func (BBSPlusSignatureSuite) Canonicalize(marshaled []byte) (*string, error)
func (BBSPlusSignatureSuite) CreateVerifyHash ¶
func (b BBSPlusSignatureSuite) CreateVerifyHash(doc map[string]any, proof crypto.Proof, opts *cryptosuite.ProofOptions) ([]byte, error)
CreateVerifyHash https://w3c-ccg.github.io/data-integrity-spec/#create-verify-hash-algorithm augmented by https://w3c-ccg.github.io/ldp-bbs2020/#create-verify-data-algorithm
func (BBSPlusSignatureSuite) Digest ¶
func (BBSPlusSignatureSuite) Digest(tbd []byte) ([]byte, error)
func (BBSPlusSignatureSuite) ID ¶
func (BBSPlusSignatureSuite) ID() string
func (BBSPlusSignatureSuite) Marshal ¶
func (BBSPlusSignatureSuite) Marshal(data any) ([]byte, error)
func (BBSPlusSignatureSuite) MessageDigestAlgorithm ¶
func (BBSPlusSignatureSuite) MessageDigestAlgorithm() gocrypto.Hash
func (BBSPlusSignatureSuite) RequiredContexts ¶
func (BBSPlusSignatureSuite) RequiredContexts() []string
func (BBSPlusSignatureSuite) Sign ¶
func (b BBSPlusSignatureSuite) Sign(s cryptosuite.Signer, p cryptosuite.WithEmbeddedProof) error
func (BBSPlusSignatureSuite) SignatureAlgorithm ¶
func (BBSPlusSignatureSuite) SignatureAlgorithm() cryptosuite.SignatureType
func (BBSPlusSignatureSuite) Type ¶
func (BBSPlusSignatureSuite) Type() cryptosuite.LDKeyType
func (BBSPlusSignatureSuite) Verify ¶
func (b BBSPlusSignatureSuite) Verify(v cryptosuite.Verifier, p cryptosuite.WithEmbeddedProof) error
type BBSPlusSigner ¶
type BBSPlusSigner struct { *crypto.BBSPlusSigner *crypto.BBSPlusVerifier // contains filtered or unexported fields }
func NewBBSPlusSigner ¶
func NewBBSPlusSigner(kid string, privKey *bbs.PrivateKey, purpose cryptosuite.ProofPurpose) *BBSPlusSigner
func (*BBSPlusSigner) GetKeyID ¶
func (s *BBSPlusSigner) GetKeyID() string
func (*BBSPlusSigner) GetPayloadFormat ¶
func (s *BBSPlusSigner) GetPayloadFormat() cryptosuite.PayloadFormat
func (*BBSPlusSigner) GetProofPurpose ¶
func (s *BBSPlusSigner) GetProofPurpose() cryptosuite.ProofPurpose
func (*BBSPlusSigner) GetSignatureType ¶
func (*BBSPlusSigner) GetSignatureType() cryptosuite.SignatureType
func (*BBSPlusSigner) GetSigningAlgorithm ¶
func (*BBSPlusSigner) GetSigningAlgorithm() string
func (*BBSPlusSigner) SetPayloadFormat ¶
func (s *BBSPlusSigner) SetPayloadFormat(format cryptosuite.PayloadFormat)
func (*BBSPlusSigner) SetProofPurpose ¶
func (s *BBSPlusSigner) SetProofPurpose(purpose cryptosuite.ProofPurpose)
type BBSPlusVerifier ¶
type BBSPlusVerifier struct {
*crypto.BBSPlusVerifier
}
func NewBBSPlusVerifier ¶
func NewBBSPlusVerifier(kid string, pubKey *bbs.PublicKey) *BBSPlusVerifier
func (BBSPlusVerifier) DeriveProof ¶
func (v BBSPlusVerifier) DeriveProof(messages [][]byte, sigBytes, nonce []byte, revealedIndexes []int) ([]byte, error)
DeriveProof derives a proof from the given signature and nonce. It is used in creating selective disclosure representations of a signed object.
func (BBSPlusVerifier) GetKeyID ¶
func (v BBSPlusVerifier) GetKeyID() string
func (BBSPlusVerifier) Verify ¶
func (v BBSPlusVerifier) Verify(message, signature []byte) error
Verify is used to verify a signature over a message using a BLS key.
func (BBSPlusVerifier) VerifyDerived ¶
func (v BBSPlusVerifier) VerifyDerived(message, signature, nonce []byte) error
VerifyDerived is used to verify a derived proof over a message using a BLS key. It is used in verifying selective disclosure representations of a signed object.
type BLSKey2020 ¶
type BLSKey2020 struct { ID string `json:"id,omitempty"` Type cryptosuite.LDKeyType `json:"type,omitempty"` Controller string `json:"controller,omitempty"` PublicKeyBase58 string `json:"publicKeyBase58,omitempty"` PrivateKeyBase58 string `json:"privateKeyBase58,omitempty"` }
func GenerateBLSKey2020 ¶
func GenerateBLSKey2020(keyType cryptosuite.LDKeyType) (*BLSKey2020, error)
GenerateBLSKey2020 https://w3c-ccg.github.io/vc-di-bbs/#bls12-381
func (BLSKey2020) GetPrivateKey ¶
func (b BLSKey2020) GetPrivateKey() (*bbs.PrivateKey, error)
func (BLSKey2020) GetPublicKey ¶
func (b BLSKey2020) GetPublicKey() (*bbs.PublicKey, error)