The stored value, null when there is none.
unavailable (rejects) The store cannot be reached (no keychain,
a read-only store, no logged-in session on Windows).
Store or replace (name: 1–64 of a-z 0-9 . _ -; value 1–1024 bytes).
At most 256 different names per plugin: a new name beyond that rejects
limit. Uninstalling with removeData deletes them.
unavailable (rejects) The store cannot be reached (no keychain,
a read-only store, no logged-in session on Windows), or the player is
a temporary window (AppInfo.temporary, player 0.10.3), which
reads the main window's secrets and saves none.
The token the user typed is kept in the system's secret store for later
runs. set stores or replaces it; the store can refuse, in which case
the plugin keeps the token for this run only.
await plugin.secrets.set("api-token", token).catch((error: PluginError) => {
// No store, or access denied: the token is not kept for next time.
void plugin.osd.show("The token could not be saved ({})", [error.code]);
});
Remove; removing a missing secret is fine.
unavailable (rejects) The store cannot be reached (no keychain,
a read-only store, no logged-in session on Windows), or the player is
a temporary window (AppInfo.temporary, player 0.10.3), which
deletes none of the main window's secrets.
Per-plugin secrets (API keys, passwords) in the system's secret store: the login keychain on macOS, the Credential Manager on Windows. Needs
secrets.unsupportedon systems without a store,unavailablewhen the store cannot be reached (no keychain, a read-only store, no logged-in session on Windows): keep a fallback (or ask again).The user denying access and other system errors reject
failed. Never write secrets to settings files.Example: Ask for an API token once and keep it in the keychain
The user types the token the first time; later runs read it from the system's secret store.
getresolvesnullwhen nothing is stored; a store that is missing or refuses access rejects (unsupported,unavailable,failed), and then the plugin keeps the token for this run only and asks again next time.Remarks
Values are stored by the player in the system's secret store under this plugin's id: other plugins cannot read them. Names are 1–64 of
a-z 0-9 . _ -, values 1–1024 bytes of text, at most 256 names per plugin (SECRET_LIMITS). In a temporary window (AppInfo.temporary)getreads the main window's values andsetanddeletereject withunavailable(player 0.10.3).Since
1.0.0