|
Download tasks/data/reverse/99designs__keyring.929f178/environment/docs/usage.md from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 1.93 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/99designs__keyring.929f178/environment/docs/usage.md
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/99designs__keyring.929f178/environment/docs/usage.md
-
curl -L -o usage.md https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/99designs__keyring.929f178/environment/docs/usage.md
1.93 kB
Keyring — Usage Documentation
Keyring provides a common interface to a range of secure credential storage services. It was originally developed as part of AWS Vault, a command line tool for securely managing AWS access from developer workstations.
Supported Backends
- macOS Keychain
- Windows Credential Manager
- Secret Service (Gnome Keyring, KWallet)
- KWallet
- Pass
- Encrypted file (JWT)
- KeyCtl
Usage
The short version of how to use keyring is shown below.
ring, _ := keyring.Open(keyring.Config{
ServiceName: "example",
})
_ = ring.Set(keyring.Item{
Key: "foo",
Data: []byte("secret-bar"),
})
i, _ := ring.Get("foo")
fmt.Printf("%s", i.Data)
Typical flow:
- Open a keyring with a
keyring.Config(at minimum aServiceName). - Store a secret with
ring.Set(keyring.Item{Key: ..., Data: ...})whereDatais a[]byte. - Retrieve it with
ring.Get("key"); the returned item'sDatafield holds the secret bytes.
For full API details, see the keyring godocs.
Module Import
The package is imported as:
github.com/99designs/keyring
Notes
- The backend selected depends on the host operating system and available credential services; the library provides a common
Open/Get/Setinterface across all of them. - Secrets are stored and returned as raw byte slices (
[]byte), so any serializable value can be stored.