Documentation ¶
Overview ¶
package secretbox is a thin wrapper around the Golang secretbox(https://godoc.org/golang.org/x/crypto/nacl/secretbox) and awnumar/memguard(https://github.com/awnumar/memguard) packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Secretbox ¶
type Secretbox struct {
// contains filtered or unexported fields
}
type Secretbox is that struct used to encypt and decrypt values.
func NewSecretbox ¶
func NewSecretbox(pswd string, opts *SecretboxOptions) (*Secretbox, error)
NewSecretbox returns a new `Secretbox` instance for 'pswd' and 'opts'.
func NewSecretboxWithBuffer ¶ added in v0.3.0
func NewSecretboxWithBuffer(buf *memguard.LockedBuffer, opts *SecretboxOptions) (*Secretbox, error)
NewSecretboxWithBuffer returns a new `Secretbox` instance for 'buf' and 'opts.
func NewSecretboxWithEnclave ¶ added in v0.3.0
func NewSecretboxWithEnclave(enclave *memguard.Enclave, opts *SecretboxOptions) (*Secretbox, error)
NewSecretboxWithEnclave returns a new `Secretbox` instance for 'enclave' and 'opts.
func (Secretbox) LockWithBuffer ¶ added in v0.3.0
func (sb Secretbox) LockWithBuffer(buf *memguard.LockedBuffer) (string, error)
Lock encypts the contents of 'buf' and returns a base64-encoded string.
func (Secretbox) LockWithReader ¶ added in v0.3.0
Lock encypts the contents of 'r' and returns a base64-encoded string.
type SecretboxOptions ¶
type SecretboxOptions struct { // Salt is a string used to "salt" keys Salt string }
SecretboxOptions is a struct with options for a specific `Secretbox` instance.
func NewSecretboxOptions ¶
func NewSecretboxOptions() *SecretboxOptions
NewSecretboxOptions returns a `SecretboxOptions` with an empty salt.