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: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InvalidRequestErrorCode is typically a code for invalid requests.
	InvalidRequestErrorCode = command.Code(iota + command.VC)

	// ValidateCredential for validate vc error.
	ValidateCredentialErrorCode

	// SaveCredentialErrorCode for save vc error.
	SaveCredentialErrorCode

	// GetCredentialErrorCode for get vc error.
	GetCredentialErrorCode

	// GetCredentialErrorCode for get vc by name error.
	GetCredentialByNameErrorCode

	// GeneratePresentationErrorCode for get generate vp error.
	GeneratePresentationErrorCode

	// GeneratePresentationByIDErrorCode for get generate vp by vc id error.
	GeneratePresentationByIDErrorCode

	// SavePresentationErrorCode for save presentation error.
	SavePresentationErrorCode

	// GetPresentationErrorCode for get vp error.
	GetPresentationErrorCode

	// GetCredentialsErrorCode for get credential records.
	GetCredentialsErrorCode

	// GetPresentationsErrorCode for get presentation records.
	GetPresentationsErrorCode

	// SignCredentialErrorCode for sign credential error.
	SignCredentialErrorCode

	// RemoveCredentialByNameErrorCode for remove vc by name errors.
	RemoveCredentialByNameErrorCode

	// RemovePresentationByNameErrorCode for remove vp by name errors.
	RemovePresentationByNameErrorCode
)

Error codes.

View Source
const (
	CommandName = "verifiable"

	// command methods.
	ValidateCredentialCommandMethod       = "ValidateCredential"
	SaveCredentialCommandMethod           = "SaveCredential"
	GetCredentialCommandMethod            = "GetCredential"
	GetCredentialByNameCommandMethod      = "GetCredentialByName"
	GetCredentialsCommandMethod           = "GetCredentials"
	SignCredentialCommandMethod           = "SignCredential"
	SavePresentationCommandMethod         = "SavePresentation"
	GetPresentationCommandMethod          = "GetPresentation"
	GetPresentationsCommandMethod         = "GetPresentations"
	GeneratePresentationCommandMethod     = "GeneratePresentation"
	GeneratePresentationByIDCommandMethod = "GeneratePresentationByID"
	RemoveCredentialByNameCommandMethod   = "RemoveCredentialByName"
	RemovePresentationByNameCommandMethod = "RemovePresentationByName"

	// Ed25519Signature2018 ed25519 signature suite.
	Ed25519Signature2018 = "Ed25519Signature2018"
	// JSONWebSignature2020 json web signature suite.
	JSONWebSignature2020 = "JsonWebSignature2020"

	// Ed25519KeyType ed25519 key type.
	Ed25519KeyType = "Ed25519"

	// P256KeyType EC P-256 key type.
	P256KeyType = "P256"

	// Ed25519VerificationKey ED25519 verification key type.
	Ed25519VerificationKey = "Ed25519VerificationKey"
)

constants for the Verifiable protocol.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

Command contains command operations provided by verifiable credential controller.

func New

func New(p provider) (*Command, error)

New returns new verifiable credential controller command instance.

func (*Command) GeneratePresentation

func (o *Command) GeneratePresentation(rw io.Writer, req io.Reader) command.Error

GeneratePresentation generates verifiable presentation from a verifiable credential.

func (*Command) GeneratePresentationByID

func (o *Command) GeneratePresentationByID(rw io.Writer, req io.Reader) command.Error

GeneratePresentationByID generates verifiable presentation from a stored verifiable credential.

func (*Command) GetCredential

func (o *Command) GetCredential(rw io.Writer, req io.Reader) command.Error

GetCredential retrieves the verifiable credential from the store.

func (*Command) GetCredentialByName

func (o *Command) GetCredentialByName(rw io.Writer, req io.Reader) command.Error

GetCredentialByName retrieves the verifiable credential by name from the store.

func (*Command) GetCredentials

func (o *Command) GetCredentials(rw io.Writer, req io.Reader) command.Error

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

func (*Command) GetHandlers

func (o *Command) GetHandlers() []command.Handler

GetHandlers returns list of all commands supported by this controller command.

func (*Command) GetPresentation

func (o *Command) GetPresentation(rw io.Writer, req io.Reader) command.Error

GetPresentation retrieves the verifiable presentation from the store.

func (*Command) GetPresentations

func (o *Command) GetPresentations(rw io.Writer, req io.Reader) command.Error

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

func (*Command) RemoveCredentialByName

