Browse API 1 documentation
grove.secrets.set()
Store or replace an extension/network Keychain value.
Store or replace an extension/network Keychain value.
Signature
grove.secrets.set(key: string, value: string): Promise<null>
Availability
All packaged runtimes with storage.secure, including settings pages. The storage capability for persistent browser data is separate.
Parameters
| Parameter | Required | Description |
|---|---|---|
key |
Yes | Nonempty key after trimming surrounding whitespace, at most 200 characters, no control characters. |
value |
Yes | String, at most 16,384 characters. Empty string is allowed; objects and binary values must be explicitly encoded. |
Return value
Resolves to null after the Keychain operation succeeds.
Behavior and errors
The namespace is isolated by extension identifier and grove.info.networkID, not by channel/query. With an empty networkID it coincides with secrets.application; prefer the explicit application namespace in application Roots and settings pages. An existing value for the same normalized key is replaced. JSON serialization is your responsibility. Missing grants, invalid keys/values, and Keychain failures reject with Error. Handle failures without logging credentials. Uninstall removes the extension’s secret namespaces; these methods do not access Mango’s own network passwords.
Example
try {
await grove.secrets.set('service-session', JSON.stringify({ enabled: true }))
} catch {
console.error('Could not save the service session.')
}
See Storage and settings.