payload

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderPartSeparator        = ";"
	EncryptionPayloadSeparator = "::"
)

Variables

View Source
var (
	HeaderAllowedNames = []string{header.DefaultName}

	ErrInvalidPayloadParts = errors.New(
		"invalid encryption payload. it must be in format of " +
			"`<header>;;<encryption_passphrase>;;<encryption_payload>`",
	)
	ErrEmptyHeader              = errors.New("invalid header. empty")
	ErrEmptyEncryptedPassphrase = errors.New("invalid encrypted passphrase. empty")
	ErrEmptyEncryptedContent    = errors.New("invalid encrypted payload. empty")
	ErrHeadersPartsMismatch     = errors.New("did not find exactly 2 header parts")
	ErrHeaderNameInvalid        = fmt.Errorf(
		"did not find name equal to any of allowed header names: %#v",
		HeaderAllowedNames,
	)
	ErrHeaderVersionInvalid = fmt.Errorf(
		"did not find version equal to any of allowed header versions: %#v",
		headerAllowedVersions,
	)
	ErrSerializeBlankHeaderName = errors.New(
		"failed to serialize blank header name",
	)
	ErrSerializeBlankHeaderVersion = errors.New(
		"failed to serialize blank header version",
	)
)

Functions

This section is empty.

Types

type DecryptionService added in v0.3.0

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

func NewDecryptionService added in v0.3.0

func NewDecryptionService(passphraseDecrypter passphraseDecrypter, contentDecrypter contentDecrypter) *DecryptionService

func (*DecryptionService) Decrypt added in v0.3.0

func (s *DecryptionService) Decrypt(encryptedPayload *EncryptedPayload) (*Payload, error)

type EncryptedPayload

type EncryptedPayload struct {
	Header              *header.Header
	EncryptedPassphrase *passphrase.EncryptedPassphrase
	EncryptedContent    *content.EncryptedContent
}

func NewEncryptedPayload

func NewEncryptedPayload(
	header *header.Header,
	encryptedPassphrase *passphrase.EncryptedPassphrase,
	encryptedContent *content.EncryptedContent,
) *EncryptedPayload

type EncryptionService added in v0.3.0

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

func NewEncryptionService added in v0.3.0

func NewEncryptionService(passphraseEncrypter passphraseEncrypter, contentEncrypter contentEncrypter) *EncryptionService

func (*EncryptionService) Encrypt added in v0.3.0

func (s *EncryptionService) Encrypt(payload *Payload) (*EncryptedPayload, error)

type Payload

type Payload struct {
	Header     *header.Header
	Passphrase *passphrase.Passphrase
	Content    *content.Content
}

func NewPayload

func NewPayload(
	header *header.Header,
	passphrase *passphrase.Passphrase,
	content *content.Content,
) *Payload

type SerdeService added in v0.3.0

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

func NewSerdeService added in v0.3.0

func NewSerdeService(b64Serde base64Serde) *SerdeService

func (*SerdeService) Deserialize added in v0.3.0

func (s *SerdeService) Deserialize(encodedContent []byte) (*EncryptedPayload, error)

func (*SerdeService) Serialize added in v0.3.0

func (s *SerdeService) Serialize(encryptedPayload *EncryptedPayload) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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