Docs · API reference · Verso.Extensions

ExtensionTrustStore Class#

Persists per-package extension trust decisions across sessions in a small JSON file under the user config directory. The first time a notebook needs an extension the hosting layer prompts for consent; once approved the decision is remembered here so later opens load it without re-prompting. Trust is keyed by package id and records the approved version, so a request for a different version re-prompts.

public sealed class ExtensionTrustStore

Inheritance System.Object → ExtensionTrustStore

Methods#

Approve(string, string) Method#

Records approval for a package at the given version (null = latest).

public void Approve(string packageId, string? version);

Parameters#

packageId System.String

version System.String

GetTrustStorePath() Method#

Returns the path to the trust file (whether or not it exists). Mirrors the user config directory layout used elsewhere: %LOCALAPPDATA%\verso\trust.json on Windows, $XDG_CONFIG_HOME/verso/trust.json (or ~/.config/...) elsewhere.

public static string GetTrustStorePath();

Returns#

System.String

IsApproved(string, string) Method#

Whether the given package is approved for the requested version. Approval is pinned to the exact version the user consented to, so a request for a different version re-prompts. A null on either side means "unspecified version" and matches only the other side also being null; it does not blanket-approve every version. This keeps a one-time "latest" approval from silently trusting a later, possibly malicious, version.

public bool IsApproved(string packageId, string? version);

Parameters#

packageId System.String

version System.String

Returns#

System.Boolean

Load() Method#

Loads the trust store from disk. A missing or malformed file yields an empty store; trust persistence must never prevent a notebook from opening.

public static Verso.Extensions.ExtensionTrustStore Load();

Returns#

ExtensionTrustStore

Load(string) Method#

Loads the trust store from a specific path (used by tests).

public static Verso.Extensions.ExtensionTrustStore Load(string path);

Parameters#

path System.String

Returns#

ExtensionTrustStore

Revoke(string) Method#

Removes any approval for a package.

public void Revoke(string packageId);

Parameters#

packageId System.String

Save() Method#

Writes the store to disk. Best effort; failures are swallowed.

public void Save();