Documentation
¶
Overview ¶
Package keyringutil stores values in the operating system keyring without being limited by the maximum size of a single keyring entry.
Windows Credential Manager limits each entry to 2560 bytes and the macOS Keychain (via go-keyring) to roughly 2900 bytes. Values larger than ChunkSize are split across several entries named "<service> #<n>", with the main entry holding a header that records the number of parts and a SHA-256 hash of the complete value. Smaller values are stored in a single entry exactly as go-keyring would store them, so existing entries remain readable.
Index ¶
Constants ¶
const ( // ChunkSize is the largest value stored in a single keyring entry. It is // below the per-entry limits of Windows Credential Manager and the macOS // Keychain with room to spare. ChunkSize = 2000 )
Variables ¶
var ( // ErrNotFound is returned when no value is stored. It is the same error // returned by go-keyring so either may be checked with errors.Is. ErrNotFound = keyring.ErrNotFound // ErrIncomplete is returned, along with [ErrNotFound], when a value that // was split into parts is missing parts or does not match its hash, such // as when a write was interrupted ErrIncomplete = errors.New("stored value is incomplete") // ErrTooLarge is returned when a value would need more than the maximum // number of parts ErrTooLarge = errors.New("value is too large to store") )
Functions ¶
func Delete ¶
Delete removes the value stored for service and user, including any parts. ErrNotFound is returned if no value was stored.
func Get ¶
Get returns the value stored for service and user. ErrNotFound is returned if no value is stored or a value split into parts is incomplete.
Types ¶
This section is empty.