@vestra-player/sdk - v1.11.3
    Preparing search index...

    Variable SECRET_LIMITSConst

    SECRET_LIMITS: Readonly<{ nameChars: 64; valueBytes: 1024; names: 256 }> = ...

    The player's limits on Secrets. A name or value outside them fails with code invalid; a new name beyond names fails with limit. The player's tests check that these agree with the player.

    The plugin keeps a token the user pasted, or tells them it is empty or too long. Values are 1–1024 bytes counted in UTF-8, so the check uses Buffer.byteLength; secrets.set would refuse other values with invalid. The store itself can still refuse (unsupported without a system store, unavailable when it cannot be reached, failed when the user denies access): only those codes get the "could not be saved" message, anything else (an invalid name) is a bug and is thrown on.

    import { SECRET_LIMITS } from "@vestra-player/sdk/testing";

    if (!token || Buffer.byteLength(token) > SECRET_LIMITS.valueBytes) {
    await plugin.osd.show("Paste a token of at most 1024 bytes.");
    } else {
    try {
    await plugin.secrets.set("api-token", token);
    } catch (error) {
    const { code } = error as PluginError;
    if (!["unsupported", "unavailable", "failed"].includes(code)) throw error;
    // No keychain or access denied: ask again next time.
    await plugin.osd.show("The token could not be saved.");
    }
    }

    1.5.14