Documentation
    Preparing search index...

    Interface AclStateContainer

    ACL state container — wraps @kehto/acl's pure functions with persistence and a convenient imperative API.

    const aclState = createAclState(persistence);
    aclState.load();
    const allowed = aclState.check(pubkey, dTag, hash, 'relay:read');
    interface AclStateContainer {
        block(pubkey: string, dTag: string, aggregateHash: string): void;
        check(
            pubkey: string,
            dTag: string,
            aggregateHash: string,
            capability:
                | "relay:read"
                | "relay:write"
                | "cache:read"
                | "cache:write"
                | "hotkey:forward"
                | "state:read"
                | "state:write"
                | "identity:read"
                | "keys:bind"
                | "keys:forward"
                | "media:control"
                | "notify:send"
                | "notify:channel"
                | "theme:read"
                | "config:read"
                | "resource:fetch"
                | "cvm:call"
                | "outbox:read"
                | "outbox:write"
                | "upload:write"
                | "intent:read"
                | "intent:write"
                | "dm:read"
                | "dm:write"
                | "fs:read"
                | "fs:write"
                | "llm:generate",
        ): boolean;
        clear(): boolean;
        getAllEntries(): AclEntryExternal[];
        getEntry(
            pubkey: string,
            dTag: string,
            aggregateHash: string,
        ): AclEntryExternal | undefined;
        getStateQuota(pubkey: string, dTag: string, aggregateHash: string): number;
        grant(
            pubkey: string,
            dTag: string,
            aggregateHash: string,
            capability:
                | "relay:read"
                | "relay:write"
                | "cache:read"
                | "cache:write"
                | "hotkey:forward"
                | "state:read"
                | "state:write"
                | "identity:read"
                | "keys:bind"
                | "keys:forward"
                | "media:control"
                | "notify:send"
                | "notify:channel"
                | "theme:read"
                | "config:read"
                | "resource:fetch"
                | "cvm:call"
                | "outbox:read"
                | "outbox:write"
                | "upload:write"
                | "intent:read"
                | "intent:write"
                | "dm:read"
                | "dm:write"
                | "fs:read"
                | "fs:write"
                | "llm:generate",
        ): void;
        isBlocked(pubkey: string, dTag: string, aggregateHash: string): boolean;
        load(): void;
        persist(): boolean;
        revoke(
            pubkey: string,
            dTag: string,
            aggregateHash: string,
            capability:
                | "relay:read"
                | "relay:write"
                | "cache:read"
                | "cache:write"
                | "hotkey:forward"
                | "state:read"
                | "state:write"
                | "identity:read"
                | "keys:bind"
                | "keys:forward"
                | "media:control"
                | "notify:send"
                | "notify:channel"
                | "theme:read"
                | "config:read"
                | "resource:fetch"
                | "cvm:call"
                | "outbox:read"
                | "outbox:write"
                | "upload:write"
                | "intent:read"
                | "intent:write"
                | "dm:read"
                | "dm:write"
                | "fs:read"
                | "fs:write"
                | "llm:generate",
        ): void;
        setStateQuota(
            pubkey: string,
            dTag: string,
            aggregateHash: string,
            bytes: number,
        ): void;
        unblock(pubkey: string, dTag: string, aggregateHash: string): void;
    }
    Index

    Methods

    • Parameters

      • pubkey: string
      • dTag: string
      • aggregateHash: string
      • capability:
            | "relay:read"
            | "relay:write"
            | "cache:read"
            | "cache:write"
            | "hotkey:forward"
            | "state:read"
            | "state:write"
            | "identity:read"
            | "keys:bind"
            | "keys:forward"
            | "media:control"
            | "notify:send"
            | "notify:channel"
            | "theme:read"
            | "config:read"
            | "resource:fetch"
            | "cvm:call"
            | "outbox:read"
            | "outbox:write"
            | "upload:write"
            | "intent:read"
            | "intent:write"
            | "dm:read"
            | "dm:write"
            | "fs:read"
            | "fs:write"
            | "llm:generate"

      Returns boolean

    • Reset live state to the configured default and attempt to clear storage.

      Returns boolean

      True if storage cleared; false if only the live reset succeeded.

      if (!acl.clear()) showSaveError();
      
    • Parameters

      • pubkey: string
      • dTag: string
      • aggregateHash: string

      Returns number

    • Parameters

      • pubkey: string
      • dTag: string
      • aggregateHash: string
      • capability:
            | "relay:read"
            | "relay:write"
            | "cache:read"
            | "cache:write"
            | "hotkey:forward"
            | "state:read"
            | "state:write"
            | "identity:read"
            | "keys:bind"
            | "keys:forward"
            | "media:control"
            | "notify:send"
            | "notify:channel"
            | "theme:read"
            | "config:read"
            | "resource:fetch"
            | "cvm:call"
            | "outbox:read"
            | "outbox:write"
            | "upload:write"
            | "intent:read"
            | "intent:write"
            | "dm:read"
            | "dm:write"
            | "fs:read"
            | "fs:write"
            | "llm:generate"

      Returns void

    • Parameters

      • pubkey: string
      • dTag: string
      • aggregateHash: string

      Returns boolean

    • Save live state without rolling back live policy on failure.

      Returns boolean

      True if the backend completed; false if it threw.

      if (!acl.persist()) showSaveError();
      
    • Parameters

      • pubkey: string
      • dTag: string
      • aggregateHash: string
      • capability:
            | "relay:read"
            | "relay:write"
            | "cache:read"
            | "cache:write"
            | "hotkey:forward"
            | "state:read"
            | "state:write"
            | "identity:read"
            | "keys:bind"
            | "keys:forward"
            | "media:control"
            | "notify:send"
            | "notify:channel"
            | "theme:read"
            | "config:read"
            | "resource:fetch"
            | "cvm:call"
            | "outbox:read"
            | "outbox:write"
            | "upload:write"
            | "intent:read"
            | "intent:write"
            | "dm:read"
            | "dm:write"
            | "fs:read"
            | "fs:write"
            | "llm:generate"

      Returns void

    • Set a principal's live storage quota without changing grants or stored data. Call persist() separately to save the policy.

      Parameters

      • pubkey: string

        Retained identity argument; policy is keyed by dTag and hash.

      • dTag: string

        Verified napplet identifier.

      • aggregateHash: string

        Verified artifact hash.

      • bytes: number

        Integer byte count from zero through Number.MAX_SAFE_INTEGER.

      Returns void

      RangeError if bytes is not a non-negative safe integer.

      acl.setStateQuota('', dTag, aggregateHash, 1024 * 1024);
      acl.persist();