@parity/product-sdk-terminal 0.5.4 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,72 +0,0 @@
1
- import { PappAdapter, HostMetadata } from '@novasamatech/host-papp';
2
-
3
- /**
4
- * Node.js adapter for the Polkadot host-papp SDK.
5
- *
6
- * Provides Node.js-compatible implementations of the SDK's storage and
7
- * transport layers, enabling QR login, attestation, and signing in
8
- * terminal/CLI environments.
9
- */
10
-
11
- /** Options for creating a terminal adapter. */
12
- interface TerminalAdapterOptions {
13
- /** Unique app identifier. Used as the storage namespace. */
14
- appId: string;
15
- /** Statement store WebSocket endpoints. Defaults to Paseo stable endpoints. */
16
- endpoints?: string[];
17
- /** Optional host metadata for the Sign-In screen. */
18
- hostMetadata?: HostMetadata;
19
- /**
20
- * Directory where session files are persisted. Defaults to
21
- * `~/.polkadot-apps/`. Override in tests to point at a temporary
22
- * directory populated with `createTestSession` from
23
- * `@parity/product-sdk-terminal/testing`.
24
- */
25
- storageDir?: string;
26
- }
27
- /**
28
- * Create a terminal adapter backed by the host-papp SDK.
29
- *
30
- * This sets up:
31
- * - File-based storage in `~/.polkadot-apps/` (since Node.js has no localStorage)
32
- * - WebSocket connection to the statement store
33
- * - The full SSO flow: QR pairing + on-chain attestation
34
- * - Session manager for signing requests
35
- */
36
- /** A PappAdapter with the `appId` it was created with and a `destroy` method for cleanup. */
37
- type TerminalAdapter = PappAdapter & {
38
- /** The `appId` passed to {@link createTerminalAdapter}. Useful for {@link createSessionSigner}. */
39
- readonly appId: string;
40
- /**
41
- * The on-disk storage directory used for sessions and (when the
42
- * host-runner facet is in use) for the allowance-key cache the
43
- * `./host` subpath maintains. `undefined` when the default
44
- * is in use; set explicitly when the caller passed `storageDir` to
45
- * {@link createTerminalAdapter}.
46
- */
47
- readonly storageDir?: string;
48
- /**
49
- * Disconnect the WebSocket and release resources.
50
- *
51
- * @remarks
52
- * Idempotent. Returns a Promise that resolves once all in-flight
53
- * statement-subscription teardowns have settled and the underlying
54
- * substrate client has been disconnected. **Awaiting is recommended
55
- * but not required** — callers that don't await get the same
56
- * fire-and-forget shape the previous version had, but they may see
57
- * the destroy-time RPC traffic finish after the function returns.
58
- *
59
- * The implementation tracks the server-side `statement_unsubscribe…`
60
- * RPCs `sessions.dispose()` fires, then awaits them via
61
- * `Promise.allSettled` before destroying the substrate-client request
62
- * queue. No timing-based guesses; no global-state mutations of
63
- * `console.error` or `process.on('unhandledRejection')`. Pending
64
- * subscribes (where `onSuccess` hasn't fired yet) are cancelled by
65
- * the underlying `getSubscribeFn` teardown via `cancelRequest()`,
66
- * which is the in-band fast-path and doesn't surface as a rejection.
67
- */
68
- destroy(): Promise<void>;
69
- };
70
- declare function createTerminalAdapter(options: TerminalAdapterOptions): TerminalAdapter;
71
-
72
- export { type TerminalAdapter as T, type TerminalAdapterOptions as a, createTerminalAdapter as c };