signer

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0, BSD-3-Clause, MIT, + 1 more Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "signer"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [12]string{"Namespaces", "NamespaceKeys", "VerificationMethod", "VerificationMethods", "JwkPublicKey", "CredentialProof", "PresentationProof", "CreateCredential", "CreatePresentation", "VerifyCredential", "VerifyPresentation", "Sign"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func NewCreateCredentialEndpoint

func NewCreateCredentialEndpoint(s Service) goa.Endpoint

NewCreateCredentialEndpoint returns an endpoint function that calls the method "CreateCredential" of service "signer".

func NewCreatePresentationEndpoint

func NewCreatePresentationEndpoint(s Service) goa.Endpoint

NewCreatePresentationEndpoint returns an endpoint function that calls the method "CreatePresentation" of service "signer".

func NewCredentialProofEndpoint

func NewCredentialProofEndpoint(s Service) goa.Endpoint

NewCredentialProofEndpoint returns an endpoint function that calls the method "CredentialProof" of service "signer".

func NewJwkPublicKeyEndpoint

func NewJwkPublicKeyEndpoint(s Service) goa.Endpoint

NewJwkPublicKeyEndpoint returns an endpoint function that calls the method "JwkPublicKey" of service "signer".

func NewNamespaceKeysEndpoint

func NewNamespaceKeysEndpoint(s Service) goa.Endpoint

NewNamespaceKeysEndpoint returns an endpoint function that calls the method "NamespaceKeys" of service "signer".

func NewNamespacesEndpoint

func NewNamespacesEndpoint(s Service) goa.Endpoint

NewNamespacesEndpoint returns an endpoint function that calls the method "Namespaces" of service "signer".

func NewPresentationProofEndpoint

func NewPresentationProofEndpoint(s Service) goa.Endpoint

NewPresentationProofEndpoint returns an endpoint function that calls the method "PresentationProof" of service "signer".

func NewSignEndpoint

func NewSignEndpoint(s Service) goa.Endpoint

NewSignEndpoint returns an endpoint function that calls the method "Sign" of service "signer".

func NewVerificationMethodEndpoint

func NewVerificationMethodEndpoint(s Service) goa.Endpoint

NewVerificationMethodEndpoint returns an endpoint function that calls the method "VerificationMethod" of service "signer".

func NewVerificationMethodsEndpoint

func NewVerificationMethodsEndpoint(s Service) goa.Endpoint

NewVerificationMethodsEndpoint returns an endpoint function that calls the method "VerificationMethods" of service "signer".

func NewVerifyCredentialEndpoint

func NewVerifyCredentialEndpoint(s Service) goa.Endpoint

NewVerifyCredentialEndpoint returns an endpoint function that calls the method "VerifyCredential" of service "signer".

func NewVerifyPresentationEndpoint

func NewVerifyPresentationEndpoint(s Service) goa.Endpoint

NewVerifyPresentationEndpoint returns an endpoint function that calls the method "VerifyPresentation" of service "signer".

Types

type Client

type Client struct {
	NamespacesEndpoint          goa.Endpoint
	NamespaceKeysEndpoint       goa.Endpoint
	VerificationMethodEndpoint  goa.Endpoint
	VerificationMethodsEndpoint goa.Endpoint
	JwkPublicKeyEndpoint        goa.Endpoint
	CredentialProofEndpoint     goa.Endpoint
	PresentationProofEndpoint   goa.Endpoint
	CreateCredentialEndpoint    goa.Endpoint
	CreatePresentationEndpoint  goa.Endpoint
	VerifyCredentialEndpoint    goa.Endpoint
	VerifyPresentationEndpoint  goa.Endpoint
	SignEndpoint                goa.Endpoint
}

Client is the "signer" service client.

func NewClient

func NewClient(namespaces, namespaceKeys, verificationMethod, verificationMethods, jwkPublicKey, credentialProof, presentationProof, createCredential, createPresentation, verifyCredential, verifyPresentation, sign goa.Endpoint) *Client

NewClient initializes a "signer" service client given the endpoints.

func (*Client) CreateCredential

func (c *Client) CreateCredential(ctx context.Context, p *CreateCredentialRequest) (res any, err error)

CreateCredential calls the "CreateCredential" endpoint of the "signer" service.

func (*Client) CreatePresentation

func (c *Client) CreatePresentation(ctx context.Context, p *CreatePresentationRequest) (res any, err error)

CreatePresentation calls the "CreatePresentation" endpoint of the "signer" service.

func (*Client) CredentialProof

func (c *Client) CredentialProof(ctx context.Context, p *CredentialProofRequest) (res any, err error)

CredentialProof calls the "CredentialProof" endpoint of the "signer" service.

func (*Client) JwkPublicKey

func (c *Client) JwkPublicKey(ctx context.Context, p *JwkPublicKeyRequest) (res any, err error)

JwkPublicKey calls the "JwkPublicKey" endpoint of the "signer" service.

func (*Client) NamespaceKeys

func (c *Client) NamespaceKeys(ctx context.Context, p *NamespaceKeysRequest) (res []string, err error)

NamespaceKeys calls the "NamespaceKeys" endpoint of the "signer" service.

func (*Client) Namespaces

func (c *Client) Namespaces(ctx context.Context) (res []string, err error)

Namespaces calls the "Namespaces" endpoint of the "signer" service.

func (*Client) PresentationProof

func (c *Client) PresentationProof(ctx context.Context, p *PresentationProofRequest) (res any, err error)

PresentationProof calls the "PresentationProof" endpoint of the "signer" service.

func (*Client) Sign

func (c *Client) Sign(ctx context.Context, p *SignRequest) (res *SignResult, err error)

Sign calls the "Sign" endpoint of the "signer" service.

func (*Client) VerificationMethod

func (c *Client) VerificationMethod(ctx context.Context, p *VerificationMethodRequest) (res *DIDVerificationMethod, err error)

VerificationMethod calls the "VerificationMethod" endpoint of the "signer" service.

func (*Client) VerificationMethods

func (c *Client) VerificationMethods(ctx context.Context, p *VerificationMethodsRequest) (res []*DIDVerificationMethod, err error)

VerificationMethods calls the "VerificationMethods" endpoint of the "signer" service.

func (*Client) VerifyCredential

func (c *Client) VerifyCredential(ctx context.Context, p *VerifyCredentialRequest) (res *VerifyResult, err error)

VerifyCredential calls the "VerifyCredential" endpoint of the "signer" service.

func (*Client) VerifyPresentation

func (c *Client) VerifyPresentation(ctx context.Context, p *VerifyPresentationRequest) (res *VerifyResult, err error)

VerifyPresentation calls the "VerifyPresentation" endpoint of the "signer" service.

type CreateCredentialRequest

type CreateCredentialRequest struct {
	// Issuer DID of the Verifiable Credential.
	Issuer string
	// Key namespace.
	Namespace string
	// Key to use for the proof signature.
	Key string
	// Raw JSON that will be the VC subject.
	CredentialSubject any
	// Additional JSONLD contexts to be specified in the VC.
	Context []string
}

CreateCredentialRequest is the payload type of the signer service CreateCredential method.

type CreatePresentationRequest

type CreatePresentationRequest struct {
	// Issuer DID of the Verifiable Presentation.
	Issuer string
	// Key namespace.
	Namespace string
	// Key to use for the proof signature.
	Key string
	// Raw JSON to be included inside the VP as Verifiable Credential.
	Data []any
	// Additional JSONLD contexts to be specified in the VP.
	Context []string
}

CreatePresentationRequest is the payload type of the signer service CreatePresentation method.

type CredentialProofRequest

type CredentialProofRequest struct {
	// Key namespace.
	Namespace string
	// Key to use for the proof signature (optional).
	Key string
	// Verifiable Credential in JSON format.
	Credential any
}

CredentialProofRequest is the payload type of the signer service CredentialProof method.

type DIDVerificationMethod

type DIDVerificationMethod struct {
	// ID of verification method.
	ID string
	// Type of verification method key.
	Type string
	// Controller of verification method specified as DID.
	Controller string
	// Public Key encoded in JWK format.
	PublicKeyJwk any
}

Public Key represented as DID Verification Method.

type Endpoints

type Endpoints struct {
	Namespaces          goa.Endpoint
	NamespaceKeys       goa.Endpoint
	VerificationMethod  goa.Endpoint
	VerificationMethods goa.Endpoint
	JwkPublicKey        goa.Endpoint
	CredentialProof     goa.Endpoint
	PresentationProof   goa.Endpoint
	CreateCredential    goa.Endpoint
	CreatePresentation  goa.Endpoint
	VerifyCredential    goa.Endpoint
	VerifyPresentation  goa.Endpoint
	Sign                goa.Endpoint
}

Endpoints wraps the "signer" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "signer" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "signer" service endpoints.

type JwkPublicKeyRequest

type JwkPublicKeyRequest struct {
	// Key namespace.
	Namespace string
	// Key name.
	Key string
}

JwkPublicKeyRequest is the payload type of the signer service JwkPublicKey method.

type NamespaceKeysRequest

type NamespaceKeysRequest struct {
	// Namespace for signing keys.
	Namespace string
}

NamespaceKeysRequest is the payload type of the signer service NamespaceKeys method.

type PresentationProofRequest

type PresentationProofRequest struct {
	// Issuer DID used to specify proof verification info.
	Issuer string
	// Key namespace.
	Namespace string
	// Key to use for the proof signature.
	Key string
	// Verifiable Presentation in JSON format.
	Presentation any
}

PresentationProofRequest is the payload type of the signer service PresentationProof method.

type Service

type Service interface {
	// Namespaces returns all keys namespaces, which corresponds to enabled Vault
	// transit engines.
	Namespaces(context.Context) (res []string, err error)
	// NamespaceKeys returns all keys in a given namespace.
	NamespaceKeys(context.Context, *NamespaceKeysRequest) (res []string, err error)
	// VerificationMethod returns a single public key formatted as DID verification
	// method for a given namespace, key and did.
	VerificationMethod(context.Context, *VerificationMethodRequest) (res *DIDVerificationMethod, err error)
	// VerificationMethods returns all public keys in a given namespace. The result
	// is formatted as array of DID verification methods with their controller
	// attribute being the given DID in the request.
	VerificationMethods(context.Context, *VerificationMethodsRequest) (res []*DIDVerificationMethod, err error)
	// JwkPublicKey returns public key by name and namespace.
	JwkPublicKey(context.Context, *JwkPublicKeyRequest) (res any, err error)
	// CredentialProof adds a proof to a given Verifiable Credential.
	CredentialProof(context.Context, *CredentialProofRequest) (res any, err error)
	// PresentationProof adds a proof to a given Verifiable Presentation.
	PresentationProof(context.Context, *PresentationProofRequest) (res any, err error)
	// CreateCredential creates VC with proof from raw JSON data.
	CreateCredential(context.Context, *CreateCredentialRequest) (res any, err error)
	// CreatePresentation creates VP with proof from raw JSON data.
	CreatePresentation(context.Context, *CreatePresentationRequest) (res any, err error)
	// VerifyCredential verifies the proof of a Verifiable Credential.
	VerifyCredential(context.Context, *VerifyCredentialRequest) (res *VerifyResult, err error)
	// VerifyPresentation verifies the proof of a Verifiable Presentation.
	VerifyPresentation(context.Context, *VerifyPresentationRequest) (res *VerifyResult, err error)
	// Sign creates digital signature on base64 encoded binary data.
	Sign(context.Context, *SignRequest) (res *SignResult, err error)
}

Signer service makes digital signatures and proofs for verifiable credentials and presentations.

type SignRequest

type SignRequest struct {
	// Key namespace to be used for signing.
	Namespace string
	// Key to be used for signing.
	Key string
	// Data that must be signed, encoded as base64 string.
	Data string
}

SignRequest is the payload type of the signer service Sign method.

type SignResult

type SignResult struct {
	// Signature encoded as base64 string.
	Signature string
}

SignResult is the result type of the signer service Sign method.

type VerificationMethodRequest

type VerificationMethodRequest struct {
	// Key namespace.
	Namespace string
	// Name of requested key.
	Key string
	// DID controller of the key.
	Did string
}

VerificationMethodRequest is the payload type of the signer service VerificationMethod method.

type VerificationMethodsRequest

type VerificationMethodsRequest struct {
	// Keys namespace.
	Namespace string
	// DID controller of the keys.
	Did string
}

VerificationMethodsRequest is the payload type of the signer service VerificationMethods method.

type VerifyCredentialRequest

type VerifyCredentialRequest struct {
	// Verifiable Credential in JSON format.
	Credential []byte
}

VerifyCredentialRequest is the payload type of the signer service VerifyCredential method.

type VerifyPresentationRequest

type VerifyPresentationRequest struct {
	// Verifiable Presentation in JSON format.
	Presentation []byte
}

VerifyPresentationRequest is the payload type of the signer service VerifyPresentation method.

type VerifyResult

type VerifyResult struct {
	// Valid specifies if the proof is successfully verified.
	Valid bool
}

VerifyResult is the result type of the signer service VerifyCredential method.

Jump to

Keyboard shortcuts

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