Documentation
¶
Index ¶
- Constants
- func DeleteKey(token, vaultID, keyID string) error
- func DeleteSecret(token, vaultID, secretID string) error
- type BLSAggregateRequestResponse
- type EncryptDecryptRequestResponse
- func Decrypt(token, vaultID, keyID string, params map[string]interface{}) (*EncryptDecryptRequestResponse, error)
- func Encrypt(token, vaultID, keyID, data string) (*EncryptDecryptRequestResponse, error)
- func EncryptWithNonce(token, vaultID, keyID, data, nonce string) (*EncryptDecryptRequestResponse, error)
- type Key
- func CreateKey(token, vaultID string, params map[string]interface{}) (*Key, error)
- func DeriveKey(token, vaultID, keyID string, params map[string]interface{}) (*Key, error)
- func FetchKey(token, vaultID, keyID string) (*Key, error)
- func ListKeys(token, vaultID string, params map[string]interface{}) ([]*Key, error)
- type SealUnsealRequestResponse
- type Secret
- type Service
- type SignRequest
- type SignResponse
- type Vault
- type VerifyRequest
- type VerifyResponse
- func VerifyAggregateSignatures(token *string, params map[string]interface{}) (*VerifyResponse, error)
- func VerifyDetachedSignature(token, spec, msg, sig, publicKey string, opts map[string]interface{}) (*VerifyResponse, error)
- func VerifySignature(token, vaultID, keyID, msg, sig string, opts map[string]interface{}) (*VerifyResponse, error)
Constants ¶
const KeyBits2048 = 2048
KeyBits2048 is the bit length for 2048-bit keys
const KeyBits3072 = 3072
KeyBits3072 is the bit length for 3072-bit keys
const KeyBits4096 = 4096
KeyBits4096 is the bit length for 4096-bit keys
const KeySpecAES256GCM = "AES-256-GCM"
KeySpecAES256GCM AES-256-GCM key spec
const KeySpecChaCha20 = "ChaCha20"
KeySpecChaCha20 ChaCha20 key spec
const KeySpecECCBIP39 = "BIP39"
KeySpecECCBIP39 BIP39 key spec
const KeySpecECCBabyJubJub = "babyJubJub"
KeySpecECCBabyJubJub babyJubJub key spec
const KeySpecECCC25519 = "C25519"
KeySpecECCC25519 C25519 key spec
const KeySpecECCEd25519 = "Ed25519"
KeySpecECCEd25519 Ed25519 key spec
const KeySpecECCSecp256k1 = "secp256k1"
KeySpecECCSecp256k1 secp256k1 key spec
const KeySpecRSA2048 = "RSA-2048"
KeySpecRSA2048 rsa 2048 key spec
const KeySpecRSA3072 = "RSA-3072"
KeySpecRSA3072 rsa 3072 key spec
const KeySpecRSA4096 = "RSA-4096"
KeySpecRSA4096 rsa 4096 key spec
const KeyTypeAsymmetric = "asymmetric"
KeyTypeAsymmetric asymmetric key type
const KeyTypeSymmetric = "symmetric"
KeyTypeSymmetric symmetric key type
const KeyUsageEncryptDecrypt = "encrypt/decrypt"
KeyUsageEncryptDecrypt encrypt/decrypt usage
const KeyUsageSignVerify = "sign/verify"
KeyUsageSignVerify sign/verify usage
const MaxHDIteration = 4294967295
MaxHDIteration is the maximum HD account index
const NonceSizeSymmetric = 12
NonceSizeSymmetric chacha20 & aes256 encrypt/decrypt nonce size
Variables ¶
This section is empty.
Functions ¶
func DeleteSecret ¶
DeleteSecret deletes a secret from the vault
Types ¶
type BLSAggregateRequestResponse ¶
type BLSAggregateRequestResponse struct { Signatures []*string `json:"signatures,omitempty"` AggregateSignature *string `json:"aggregate_signature,omitempty"` }
BLSAggregateRequestResponse provides the BLS sig information to aggregate n BLS signatures into one BLS signature
func AggregateSignatures ¶
func AggregateSignatures(token *string, params map[string]interface{}) (*BLSAggregateRequestResponse, error)
AggregateSignatures aggregates BLS signatures into a single BLS signature
type EncryptDecryptRequestResponse ¶
type EncryptDecryptRequestResponse struct { Data string `json:"data"` Nonce *string `json:"nonce,omitempty"` }
EncryptDecryptRequestResponse contains the data (i.e., encrypted or decrypted) and an optional nonce
func Decrypt ¶
func Decrypt(token, vaultID, keyID string, params map[string]interface{}) (*EncryptDecryptRequestResponse, error)
Decrypt decrypts provided encrypted data with a key from the vault
func Encrypt ¶
func Encrypt(token, vaultID, keyID, data string) (*EncryptDecryptRequestResponse, error)
Encrypt encrypts provided data with a key from the vault and a randomly generated nonce
func EncryptWithNonce ¶
func EncryptWithNonce(token, vaultID, keyID, data, nonce string) (*EncryptDecryptRequestResponse, error)
EncryptWithNonce encrypts provided data with a key from the vault and provided nonce
type Key ¶
type Key struct { api.Model VaultID *uuid.UUID `json:"vault_id"` Type *string `json:"type"` // symmetric or asymmetric Usage *string `json:"usage"` Spec *string `json:"spec"` Name *string `json:"name"` Description *string `json:"description"` // these fields are only populated for ephemeral keys Ephemeral *bool `json:"ephemeral,omitempty"` PrivateKey *string `json:"private_key,omitempty"` Seed *string `json:"seed,omitempty"` Address *string `json:"address,omitempty"` HDDerivationPath *string `json:"hd_derivation_path,omitempty"` PublicKey *string `json:"public_key,omitempty"` }
Key represents a symmetric or asymmetric signing key
type SealUnsealRequestResponse ¶
type SealUnsealRequestResponse struct { UnsealerKey *string `json:"key,omitempty"` ValidationHash *string `json:"validation_hash,omitempty"` }
SealUnsealRequestResponse provides the unseal information
func GenerateSeal ¶
func GenerateSeal(token string, params map[string]interface{}) (*SealUnsealRequestResponse, error)
GenerateSeal returns a valid unsealing key used to encrypt vault master keys
type Secret ¶
type Secret struct { api.Model VaultID *uuid.UUID `json:"vault_id"` Type *string `json:"type"` // arbitrary secret type Name *string `json:"name"` Description *string `json:"description"` Value *string `json:"value,omitempty"` }
Secret represents a string, encrypted by the vault master key
func CreateSecret ¶
CreateSecret stores a new secret in the vault
func FetchSecret ¶
FetchSecret fetches a secret from the given vault
type Service ¶
Service for the vault api
func InitVaultService ¶
InitVaultService convenience method to initialize an `vault.Service` instance
type SignRequest ¶
type SignRequest struct {
Message string `json:"message"`
}
SignRequest contains a message to be signed
type SignResponse ¶
type SignResponse struct { Signature *string `json:"signature,omitempty"` Address *string `json:"address,omitempty"` DerivationPath *string `json:"hd_derivation_path,omitempty"` }
SignResponse contains the signature for the message
func SignMessage ¶
func SignMessage(token, vaultID, keyID, msg string, opts map[string]interface{}) (*SignResponse, error)
SignMessage signs a message with the given key
type Vault ¶
Vault provides secure key management
func CreateVault ¶
CreateVault on behalf of the given API token
type VerifyRequest ¶
VerifyRequest contains the message and signature for verification
type VerifyResponse ¶
type VerifyResponse struct {
Verified bool `json:"verified"`
}
VerifyResponse contains a flag indicating if the signature was verified
func VerifyAggregateSignatures ¶
func VerifyAggregateSignatures(token *string, params map[string]interface{}) (*VerifyResponse, error)
VerifyAggregateSignatures verifies a bls signature
func VerifyDetachedSignature ¶
func VerifyDetachedSignature(token, spec, msg, sig, publicKey string, opts map[string]interface{}) (*VerifyResponse, error)
VerifyDetachedSignature verifies a signature generated by a key external to vault
func VerifySignature ¶
func VerifySignature(token, vaultID, keyID, msg, sig string, opts map[string]interface{}) (*VerifyResponse, error)
VerifySignature verifies a signature