api

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package api provides primitives to interact the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

Types

type ApiWrapper

type ApiWrapper struct {
	C pkg.Client
}

func (*ApiWrapper) Decrypt

func (w *ApiWrapper) Decrypt(ctx echo.Context) error

Decrypt is the API handler function for decrypting a piece of data.

func (*ApiWrapper) Encrypt

func (w *ApiWrapper) Encrypt(ctx echo.Context) error

Encrypt is the implementation of the REST service call POST /crypto/encrypt

func (*ApiWrapper) ExternalId

func (w *ApiWrapper) ExternalId(ctx echo.Context) error

ExternalId is the API handler function for generating a unique external identifier for a given identifier and legalEntity.

func (*ApiWrapper) GenerateKeyPair

func (w *ApiWrapper) GenerateKeyPair(ctx echo.Context, params GenerateKeyPairParams) error

GenerateKeyPair is the implementation of the REST service call POST /crypto/generate It returns the public key for the given legal entity in either PEM or JWK format depending on the accept-header. Default is PEM (backwards compatibility)

func (*ApiWrapper) PublicKey

func (w *ApiWrapper) PublicKey(ctx echo.Context, urn string) error

PublicKey returns a public key for the given urn. The urn represents a legal entity. The api returns the public key either in PEM or JWK format. It uses the accept header to determine this. Default is PEM (text/plain), only when application/json is requested will it return JWK.

func (*ApiWrapper) Sign

func (w *ApiWrapper) Sign(ctx echo.Context) error

func (*ApiWrapper) SignJwt

func (w *ApiWrapper) SignJwt(ctx echo.Context) error

func (*ApiWrapper) Verify

func (w *ApiWrapper) Verify(ctx echo.Context) error

type DecryptJSONBody added in v0.14.0

type DecryptJSONBody DecryptRequest

DecryptJSONBody defines parameters for Decrypt.

type DecryptJSONRequestBody

type DecryptJSONRequestBody DecryptJSONBody

DecryptRequestBody defines body for Decrypt for application/json ContentType.

type DecryptRequest

type DecryptRequest struct {

	// Base64 encoded cipherText
	CipherText string `json:"cipherText"`

	// base64 encoded encrypted symmetric key
	CipherTextKey string `json:"cipherTextKey"`

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN
	LegalEntity Identifier `json:"legalEntity"`

	// base64 encoded nonce
	Nonce string `json:"nonce"`
}

DecryptRequest defines model for DecryptRequest.

type DecryptResponse

type DecryptResponse struct {

	// Base64 encoded plain text
	PlainText string `json:"plainText"`
}

DecryptResponse defines model for DecryptResponse.

type EchoRouter added in v0.14.0

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type EncryptJSONBody added in v0.14.0

type EncryptJSONBody EncryptRequest

EncryptJSONBody defines parameters for Encrypt.

type EncryptJSONRequestBody

type EncryptJSONRequestBody EncryptJSONBody

EncryptRequestBody defines body for Encrypt for application/json ContentType.

type EncryptRequest

type EncryptRequest struct {
	EncryptRequestSubjects []EncryptRequestSubject `json:"encryptRequestSubjects"`

	// Base64 encoded binary data
	PlainText string `json:"plainText"`
}

EncryptRequest defines model for EncryptRequest.

type EncryptRequestSubject

type EncryptRequestSubject struct {

	// as described by https://tools.ietf.org/html/rfc7517. Modelled as object so libraries can parse the tokens themselves.
	Jwk *JWK `json:"jwk,omitempty"`

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN
	LegalEntity Identifier `json:"legalEntity"`

	// PEM encoded public key
	PublicKey *PublicKey `json:"publicKey,omitempty"`
}

EncryptRequestSubject defines model for EncryptRequestSubject.

type EncryptResponse

type EncryptResponse struct {

	// Base64 encoded encrypted text
	CipherText             string                 `json:"cipherText"`
	EncryptResponseEntries []EncryptResponseEntry `json:"encryptResponseEntries"`

	// Base64 encoded nonce
	Nonce string `json:"nonce"`
}

EncryptResponse defines model for EncryptResponse.

type EncryptResponseEntry

type EncryptResponseEntry struct {

	// Base64 encoded encrypted key
	CipherTextKey string `json:"cipherTextKey"`

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN
	LegalEntity Identifier `json:"legalEntity"`
}

EncryptResponseEntry defines model for EncryptResponseEntry.

type ExternalIdJSONBody added in v0.14.0

type ExternalIdJSONBody ExternalIdRequest

ExternalIdJSONBody defines parameters for ExternalId.

type ExternalIdJSONRequestBody

type ExternalIdJSONRequestBody ExternalIdJSONBody

ExternalIdRequestBody defines body for ExternalId for application/json ContentType.

type ExternalIdRequest

type ExternalIdRequest struct {

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN
	Actor Identifier `json:"actor"`

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN
	LegalEntity Identifier `json:"legalEntity"`

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN
	Subject Identifier `json:"subject"`
}

ExternalIdRequest defines model for ExternalIdRequest.

type ExternalIdResponse

type ExternalIdResponse struct {

	// hex encoded identifier
	ExternalId string `json:"externalId"`
}

ExternalIdResponse defines model for ExternalIdResponse.

type GenerateKeyPairParams

type GenerateKeyPairParams struct {

	// URN identifying the legal entity
	LegalEntity Identifier `json:"legalEntity"`
}

GenerateKeyPairParams defines parameters for GenerateKeyPair.

type Identifier

type Identifier string

Identifier defines model for Identifier.

type JWK

type JWK struct {
	AdditionalProperties map[string]interface{} `json:"-"`
}

