vault

package
v0.0.0-...-ce18777 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobV1

type BlobV1 struct {
	Version       int      `bson:"version"`
	WrappedDEK    string   `bson:"wrapped_dek"`
	Nonce         [24]byte `bson:"nonce"`
	EncryptedData []byte   `bson:"data"`
}

type KMSGCPBoxer

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

func NewKMSGCPBoxer

func NewKMSGCPBoxer(keyPath string) *KMSGCPBoxer

func (*KMSGCPBoxer) Open

func (b *KMSGCPBoxer) Open(in string) ([]byte, error)

func (*KMSGCPBoxer) Seal

func (b *KMSGCPBoxer) Seal(in []byte) (string, error)

func (*KMSGCPBoxer) WrapType

func (b *KMSGCPBoxer) WrapType() string

type KMSGCPManager

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

func NewKMSGCPManager

func NewKMSGCPManager(keyPath string) (*KMSGCPManager, error)

func (*KMSGCPManager) Decrypt

func (k *KMSGCPManager) Decrypt(in []byte) ([]byte, error)

func (*KMSGCPManager) Encrypt

func (k *KMSGCPManager) Encrypt(in []byte) ([]byte, error)

type KMSManager

type KMSManager interface {
	Encrypt([]byte) ([]byte, error)
	Decrypt([]byte) ([]byte, error)
}

type PassphraseBoxer

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

func NewPassphraseBoxer

func NewPassphraseBoxer(password string) *PassphraseBoxer

func (*PassphraseBoxer) Open

func (b *PassphraseBoxer) Open(in string) ([]byte, error)

func (*PassphraseBoxer) Seal

func (b *PassphraseBoxer) Seal(in []byte) (string, error)

func (*PassphraseBoxer) WrapType

func (b *PassphraseBoxer) WrapType() string

type PassthroughKeyManager

type PassthroughKeyManager struct{}

func NewPassthroughKeyManager

func NewPassthroughKeyManager() *PassthroughKeyManager

func (PassthroughKeyManager) Decrypt

func (k PassthroughKeyManager) Decrypt(in []byte) ([]byte, error)

func (PassthroughKeyManager) Encrypt

func (k PassthroughKeyManager) Encrypt(in []byte) ([]byte, error)

type SecretBoxer

type SecretBoxer interface {
	Seal(in []byte) (string, error)
	Open(in string) ([]byte, error)
	WrapType() string
}

func SecretBoxerForType

func SecretBoxerForType(boxerType string, keypath string) (SecretBoxer, error)

type Vault

type Vault struct {
	Kind    string `json:"kind"`
	Version int    `json:"version"`
	Comment string `json:"comment"`

	SecretBoxWrap       string `json:"secretbox_wrap"`
	SecretBoxCiphertext string `json:"secretbox_ciphertext"`

	KeyBag []solana.PrivateKey `json:"-"`
}

Vault represents a `solana-go` wallet. It contains the encrypted material to load a KeyBag, which is the signing provider for signing transactions using the `solana-go` library.

func NewVault

func NewVault() *Vault

NewVault returns an empty vault, unsaved and with no keys.

func NewVaultFromSingleKey

func NewVaultFromSingleKey(privKey string) (*Vault, error)

NewVaultFromSingleKey creates a new Vault from the provided private key.

func NewVaultFromWalletFile

func NewVaultFromWalletFile(filename string) (*Vault, error)

NewVaultFromWalletFile returns a new Vault instance from the provided filename of an eos wallet.

func (*Vault) AddPrivateKey

func (v *Vault) AddPrivateKey(privateKey solana.PrivateKey) solana.PublicKey

AddPrivateKey appends the provided private key into the Vault's KeyBag

func (*Vault) NewKeyPair

func (v *Vault) NewKeyPair() (pub solana.PublicKey, err error)

NewKeyPair creates a new keypair, saves the private key in the local wallet and returns the public key. It does NOT save the wallet, you better do that soon after.

func (*Vault) Open

func (v *Vault) Open(boxer SecretBoxer) error

func (*Vault) PrintPrivateKeys

func (v *Vault) PrintPrivateKeys()

func (*Vault) PrintPublicKeys

func (v *Vault) PrintPublicKeys()

PrintPublicKeys prints a PublicKey corresponding to each PrivateKey in the Vault's KeyBag.

func (*Vault) Seal

func (v *Vault) Seal(boxer SecretBoxer) error

func (*Vault) WriteToFile

func (v *Vault) WriteToFile(filename string) error

WriteToFile writes the Vault to disk. You need to encrypt before writing to file, otherwise you might lose much :)

Jump to

Keyboard shortcuts

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