Documentation ¶
Index ¶
- func GetDecryptPassphrase() (string, error)
- func GetEncryptPassphrase() (string, error)
- func GetPassword(input string) (string, error)
- func NewRandomPrivateKey() (PublicKey, PrivateKey, error)
- type PassphraseBoxer
- type PrivateKey
- type PublicKey
- type SecretBoxer
- type Vault
- func (v *Vault) AddPrivateKey(privateKey PrivateKey) PublicKey
- func (v *Vault) NewKeyPair() (pub PublicKey, err error)
- func (v *Vault) Open(boxer SecretBoxer) error
- func (v *Vault) PrintPrivateKeys()
- func (v *Vault) PrintPublicKeys()
- func (v *Vault) Seal(boxer SecretBoxer) error
- func (v *Vault) WriteToFile(filename string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDecryptPassphrase ¶
func GetEncryptPassphrase ¶
func GetPassword ¶
func NewRandomPrivateKey ¶
func NewRandomPrivateKey() (PublicKey, PrivateKey, error)
Types ¶
type PassphraseBoxer ¶
type PassphraseBoxer struct {
// contains filtered or unexported fields
}
func NewPassphraseBoxer ¶
func NewPassphraseBoxer(password string) *PassphraseBoxer
func (*PassphraseBoxer) WrapType ¶
func (b *PassphraseBoxer) WrapType() string
type PrivateKey ¶
type PrivateKey []byte
func MustPrivateKeyFromBase58 ¶
func MustPrivateKeyFromBase58(in string) PrivateKey
func PrivateKeyFromBase58 ¶
func PrivateKeyFromBase58(privkey string) (PrivateKey, error)
func PrivateKeyFromSolanaKeygenFile ¶
func PrivateKeyFromSolanaKeygenFile(file string) (PrivateKey, error)
func (PrivateKey) PublicKey ¶
func (k PrivateKey) PublicKey() PublicKey
func (PrivateKey) String ¶
func (k PrivateKey) String() string
type PublicKey ¶
type PublicKey [32]byte
func MustPublicKeyFromBase58 ¶
func PublicKeyFromBase58 ¶
func PublicKeyFromBytes ¶
func (PublicKey) MarshalJSON ¶
func (*PublicKey) UnmarshalJSON ¶
type SecretBoxer ¶
type SecretBoxer interface { Seal(in []byte) (string, error) Open(in string) ([]byte, error) WrapType() string }
func SecretBoxerForType ¶
func SecretBoxerForType(boxerType 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 []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 MustGetWallet ¶
func MustGetWallet() *Vault
func NewVaultFromSingleKey ¶
NewVaultFromSingleKey creates a new Vault from the provided private key.
func NewVaultFromWalletFile ¶
NewVaultFromWalletFile returns a new Vault instance from the provided filename of an eos wallet.
func (*Vault) AddPrivateKey ¶
func (v *Vault) AddPrivateKey(privateKey PrivateKey) PublicKey
AddPrivateKey appends the provided private key into the Vault's KeyBag
func (*Vault) NewKeyPair ¶
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 ¶
WriteToFile writes the Vault to disk. You need to encrypt before writing to file, otherwise you might lose much :)