JWK defines model for JWK.

func (JWK) Get

func (a JWK) Get(fieldName string) (value interface{}, found bool)

Getter for additional properties for JWK. Returns the specified element and whether it was found

func (JWK) MarshalJSON

func (a JWK) MarshalJSON() ([]byte, error)

Override default JSON handling for JWK to handle AdditionalProperties

func (*JWK) Set

func (a *JWK) Set(fieldName string, value interface{})

Setter for additional properties for JWK

func (*JWK) UnmarshalJSON

func (a *JWK) UnmarshalJSON(b []byte) error

Override default JSON handling for JWK to handle AdditionalProperties

type PublicKey

type PublicKey string

PublicKey defines model for PublicKey.

type ServerInterface

type ServerInterface interface {
	// decrypt a cipherText for the given legalEntity
	// (POST /crypto/decrypt)
	Decrypt(ctx echo.Context) error
	// encrypt a piece of data for a list of public keys/legalEntity's. A single symmetric keys will be used for all entries
	// (POST /crypto/encrypt)
	Encrypt(ctx echo.Context) error
	// calculate an externalId for a (custodian, subject, actor) triple
	// (POST /crypto/external_id)
	ExternalId(ctx echo.Context) error
	// Send a request for checking if the given combination has valid consent
	// (POST /crypto/generate)
	GenerateKeyPair(ctx echo.Context, params GenerateKeyPairParams) error
	// get the public key for a given organization. It returns the key in PEM or JWK form. This depends on the accept header used (text/plain vs application/json)
	// (GET /crypto/public_key/{urn})
	PublicKey(ctx echo.Context, urn string) error
	// sign a piece of data with the private key of the given legalEntity
	// (POST /crypto/sign)
	Sign(ctx echo.Context) error
	// sign a JWT payload with the private key of the given legalEntity
	// (POST /crypto/sign_jwt)
	SignJwt(ctx echo.Context) error
	// verify a signature given a public key, signature and the data
	// (POST /crypto/verify)
	Verify(ctx echo.Context) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) Decrypt

func (w *ServerInterfaceWrapper) Decrypt(ctx echo.Context) error

Decrypt converts echo context to params.

func (*ServerInterfaceWrapper) Encrypt

func (w *ServerInterfaceWrapper) Encrypt(ctx echo.Context) error

Encrypt converts echo context to params.

func (*ServerInterfaceWrapper) ExternalId

func (w *ServerInterfaceWrapper) ExternalId(ctx echo.Context) error

ExternalId converts echo context to params.

func (*ServerInterfaceWrapper) GenerateKeyPair

func (w *ServerInterfaceWrapper) GenerateKeyPair(ctx echo.Context) error

GenerateKeyPair converts echo context to params.

func (*ServerInterfaceWrapper) PublicKey

func (w *ServerInterfaceWrapper) PublicKey(ctx echo.Context) error

PublicKey converts echo context to params.

func (*ServerInterfaceWrapper) Sign

Sign converts echo context to params.

func (*ServerInterfaceWrapper) SignJwt

func (w *ServerInterfaceWrapper) SignJwt(ctx echo.Context) error

SignJwt converts echo context to params.

func (*ServerInterfaceWrapper) Verify

func (w *ServerInterfaceWrapper) Verify(ctx echo.Context) error

Verify converts echo context to params.

type SignJSONBody added in v0.14.0

type SignJSONBody SignRequest

SignJSONBody defines parameters for Sign.

type SignJSONRequestBody

type SignJSONRequestBody SignJSONBody

SignRequestBody defines body for Sign for application/json ContentType.

type SignJwtJSONBody added in v0.14.0

type SignJwtJSONBody SignJwtRequest

SignJwtJSONBody defines parameters for SignJwt.

type SignJwtJSONRequestBody

type SignJwtJSONRequestBody SignJwtJSONBody

SignJwtRequestBody defines body for SignJwt for application/json ContentType.

type SignJwtRequest

type SignJwtRequest struct {
	Claims map[string]interface{} `json:"claims"`

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN
	LegalEntity Identifier `json:"legalEntity"`
}

SignJwtRequest defines model for SignJwtRequest.

type SignRequest

type SignRequest struct {

	// Generic identifier used for representing BSN, agbcode, etc. It's always constructed as an URN followed by a double colon (:) and then the identifying value of the given URN
	LegalEntity Identifier `json:"legalEntity"`

	// Base64 encoded data
	PlainText string `json:"plainText"`
}

SignRequest defines model for SignRequest.

type SignResponse

type SignResponse struct {

	// hex encoded signature
	Signature string `json:"signature"`
}

SignResponse defines model for SignResponse.

type VerifyJSONBody added in v0.14.0

type VerifyJSONBody VerifyRequest

VerifyJSONBody defines parameters for Verify.

type VerifyJSONRequestBody

type VerifyJSONRequestBody VerifyJSONBody

VerifyRequestBody defines body for Verify for application/json ContentType.

type VerifyRequest

type VerifyRequest struct {

	// as described by https://tools.ietf.org/html/rfc7517. Modelled as object so libraries can parse the tokens themselves.
	Jwk *JWK `json:"jwk,omitempty"`

	// Base64 encoded binary data
	PlainText string `json:"plainText"`

	// PEM encoded public key
	PublicKey *PublicKey `json:"publicKey,omitempty"`

	// hex encoded signature
	Signature string `json:"signature"`
}

VerifyRequest defines model for VerifyRequest.

type VerifyResponse

type VerifyResponse struct {

	// true or false
	Outcome bool `json:"outcome"`
}

VerifyResponse defines model for VerifyResponse.

Jump to

Keyboard shortcuts

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