verifiable

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 9 Imported by: 14

Documentation

Index

Constants

View Source
const NameSpace = "verifiable"

NameSpace for vc store.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt added in v0.1.4

type Opt func(o *options)

Opt represents option function.

func WithMyDID added in v0.1.4

func WithMyDID(val string) Opt

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

func WithTheirDID added in v0.1.4

func WithTheirDID(val string) Opt

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

type Record added in v0.1.3

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 added in v0.1.4

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 added in v0.1.4

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

GetCredential retrieves a verifiable credential based on ID.

func (*StoreImplementation) GetCredentialIDByName added in v0.1.4

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

GetCredentialIDByName retrieves verifiable credential id based on name.

func (*StoreImplementation) GetCredentials added in v0.1.4

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

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

func (*StoreImplementation) GetPresentation added in v0.1.4

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

GetPresentation retrieves a verifiable presentation based on ID.

func (*StoreImplementation) GetPresentationIDByName added in v0.1.4

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

GetPresentationIDByName retrieves verifiable presentation id based on name.

func (*StoreImplementation) GetPresentations added in v0.1.4

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

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

func (*StoreImplementation) RemoveCredentialByName added in v0.1.4

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

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

func (*StoreImplementation) RemovePresentationByName added in v0.1.4

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

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

func (*StoreImplementation) SaveCredential added in v0.1.4

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

SaveCredential saves a verifiable credential.

func (*StoreImplementation) SavePresentation added in v0.1.4

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

SavePresentation saves a verifiable presentation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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