siga

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package siga provides a client for creating and validating signature containers with the Signature Gateway (SiGa) service provided by the Information System Authority of the Republic of Estonia.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// CreateContainer creates a new unsigned container for the specified
	// session identifier with the listed DataFiles. It will close any
	// existing container related to this session identifier.
	CreateContainer(ctx context.Context, session string, datafiles ...*DataFile) error

	// UploadContainer uploads an existing container for the specified
	// session identifier. It will close any existing container related to
	// this session identifier.
	UploadContainer(ctx context.Context, session string, r io.Reader) error

	// StartRemoteSigning initiates signing of the container using external
	// methods. The certificate must be a DER-encoded X.509 certificate.
	// The method returns the hashed data to be signed and the digest
	// algorithm that was used to hash the data.
	//
	// This will interrupt any outstanding signing operations for this
	// session.
	StartRemoteSigning(ctx context.Context, session string, cert []byte) ([]byte, string, error)

	// FinalizeRemoteSigning completes the signing operation started with
	// StartRemoteSigning by providing the signature value generated using
	// external methods.
	FinalizeRemoteSigning(ctx context.Context, session string, signature []byte) error

	// StartMobileIDSigning initiates signing of the container using
	// Mobile-ID. The phone number must start with a +372 prefix. The
	// message, if not empty, is displayed to the signer on their phone.
	// The method returns the challenge identifier that must be displayed
	// to the signer for confirmation.
	//
	// This will interrupt any outstanding signing operations for this
	// session.
	StartMobileIDSigning(ctx context.Context, session, person, phone, message string) (string, error)

	// RequestMobileIDSigningStatus polls the status of the signing
	// operation started with StartMobileIDSigning. If the method returns
	// true, then the signing operation is complete, otherwise it is
	// necessary to poll again.
	RequestMobileIDSigningStatus(ctx context.Context, session string) (bool, error)

	// WriteContainer retrieves the container, converts it from hashcode
	// form to complete form, and writes it to w. If no signing operations
	// were completed, then the output will be an unsigned container.
	WriteContainer(ctx context.Context, session string, w io.Writer) error

	// CloseContainer frees any resources connected with the container
	// related to the specified session identifier.
	CloseContainer(ctx context.Context, session string) error

	// Close frees any resources connected with the client.
	Close() error
}

Client is the low-level interface provided by SiGa clients.

The interface is purposefully more limited than the possibilities provided by SiGa to keep it simple. It uses a pre-configured signature profile, excludes signer role and signature production place options, etc.

func NewClient

func NewClient(conf Conf) (Client, error)

NewClient moodustab moodustab SiGa-ga suhtlemiseks HTTPS kliendi. Kliendil on võime hoida suhtluse olekut.

type Conf

type Conf struct {
	// ClientConf embeds the configuration for the HTTP client used to
	// connect to the SiGa service provider.
	https.ClientConf

	// ServiceIdentifier is the identifier used to authorize requests.
	ServiceIdentifier string

	// ServiceKey is the Base64-encoded signing secret key used to
	// authorize requests.
	ServiceKey string

	// HMACAlgorithm is the HMAC algorithm used to authorize requests.
	// Possible values are "HMAC-SHA256", "HMAC-SHA384", and "HMAC-SHA512".
	// If HMACAlgorithm is empty, then "HMAC-SHA256" is used.
	HMACAlgorithm string

	// SignatureProfile is the signature profile used for qualifying
	// signatures. Possible values are dictated by the SiGa service
	// provider. If SignatureProfile is empty, then "LT" is used.
	SignatureProfile string

	// MIDLanguage is the language used for user dialogs in the user's
	// phone during Mobile-ID signing. Possible values are dictated by the
	// SiGa service provider. If MIDLanguage is empty, then "EST" is used.
	MIDLanguage string
}

Conf contains configuration values for the SiGa client.

type DataFile

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

DataFile is a data file contained in a signature container.

func NewDataFile

func NewDataFile(name string, reader io.Reader) (*DataFile, error)

NewDataFile creates a DataFile from a name and data read from reader.

func ReadDataFile

func ReadDataFile(path string) (*DataFile, error)

ReadDataFile creates a DataFile from a filesystem path. It uses the basename of the path as the name of the DataFile.

func (*DataFile) Data

func (f *DataFile) Data() io.Reader

Data returns a Reader for reading the contents of the DataFile.

func (*DataFile) Name

func (f *DataFile) Name() string

Name returns the name of the DataFile.

Jump to

Keyboard shortcuts

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