vc

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveCredential

func DeriveCredential(vc []byte) ([]byte, error)

DeriveCredential derives a new verifiable credential using selection disclosure (to be implemented).

func SignCredential

func SignCredential(credential []byte, privKey []byte, opts *ProofOptions) ([]byte, error)

SignCredential creates a verifiable credential by adding a proof to the credential.

func SignPresentation

func SignPresentation(presentation []byte, privKey []byte, opts *ProofOptions) ([]byte, error)

SignPresentation creates a verifiable presentation by adding a proof to the presentation.

func VerifyCredential

func VerifyCredential(vc []byte, pubKey []byte, pubKeyType string) error

VerifyCredential verifies a proof in the verifiable credential.

func VerifyPresentation

func VerifyPresentation(vp []byte, pubKey []byte, pubKeyType string) error

VerifyPresentation verifies a proof in the verifiable presentation.

Types

type Credential

type Credential struct {
	Context               string
	ID                    string
	Type                  string
	Issuer                string
	IssuedAt              string
	ExpiresAt             string
	CredentialSubjectJSON []byte
}

Credential is a helper model to assemble an W3C compatible JSON document.

func (*Credential) MarshalJSON

func (c *Credential) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON document compatible with the W3C standard.

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator is an iterator of byte slices (because gomobile doesn't support slice types except 1-D []byte).

func GetCredentials

func GetCredentials(presentation []byte) (*Iterator, error)

GetCredentials returns a Iterator that contains verifiable credentials in the verifiable presentation.

func (*Iterator) HasNext

func (i *Iterator) HasNext() bool

func (*Iterator) Next

func (i *Iterator) Next() []byte

type Presentation

type Presentation struct {
	ID     string
	Holder string
	// contains filtered or unexported fields
}

Presentation is a helper model to assemble an W3C compatible JSON document.

func (*Presentation) AddVerifiableCredential

func (p *Presentation) AddVerifiableCredential(vcBytes []byte) error

AddVerifiableCredential adds a raw JSON of a verifiable credential to the Presentation.

func (*Presentation) MarshalJSON

func (p *Presentation) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON document compatible with the W3C standard.

type Proof

type Proof struct {
	VerificationMethod string `json:"verificationMethod"`
	Type               string `json:"type"`
	ProofPurpose       string `json:"proofPurpose"`
	Created            string `json:"created"`
	Domain             string `json:"domain,omitempty"`
	Challenge          string `json:"challenge,omitempty"`
}

Proof is a LD Proof struct: https://w3c-ccg.github.io/ld-proofs/

type ProofIterator

type ProofIterator struct {
	// contains filtered or unexported fields
}

ProofIterator is an iterator of byte slices (because gomobile doesn't support slice types except 1-D []byte).

func GetCredentialProofs

func GetCredentialProofs(vc []byte) (*ProofIterator, error)

func GetPresentationProofs

func GetPresentationProofs(vp []byte) (*ProofIterator, error)

func (*ProofIterator) HasNext

func (i *ProofIterator) HasNext() bool

func (*ProofIterator) Next

func (i *ProofIterator) Next() *Proof

type ProofOptions

type ProofOptions struct {
	VerificationMethod string `json:"verificationMethod,omitempty"`
	SignatureType      string `json:"signatureType,omitempty"`
	ProofPurpose       string `json:"proofPurpose,omitempty"`
	Created            string `json:"created,omitempty"`
	Domain             string `json:"domain,omitempty"`
	Challenge          string `json:"challenge,omitempty"`
}

ProofOptions is model to allow the dynamic proofing options by the user.

Jump to

Keyboard shortcuts

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