model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package model holds structs used for passing in data and retrieving results from dare operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomNonce

func RandomNonce() ([24]byte, error)

RandomNonce ...

Types

type DecryptRequest

type DecryptRequest struct {
	Targets             map[string]string `json:"targets,omitempty" mapstructure:"targets,omitempty"`
	UUID                string            `json:"uuid,omitempty" mapstructure:"uuid,omitempty"`
	DestinationRootPath string            `json:"destination_root_path,omitempty" mapstructure:"destination_root_path,omitempty"`

	Key   [32]byte
	Nonce [24]byte
	// contains filtered or unexported fields
}

DecryptRequest ...

func (*DecryptRequest) Response

func (r *DecryptRequest) Response() *DecryptResponse

Response ...

func (*DecryptRequest) Sanitize

func (r *DecryptRequest) Sanitize() error

Sanitize ...

type DecryptResponse

type DecryptResponse struct {
	DecryptedArtifacts map[string]Hash `json:"decrypted_artifacts,omitempty" mapstructure:"decrypted_artifacts,omitempty"`
	UUID               string          `json:"uuid,omitempty" mapstructure:"uuid,omitempty"`
	// contains filtered or unexported fields
}

DecryptResponse ...

func (*DecryptResponse) Sanitize

func (r *DecryptResponse) Sanitize() error

Sanitize ...

func (*DecryptResponse) String

func (r *DecryptResponse) String() []string

type EncryptRequest

type EncryptRequest struct {
	Targets             map[string]string `json:"targets,omitempty" mapstructure:"targets,omitempty"`
	UUID                string            `json:"uuid,omitempty" mapstructure:"uuid,omitempty"`
	DestinationRootPath string            `json:"destination_root_path,omitempty" mapstructure:"destination_root_path,omitempty"`
	Key                 [32]byte          `json:"-" `
	Nonce               [24]byte          `json:"-" `
	// contains filtered or unexported fields
}

EncryptRequest ...

func (*EncryptRequest) Response

func (r *EncryptRequest) Response() *EncryptResponse

Response ...

func (*EncryptRequest) Sanitize

func (r *EncryptRequest) Sanitize() error

Sanitize ...

type EncryptResponse

type EncryptResponse struct {
	EncryptedArtifacts map[string]Hash `json:"encrypted_artifacts,omitempty" mapstructure:"encrypted_artifacts,omitempty"`
	RandomNonce        string          `json:"random_nonce,omitempty" mapstructure:"random_nonce,omitempty"`
	UUID               string          `json:"uuid,omitempty" mapstructure:"uuid,omitempty"`
	// contains filtered or unexported fields
}

EncryptResponse ...

func (*EncryptResponse) Sanitize

func (r *EncryptResponse) Sanitize() error

Sanitize ...

func (*EncryptResponse) String

func (r *EncryptResponse) String() []string

type Hash

type Hash struct {
	Md5    string `json:"md5,omitempty" mapstructure:"md5,omitempty"`
	Sha256 string `json:"sha256,omitempty" mapstructure:"sha256,omitempty"`
}

Hash stores file hash values

func (*Hash) Sanitize

func (h *Hash) Sanitize() error

Sanitize checks for unacceptable values

type Key

type Key struct {
	Targets             map[string]string `json:"targets,omitempty" mapstructure:"targets,omitempty"`
	UUID                string            `json:"uuid,omitempty" mapstructure:"uuid,omitempty"`
	DestinationRootPath string            `json:"destination_root_path,omitempty" mapstructure:"destination_root_path,omitempty"`
	EncryptionKey       string            `json:"encryption_key,omitempty" mapstructure:"encryption_key,omitempty"`
	Nonce               string            `json:"nonce,omitempty" mapstructure:"nonce,omitempty"`
	// contains filtered or unexported fields
}

Key ...

func NewKey

func NewKey(l *log.Logger, uuid string, opts ...KeyOption) (*Key, error)

NewKey generates a new key

func (*Key) GetEncryptionKey

func (k *Key) GetEncryptionKey() ([32]byte, error)

GetEncryptionKey ...

func (*Key) GetNonce

func (k *Key) GetNonce() ([24]byte, error)

GetNonce ...

func (*Key) NewDecryptRequest

func (k *Key) NewDecryptRequest(source, destinationRoot string) (*DecryptRequest, error)

NewDecryptRequest adds a target path to Decrypt

func (*Key) NewEncryptRequest

func (k *Key) NewEncryptRequest(source, destinationRoot, regex string) (*EncryptRequest, error)

NewEncryptRequest adds a target path to encrypt

func (*Key) Sanitize

func (k *Key) Sanitize() error

Sanitize check struct fields for unacceptable values and sets defaults

type KeyOption

type KeyOption func(*Key) error

KeyOption ...

func WithEncryptionKey

func WithEncryptionKey(arg string) KeyOption

WithEncryptionKey sets encryption key

func WithKeyFile

func WithKeyFile(arg string) KeyOption

WithKeyFile reads encryption key from file

func WithNonce

func WithNonce(arg string) KeyOption

WithNonce sets nonce value

Jump to

Keyboard shortcuts

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