Help us shape the future of Go! Take the 2026 Go Developer Survey

verifiable

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

	// ValidateCredentialErrorCode for validate vc error.
	ValidateCredentialErrorCode

	// SaveCredentialErrorCode for save vc error.
	SaveCredentialErrorCode

	// GetCredentialErrorCode for get vc error.
	GetCredentialErrorCode

	// GetCredentialByNameErrorCode 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

	// DeriveCredentialErrorCode for derive credential error.
	DeriveCredentialErrorCode
)

Error codes.

View Source
const (
	CommandName = "verifiable"

	// command methods.
	ValidateCredentialCommandMethod       = "ValidateCredential"
	SaveCredentialCommandMethod           = "SaveCredential"
	GetCredentialCommandMethod            = "GetCredential"
	GetCredentialByNameCommandMethod      = "GetCredentialByName"
	GetCredentialsCommandMethod           = "GetCredentials"
	SignCredentialCommandMethod           = "SignCredential"
	DeriveCredentialCommandMethod         = "DeriveCredential"
	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"

	// BbsBlsSignature2020 BBS signature suite.
	BbsBlsSignature2020 = "BbsBlsSignature2020"

	// Ed25519Curve ed25519 curve.
	Ed25519Curve = "Ed25519"

	// P256KeyCurve EC P-256 curve.
	P256KeyCurve = "P-256"

	// P384KeyCurve EC P-384 curve.
	P384KeyCurve = "P-384"

	// P521KeyCurve EC P-521 curve.
	P521KeyCurve = "P-521"

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

	// JSONWebKey2020 verification key type.
	JSONWebKey2020 = "JsonWebKey2020"
)

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) DeriveCredential added in v0.1.6

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

DeriveCredential derives a given verifiable credential for selective disclosure and returns it in response body.

func (*Command) GeneratePresentation added in v0.1.3

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

GeneratePresentation generates verifiable presentation from a verifiable credential.

func (*Command) GeneratePresentationByID added in v0.1.3

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

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

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

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

GetPresentation retrieves the verifiable presentation from the store.

func (*Command) GetPresentations added in v0.1.3

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

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.

func (*Command) RemovePresentationByName added in v0.1.4

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.

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

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

SavePresentation saves the presentation to the store.

func (*Command) SignCredential added in v0.1.4

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

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

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

type DeriveCredentialRequest added in v0.1.6

type DeriveCredentialRequest struct {
	// Raw Credential from which a new credential will be derived
	Credential json.RawMessage `json:"credential,omitempty"`
	// Frame is JSON-LD frame used for selective disclosure.
	Frame map[string]interface{} `json:"frame,omitempty"`
	// Nonce to prove uniqueness or freshness of the proof.
	Nonce string `json:"nonce,omitempty"`
	// SkipVerify can be used to skip verification of `Credential` provided.
	SkipVerify bool `json:"skipVerify,omitempty"`
}

DeriveCredentialRequest is request for deriving credential.

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

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

NameArg model

This is used for querying by name from input json.

type Presentation added in v0.1.3

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

Presentation is model for verifiable presentation.

type PresentationExt added in v0.1.3

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

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

type PresentationRequest added in v0.1.3

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

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

type ProofOptions struct {
	KID string `json:"kid,omitempty"`
	// VerificationMethod is the URI of the verificationMethod used for the proof.
	VerificationMethod      string                                 `json:"verificationMethod,omitempty"`
	SignatureRepresentation *docverifiable.SignatureRepresentation `json:"signatureRepresentation,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 added in v0.1.3

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

RecordResult holds the credential records.

type RemoveCredentialByNameResponse added in v0.1.4

type RemoveCredentialByNameResponse struct{}

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

type RemovePresentationByNameResponse added in v0.1.4

type RemovePresentationByNameResponse struct{}

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

type SignCredentialRequest added in v0.1.4

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

SignCredentialRequest is adding proof to given credential.

type SignCredentialResponse added in v0.1.4

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