func (o *Command) RemoveCredentialByName(rw io.Writer, req io.Reader) command.Error

RemoveCredentialByName will remove a VC that matches the specified name from the verifiable store nolint: dupl

func (*Command) RemovePresentationByName

func (o *Command) RemovePresentationByName(rw io.Writer, req io.Reader) command.Error

RemovePresentationByName will remove a VP that matches the specified name from the verifiable store nolint: dupl

func (*Command) SaveCredential

func (o *Command) SaveCredential(rw io.Writer, req io.Reader) command.Error

SaveCredential saves the verifiable credential to the store.

func (*Command) SavePresentation

func (o *Command) SavePresentation(rw io.Writer, req io.Reader) command.Error

SavePresentation saves the presentation to the store.

func (*Command) SignCredential

func (o *Command) SignCredential(rw io.Writer, req io.Reader) command.Error

SignCredential adds proof to given verifiable credential.

func (*Command) ValidateCredential

func (o *Command) ValidateCredential(rw io.Writer, req io.Reader) command.Error

ValidateCredential validates the verifiable credential.

type Credential

type Credential struct {
	VerifiableCredential string `json:"verifiableCredential,omitempty"`
}

Credential is model for verifiable credential.

type CredentialExt

type CredentialExt struct {
	Credential
	Name string `json:"name,omitempty"`
}

CredentialExt is model for verifiable credential with fields related to command features.

type IDArg

type IDArg struct {
	// ID
	ID string `json:"id"`
}

IDArg model

This is used for querying/removing by ID from input json.

type NameArg

type NameArg struct {
	// Name
	Name string `json:"name"`
}

NameArg model

This is used for querying by name from input json.

type Presentation

type Presentation struct {
	VerifiablePresentation json.RawMessage `json:"verifiablePresentation,omitempty"`
}

Presentation is model for verifiable presentation.

type PresentationExt

type PresentationExt struct {
	Presentation
	Name string `json:"name,omitempty"`
}

PresentationExt is model for presentation with fields related to command features.

type PresentationRequest

type PresentationRequest struct {
	VerifiableCredentials []json.RawMessage `json:"verifiableCredential,omitempty"`
	Presentation          json.RawMessage   `json:"presentation,omitempty"`
	DID                   string            `json:"did,omitempty"`
	*ProofOptions
	// SkipVerify can be used to skip verification of `VerifiableCredentials` provided.
	SkipVerify bool `json:"skipVerify,omitempty"`
}

PresentationRequest is model for verifiable presentation request.

type PresentationRequestByID

type PresentationRequestByID struct {
	// ID
	ID string `json:"id"`

	// DID ID
	DID string `json:"did"`

	// SignatureType
	SignatureType string `json:"signatureType"`
}

PresentationRequestByID model

This is used for querying/removing by ID from input json.

type ProofOptions

type ProofOptions struct {
	// VerificationMethod is the URI of the verificationMethod used for the proof.
	VerificationMethod string `json:"verificationMethod,omitempty"`
	// Created date of the proof. If omitted current system time will be used.
	Created *time.Time `json:"created,omitempty"`
	// Domain is operational domain of a digital proof.
	Domain string `json:"domain,omitempty"`
	// Challenge is a random or pseudo-random value option authentication
	Challenge string `json:"challenge,omitempty"`
	// SignatureType signature type used for signing
	SignatureType string `json:"signatureType,omitempty"`
	// contains filtered or unexported fields
}

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

type RecordResult

type RecordResult struct {
	// Result
	Result []*verifiable.Record `json:"result,omitempty"`
}

RecordResult holds the credential records.

type RemoveCredentialByNameResponse

type RemoveCredentialByNameResponse struct{}

RemoveCredentialByNameResponse is a response model for removing a vc by name from the verifiable store.

type RemovePresentationByNameResponse

type RemovePresentationByNameResponse struct{}

RemovePresentationByNameResponse is a response model for removing a vp by name from the verifiable store.

type SignCredentialRequest

type SignCredentialRequest struct {
	Credential json.RawMessage `json:"credential,omitempty"`
	DID        string          `json:"did,omitempty"`
	*ProofOptions
}

SignCredentialRequest is adding proof to given credential.

type SignCredentialResponse

type SignCredentialResponse struct {
	VerifiableCredential json.RawMessage `json:"verifiableCredential,omitempty"`
}

SignCredentialResponse is model for sign credential response.

Jump to

Keyboard shortcuts

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