verifiable

package
v0.1.6-0...-5c25bcb Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NameSpace for vc store.
	NameSpace = "verifiable"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(o *options)

Opt represents option function.

func WithMyDID

func WithMyDID(val string) Opt

WithMyDID allows specifying MyDID for credential or presentation that is being issued.

func WithTheirDID

func WithTheirDID(val string) Opt

WithTheirDID allows specifying TheirDID for credential or presentation that is being issued.

type Record

type Record struct {
	Name      string   `json:"name,omitempty"`
	ID        string   `json:"id,omitempty"`
	Context   []string `json:"context,omitempty"`
	Type      []string `json:"type,omitempty"`
	SubjectID string   `json:"subjectId,omitempty"`
	// MyDID and TheirDID contains information about participants who were involved in the process
	// of issuing a credential or presentation.
	MyDID    string `json:"my_did,omitempty"`
	TheirDID string `json:"their_did,omitempty"`
}

Record model containing name, ID and other fields of interest.

type Store

type Store interface {
	SaveCredential(name string, vc *verifiable.Credential, opts ...Opt) error
	SavePresentation(name string, vp *verifiable.Presentation, opts ...Opt) error
	GetCredential(id string) (*verifiable.Credential, error)
	GetPresentation(id string) (*verifiable.Presentation, error)
	GetCredentialIDByName(name string) (string, error)
	GetPresentationIDByName(name string) (string, error)
	GetCredentials() ([]*Record, error)
	GetPresentations() ([]*Record, error)
	RemoveCredentialByName(name string) error
	RemovePresentationByName(name string) error
}

Store provides interface for storing and managing verifiable credentials.

type StoreImplementation

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

StoreImplementation stores vc.

func New

func New(ctx provider) (*StoreImplementation, error)

New returns a new vc store.

func (*StoreImplementation) GetCredential

func (s *StoreImplementation) GetCredential(id string) (*verifiable.Credential, error)

GetCredential retrieves a verifiable credential based on ID.

func (*StoreImplementation) GetCredentialIDByName

func (s *StoreImplementation) GetCredentialIDByName(name string) (string, error)

GetCredentialIDByName retrieves verifiable credential id based on name.

func (*StoreImplementation) GetCredentials

func (s *StoreImplementation) GetCredentials() ([]*Record, error)

GetCredentials retrieves the verifiable credential records containing name and fields of interest.

func (*StoreImplementation) GetPresentation

func (s *StoreImplementation) GetPresentation(id string) (*verifiable.Presentation, error)

GetPresentation retrieves a verifiable presentation based on ID.

func (*StoreImplementation) GetPresentationIDByName

func (s *StoreImplementation) GetPresentationIDByName(name string) (string, error)

GetPresentationIDByName retrieves verifiable presentation id based on name.

func (*StoreImplementation) GetPresentations

func (s *StoreImplementation) GetPresentations() ([]*Record, error)

GetPresentations retrieves the verifiable presenations records containing name and fields of interest.

func (*StoreImplementation) RemoveCredentialByName

func (s *StoreImplementation) RemoveCredentialByName(name string) error

RemoveCredentialByName removes the verifiable credential and its records containing given name.

func (*StoreImplementation) RemovePresentationByName

func (s *StoreImplementation) RemovePresentationByName(name string) error

RemovePresentationByName removes the verifiable presentation and its records containing given name.

func (*StoreImplementation) SaveCredential

func (s *StoreImplementation) SaveCredential(name string, vc *verifiable.Credential, opts ...Opt) error

SaveCredential saves a verifiable credential.

func (*StoreImplementation) SavePresentation

func (s *StoreImplementation) SavePresentation(name string, vp *verifiable.Presentation, opts ...Opt) error

SavePresentation saves a verifiable presentation.

Jump to

Keyboard shortcuts

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