dvs

package
v0.0.0-...-5a7d5b2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) func(*Client)

WithHTTPClient is a functional option to set the http client

Types

type Client

type Client struct {
	Keys oidc.KeySet
	// contains filtered or unexported fields
}

Client is a client used for DVS verification.

func New

func New(ctx context.Context, mfa *mfa.Client, opts ...func(*Client)) *Client

New returns new DVS client.

func (*Client) CreateAuthToken

func (c *Client) CreateAuthToken(docHash string) (string, error)

CreateAuthToken creates auth token for authentication in front of the DVS service.

func (*Client) CreateDocumentHash

func (c *Client) CreateDocumentHash(doc string) string

CreateDocumentHash creates a document hash using the SHA256 hashing algorithm.

func (*Client) VerifySignature

func (c *Client) VerifySignature(ctx context.Context, dvsReq *VerifyRequest) (VerificationResult, error)

VerifySignature sends signature for verification to the DVS (designated verifier scheme) service and verifies the received response.

type VerificationResult

type VerificationResult int

VerificationResult is used to notify the user what is the DVS verification status.

const (
	ValidSignature VerificationResult = iota
	BadPin
	UserBlocked
	MissingSignature
	InvalidSignature
)

VerificationResult values.

func (VerificationResult) String

func (r VerificationResult) String() string

type VerifyRequest

type VerifyRequest struct {
	Signature VerifyRequestSignature `json:"signature"`
	Timestamp int                    `json:"timestamp"`
	Type      string                 `json:"type"`
}

VerifyRequest is the request payload for the dvs verify request.

type VerifyRequestSignature

type VerifyRequestSignature struct {
	Hash      string `json:"hash"`
	MPinID    string `json:"mpinId"`
	PublicKey string `json:"publicKey"`
	U         string `json:"u"`
	V         string `json:"v"`
}

VerifyRequestSignature is the signature part of the dvs verify request.

type VerifyResponse

type VerifyResponse struct {
	Certificate string `json:"certificate"`
}

VerifyResponse is the response from the the dvs verify request.

Jump to

Keyboard shortcuts

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