crypto

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2023 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	// Ed25519KeyType ed25519 key type.
	Ed25519KeyType = "Ed25519"

	// P256KeyType EC P-256 key type.
	P256KeyType = "P256"
)
View Source
const (
	// AssertionMethod assertionMethod.
	AssertionMethod = "assertionMethod"

	// Authentication authentication.
	Authentication = "authentication"

	// CapabilityDelegation capabilityDelegation.
	CapabilityDelegation = "capabilityDelegation"

	// CapabilityInvocation capabilityInvocation.
	CapabilityInvocation = "capabilityInvocation"
)
View Source
const (
	// Purpose is the key of verifiable.Proof.
	Purpose = "proofPurpose"

	// VerificationMethod is the key of verifiable.Proof.
	VerificationMethod = "verificationMethod"
)
View Source
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

func ValidateProof(proof verifiable.Proof, verificationMethod string, didDoc *did.Doc) error

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.

func ValidateProofPurpose

func ValidateProofPurpose(proofPurpose, method string, didDoc *did.Doc) error

ValidateProofPurpose validates the proof purpose.

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 WithDomain

func WithDomain(domain string) SigningOpts

WithDomain proof domain.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL