Documentation
¶
Index ¶
- Constants
- Variables
- func ConfiguredKeyStorage(ctx context.Context, h string) string
- func KeychainBackendLabel() string
- func NormalizeOTPSecret(value string) (string, error)
- func NormalizeOrigin(urlOrOrigin string) (string, error)
- func RequiredFields(kind string) []string
- func ScrubSecretFromText(text string, secret *jsonutil.Object) string
- func TOTPAt(seed string, digits, period int, at float64) (string, error)
- func TOTPNow(seed string) (string, error)
- func VaultDeleteKeyRef(ref map[string]any) bool
- type KeychainUnavailable
- type MemoryKeyring
- type VaultError
- type VaultItemMeta
- type VaultStore
- func (s *VaultStore) AddItem(kind, label string, secret *jsonutil.Object, origin string) (VaultItemMeta, error)
- func (s *VaultStore) EncryptVaultBody(plaintext []byte) error
- func (s *VaultStore) GetMeta(itemID string) (*VaultItemMeta, error)
- func (s *VaultStore) KeyLocation() (*jsonutil.Object, error)
- func (s *VaultStore) ListItems() ([]VaultItemMeta, error)
- func (s *VaultStore) MigrateKey(target string) (string, error)
- func (s *VaultStore) OwnCopiedKey(publishedBase string) (*jsonutil.Object, error)
- func (s *VaultStore) RemoveItem(itemID string) (bool, error)
- func (s *VaultStore) ResolveSecret(itemID string) (*jsonutil.Object, error)
Constants ¶
const VaultKeychainService = "Icebath Agent vault key"
Keychain service every vault key entry is filed under
Variables ¶
var AddressFields = jsonutil.ObjectOf("address_line1", "address-line1", "address_line2", "address-line2", "city", "address-level2",
"state", "address-level1", "postal_code", "postal-code", "country", "country-name")
Address payload names mapped to the WHATWG autocomplete token the fill targets
var LoginIdentifierTypes = []string{"email", "phone", "username"}
var PaymentFields = jsonutil.ObjectOf("card_number", "cc-number", "cardholder_name", "cc-name", "exp_month", "cc-exp-month",
"exp_year", "cc-exp-year", "cvc", "cc-csc", "billing_postal_code", "postal-code")
Payment payload names mapped to the WHATWG autocomplete token the fill targets
var VaultKinds = []string{"login", "payment", "address"}
Functions ¶
func ConfiguredKeyStorage ¶
ConfiguredKeyStorage is the vault.key_storage setting of a home, file when unset
func KeychainBackendLabel ¶
func KeychainBackendLabel() string
Human name of the keychain this process would use, for the vault key command
func NormalizeOTPSecret ¶
Canonical stored seed of a base32 secret or otpauth totp URI, non default parameters appended
func NormalizeOrigin ¶
Scheme, host and non default port of a URL or origin, a VaultError without scheme and host
func RequiredFields ¶
RequiredFields lists the fields a payment or address item must carry
func ScrubSecretFromText ¶
Strips every secret value of at least three characters and password echoes from text
func TOTPAt ¶
RFC 6238 code for a stored seed at a unix time, the seed form NormalizeOTPSecret produces
func VaultDeleteKeyRef ¶
Deletes the entry a plain map pointer names, true once it is gone
Types ¶
type KeychainUnavailable ¶
No OS keychain is reachable from this process, headless or a plaintext backend
func (*KeychainUnavailable) Error ¶
func (e *KeychainUnavailable) Error() string
type MemoryKeyring ¶
type MemoryKeyring struct {
// contains filtered or unexported fields
}
MemoryKeyring is an in memory OS keychain stand in for tests of the packages that drive the vault
func UseMemoryKeyring ¶
func UseMemoryKeyring() (*MemoryKeyring, func())
UseMemoryKeyring installs an in memory keyring as the host keychain, the returned func restores the native one
func (*MemoryKeyring) Count ¶
func (k *MemoryKeyring) Count() int
Count is how many entries the keyring holds
func (*MemoryKeyring) DeletePassword ¶
func (k *MemoryKeyring) DeletePassword(service, account string) error
func (*MemoryKeyring) GetPassword ¶
func (k *MemoryKeyring) GetPassword(service, account string) (string, bool, error)
func (*MemoryKeyring) SetPassword ¶
func (k *MemoryKeyring) SetPassword(service, account, password string) error
type VaultError ¶
type VaultError struct{ Msg string }
Vault failure that is safe to surface, never carrying a secret value
func (*VaultError) Error ¶
func (e *VaultError) Error() string
type VaultItemMeta ¶
type VaultItemMeta struct {
ID string
Kind string
Label string
Origin any
CreatedAt string
IdentifierType any
Identifier any
HasOTP bool
AllowedOrigins []string
}
Metadata only view of a vault item, never a secret value
func (VaultItemMeta) ToDict ¶
func (m VaultItemMeta) ToDict() *jsonutil.Object
type VaultStore ¶
type VaultStore struct {
// contains filtered or unexported fields
}
Encrypted profile scoped vault under the home's vault directory
func GetVaultStore ¶
func GetVaultStore(ctx context.Context) *VaultStore
Default store of the home in effect for ctx
func NewVaultStore ¶
func NewVaultStore(ctx context.Context, baseDir string) *VaultStore
Store at baseDir, empty meaning the vault directory of the home in effect for ctx
func (*VaultStore) AddItem ¶
func (s *VaultStore) AddItem(kind, label string, secret *jsonutil.Object, origin string) (VaultItemMeta, error)
Adds an item, a login keeping its identifier in metadata and only the password and seed secret
func (*VaultStore) EncryptVaultBody ¶
func (s *VaultStore) EncryptVaultBody(plaintext []byte) error
EncryptVaultBody writes plaintext as this store's encrypted vault file, the way a test corrupts a store
func (*VaultStore) GetMeta ¶
func (s *VaultStore) GetMeta(itemID string) (*VaultItemMeta, error)
func (*VaultStore) KeyLocation ¶
func (s *VaultStore) KeyLocation() (*jsonutil.Object, error)
Where this vault's key lives, never the key itself
func (*VaultStore) ListItems ¶
func (s *VaultStore) ListItems() ([]VaultItemMeta, error)
Metadata only listing, secret payloads never included
func (*VaultStore) MigrateKey ¶
func (s *VaultStore) MigrateKey(target string) (string, error)
Moves the key between the file and the OS keychain, proving the destination before removing the source
func (*VaultStore) OwnCopiedKey ¶
func (s *VaultStore) OwnCopiedKey(publishedBase string) (*jsonutil.Object, error)
Gives a cloned vault its own keychain entry before publication at publishedBase, nil when nothing is shared
func (*VaultStore) RemoveItem ¶
func (s *VaultStore) RemoveItem(itemID string) (bool, error)
func (*VaultStore) ResolveSecret ¶
func (s *VaultStore) ResolveSecret(itemID string) (*jsonutil.Object, error)
Decrypted secret payload for server side use only, never for results, logs or errors