Documentation ¶
Index ¶
- func DeriveCredential(vc []byte) ([]byte, error)
- func SignCredential(credential []byte, privKey []byte, opts *ProofOptions) ([]byte, error)
- func SignPresentation(presentation []byte, privKey []byte, opts *ProofOptions) ([]byte, error)
- func VerifyCredential(vc []byte, pubKey []byte, pubKeyType string) error
- func VerifyPresentation(vp []byte, pubKey []byte, pubKeyType string) error
- type Credential
- type Iterator
- type Presentation
- type Proof
- type ProofIterator
- type ProofOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveCredential ¶
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 ¶
VerifyCredential verifies a proof in the verifiable credential.
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 ¶
GetCredentials returns a Iterator that contains verifiable credentials in the verifiable presentation.
type Presentation ¶
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.