api

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: GPL-3.0 Imports: 17 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 runtime.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 DecryptJSONRequestBody

type DecryptJSONRequestBody decryptJSONBody

DecryptRequestBody defines body for Decrypt for application/json ContentType.

type DecryptRequest

type DecryptRequest struct {
	CipherText    string     `json:"cipherText"`
	CipherTextKey string     `json:"cipherTextKey"`
	LegalEntity   Identifier `json:"legalEntity"`
	Nonce         string     `json:"nonce"`
}

DecryptRequest defines model for DecryptRequest.

type DecryptResponse

type DecryptResponse struct {
	PlainText string `json:"plainText"`
}

DecryptResponse defines model for DecryptResponse.

type EncryptJSONRequestBody

type EncryptJSONRequestBody encryptJSONBody

EncryptRequestBody defines body for Encrypt for application/json ContentType.

type EncryptRequest

type EncryptRequest struct {
	EncryptRequestSubjects []EncryptRequestSubject `json:"encryptRequestSubjects"`
	PlainText              string                  `json:"plainText"`
}

EncryptRequest defines model for EncryptRequest.

type EncryptRequestSubject

type EncryptRequestSubject struct {
	Jwk         *JWK       `json:"jwk,omitempty"`
	LegalEntity Identifier `json:"legalEntity"`
	PublicKey   *PublicKey `json:"publicKey,omitempty"`
}

EncryptRequestSubject defines model for EncryptRequestSubject.

type EncryptResponse

type EncryptResponse struct {
	CipherText             string                 `json:"cipherText"`
	EncryptResponseEntries []EncryptResponseEntry `json:"encryptResponseEntries"`
	Nonce                  string                 `json:"nonce"`
}

EncryptResponse defines model for EncryptResponse.

type EncryptResponseEntry

type EncryptResponseEntry struct {
	CipherTextKey string     `json:"cipherTextKey"`
	LegalEntity   Identifier `json:"legalEntity"`
}

EncryptResponseEntry defines model for EncryptResponseEntry.

type ExternalIdJSONRequestBody

type ExternalIdJSONRequestBody externalIdJSONBody

ExternalIdRequestBody defines body for ExternalId for application/json ContentType.

type ExternalIdRequest

type ExternalIdRequest struct {
	Actor       Identifier `json:"actor"`
	LegalEntity Identifier `json:"legalEntity"`
	Subject     Identifier `json:"subject"`
}

ExternalIdRequest defines model for ExternalIdRequest.

type ExternalIdResponse

type ExternalIdResponse struct {
	ExternalId string `json:"externalId"`
}

ExternalIdResponse defines model for ExternalIdResponse.

type GenerateKeyPairParams

type GenerateKeyPairParams struct {
	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 SignJSONRequestBody

type SignJSONRequestBody signJSONBody

SignRequestBody defines body for Sign for application/json ContentType.

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"`
	LegalEntity Identifier             `json:"legalEntity"`
}

SignJwtRequest defines model for SignJwtRequest.

type SignRequest

type SignRequest struct {
	LegalEntity Identifier `json:"legalEntity"`
	PlainText   string     `json:"plainText"`
}

SignRequest defines model for SignRequest.

type SignResponse

type SignResponse struct {
	Signature string `json:"signature"`
}

SignResponse defines model for SignResponse.

type VerifyJSONRequestBody

type VerifyJSONRequestBody verifyJSONBody

VerifyRequestBody defines body for Verify for application/json ContentType.

type VerifyRequest

type VerifyRequest struct {
	Jwk       *JWK       `json:"jwk,omitempty"`
	PlainText string     `json:"plainText"`
	PublicKey *PublicKey `json:"publicKey,omitempty"`
	Signature string     `json:"signature"`
}

VerifyRequest defines model for VerifyRequest.

type VerifyResponse

type VerifyResponse struct {
	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