Browse API 1 documentation
GroveAPI 1preview

grove.secrets.get()

Read an extension/network Keychain value.

Mango 3.1+View Markdown

Read an extension/network Keychain value.

Signature

ts
grove.secrets.get(key: string): Promise<string | 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.

Return value

Resolves to the stored string, or null if the key does not exist. Empty string is a stored value and differs from null.

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. 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

js
try {
  const value = await grove.secrets.get('service-session')
  if (value === null) console.info('Service sign-in is needed')
} catch {
  console.error('Could not read the service session.')
}

See Storage and settings.