Documentation ¶
Index ¶
- Constants
- func GetVerificationMethodFromProof(proof verifiable.Proof) (string, error)
- func ValidateProof(proof verifiable.Proof, verificationMethod string, didDoc *did.Doc) error
- func ValidateProofKey(proof verifiable.Proof, key, expectedValue string) error
- func ValidateProofPurpose(proofPurpose, method string, didDoc *did.Doc) error
- type Crypto
- type SigningOpts
- func WithChallenge(challenge string) SigningOpts
- func WithCreated(created *time.Time) SigningOpts
- func WithDomain(domain string) SigningOpts
- func WithPurpose(purpose string) SigningOpts
- func WithSignatureType(signatureType vcsverifiable.SignatureType) SigningOpts
- func WithSigningRepresentation(representation string) SigningOpts
- func WithVerificationMethod(verificationMethod string) SigningOpts
Constants ¶
const ( // Ed25519VerificationKey2018 ed25119 verification type. Ed25519VerificationKey2018 = "Ed25519VerificationKey2018" // Ed25519VerificationKey2020 ed25119 verification type. Ed25519VerificationKey2020 = "Ed25519VerificationKey2020" // JSONWebKey2020 verification type. JSONWebKey2020 = "JsonWebKey2020" // EcdsaSecp256k1VerificationKey2019 verification type. EcdsaSecp256k1VerificationKey2019 = "EcdsaSecp256k1VerificationKey2019" // Bls12381G2Key2020 verification type. Bls12381G2Key2020 = "Bls12381G2Key2020" )
const ( // Ed25519KeyType ed25519 key type. Ed25519KeyType = "Ed25519" // P256KeyType EC P-256 key type. P256KeyType = "P256" )
const ( // AssertionMethod assertionMethod. AssertionMethod = "assertionMethod" // Authentication authentication. Authentication = "authentication" // CapabilityDelegation capabilityDelegation. CapabilityDelegation = "capabilityDelegation" // CapabilityInvocation capabilityInvocation. CapabilityInvocation = "capabilityInvocation" )
const ( // Purpose is the key of verifiable.Proof. Purpose = "proofPurpose" // VerificationMethod is the key of verifiable.Proof. VerificationMethod = "verificationMethod" )
const ( // Challenge is the key of verifiable.Proof. Challenge = "challenge" // Domain is the key of verifiable.Proof. Domain = "domain" )
Variables ¶
This section is empty.
Functions ¶
func GetVerificationMethodFromProof ¶
func GetVerificationMethodFromProof(proof verifiable.Proof) (string, error)
GetVerificationMethodFromProof returns verification method from proof.
func ValidateProof ¶
ValidateProof validates proof.
func ValidateProofKey ¶
func ValidateProofKey(proof verifiable.Proof, key, expectedValue string) error
ValidateProofKey checks whether the key equals to expectedValue in a given proof.
Types ¶
type Crypto ¶
type Crypto struct {
// contains filtered or unexported fields
}
Crypto to sign credential.
func New ¶
func New(vdr vdrapi.Registry, loader ld.DocumentLoader) *Crypto
New return new instance of vc crypto.
func (*Crypto) SignCredential ¶
func (c *Crypto) SignCredential( signerData *vc.Signer, vc *verifiable.Credential, opts ...SigningOpts) (*verifiable.Credential, error)
func (*Crypto) SignPresentation ¶
func (c *Crypto) SignPresentation(signerData *vc.Signer, vp *verifiable.Presentation, opts ...SigningOpts) (*verifiable.Presentation, error)
SignPresentation signs a presentation.
type SigningOpts ¶
type SigningOpts func(opts *signingOpts)
SigningOpts is signing credential option.
func WithChallenge ¶
func WithChallenge(challenge string) SigningOpts
WithChallenge proof challenge.
func WithCreated ¶
func WithCreated(created *time.Time) SigningOpts
WithCreated is an option to pass created time option for signing.
func WithPurpose ¶
func WithPurpose(purpose string) SigningOpts
WithPurpose is an option to pass proof purpose option for signing.
func WithSignatureType ¶
func WithSignatureType(signatureType vcsverifiable.SignatureType) SigningOpts
WithSignatureType is an option to pass signature type for signing.
func WithSigningRepresentation ¶
func WithSigningRepresentation(representation string) SigningOpts
WithSigningRepresentation is an option to pass representation for signing.
func WithVerificationMethod ¶
func WithVerificationMethod(verificationMethod string) SigningOpts
WithVerificationMethod is an option to pass verification method for signing.