Skip to content

Class: SealController ​

Defined in: @meddleware/sealed-storage-client/src/controller.ts:87

Orchestrates Seal threshold encrypt/decrypt over a policy registry, and manages the per-address SessionKey (signed once, cached until it expires). No policy logic lives here — that is entirely in the registered providers, so new policy types need no controller changes.

Constructors ​

Constructor ​

new SealController(cfg, registry): SealController

Defined in: @meddleware/sealed-storage-client/src/controller.ts:92

Parameters ​

cfg ​

SealControllerConfig

registry ​

PolicyRegistry

Returns ​

SealController

Accessors ​

verifiesKeyServers ​

Get Signature ​

get verifiesKeyServers(): boolean

Defined in: @meddleware/sealed-storage-client/src/controller.ts:125

Whether key-server URLs are verified against their on-chain objects. It is one SDK-wide switch: on by default, but off as soon as ANY server is reached through an aggregator — so in a mixed configuration the independent servers are not URL-verified either. Check this before trusting a mixed setup.

Returns ​

boolean

Methods ​

clearSession() ​

clearSession(address?): void

Defined in: @meddleware/sealed-storage-client/src/controller.ts:238

Drop cached SessionKey(s). Call this on wallet disconnect or account change so a key minted for a previous address is never reused after reconnect — a reused session would sign key-server requests under a stale identity. With no argument, clears every cached session; with an address, clears just that one.

Parameters ​

address? ​

string

Returns ​

void


decrypt() ​

decrypt<P>(type, params, id, ciphertext, opts): Promise<Uint8Array<ArrayBufferLike>>

Defined in: @meddleware/sealed-storage-client/src/controller.ts:158

Decrypt ciphertext sealed under policy type with identity id (hex, from the manifest). params supplies the on-chain objects the policy's seal_approve needs. Prompts a single wallet personal-message signature per address to mint a SessionKey (cached until expiry).

Before any key is requested it checks, and throws on a mismatch: the id is even-length hex; the provider's verifyId (layout and consistency with params); that the ciphertext header names the same identity and this controller's policy package; and that the approve PTB holds only seal_approve* calls to the policy package.

Type Parameters ​

P ​

P

Parameters ​

type ​

string

params ​

P

id ​

string

ciphertext ​

Uint8Array

opts ​
address ​

string

signPersonalMessage ​

SignPersonalMessage

Returns ​

Promise<Uint8Array<ArrayBufferLike>>


encrypt() ​

encrypt<P>(type, params, data): Promise<EncryptResult>

Defined in: @meddleware/sealed-storage-client/src/controller.ts:130

Encrypt data under policy type with params. Returns the identity (hex) + ciphertext.

Type Parameters ​

P ​

P

Parameters ​

type ​

string

params ​

P

data ​

Uint8Array

Returns ​

Promise<EncryptResult>


explainRefusal() ​

explainRefusal<P>(type, params, id, opts): Promise<RefusalExplanation>

Defined in: @meddleware/sealed-storage-client/src/controller.ts:209

Explain why a decrypt was (or would be) refused: builds the same approve PTB decrypt sends to the key servers, simulates it as opts.address over the controller's client (read-only: no signing, no funds, one RPC) and returns the policy abort it hits. The key servers' own refusal (NoAccessError, InvalidParameterError) carries no abort, which is why this exists.

Call it after a decrypt failed, never automatically: decrypt does not call it. It does not throw on a refusal; an error while simulating (network, a node that rejects the build) comes back as kind: 'unknown' with the error as cause. kind: 'allowed' means the policy approves this address, so the refusal came from the key servers (unreachable, below the threshold, or a full node that has not seen a new object yet). It does not use or mint a SessionKey.

Type Parameters ​

P ​

P

Parameters ​

type ​

string

params ​

P

id ​

string

opts ​
address ​

string

Returns ​

Promise<RefusalExplanation>

Throws ​

only for an unregistered policy type (as decrypt).

2026 Meddleware. All jams preserved.