Documentation ¶
Index ¶
- type DecryptInput
- type DecryptOutput
- type EncryptInput
- type EncryptOutput
- type Endpoints
- type KMS
- func (k *KMS) Decrypt(input *DecryptInput) (*DecryptOutput, error)
- func (k *KMS) DecryptWithContext(ctx context.Context, input *DecryptInput) (*DecryptOutput, error)
- func (k *KMS) Encrypt(input *EncryptInput) (*EncryptOutput, error)
- func (k *KMS) EncryptWithContext(ctx context.Context, input *EncryptInput) (*EncryptOutput, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DecryptInput ¶
type DecryptInput struct { ID uint32 `json:"id"` KeyID string `json:"keyid" validate:"nonzero"` VaultID string `json:"vaultid" validate:"nonzero"` Algorithm string `json:"algorithm,omitempty"` Context map[string]string `json:"context,omitempty"` Payload []byte `json:"payload"` }
DecryptInput contains a payload to be decrypted by DuoKey. Validation is done by calling request.New.
type DecryptOutput ¶
type DecryptOutput struct { Success bool `json:"success"` Result struct { KeyID string `json:"keyid" validate:"nonzero"` Algorithm string `json:"algorithm"` Payload []byte `json:"payload"` ID uint32 `json:"id"` } `json:"result"` TargetURL *string `json:"targetUrl"` Error *string `json:"error"` ABP bool `json:"__abp"` }
DecryptOutput contains the deserialized payload returned by the DuoKey server. Validation is done by calling request.Send.
type EncryptInput ¶
type EncryptInput struct { ID uint32 `json:"id"` KeyID string `json:"keyid" validate:"nonzero"` VaultID string `json:"vaultid" validate:"nonzero"` Algorithm string `json:"algorithm,omitempty"` Context map[string]string `json:"context,omitempty"` Payload []byte `json:"payload"` }
EncryptInput contains a payload to be encrypted by DuoKey. DuoKey determines the encryption algorithm from the VaultID and KeyId. The optional field Algorithm allows you to specify a chaining mode or a padding scheme. An initial vector or a tag can be supplied using the Context field. Validation is done by calling request.New.
type EncryptOutput ¶
type EncryptOutput struct { Success bool `json:"success"` Result struct { KeyID string `json:"keyid" validate:"nonzero"` Algorithm string `json:"algorithm"` Payload []byte `json:"payload"` ID uint32 `json:"id"` } `json:"result"` TargetURL *string `json:"targetUrl"` Error *string `json:"error"` ABP bool `json:"__abp"` }
EncryptOutput contains the deserialized payload returned by the DuoKey server. Validation is done by calling request.Send.
type Endpoints ¶
Endpoints of the crypto services (all routes of the DuoKey REST API are customizable)
type KMS ¶
KMS implements the KMSAPI interface
func NewClient ¶ added in v0.0.7
func NewClient(credentials credentials.Config, endpoints Endpoints) (*KMS, error)
New checks the credentials and returns a KMS client with the default logger.
func NewClientWithLogger ¶ added in v0.0.7
func NewClientWithLogger(credentials credentials.Config, endpoints Endpoints, logger duokey.Logger) (*KMS, error)
New checks the credentials and returns a KMS client with a custom logger.
func (*KMS) Decrypt ¶
func (k *KMS) Decrypt(input *DecryptInput) (*DecryptOutput, error)
Decrypt API operation for DuoKey
func (*KMS) DecryptWithContext ¶
func (k *KMS) DecryptWithContext(ctx context.Context, input *DecryptInput) (*DecryptOutput, error)
DecryptWithContext is the same operation as Decrypt. It is however possible to pass a non-nil context.
func (*KMS) Encrypt ¶
func (k *KMS) Encrypt(input *EncryptInput) (*EncryptOutput, error)
Encrypt API operation for DuoKey
func (*KMS) EncryptWithContext ¶
func (k *KMS) EncryptWithContext(ctx context.Context, input *EncryptInput) (*EncryptOutput, error)
EncryptWithContext is the same operation as Encrypt. It is however possible to pass a non-nil context.