@napplet/sdk 0.3.1 → 0.6.0

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.
package/README.md CHANGED
@@ -65,7 +65,8 @@ const keySub = keys.onAction('editor.save', () => {
65
65
 
66
66
  // Create a media session
67
67
  const { sessionId } = await media.createSession({
68
- title: 'My Song', artist: 'The Artist',
68
+ owner: 'napplet',
69
+ metadata: { title: 'My Song', artist: 'The Artist' },
69
70
  });
70
71
  media.reportState(sessionId, { status: 'playing', position: 42.5, duration: 240 });
71
72
 
@@ -93,14 +94,14 @@ const handle = resource.bytesAsObjectURL('blossom:sha256:e3b0c44298fc1c149afbf4c
93
94
  imgEl.src = handle.url;
94
95
  // handle.revoke() when done
95
96
 
96
- // Check shell-assigned class (v0.29.0, NUB-CLASS)
97
+ // Check shell-assigned class (v0.29.0, NAP-CLASS)
97
98
  import { getClass, CLASS_DOMAIN } from '@napplet/sdk';
98
- if (window.napplet.shell.supports(`nub:${CLASS_DOMAIN}`)) {
99
+ if (window.napplet.shell.supports(`nap:${CLASS_DOMAIN}`)) {
99
100
  const cls = getClass(); // number | undefined
100
- if (cls === 2) { /* NUB-CLASS-2 posture */ }
101
+ if (cls === 2) { /* NAP-CLASS-2 posture */ }
101
102
  }
102
103
 
103
- // Use direct network access if the user approved `connect` origins (v0.29.0, NUB-CONNECT)
104
+ // Use direct network access if the user approved `connect` origins (v0.29.0, NAP-CONNECT)
104
105
  import { connectGranted, connectOrigins } from '@napplet/sdk';
105
106
  if (connectGranted()) {
106
107
  const res = await fetch(`${connectOrigins()[0]}/items`);
@@ -151,16 +152,19 @@ Sandboxed key-value storage. Mirrors `window.napplet.storage`. 512 KB quota per
151
152
 
152
153
  ### `media`
153
154
 
154
- Media session control. Mirrors `window.napplet.media`.
155
+ Ownership-aware media sessions. Napplet-owned sessions let your app play media and report state to the shell; shell-owned sessions provide a `source` so the shell fetches, plays, and reports state back.
155
156
 
156
157
  | Method | Returns | Description |
157
158
  |--------|---------|-------------|
158
- | `createSession(metadata?)` | `Promise<{ sessionId }>` | Create a new media session with optional metadata |
159
+ | `createSession(options)` | `Promise<{ sessionId?, owner?, error? }>` | Create a napplet- or shell-owned media session |
159
160
  | `updateSession(sessionId, metadata)` | `void` | Update metadata for an existing session |
160
161
  | `destroySession(sessionId)` | `void` | Destroy a session |
161
162
  | `reportState(sessionId, state)` | `void` | Report playback state |
162
163
  | `reportCapabilities(sessionId, actions)` | `void` | Declare supported media actions |
164
+ | `sendCommand(sessionId, action, value?)` | `void` | Request a control action from the current playback owner |
163
165
  | `onCommand(sessionId, callback)` | `{ close(): void }` | Listen for shell media commands |
166
+ | `onState(sessionId, callback)` | `{ close(): void }` | Listen for shell-reported state on shell-owned sessions |
167
+ | `onCapabilities(sessionId, callback)` | `{ close(): void }` | Listen for shell-reported capabilities on shell-owned sessions |
164
168
  | `onControls(sessionId, callback)` | `{ close(): void }` | Listen for the shell's supported control list |
165
169
 
166
170
  ### `notify`
@@ -181,7 +185,7 @@ Shell-rendered notifications. Mirrors `window.napplet.notify`.
181
185
 
182
186
  ### `config`
183
187
 
184
- Per-napplet declarative configuration (NUB-CONFIG). Mirrors `window.napplet.config`.
188
+ Per-napplet declarative configuration (NAP-CONFIG). Mirrors `window.napplet.config`.
185
189
 
186
190
  | Method | Returns | Description |
187
191
  |--------|---------|-------------|
@@ -192,9 +196,9 @@ Per-napplet declarative configuration (NUB-CONFIG). Mirrors `window.napplet.conf
192
196
  | `onSchemaError(callback)` | `() => void` | Listen for `config.schemaError` pushes (returns plain teardown fn) |
193
197
  | `schema` (accessor) | `Record<string, unknown> \| null` | Readonly current schema |
194
198
 
195
- ### FromSchema type inference (NUB-CONFIG)
199
+ ### FromSchema type inference (NAP-CONFIG)
196
200
 
197
- `json-schema-to-ts` is declared as an optional `peerDependency` of `@napplet/nub` (scoped to the `@napplet/nub/config` domain's `FromSchema` typing). Install it in your napplet to get `FromSchema<typeof schema>` typing for your `config.subscribe` callback -- the `values` parameter is inferred directly from your schema (enums, required fields, defaults all flow through). Authors who skip `json-schema-to-ts` pay no install cost and `config.subscribe` still works with the default `Record<string, unknown>` typing.
201
+ `json-schema-to-ts` is declared as an optional `peerDependency` of `@napplet/nap` (scoped to the `@napplet/nap/config` domain's `FromSchema` typing). Install it in your napplet to get `FromSchema<typeof schema>` typing for your `config.subscribe` callback -- the `values` parameter is inferred directly from your schema (enums, required fields, defaults all flow through). Authors who skip `json-schema-to-ts` pay no install cost and `config.subscribe` still works with the default `Record<string, unknown>` typing.
198
202
 
199
203
  ```ts
200
204
  import '@napplet/shim';
@@ -224,7 +228,7 @@ npm install --save-dev json-schema-to-ts
224
228
 
225
229
  ### `resource`
226
230
 
227
- Sandboxed byte fetching (NUB-RESOURCE). Mirrors `window.napplet.resource`. Required because the iframe sandbox + strict CSP block direct `fetch()` / `<img src=externalUrl>` / `XMLHttpRequest`.
231
+ Sandboxed byte fetching (NAP-RESOURCE). Mirrors `window.napplet.resource`. Required because the iframe sandbox + strict CSP block direct `fetch()` / `<img src=externalUrl>` / `XMLHttpRequest`.
228
232
 
229
233
  | Method | Returns | Description |
230
234
  |--------|---------|-------------|
@@ -244,7 +248,7 @@ const handle = resourceBytesAsObjectURL('blossom:sha256:...');
244
248
 
245
249
  ### `connect` (v0.29.0)
246
250
 
247
- User-gated direct network access (NUB-CONNECT). State-only — no method namespace, no wire messages. The SDK re-exports the `NappletConnect` type, the `CONNECT_DOMAIN` constant, the `installConnectShim` installer, and the `connectGranted` / `connectOrigins` / `normalizeConnectOrigin` helper functions.
251
+ User-gated direct network access (NAP-CONNECT). State-only — no method namespace, no wire messages. The SDK re-exports the `NappletConnect` type, the `CONNECT_DOMAIN` constant, the `installConnectShim` installer, and the `connectGranted` / `connectOrigins` / `normalizeConnectOrigin` helper functions.
248
252
 
249
253
  ```ts
250
254
  import type { NappletConnect } from '@napplet/sdk';
@@ -262,37 +266,37 @@ const normalized = normalizeConnectOrigin('https://api.example.com'); // retur
262
266
 
263
267
  | Export | Kind | Source | Description |
264
268
  |--------|------|--------|-------------|
265
- | `NappletConnect` | type | `@napplet/nub/connect` | `{ readonly granted: boolean; readonly origins: readonly string[] }` |
266
- | `CONNECT_DOMAIN` | const | `@napplet/nub/connect` | The domain identifier string `'connect'` |
267
- | `installConnectShim` | function | `@napplet/nub/connect` | Side-effect installer — reads the discovery meta tag and mounts `window.napplet.connect` |
268
- | `connectGranted()` | function | `@napplet/nub/connect` | `() => boolean` — readonly helper; safer than direct `window.napplet.connect.granted` access |
269
- | `connectOrigins()` | function | `@napplet/nub/connect` | `() => readonly string[]` — readonly helper |
270
- | `normalizeConnectOrigin(origin)` | function | `@napplet/nub/connect` | Shared origin validator (used by vite-plugin AND shell implementations); throws on invalid input with `[@napplet/nub/connect]`-prefixed messages |
269
+ | `NappletConnect` | type | `@napplet/nap/connect` | `{ readonly granted: boolean; readonly origins: readonly string[] }` |
270
+ | `CONNECT_DOMAIN` | const | `@napplet/nap/connect` | The domain identifier string `'connect'` |
271
+ | `installConnectShim` | function | `@napplet/nap/connect` | Side-effect installer — reads the discovery meta tag and mounts `window.napplet.connect` |
272
+ | `connectGranted()` | function | `@napplet/nap/connect` | `() => boolean` — readonly helper; safer than direct `window.napplet.connect.granted` access |
273
+ | `connectOrigins()` | function | `@napplet/nap/connect` | `() => readonly string[]` — readonly helper |
274
+ | `normalizeConnectOrigin(origin)` | function | `@napplet/nap/connect` | Shared origin validator (used by vite-plugin AND shell implementations); throws on invalid input with `[@napplet/nap/connect]`-prefixed messages |
271
275
 
272
276
  ### `class` (v0.29.0)
273
277
 
274
- Shell-assigned integer class (NUB-CLASS). Wire-only — the shell sends exactly one `class.assigned` envelope per napplet lifecycle; the shim writes the integer to `window.napplet.class`. The SDK re-exports the wire type, the domain constant, the installer, and a `getClass()` helper.
278
+ Shell-assigned integer class (NAP-CLASS). Wire-only — the shell sends exactly one `class.assigned` envelope per napplet lifecycle; the shim writes the integer to `window.napplet.class`. The SDK re-exports the wire type, the domain constant, the installer, and a `getClass()` helper.
275
279
 
276
280
  ```ts
277
- import type { ClassAssignedMessage, NappletClass, ClassNubMessage } from '@napplet/sdk';
281
+ import type { ClassAssignedMessage, NappletClass, ClassNapMessage } from '@napplet/sdk';
278
282
  import { CLASS_DOMAIN, installClassShim, getClass } from '@napplet/sdk';
279
283
 
280
- if (window.napplet.shell.supports(`nub:${CLASS_DOMAIN}`)) {
284
+ if (window.napplet.shell.supports(`nap:${CLASS_DOMAIN}`)) {
281
285
  const cls = getClass(); // number | undefined
282
- // cls === 1 → NUB-CLASS-1 (strict baseline)
283
- // cls === 2 → NUB-CLASS-2 (user-approved explicit-origin)
284
- // cls === undefined → shell doesn't implement nub:class OR envelope hasn't arrived yet
286
+ // cls === 1 -> NAP-CLASS-1 (strict baseline)
287
+ // cls === 2 -> NAP-CLASS-2 (user-approved explicit-origin)
288
+ // cls === undefined -> shell doesn't implement nap:class OR envelope hasn't arrived yet
285
289
  }
286
290
  ```
287
291
 
288
292
  | Export | Kind | Source | Description |
289
293
  |--------|------|--------|-------------|
290
- | `ClassAssignedMessage` | type | `@napplet/nub/class` | `{ type: 'class.assigned'; id: string; class: number }` |
291
- | `NappletClass` | type | `@napplet/nub/class` | `{ readonly class: number \| undefined }` |
292
- | `ClassMessage` / `ClassNubMessage` | type | `@napplet/nub/class` | Discriminated union alias (class.assigned is the only member in v1) |
293
- | `CLASS_DOMAIN` | const | `@napplet/nub/class` | The domain identifier string `'class'` |
294
- | `installClassShim` | function | `@napplet/nub/class` | Side-effect installer — registers the `class.assigned` dispatcher handler and mounts `window.napplet.class` |
295
- | `getClass()` | function | `@napplet/nub/class` | `() => number \| undefined` — readonly helper |
294
+ | `ClassAssignedMessage` | type | `@napplet/nap/class` | `{ type: 'class.assigned'; id: string; class: number }` |
295
+ | `NappletClass` | type | `@napplet/nap/class` | `{ readonly class: number \| undefined }` |
296
+ | `ClassMessage` / `ClassNapMessage` | type | `@napplet/nap/class` | Discriminated union alias (class.assigned is the only member in v1) |
297
+ | `CLASS_DOMAIN` | const | `@napplet/nap/class` | The domain identifier string `'class'` |
298
+ | `installClassShim` | function | `@napplet/nap/class` | Side-effect installer — registers the `class.assigned` dispatcher handler and mounts `window.napplet.class` |
299
+ | `getClass()` | function | `@napplet/nap/class` | `() => number \| undefined` — readonly helper |
296
300
 
297
301
  ### `keys`
298
302
 
@@ -306,30 +310,29 @@ Keyboard forwarding and action keybindings. Mirrors `window.napplet.keys`.
306
310
 
307
311
  ### `identity`
308
312
 
309
- Read-only user queries and class-gated decrypt (NUB-IDENTITY). The identity namespace
313
+ Read-only user identity queries (NAP-IDENTITY). The identity namespace
310
314
  is NOT exported as a top-level SDK object — use `window.napplet.identity.*` directly
311
315
  after importing `@napplet/shim`, or use the bare-name helpers below.
312
316
 
313
317
  | Method | Returns | Description |
314
318
  |--------|---------|-------------|
315
- | `window.napplet.identity.getPublicKey()` | `Promise<string>` | Shell-owned user pubkey; never the napplet's own key |
316
- | `window.napplet.identity.decrypt(event)` | `Promise<{ rumor: Rumor; sender: string }>` | Class-gated decrypt (NIP-04 / NIP-44 / NIP-17 auto-detect); `sender` is shell-authenticated |
319
+ | `window.napplet.identity.getPublicKey()` | `Promise<string>` | Shell-user pubkey, or `""` when no user/signer is connected |
320
+ | `window.napplet.identity.onChanged(handler)` | `{ close(): void }` | Listen for shell-pushed identity changes; handler receives a pubkey or `""` |
317
321
 
318
322
  Bare helper aliases are also re-exported for consumers that prefer functional imports:
319
323
 
320
324
  ```ts
321
- import { identityGetPublicKey, identityDecrypt } from '@napplet/sdk';
322
- import type { Rumor } from '@napplet/sdk';
325
+ import { identityGetPublicKey, identityOnChanged } from '@napplet/sdk';
323
326
 
324
327
  const pubkey = await identityGetPublicKey();
325
- const { rumor, sender } = await identityDecrypt(giftWrapEvent);
328
+ const sub = identityOnChanged((nextPubkey) => {
329
+ console.log(nextPubkey || 'signed out');
330
+ });
326
331
  ```
327
332
 
328
- `identity.decrypt` is legal only for napplets assigned `class: 1` per NUB-CLASS-1
329
- (strict baseline posture with `connect-src 'none'`). Other classes receive a
330
- `class-forbidden` error. See the [@napplet/nub identity section](../nub/README.md#identity-nub-v0290)
331
- for the 8-code error vocabulary, auto-detect behavior, and the rationale for
332
- class-gating this API.
333
+ NAP-IDENTITY is strictly read-only. Signing remains delegated through
334
+ `relay.publish()`, encryption through `relay.publishEncrypted()`, and identity
335
+ changes arrive through `identity.changed` rather than polling.
333
336
 
334
337
  ### `shell`
335
338
 
@@ -339,19 +342,22 @@ Namespaced capability query. Access via `window.napplet.shell.supports()` after
339
342
 
340
343
  | Method | Returns | Description |
341
344
  |--------|---------|-------------|
342
- | `supports(capability)` | `boolean` | Check shell support for a NUB (`nub:relay`) or permission (`perm:popups`). Bare NUB names also accepted (`relay`). |
345
+ | `supports(capability, protocol?)` | `boolean` | Check shell support for a NAP (`nap:relay`), permission (`perm:popups`), or numbered NAP-NN protocol over an interface (`ifc`, `NAP-01`). Bare NAP names are also accepted (`relay`). |
343
346
 
344
347
  **Example:**
345
348
 
346
349
  ```ts
347
350
  import '@napplet/shim';
348
351
 
349
- // NUB domains (bare shorthand or nub: prefix)
352
+ // NAP domains (bare shorthand or nap: prefix)
350
353
  if (window.napplet.shell.supports('relay')) { /* ... */ }
351
- if (window.napplet.shell.supports('nub:identity')) { /* ... */ }
354
+ if (window.napplet.shell.supports('nap:identity')) { /* ... */ }
352
355
 
353
356
  // Permissions
354
357
  if (window.napplet.shell.supports('perm:popups')) { /* ... */ }
358
+
359
+ // Numbered NAP-NN message protocols
360
+ if (window.napplet.shell.supports('ifc', 'NAP-01')) { /* ... */ }
355
361
  ```
356
362
 
357
363
  ### Namespace Import
@@ -368,7 +374,7 @@ napplet.config.subscribe((v) => console.log(v));
368
374
 
369
375
  ## Types
370
376
 
371
- All protocol types are re-exported from `@napplet/core` and the NUB packages:
377
+ All protocol types are re-exported from `@napplet/core` and the NAP packages:
372
378
 
373
379
  ```ts
374
380
  import type {
@@ -378,15 +384,18 @@ import type {
378
384
  Subscription,
379
385
  EventTemplate,
380
386
  NappletMessage,
381
- NubDomain,
387
+ NapDomain,
388
+ NapDomain,
382
389
  NamespacedCapability,
390
+ NapProtocolId,
391
+ NapProtocolId,
383
392
  ShellSupports,
384
- // NUB message types (re-exported from NUB packages)
385
- RelayNubMessage,
386
- IdentityNubMessage,
387
- StorageNubMessage,
388
- IfcNubMessage,
389
- KeysNubMessage,
393
+ // NAP message types (re-exported from NAP packages)
394
+ RelayNapMessage,
395
+ IdentityNapMessage,
396
+ StorageNapMessage,
397
+ IfcNapMessage,
398
+ KeysNapMessage,
390
399
  Action,
391
400
  } from '@napplet/sdk';
392
401
  ```
@@ -400,73 +409,74 @@ import type {
400
409
  | `Subscription` | Handle with `close()` method |
401
410
  | `EventTemplate` | Unsigned event for `relay.publish()` |
402
411
  | `NappletMessage` | Base JSON envelope type for all protocol messages |
403
- | `NubDomain` | String literal union of NUB domain names |
404
- | `NamespacedCapability` | Union of `NubDomain \| nub:* \| perm:*` for `supports()` |
412
+ | `NapDomain` | String literal union of NAP domain names |
413
+ | `NamespacedCapability` | Union of `NapDomain \| nap:* \| perm:*` for `supports()` |
414
+ | `NapProtocolId` | Numbered NAP protocol id such as `NAP-01` for the optional second `supports()` argument |
405
415
  | `ShellSupports` | Interface for the shell capability query API |
406
416
 
407
- ### NUB Message Types
417
+ ### NAP Message Types
408
418
 
409
- These are discriminated union types covering all messages in each NUB domain. Useful for writing typed message
419
+ These are discriminated union types covering all messages in each NAP domain. Useful for writing typed message
410
420
  handlers in shell implementations or protocol-aware code.
411
421
 
412
- | Type | NUB Package | Description |
422
+ | Type | NAP Package | Description |
413
423
  |------|-------------|-------------|
414
- | `RelayNubMessage` | `@napplet/nub/relay` | Discriminated union of all relay domain messages |
415
- | `IdentityNubMessage` | `@napplet/nub/identity` | Discriminated union of all identity domain messages |
416
- | `StorageNubMessage` | `@napplet/nub/storage` | Discriminated union of all storage domain messages |
417
- | `IfcNubMessage` | `@napplet/nub/ifc` | Discriminated union of all IFC domain messages |
418
- | `KeysNubMessage` | `@napplet/nub/keys` | Discriminated union of all keys domain messages |
419
- | `MediaNubMessage` | `@napplet/nub/media` | Discriminated union of all media domain messages |
420
- | `NotifyNubMessage` | `@napplet/nub/notify` | Discriminated union of all notify domain messages |
421
- | `ConfigNubMessage` | `@napplet/nub/config` | Discriminated union of all config domain messages |
422
- | `ResourceNubMessage` | `@napplet/nub/resource` | Discriminated union of all resource domain messages |
423
- | `ConnectNubMessage` * | `@napplet/nub/connect` | State-only NUB — no wire messages. The `NappletConnect` runtime state type is the consumer-facing import. |
424
- | `ClassNubMessage` | `@napplet/nub/class` | Discriminated union of all class domain messages (v1: only `ClassAssignedMessage`) |
425
-
426
- \* There is no `ConnectNubMessage` type; NUB-CONNECT has no postMessage wire. The consumer-facing import is the `NappletConnect` runtime state interface.
424
+ | `RelayNapMessage` | `@napplet/nap/relay` | Discriminated union of all relay domain messages |
425
+ | `IdentityNapMessage` | `@napplet/nap/identity` | Discriminated union of all identity domain messages |
426
+ | `StorageNapMessage` | `@napplet/nap/storage` | Discriminated union of all storage domain messages |
427
+ | `IfcNapMessage` | `@napplet/nap/ifc` | Discriminated union of all IFC domain messages |
428
+ | `KeysNapMessage` | `@napplet/nap/keys` | Discriminated union of all keys domain messages |
429
+ | `MediaNapMessage` | `@napplet/nap/media` | Discriminated union of all media domain messages |
430
+ | `NotifyNapMessage` | `@napplet/nap/notify` | Discriminated union of all notify domain messages |
431
+ | `ConfigNapMessage` | `@napplet/nap/config` | Discriminated union of all config domain messages |
432
+ | `ResourceNapMessage` | `@napplet/nap/resource` | Discriminated union of all resource domain messages |
433
+ | `ConnectNapMessage` * | `@napplet/nap/connect` | State-only NAP — no wire messages. The `NappletConnect` runtime state type is the consumer-facing import. |
434
+ | `ClassNapMessage` | `@napplet/nap/class` | Discriminated union of all class domain messages (v1: only `ClassAssignedMessage`) |
435
+
436
+ \* There is no `ConnectNapMessage` type; NAP-CONNECT has no postMessage wire. The consumer-facing import is the `NappletConnect` runtime state interface.
427
437
 
428
438
  Individual message types (e.g., `RelaySubscribeMessage`, `IdentityGetPublicKeyMessage`) are also re-exported from
429
439
  `@napplet/sdk` for fine-grained typing.
430
440
 
431
- ## NUB Domain Constants
441
+ ## NAP Domain Constants
432
442
 
433
- Each NUB domain has a string constant re-exported from its package:
443
+ Each NAP domain has a string constant re-exported from its package:
434
444
 
435
445
  ```ts
436
446
  import { RELAY_DOMAIN, IDENTITY_DOMAIN, STORAGE_DOMAIN, IFC_DOMAIN, THEME_DOMAIN, KEYS_DOMAIN, MEDIA_DOMAIN, NOTIFY_DOMAIN, CONFIG_DOMAIN, RESOURCE_DOMAIN, CONNECT_DOMAIN, CLASS_DOMAIN } from '@napplet/sdk';
437
447
  // Values: 'relay', 'identity', 'storage', 'ifc', 'theme', 'keys', 'media', 'notify', 'config', 'resource', 'connect', 'class'
438
448
  ```
439
449
 
440
- These constants are re-exported from the individual NUB packages. Use them with the shell capability query
450
+ These constants are re-exported from the individual domain packages. Use them with the shell capability query
441
451
  API for type-safe conditional logic:
442
452
 
443
453
  ```ts
444
- if (window.napplet.shell.supports('nub:relay')) {
454
+ if (window.napplet.shell.supports('nap:relay')) {
445
455
  // relay operations are available
446
456
  }
447
457
 
448
- if (window.napplet.shell.supports('nub:identity')) {
458
+ if (window.napplet.shell.supports('nap:identity')) {
449
459
  // identity queries are available
450
460
  }
451
461
 
452
- if (window.napplet.shell.supports('nub:config')) {
453
- // NUB-CONFIG is available -- schema registration and subscribe()
462
+ if (window.napplet.shell.supports('nap:config')) {
463
+ // NAP-CONFIG is available -- schema registration and subscribe()
454
464
  }
455
465
 
456
- if (window.napplet.shell.supports('nub:resource')) {
466
+ if (window.napplet.shell.supports('nap:resource')) {
457
467
  // resource.bytes(url) is available; check per-scheme too:
458
468
  if (window.napplet.shell.supports('resource:scheme:blossom')) { /* ... */ }
459
469
  }
460
470
 
461
- if (window.napplet.shell.supports('nub:connect')) {
462
- // NUB-CONNECT is available — window.napplet.connect reflects shell grant state
471
+ if (window.napplet.shell.supports('nap:connect')) {
472
+ // NAP-CONNECT is available -- window.napplet.connect reflects shell grant state
463
473
  // Check per-scheme operator policy:
464
474
  if (window.napplet.shell.supports('connect:scheme:http')) { /* cleartext http: origins permitted */ }
465
475
  if (window.napplet.shell.supports('connect:scheme:ws')) { /* cleartext ws: origins permitted */ }
466
476
  }
467
477
 
468
- if (window.napplet.shell.supports('nub:class')) {
469
- // NUB-CLASS is available — window.napplet.class will be populated by class.assigned
478
+ if (window.napplet.shell.supports('nap:class')) {
479
+ // NAP-CLASS is available -- window.napplet.class will be populated by class.assigned
470
480
  }
471
481
  ```
472
482
 
package/dist/index.d.ts CHANGED
@@ -1,17 +1,18 @@
1
- import { Subscription, NostrEvent, Rumor, NostrFilter, EventTemplate } from '@napplet/core';
2
- export { EventTemplate, NUB_DOMAINS, NamespacedCapability, NappletMessage, NostrEvent, NostrFilter, NubDomain, Rumor, ShellSupports, Subscription, UnsignedEvent } from '@napplet/core';
3
- export { DOMAIN as RELAY_DOMAIN, RelayCloseMessage, RelayClosedMessage, RelayEoseMessage, RelayEventMessage, RelayInboundMessage, RelayMessage, RelayNubMessage, RelayOutboundMessage, RelayPublishEncryptedMessage, RelayPublishEncryptedResultMessage, RelayPublishMessage, RelayPublishResultMessage, RelayQueryMessage, RelayQueryResultMessage, RelaySubscribeMessage, installRelayShim, relayPublish, relayPublishEncrypted, relayQuery, relaySubscribe } from '@napplet/nub/relay';
4
- export { Badge, DOMAIN as IDENTITY_DOMAIN, IdentityDecryptErrorCode, IdentityDecryptErrorMessage, IdentityDecryptMessage, IdentityDecryptResultMessage, IdentityGetBadgesMessage, IdentityGetBadgesResultMessage, IdentityGetBlockedMessage, IdentityGetBlockedResultMessage, IdentityGetFollowsMessage, IdentityGetFollowsResultMessage, IdentityGetListMessage, IdentityGetListResultMessage, IdentityGetMutesMessage, IdentityGetMutesResultMessage, IdentityGetProfileMessage, IdentityGetProfileResultMessage, IdentityGetPublicKeyMessage, IdentityGetPublicKeyResultMessage, IdentityGetRelaysMessage, IdentityGetRelaysResultMessage, IdentityGetZapsMessage, IdentityGetZapsResultMessage, IdentityMessage, IdentityNubMessage, RelayPermission as IdentityRelayPermission, IdentityRequestMessage, IdentityResultMessage, ProfileData, ZapReceipt, identityDecrypt, identityGetBadges, identityGetBlocked, identityGetFollows, identityGetList, identityGetMutes, identityGetProfile, identityGetPublicKey, identityGetRelays, identityGetZaps, installIdentityShim } from '@napplet/nub/identity';
5
- export { DOMAIN as STORAGE_DOMAIN, StorageGetMessage, StorageGetResultMessage, StorageKeysMessage, StorageKeysResultMessage, StorageMessage, StorageNubMessage, StorageRemoveMessage, StorageRemoveResultMessage, StorageRequestMessage, StorageResultMessage, StorageSetMessage, StorageSetResultMessage, installStorageShim, storageGetItem, storageKeys, storageRemoveItem, storageSetItem } from '@napplet/nub/storage';
6
- export { DOMAIN as IFC_DOMAIN, IfcChannelBroadcastMessage, IfcChannelCloseMessage, IfcChannelClosedMessage, IfcChannelEmitMessage, IfcChannelEventMessage, IfcChannelListMessage, IfcChannelListResultMessage, IfcChannelMessage, IfcChannelOpenMessage, IfcChannelOpenResultMessage, IfcEmitMessage, IfcEventMessage, IfcInboundMessage, IfcMessage, IfcNubMessage, IfcOutboundMessage, IfcSubscribeMessage, IfcSubscribeResultMessage, IfcTopicMessage, IfcUnsubscribeMessage, ifcEmit, ifcOn, installIfcShim } from '@napplet/nub/ifc';
7
- export { DOMAIN as THEME_DOMAIN, Theme, ThemeBackground, ThemeChangedMessage, ThemeColors, ThemeFont, ThemeGetMessage, ThemeGetResultMessage, ThemeMessage, ThemeNubMessage, ThemeRequestMessage, ThemeResultMessage } from '@napplet/nub/theme';
8
- export { Action, DOMAIN as KEYS_DOMAIN, KeyBinding, KeysActionMessage, KeysBindingsMessage, KeysForwardMessage, KeysMessage, KeysNubMessage, KeysRegisterActionMessage, KeysRegisterActionResultMessage, KeysRequestMessage, KeysResultMessage, KeysUnregisterActionMessage, RegisterResult, installKeysShim, keysOnAction, keysRegister, keysRegisterAction, keysUnregisterAction } from '@napplet/nub/keys';
9
- export { DOMAIN as MEDIA_DOMAIN, MediaAction, MediaArtwork, MediaCapabilitiesMessage, MediaCommandMessage, MediaControlsMessage, MediaMessage, MediaMetadata, MediaNubMessage, MediaRequestMessage, MediaResultMessage, MediaSessionCreateMessage, MediaSessionCreateResultMessage, MediaSessionDestroyMessage, MediaSessionUpdateMessage, MediaState, MediaStateMessage, installMediaShim, mediaCreateSession, mediaDestroySession, mediaOnCommand, mediaOnControls, mediaReportCapabilities, mediaReportState, mediaUpdateSession } from '@napplet/nub/media';
10
- export { DOMAIN as NOTIFY_DOMAIN, NotificationAction, NotificationChannel, NotificationPriority, NotifyActionMessage, NotifyBadgeMessage, NotifyChannelRegisterMessage, NotifyClickedMessage, NotifyControl, NotifyControlsMessage, NotifyDismissMessage, NotifyDismissedMessage, NotifyMessage, NotifyNubMessage, NotifyPermissionRequestMessage, NotifyPermissionResultMessage, NotifyRequestMessage, NotifyResultMessage, NotifySendMessage, NotifySendResultMessage, installNotifyShim, notifyBadge, notifyDismiss, notifyOnAction, notifyOnClicked, notifyOnControls, notifyOnDismissed, notifyRegisterChannel, notifyRequestPermission, notifySend } from '@napplet/nub/notify';
11
- export { DOMAIN as CONFIG_DOMAIN, ConfigGetMessage, ConfigMessage, ConfigNubMessage, ConfigOpenSettingsMessage, ConfigRegisterSchemaMessage, ConfigRegisterSchemaResultMessage, ConfigRequestMessage, ConfigResultMessage, ConfigSchema, ConfigSchemaErrorCode, ConfigSchemaErrorMessage, ConfigSubscribeMessage, ConfigUnsubscribeMessage, ConfigValues, ConfigValuesMessage, NappletConfigSchema, NappletConfigSchemaExtensions, installConfigShim } from '@napplet/nub/config';
12
- export { DOMAIN as RESOURCE_DOMAIN, ResourceBytesErrorMessage, ResourceBytesMessage, ResourceBytesResultMessage, ResourceCancelMessage, ResourceErrorCode, ResourceMessage, ResourceNubMessage, ResourceRequestMessage, ResourceResultMessage, ResourceScheme, ResourceSidecarEntry, installResourceShim, resourceBytes, resourceBytesAsObjectURL } from '@napplet/nub/resource';
13
- export { DOMAIN as CONNECT_DOMAIN, NappletConnect, connectGranted, connectOrigins, installConnectShim, normalizeConnectOrigin } from '@napplet/nub/connect';
14
- export { DOMAIN as CLASS_DOMAIN, ClassAssignedMessage, ClassMessage, ClassNubMessage, NappletClass, getClass, installClassShim } from '@napplet/nub/class';
1
+ import { Subscription, NostrEvent, NostrFilter, EventTemplate } from '@napplet/core';
2
+ export { EventTemplate, NAP_DOMAINS, NamespacedCapability, NapDomain, NapProtocolId, NappletMessage, NostrEvent, NostrFilter, ProtocolId, ShellSupports, Subscription } from '@napplet/core';
3
+ import { MediaSessionCreate, MediaSessionResult, MediaMetadata, MediaState, MediaAction } from '@napplet/nap/media';
4
+ export { DOMAIN as MEDIA_DOMAIN, MediaAction, MediaArtwork, MediaCapabilitiesMessage, MediaCommandMessage, MediaControlsMessage, MediaMessage, MediaMetadata, MediaNapMessage, MediaPlaybackOwner, MediaRequestMessage, MediaResultMessage, MediaSessionCreate, MediaSessionCreateMessage, MediaSessionCreateResultMessage, MediaSessionDestroyMessage, MediaSessionResult, MediaSessionUpdateMessage, MediaSourceRef, MediaState, MediaStateMessage, installMediaShim, mediaCreateSession, mediaDestroySession, mediaOnCapabilities, mediaOnCommand, mediaOnControls, mediaOnState, mediaReportCapabilities, mediaReportState, mediaSendCommand, mediaUpdateSession } from '@napplet/nap/media';
5
+ export { DOMAIN as RELAY_DOMAIN, RelayCloseMessage, RelayClosedMessage, RelayEoseMessage, RelayEventMessage, RelayInboundMessage, RelayMessage, RelayNapMessage, RelayOutboundMessage, RelayPublishEncryptedMessage, RelayPublishEncryptedResultMessage, RelayPublishMessage, RelayPublishResultMessage, RelayQueryMessage, RelayQueryResultMessage, RelaySubscribeMessage, installRelayShim, relayPublish, relayPublishEncrypted, relayQuery, relaySubscribe } from '@napplet/nap/relay';
6
+ export { Badge, DOMAIN as IDENTITY_DOMAIN, IdentityChangedMessage, IdentityGetBadgesMessage, IdentityGetBadgesResultMessage, IdentityGetBlockedMessage, IdentityGetBlockedResultMessage, IdentityGetFollowsMessage, IdentityGetFollowsResultMessage, IdentityGetListMessage, IdentityGetListResultMessage, IdentityGetMutesMessage, IdentityGetMutesResultMessage, IdentityGetProfileMessage, IdentityGetProfileResultMessage, IdentityGetPublicKeyMessage, IdentityGetPublicKeyResultMessage, IdentityGetRelaysMessage, IdentityGetRelaysResultMessage, IdentityGetZapsMessage, IdentityGetZapsResultMessage, IdentityMessage, IdentityNapMessage, RelayPermission as IdentityRelayPermission, IdentityRequestMessage, IdentityResultMessage, ProfileData, ZapReceipt, identityGetBadges, identityGetBlocked, identityGetFollows, identityGetList, identityGetMutes, identityGetProfile, identityGetPublicKey, identityGetRelays, identityGetZaps, identityOnChanged, installIdentityShim } from '@napplet/nap/identity';
7
+ export { DOMAIN as STORAGE_DOMAIN, StorageGetMessage, StorageGetResultMessage, StorageKeysMessage, StorageKeysResultMessage, StorageMessage, StorageNapMessage, StorageRemoveMessage, StorageRemoveResultMessage, StorageRequestMessage, StorageResultMessage, StorageSetMessage, StorageSetResultMessage, installStorageShim, storageGetItem, storageKeys, storageRemoveItem, storageSetItem } from '@napplet/nap/storage';
8
+ export { DOMAIN as IFC_DOMAIN, IfcChannelBroadcastMessage, IfcChannelCloseMessage, IfcChannelClosedMessage, IfcChannelEmitMessage, IfcChannelEventMessage, IfcChannelListMessage, IfcChannelListResultMessage, IfcChannelMessage, IfcChannelOpenMessage, IfcChannelOpenResultMessage, IfcEmitMessage, IfcEventMessage, IfcInboundMessage, IfcMessage, IfcNapMessage, IfcOutboundMessage, IfcSubscribeMessage, IfcSubscribeResultMessage, IfcTopicMessage, IfcUnsubscribeMessage, ifcEmit, ifcOn, installIfcShim } from '@napplet/nap/ifc';
9
+ export { DOMAIN as THEME_DOMAIN, Theme, ThemeBackground, ThemeChangedMessage, ThemeColors, ThemeFont, ThemeGetMessage, ThemeGetResultMessage, ThemeMessage, ThemeNapMessage, ThemeRequestMessage, ThemeResultMessage } from '@napplet/nap/theme';
10
+ export { Action, DOMAIN as KEYS_DOMAIN, KeyBinding, KeysActionMessage, KeysBindingsMessage, KeysForwardMessage, KeysMessage, KeysNapMessage, KeysRegisterActionMessage, KeysRegisterActionResultMessage, KeysRequestMessage, KeysResultMessage, KeysUnregisterActionMessage, RegisterResult, installKeysShim, keysOnAction, keysRegister, keysRegisterAction, keysUnregisterAction } from '@napplet/nap/keys';
11
+ export { DOMAIN as NOTIFY_DOMAIN, NotificationAction, NotificationChannel, NotificationPriority, NotifyActionMessage, NotifyBadgeMessage, NotifyChannelRegisterMessage, NotifyClickedMessage, NotifyControl, NotifyControlsMessage, NotifyDismissMessage, NotifyDismissedMessage, NotifyMessage, NotifyNapMessage, NotifyPermissionRequestMessage, NotifyPermissionResultMessage, NotifyRequestMessage, NotifyResultMessage, NotifySendMessage, NotifySendResultMessage, installNotifyShim, notifyBadge, notifyDismiss, notifyOnAction, notifyOnClicked, notifyOnControls, notifyOnDismissed, notifyRegisterChannel, notifyRequestPermission, notifySend } from '@napplet/nap/notify';
12
+ export { DOMAIN as CONFIG_DOMAIN, ConfigGetMessage, ConfigMessage, ConfigNapMessage, ConfigOpenSettingsMessage, ConfigRegisterSchemaMessage, ConfigRegisterSchemaResultMessage, ConfigRequestMessage, ConfigResultMessage, ConfigSchema, ConfigSchemaErrorCode, ConfigSchemaErrorMessage, ConfigSubscribeMessage, ConfigUnsubscribeMessage, ConfigValues, ConfigValuesMessage, NappletConfigSchema, NappletConfigSchemaExtensions, installConfigShim } from '@napplet/nap/config';
13
+ export { DOMAIN as RESOURCE_DOMAIN, ResourceBytesErrorMessage, ResourceBytesMessage, ResourceBytesResultMessage, ResourceCancelMessage, ResourceErrorCode, ResourceMessage, ResourceNapMessage, ResourceRequestMessage, ResourceResultMessage, ResourceScheme, ResourceSidecarEntry, installResourceShim, resourceBytes, resourceBytesAsObjectURL } from '@napplet/nap/resource';
14
+ export { DOMAIN as CONNECT_DOMAIN, NappletConnect, connectGranted, connectOrigins, installConnectShim, normalizeConnectOrigin } from '@napplet/nap/connect';
15
+ export { DOMAIN as CLASS_DOMAIN, ClassAssignedMessage, ClassMessage, ClassNapMessage, NappletClass, getClass, installClassShim } from '@napplet/nap/class';
15
16
 
16
17
  /**
17
18
  * @napplet/sdk -- Typed named exports wrapping window.napplet.
@@ -27,10 +28,10 @@ export { DOMAIN as CLASS_DOMAIN, ClassAssignedMessage, ClassMessage, ClassNubMes
27
28
  * The shim must still be imported somewhere in the application to install
28
29
  * the `window.napplet` global. The SDK only wraps it -- it does not install it.
29
30
  *
30
- * Domain-specific SDK helpers are also available directly from NUB packages:
31
+ * Domain-specific SDK helpers are also available directly from NAP packages:
31
32
  * ```ts
32
- * import { relaySubscribe } from '@napplet/nub/relay';
33
- * import { storageGetItem } from '@napplet/nub/storage';
33
+ * import { relaySubscribe } from '@napplet/nap/relay';
34
+ * import { storageGetItem } from '@napplet/nap/storage';
34
35
  * ```
35
36
  *
36
37
  * @packageDocumentation
@@ -165,7 +166,8 @@ declare const storage: {
165
166
  * import { media } from '@napplet/sdk';
166
167
  *
167
168
  * const { sessionId } = await media.createSession({
168
- * title: 'My Song', artist: 'The Artist',
169
+ * owner: 'napplet',
170
+ * metadata: { title: 'My Song', artist: 'The Artist' },
169
171
  * });
170
172
  *
171
173
  * media.reportState(sessionId, { status: 'playing', position: 42.5 });
@@ -174,38 +176,16 @@ declare const storage: {
174
176
  declare const media: {
175
177
  /**
176
178
  * Create a new media session with the shell.
177
- * @param metadata Optional initial metadata
178
- * @returns The confirmed session result with sessionId
179
- */
180
- createSession(metadata?: {
181
- title?: string;
182
- artist?: string;
183
- album?: string;
184
- artwork?: {
185
- url?: string;
186
- hash?: string;
187
- };
188
- duration?: number;
189
- mediaType?: "audio" | "video";
190
- }): Promise<{
191
- sessionId: string;
192
- }>;
179
+ * @param options Ownership-aware session options
180
+ * @returns The shell result with canonical sessionId and owner, or error
181
+ */
182
+ createSession(options: MediaSessionCreate): Promise<MediaSessionResult>;
193
183
  /**
194
184
  * Update metadata for an existing session.
195
185
  * @param sessionId The session to update
196
186
  * @param metadata Partial metadata fields to update
197
187
  */
198
- updateSession(sessionId: string, metadata: {
199
- title?: string;
200
- artist?: string;
201
- album?: string;
202
- artwork?: {
203
- url?: string;
204
- hash?: string;
205
- };
206
- duration?: number;
207
- mediaType?: "audio" | "video";
208
- }): void;
188
+ updateSession(sessionId: string, metadata: Partial<MediaMetadata>): void;
209
189
  /**
210
190
  * Destroy a media session.
211
191
  * @param sessionId The session to destroy
@@ -216,32 +196,48 @@ declare const media: {
216
196
  * @param sessionId The session to report state for
217
197
  * @param state Current playback state
218
198
  */
219
- reportState(sessionId: string, state: {
220
- status: "playing" | "paused" | "stopped" | "buffering";
221
- position?: number;
222
- duration?: number;
223
- volume?: number;
224
- }): void;
199
+ reportState(sessionId: string, state: MediaState): void;
225
200
  /**
226
201
  * Declare which media actions the session currently supports.
227
202
  * @param sessionId The session to update capabilities for
228
203
  * @param actions Currently supported actions
229
204
  */
230
- reportCapabilities(sessionId: string, actions: ("play" | "pause" | "stop" | "next" | "prev" | "seek" | "volume")[]): void;
205
+ reportCapabilities(sessionId: string, actions: MediaAction[]): void;
206
+ /**
207
+ * Send a command to the current playback owner.
208
+ * @param sessionId The session to control
209
+ * @param action The media action to request
210
+ * @param value Optional value for seek/volume
211
+ */
212
+ sendCommand(sessionId: string, action: MediaAction, value?: number): void;
231
213
  /**
232
214
  * Listen for media commands from the shell.
233
215
  * @param sessionId The session to listen for commands on
234
216
  * @param callback Called with (action, value?) when a command is received
235
217
  * @returns A Subscription with `close()` to stop listening
236
218
  */
237
- onCommand(sessionId: string, callback: (action: "play" | "pause" | "stop" | "next" | "prev" | "seek" | "volume", value?: number) => void): Subscription;
219
+ onCommand(sessionId: string, callback: (action: MediaAction, value?: number) => void): Subscription;
220
+ /**
221
+ * Listen for shell-reported playback state for shell-owned sessions.
222
+ * @param sessionId The session to listen for state on
223
+ * @param callback Called with playback state
224
+ * @returns A Subscription with `close()` to stop listening
225
+ */
226
+ onState(sessionId: string, callback: (state: MediaState) => void): Subscription;
227
+ /**
228
+ * Listen for shell-reported capabilities for shell-owned sessions.
229
+ * @param sessionId The session to listen for capabilities on
230
+ * @param callback Called with available actions
231
+ * @returns A Subscription with `close()` to stop listening
232
+ */
233
+ onCapabilities(sessionId: string, callback: (actions: MediaAction[]) => void): Subscription;
238
234
  /**
239
235
  * Listen for the shell's media control list.
240
236
  * @param sessionId The session to associate controls with
241
237
  * @param callback Called with the shell's supported controls
242
238
  * @returns A Subscription with `close()` to stop listening
243
239
  */
244
- onControls(sessionId: string, callback: (controls: ("play" | "pause" | "stop" | "next" | "prev" | "seek" | "volume")[]) => void): Subscription;
240
+ onControls(sessionId: string, callback: (controls: MediaAction[]) => void): Subscription;
245
241
  };
246
242
  /**
247
243
  * Shell-rendered notifications: send notifications, set badge counts,
@@ -426,6 +422,12 @@ declare const identity: {
426
422
  * @returns Hex-encoded public key string
427
423
  */
428
424
  getPublicKey(): Promise<string>;
425
+ /**
426
+ * Listen for shell-pushed user identity changes.
427
+ * @param handler Called with a hex pubkey, or "" when no user/signer is connected
428
+ * @returns Subscription with close() to detach the handler
429
+ */
430
+ onChanged(handler: (pubkey: string) => void): Subscription;
429
431
  /**
430
432
  * Get the user's relay list (NIP-65).
431
433
  * @returns Record mapping relay URLs to read/write permissions
@@ -491,22 +493,9 @@ declare const identity: {
491
493
  thumbs?: string[];
492
494
  awardedBy: string;
493
495
  }[]>;
494
- /**
495
- * Decrypt a received Nostr event (NIP-04 / direct NIP-44 / NIP-17 gift-wrap).
496
- *
497
- * Shape is auto-detected by the shell; napplets do NOT select encryption mode.
498
- * Only legal for napplets assigned class: 1 per NUB-CLASS-1 (shell-enforced).
499
- *
500
- * @param event The received event (outer wrap for NIP-17, kind-4 for NIP-04, etc.)
501
- * @returns Promise resolving to { rumor, sender }; rejects with Error on failure.
502
- */
503
- decrypt(event: NostrEvent): Promise<{
504
- rumor: Rumor;
505
- sender: string;
506
- }>;
507
496
  };
508
497
  /**
509
- * Per-napplet declarative configuration (NUB-CONFIG): register a schema,
498
+ * Per-napplet declarative configuration (NAP-CONFIG): register a schema,
510
499
  * read current values, subscribe to live updates, deep-link into the
511
500
  * shell-owned settings UI, and listen for schema errors.
512
501
  *
package/dist/index.js CHANGED
@@ -1,38 +1,49 @@
1
1
  // src/index.ts
2
- import { NUB_DOMAINS } from "@napplet/core";
3
- import { DOMAIN } from "@napplet/nub/relay";
4
- import { DOMAIN as DOMAIN2 } from "@napplet/nub/identity";
5
- import { DOMAIN as DOMAIN3 } from "@napplet/nub/storage";
6
- import { DOMAIN as DOMAIN4 } from "@napplet/nub/ifc";
7
- import { DOMAIN as DOMAIN5 } from "@napplet/nub/theme";
8
- import { DOMAIN as DOMAIN6 } from "@napplet/nub/keys";
9
- import { DOMAIN as DOMAIN7 } from "@napplet/nub/media";
10
- import { DOMAIN as DOMAIN8 } from "@napplet/nub/notify";
11
- import { DOMAIN as DOMAIN9 } from "@napplet/nub/config";
12
- import { DOMAIN as DOMAIN10 } from "@napplet/nub/resource";
13
- import { DOMAIN as DOMAIN11 } from "@napplet/nub/connect";
14
- import { DOMAIN as DOMAIN12 } from "@napplet/nub/class";
15
- import { installRelayShim } from "@napplet/nub/relay";
16
- import { installIdentityShim } from "@napplet/nub/identity";
17
- import { installStorageShim } from "@napplet/nub/storage";
18
- import { installIfcShim } from "@napplet/nub/ifc";
19
- import { installKeysShim } from "@napplet/nub/keys";
20
- import { installMediaShim } from "@napplet/nub/media";
21
- import { installNotifyShim } from "@napplet/nub/notify";
22
- import { installConfigShim } from "@napplet/nub/config";
23
- import { installResourceShim } from "@napplet/nub/resource";
24
- import { installConnectShim } from "@napplet/nub/connect";
25
- import { installClassShim } from "@napplet/nub/class";
26
- import { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from "@napplet/nub/relay";
27
- import { identityGetPublicKey, identityGetRelays, identityGetProfile, identityGetFollows, identityGetList, identityGetZaps, identityGetMutes, identityGetBlocked, identityGetBadges, identityDecrypt } from "@napplet/nub/identity";
28
- import { storageGetItem, storageSetItem, storageRemoveItem, storageKeys } from "@napplet/nub/storage";
29
- import { ifcEmit, ifcOn } from "@napplet/nub/ifc";
30
- import { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from "@napplet/nub/keys";
31
- import { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaOnCommand, mediaOnControls } from "@napplet/nub/media";
32
- import { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from "@napplet/nub/notify";
33
- import { resourceBytes, resourceBytesAsObjectURL } from "@napplet/nub/resource";
34
- import { connectGranted, connectOrigins, normalizeConnectOrigin } from "@napplet/nub/connect";
35
- import { getClass } from "@napplet/nub/class";
2
+ import { NAP_DOMAINS } from "@napplet/core";
3
+ import { DOMAIN } from "@napplet/nap/relay";
4
+ import { DOMAIN as DOMAIN2 } from "@napplet/nap/identity";
5
+ import { DOMAIN as DOMAIN3 } from "@napplet/nap/storage";
6
+ import { DOMAIN as DOMAIN4 } from "@napplet/nap/ifc";
7
+ import { DOMAIN as DOMAIN5 } from "@napplet/nap/theme";
8
+ import { DOMAIN as DOMAIN6 } from "@napplet/nap/keys";
9
+ import { DOMAIN as DOMAIN7 } from "@napplet/nap/media";
10
+ import { DOMAIN as DOMAIN8 } from "@napplet/nap/notify";
11
+ import { DOMAIN as DOMAIN9 } from "@napplet/nap/config";
12
+ import { DOMAIN as DOMAIN10 } from "@napplet/nap/resource";
13
+ import { DOMAIN as DOMAIN11 } from "@napplet/nap/connect";
14
+ import { DOMAIN as DOMAIN12 } from "@napplet/nap/class";
15
+ import { installRelayShim } from "@napplet/nap/relay";
16
+ import { installIdentityShim } from "@napplet/nap/identity";
17
+ import { installStorageShim } from "@napplet/nap/storage";
18
+ import { installIfcShim } from "@napplet/nap/ifc";
19
+ import { installKeysShim } from "@napplet/nap/keys";
20
+ import { installMediaShim } from "@napplet/nap/media";
21
+ import { installNotifyShim } from "@napplet/nap/notify";
22
+ import { installConfigShim } from "@napplet/nap/config";
23
+ import { installResourceShim } from "@napplet/nap/resource";
24
+ import { installConnectShim } from "@napplet/nap/connect";
25
+ import { installClassShim } from "@napplet/nap/class";
26
+ import { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from "@napplet/nap/relay";
27
+ import {
28
+ identityGetPublicKey,
29
+ identityOnChanged,
30
+ identityGetRelays,
31
+ identityGetProfile,
32
+ identityGetFollows,
33
+ identityGetList,
34
+ identityGetZaps,
35
+ identityGetMutes,
36
+ identityGetBlocked,
37
+ identityGetBadges
38
+ } from "@napplet/nap/identity";
39
+ import { storageGetItem, storageSetItem, storageRemoveItem, storageKeys } from "@napplet/nap/storage";
40
+ import { ifcEmit, ifcOn } from "@napplet/nap/ifc";
41
+ import { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from "@napplet/nap/keys";
42
+ import { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaSendCommand, mediaOnCommand, mediaOnState, mediaOnCapabilities, mediaOnControls } from "@napplet/nap/media";
43
+ import { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from "@napplet/nap/notify";
44
+ import { resourceBytes, resourceBytesAsObjectURL } from "@napplet/nap/resource";
45
+ import { connectGranted, connectOrigins, normalizeConnectOrigin } from "@napplet/nap/connect";
46
+ import { getClass } from "@napplet/nap/class";
36
47
  function requireNapplet() {
37
48
  const w = window;
38
49
  if (!w.napplet) {
@@ -135,11 +146,11 @@ var storage = {
135
146
  var media = {
136
147
  /**
137
148
  * Create a new media session with the shell.
138
- * @param metadata Optional initial metadata
139
- * @returns The confirmed session result with sessionId
149
+ * @param options Ownership-aware session options
150
+ * @returns The shell result with canonical sessionId and owner, or error
140
151
  */
141
- createSession(metadata) {
142
- return requireNapplet().media.createSession(metadata);
152
+ createSession(options) {
153
+ return requireNapplet().media.createSession(options);
143
154
  },
144
155
  /**
145
156
  * Update metadata for an existing session.
@@ -172,6 +183,15 @@ var media = {
172
183
  reportCapabilities(sessionId, actions) {
173
184
  requireNapplet().media.reportCapabilities(sessionId, actions);
174
185
  },
186
+ /**
187
+ * Send a command to the current playback owner.
188
+ * @param sessionId The session to control
189
+ * @param action The media action to request
190
+ * @param value Optional value for seek/volume
191
+ */
192
+ sendCommand(sessionId, action, value) {
193
+ requireNapplet().media.sendCommand(sessionId, action, value);
194
+ },
175
195
  /**
176
196
  * Listen for media commands from the shell.
177
197
  * @param sessionId The session to listen for commands on
@@ -181,6 +201,24 @@ var media = {
181
201
  onCommand(sessionId, callback) {
182
202
  return requireNapplet().media.onCommand(sessionId, callback);
183
203
  },
204
+ /**
205
+ * Listen for shell-reported playback state for shell-owned sessions.
206
+ * @param sessionId The session to listen for state on
207
+ * @param callback Called with playback state
208
+ * @returns A Subscription with `close()` to stop listening
209
+ */
210
+ onState(sessionId, callback) {
211
+ return requireNapplet().media.onState(sessionId, callback);
212
+ },
213
+ /**
214
+ * Listen for shell-reported capabilities for shell-owned sessions.
215
+ * @param sessionId The session to listen for capabilities on
216
+ * @param callback Called with available actions
217
+ * @returns A Subscription with `close()` to stop listening
218
+ */
219
+ onCapabilities(sessionId, callback) {
220
+ return requireNapplet().media.onCapabilities(sessionId, callback);
221
+ },
184
222
  /**
185
223
  * Listen for the shell's media control list.
186
224
  * @param sessionId The session to associate controls with
@@ -330,6 +368,14 @@ var identity = {
330
368
  getPublicKey() {
331
369
  return requireNapplet().identity.getPublicKey();
332
370
  },
371
+ /**
372
+ * Listen for shell-pushed user identity changes.
373
+ * @param handler Called with a hex pubkey, or "" when no user/signer is connected
374
+ * @returns Subscription with close() to detach the handler
375
+ */
376
+ onChanged(handler) {
377
+ return requireNapplet().identity.onChanged(handler);
378
+ },
333
379
  /**
334
380
  * Get the user's relay list (NIP-65).
335
381
  * @returns Record mapping relay URLs to read/write permissions
@@ -386,18 +432,6 @@ var identity = {
386
432
  */
387
433
  getBadges() {
388
434
  return requireNapplet().identity.getBadges();
389
- },
390
- /**
391
- * Decrypt a received Nostr event (NIP-04 / direct NIP-44 / NIP-17 gift-wrap).
392
- *
393
- * Shape is auto-detected by the shell; napplets do NOT select encryption mode.
394
- * Only legal for napplets assigned class: 1 per NUB-CLASS-1 (shell-enforced).
395
- *
396
- * @param event The received event (outer wrap for NIP-17, kind-4 for NIP-04, etc.)
397
- * @returns Promise resolving to { rumor, sender }; rejects with Error on failure.
398
- */
399
- decrypt(event) {
400
- return requireNapplet().identity.decrypt(event);
401
435
  }
402
436
  };
403
437
  var config = {
@@ -479,8 +513,8 @@ export {
479
513
  DOMAIN4 as IFC_DOMAIN,
480
514
  DOMAIN6 as KEYS_DOMAIN,
481
515
  DOMAIN7 as MEDIA_DOMAIN,
516
+ NAP_DOMAINS,
482
517
  DOMAIN8 as NOTIFY_DOMAIN,
483
- NUB_DOMAINS,
484
518
  DOMAIN as RELAY_DOMAIN,
485
519
  DOMAIN10 as RESOURCE_DOMAIN,
486
520
  DOMAIN3 as STORAGE_DOMAIN,
@@ -490,7 +524,6 @@ export {
490
524
  connectOrigins,
491
525
  getClass,
492
526
  identity,
493
- identityDecrypt,
494
527
  identityGetBadges,
495
528
  identityGetBlocked,
496
529
  identityGetFollows,
@@ -500,6 +533,7 @@ export {
500
533
  identityGetPublicKey,
501
534
  identityGetRelays,
502
535
  identityGetZaps,
536
+ identityOnChanged,
503
537
  ifc,
504
538
  ifcEmit,
505
539
  ifcOn,
@@ -522,10 +556,13 @@ export {
522
556
  media,
523
557
  mediaCreateSession,
524
558
  mediaDestroySession,
559
+ mediaOnCapabilities,
525
560
  mediaOnCommand,
526
561
  mediaOnControls,
562
+ mediaOnState,
527
563
  mediaReportCapabilities,
528
564
  mediaReportState,
565
+ mediaSendCommand,
529
566
  mediaUpdateSession,
530
567
  normalizeConnectOrigin,
531
568
  notify,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @napplet/sdk -- Typed named exports wrapping window.napplet.\n *\n * Provides `relay`, `ifc`, `storage`, and `keys` objects that delegate\n * to `window.napplet.*` at call time. Developers using a bundler can import\n * individual namespaces without depending on the shim's side-effect install:\n *\n * ```ts\n * import { relay, ifc } from '@napplet/sdk';\n * ```\n *\n * The shim must still be imported somewhere in the application to install\n * the `window.napplet` global. The SDK only wraps it -- it does not install it.\n *\n * Domain-specific SDK helpers are also available directly from NUB packages:\n * ```ts\n * import { relaySubscribe } from '@napplet/nub/relay';\n * import { storageGetItem } from '@napplet/nub/storage';\n * ```\n *\n * @packageDocumentation\n */\n\nimport type {\n NappletGlobal,\n NostrEvent,\n NostrFilter,\n Rumor,\n Subscription,\n EventTemplate,\n} from '@napplet/core';\n\n/**\n * Retrieve the `window.napplet` global, throwing a clear error if it is absent.\n *\n * Every SDK method calls this at invocation time -- not at module load time --\n * so the shim can be imported in any order relative to the SDK.\n */\nfunction requireNapplet(): NappletGlobal {\n const w = window as Window & { napplet?: NappletGlobal };\n if (!w.napplet) {\n throw new Error('window.napplet not installed -- import @napplet/shim first');\n }\n return w.napplet;\n}\n\n/**\n * NIP-01 relay operations: subscribe to events, publish events, one-shot queries.\n *\n * Each method delegates to `window.napplet.relay.*` at call time, which in turn\n * routes through the shell's relay pool via postMessage.\n *\n * @example\n * ```ts\n * import { relay } from '@napplet/sdk';\n *\n * const sub = relay.subscribe(\n * { kinds: [1], limit: 10 },\n * (event) => console.log(event),\n * () => console.log('EOSE'),\n * );\n * ```\n */\nexport const relay = {\n /**\n * Open a live NIP-01 subscription through the shell's relay pool.\n * @param filters One or more NIP-01 subscription filters\n * @param onEvent Called for each matching event\n * @param onEose Called when the shell signals end of stored events (EOSE)\n * @param options Optional: `{ relay, group }` for NIP-29 scoped relay subscriptions\n * @returns A Subscription handle with a `close()` method\n */\n subscribe(\n filters: NostrFilter | NostrFilter[],\n onEvent: (event: NostrEvent) => void,\n onEose: () => void,\n options?: { relay?: string; group?: string },\n ): Subscription {\n return requireNapplet().relay.subscribe(filters, onEvent, onEose, options);\n },\n\n /**\n * Sign and publish a Nostr event through the shell.\n * @param template Unsigned event template\n * @param options Optional: `{ relay: true }` to publish via scoped relay\n * @returns The signed NostrEvent after successful publication\n */\n publish(\n template: EventTemplate,\n options?: { relay?: boolean },\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publish(template, options);\n },\n\n /**\n * Publish an encrypted Nostr event through the shell.\n * @param template Unsigned event template\n * @param recipient Hex-encoded recipient public key\n * @param encryption Encryption scheme: 'nip44' (default) or 'nip04'\n * @returns The signed encrypted NostrEvent after successful publication\n */\n publishEncrypted(\n template: EventTemplate,\n recipient: string,\n encryption: 'nip44' | 'nip04' = 'nip44',\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publishEncrypted(template, recipient, encryption);\n },\n\n /**\n * One-shot query: subscribe, collect events until EOSE, then resolve.\n * @param filters NIP-01 subscription filters\n * @returns Promise resolving to array of matching NostrEvent objects\n */\n query(filters: NostrFilter | NostrFilter[]): Promise<NostrEvent[]> {\n return requireNapplet().relay.query(filters);\n },\n};\n\n/**\n * Inter-frame pubsub: broadcast and receive IFC-PEER events through the shell.\n *\n * @example\n * ```ts\n * import { ifc } from '@napplet/sdk';\n *\n * ifc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));\n *\n * const sub = ifc.on('profile:open', (payload) => {\n * console.log('Profile requested:', payload);\n * });\n * ```\n */\nexport const ifc = {\n /**\n * Broadcast an IFC-PEER event to other napplets via the shell.\n * @param topic The 't' tag value (e.g., 'profile:open')\n * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])\n * @param content Event content (default: empty string)\n */\n emit(topic: string, extraTags?: string[][], content?: string): void {\n requireNapplet().ifc.emit(topic, extraTags, content);\n },\n\n /**\n * Subscribe to IFC-PEER events on a specific topic.\n * @param topic The 't' tag value to listen for\n * @param callback Called with `(payload, event)` for each matching event\n * @returns A Subscription handle with a `close()` method\n */\n on(\n topic: string,\n callback: (payload: unknown, event: NostrEvent) => void,\n ): Subscription {\n return requireNapplet().ifc.on(topic, callback);\n },\n};\n\n/**\n * Napplet-scoped storage: async localStorage-like API proxied through the shell.\n * Each napplet's storage is isolated by identity.\n *\n * @example\n * ```ts\n * import { storage } from '@napplet/sdk';\n *\n * await storage.setItem('theme', 'dark');\n * const theme = await storage.getItem('theme'); // 'dark'\n * ```\n */\nexport const storage = {\n /**\n * Retrieve a stored value by key. Returns null if the key does not exist.\n * @param key The storage key\n * @returns The stored string value, or null if not found\n */\n getItem(key: string): Promise<string | null> {\n return requireNapplet().storage.getItem(key);\n },\n\n /**\n * Store a key-value pair.\n * @param key The storage key\n * @param value The string value to store\n */\n setItem(key: string, value: string): Promise<void> {\n return requireNapplet().storage.setItem(key, value);\n },\n\n /**\n * Remove a stored key.\n * @param key The storage key to remove\n */\n removeItem(key: string): Promise<void> {\n return requireNapplet().storage.removeItem(key);\n },\n\n /**\n * List all keys stored by this napplet.\n * @returns Array of storage key strings\n */\n keys(): Promise<string[]> {\n return requireNapplet().storage.keys();\n },\n};\n\n/**\n * Media session control: create sessions, report state and metadata,\n * declare capabilities, receive commands from the shell.\n *\n * @example\n * ```ts\n * import { media } from '@napplet/sdk';\n *\n * const { sessionId } = await media.createSession({\n * title: 'My Song', artist: 'The Artist',\n * });\n *\n * media.reportState(sessionId, { status: 'playing', position: 42.5 });\n * ```\n */\nexport const media = {\n /**\n * Create a new media session with the shell.\n * @param metadata Optional initial metadata\n * @returns The confirmed session result with sessionId\n */\n createSession(metadata?: {\n title?: string;\n artist?: string;\n album?: string;\n artwork?: { url?: string; hash?: string };\n duration?: number;\n mediaType?: 'audio' | 'video';\n }): Promise<{ sessionId: string }> {\n return requireNapplet().media.createSession(metadata);\n },\n\n /**\n * Update metadata for an existing session.\n * @param sessionId The session to update\n * @param metadata Partial metadata fields to update\n */\n updateSession(sessionId: string, metadata: {\n title?: string;\n artist?: string;\n album?: string;\n artwork?: { url?: string; hash?: string };\n duration?: number;\n mediaType?: 'audio' | 'video';\n }): void {\n requireNapplet().media.updateSession(sessionId, metadata);\n },\n\n /**\n * Destroy a media session.\n * @param sessionId The session to destroy\n */\n destroySession(sessionId: string): void {\n requireNapplet().media.destroySession(sessionId);\n },\n\n /**\n * Report current playback state for a session.\n * @param sessionId The session to report state for\n * @param state Current playback state\n */\n reportState(sessionId: string, state: {\n status: 'playing' | 'paused' | 'stopped' | 'buffering';\n position?: number;\n duration?: number;\n volume?: number;\n }): void {\n requireNapplet().media.reportState(sessionId, state);\n },\n\n /**\n * Declare which media actions the session currently supports.\n * @param sessionId The session to update capabilities for\n * @param actions Currently supported actions\n */\n reportCapabilities(sessionId: string, actions: ('play' | 'pause' | 'stop' | 'next' | 'prev' | 'seek' | 'volume')[]): void {\n requireNapplet().media.reportCapabilities(sessionId, actions);\n },\n\n /**\n * Listen for media commands from the shell.\n * @param sessionId The session to listen for commands on\n * @param callback Called with (action, value?) when a command is received\n * @returns A Subscription with `close()` to stop listening\n */\n onCommand(\n sessionId: string,\n callback: (action: 'play' | 'pause' | 'stop' | 'next' | 'prev' | 'seek' | 'volume', value?: number) => void,\n ): Subscription {\n return requireNapplet().media.onCommand(sessionId, callback);\n },\n\n /**\n * Listen for the shell's media control list.\n * @param sessionId The session to associate controls with\n * @param callback Called with the shell's supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n sessionId: string,\n callback: (controls: ('play' | 'pause' | 'stop' | 'next' | 'prev' | 'seek' | 'volume')[]) => void,\n ): Subscription {\n return requireNapplet().media.onControls(sessionId, callback);\n },\n};\n\n/**\n * Shell-rendered notifications: send notifications, set badge counts,\n * register channels, request permission, listen for user interaction.\n *\n * @example\n * ```ts\n * import { notify } from '@napplet/sdk';\n *\n * const { notificationId } = await notify.send({\n * title: 'New message', body: 'Alice: hey!',\n * });\n *\n * notify.badge(3);\n * ```\n */\nexport const notify = {\n /**\n * Send a notification to the shell.\n * @param notification Notification payload (title required)\n * @returns The shell-assigned notificationId\n */\n send(notification: {\n title: string;\n body?: string;\n icon?: string;\n actions?: { id: string; label: string }[];\n channel?: string;\n priority?: 'low' | 'normal' | 'high' | 'urgent';\n }): Promise<{ notificationId: string }> {\n return requireNapplet().notify.send(notification);\n },\n\n /**\n * Dismiss a notification by ID.\n * @param notificationId The notification to dismiss\n */\n dismiss(notificationId: string): void {\n requireNapplet().notify.dismiss(notificationId);\n },\n\n /**\n * Set the badge count for this napplet. Pass 0 to clear.\n * @param count Badge count\n */\n badge(count: number): void {\n requireNapplet().notify.badge(count);\n },\n\n /**\n * Register a notification channel.\n * @param channel Channel definition\n */\n registerChannel(channel: {\n channelId: string;\n label: string;\n description?: string;\n defaultPriority?: 'low' | 'normal' | 'high' | 'urgent';\n }): void {\n requireNapplet().notify.registerChannel(channel);\n },\n\n /**\n * Request permission to send notifications.\n * @param channel Optional channel to request permission for\n * @returns Whether permission was granted\n */\n requestPermission(channel?: string): Promise<{ granted: boolean }> {\n return requireNapplet().notify.requestPermission(channel);\n },\n\n /**\n * Listen for action button clicks on notifications.\n * @param callback Called with (notificationId, actionId)\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(\n callback: (notificationId: string, actionId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onAction(callback);\n },\n\n /**\n * Listen for notification body clicks.\n * @param callback Called with (notificationId)\n * @returns A Subscription with `close()` to stop listening\n */\n onClicked(\n callback: (notificationId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onClicked(callback);\n },\n\n /**\n * Listen for notification dismissals.\n * @param callback Called with (notificationId, reason?)\n * @returns A Subscription with `close()` to stop listening\n */\n onDismissed(\n callback: (notificationId: string, reason?: string) => void,\n ): Subscription {\n return requireNapplet().notify.onDismissed(callback);\n },\n\n /**\n * Listen for the shell's notification capability list.\n * @param callback Called with supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n callback: (controls: ('toasts' | 'badges' | 'actions' | 'channels' | 'system')[]) => void,\n ): Subscription {\n return requireNapplet().notify.onControls(callback);\n },\n};\n\n/**\n * Keyboard forwarding and action keybindings: register named actions the shell\n * can bind to keys, listen for shell-triggered actions locally.\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const result = await keys.registerAction({\n * id: 'editor.save',\n * label: 'Save',\n * defaultKey: 'Ctrl+S',\n * });\n *\n * const sub = keys.onAction('editor.save', () => {\n * console.log('Save triggered!');\n * });\n * ```\n */\nexport const keys = {\n /**\n * Declare a named action that the shell can bind to a key.\n * @param action The action to register (id, label, optional defaultKey)\n * @returns The assigned binding, if any\n */\n registerAction(action: {\n id: string;\n label: string;\n defaultKey?: string;\n }): Promise<{ actionId: string; binding?: string }> {\n return requireNapplet().keys.registerAction(action);\n },\n\n /**\n * Remove a previously registered action.\n * @param actionId The action to unregister\n */\n unregisterAction(actionId: string): void {\n requireNapplet().keys.unregisterAction(actionId);\n },\n\n /**\n * Register a local handler for when a bound key is pressed.\n * @param actionId The action to listen for\n * @param callback Called when the action is triggered\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(actionId: string, callback: () => void): Subscription {\n return requireNapplet().keys.onAction(actionId, callback);\n },\n\n /**\n * Convenience: register a named action AND wire a local handler in one call.\n * Returns a handle whose `close()` both unregisters the action and removes\n * the onAction listener.\n *\n * @param action The action to register (id, label, optional defaultKey)\n * @param handler Called when the shell triggers this action\n * @returns The assigned binding plus a `close()` teardown function\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const handle = await keys.register(\n * { id: 'editor.save', label: 'Save', defaultKey: 'Ctrl+S' },\n * () => saveDocument(),\n * );\n *\n * // Later, tear down both registration and listener:\n * handle.close();\n * ```\n */\n async register(\n action: { id: string; label: string; defaultKey?: string },\n handler: () => void,\n ): Promise<{ actionId: string; binding?: string; close: () => void }> {\n const n = requireNapplet();\n const result = await n.keys.registerAction(action);\n const sub = n.keys.onAction(action.id, handler);\n return {\n ...result,\n close() {\n sub.close();\n n.keys.unregisterAction(action.id);\n },\n };\n },\n};\n\n/**\n * Read-only user identity queries: public key, profile, follows, relays,\n * lists, zaps, mutes, blocked, badges.\n *\n * @example\n * ```ts\n * import { identity } from '@napplet/sdk';\n *\n * const pubkey = await identity.getPublicKey();\n * const profile = await identity.getProfile();\n * const follows = await identity.getFollows();\n * ```\n */\nexport const identity = {\n /**\n * Get the user's hex-encoded public key. Always succeeds.\n * @returns Hex-encoded public key string\n */\n getPublicKey(): Promise<string> {\n return requireNapplet().identity.getPublicKey();\n },\n\n /**\n * Get the user's relay list (NIP-65).\n * @returns Record mapping relay URLs to read/write permissions\n */\n getRelays(): Promise<Record<string, { read: boolean; write: boolean }>> {\n return requireNapplet().identity.getRelays();\n },\n\n /**\n * Get the user's profile metadata (kind 0).\n * @returns Profile data, or null if not found\n */\n getProfile(): Promise<{\n name?: string;\n displayName?: string;\n about?: string;\n picture?: string;\n banner?: string;\n nip05?: string;\n lud16?: string;\n website?: string;\n } | null> {\n return requireNapplet().identity.getProfile();\n },\n\n /**\n * Get the user's follow list (kind 3 contact list).\n * @returns Array of hex-encoded public keys\n */\n getFollows(): Promise<string[]> {\n return requireNapplet().identity.getFollows();\n },\n\n /**\n * Get entries from a user's categorized list.\n * @param listType List category (e.g., \"bookmarks\", \"interests\", \"pins\")\n * @returns Array of list entry values\n */\n getList(listType: string): Promise<string[]> {\n return requireNapplet().identity.getList(listType);\n },\n\n /**\n * Get zap receipts sent to the user.\n * @returns Array of zap receipt objects\n */\n getZaps(): Promise<{\n eventId: string;\n sender: string;\n amount: number;\n content?: string;\n }[]> {\n return requireNapplet().identity.getZaps();\n },\n\n /**\n * Get the user's mute list (kind 10000).\n * @returns Array of hex-encoded muted public keys\n */\n getMutes(): Promise<string[]> {\n return requireNapplet().identity.getMutes();\n },\n\n /**\n * Get the user's block list.\n * @returns Array of hex-encoded blocked public keys\n */\n getBlocked(): Promise<string[]> {\n return requireNapplet().identity.getBlocked();\n },\n\n /**\n * Get badges awarded to the user (NIP-58).\n * @returns Array of badge objects\n */\n getBadges(): Promise<{\n id: string;\n name?: string;\n description?: string;\n image?: string;\n thumbs?: string[];\n awardedBy: string;\n }[]> {\n return requireNapplet().identity.getBadges();\n },\n\n /**\n * Decrypt a received Nostr event (NIP-04 / direct NIP-44 / NIP-17 gift-wrap).\n *\n * Shape is auto-detected by the shell; napplets do NOT select encryption mode.\n * Only legal for napplets assigned class: 1 per NUB-CLASS-1 (shell-enforced).\n *\n * @param event The received event (outer wrap for NIP-17, kind-4 for NIP-04, etc.)\n * @returns Promise resolving to { rumor, sender }; rejects with Error on failure.\n */\n decrypt(event: NostrEvent): Promise<{ rumor: Rumor; sender: string }> {\n return requireNapplet().identity.decrypt(event);\n },\n};\n\n/**\n * Per-napplet declarative configuration (NUB-CONFIG): register a schema,\n * read current values, subscribe to live updates, deep-link into the\n * shell-owned settings UI, and listen for schema errors.\n *\n * @example\n * ```ts\n * import { config } from '@napplet/sdk';\n *\n * await config.registerSchema({\n * type: 'object',\n * properties: { theme: { type: 'string', enum: ['light', 'dark'], default: 'dark' } },\n * });\n *\n * const sub = config.subscribe((values) => { applyTheme(values.theme); });\n *\n * config.openSettings({ section: 'appearance' });\n * ```\n */\nexport const config = {\n /**\n * Snapshot current validated + defaulted config values.\n * @returns A one-shot ConfigValues object.\n */\n get(): Promise<Record<string, unknown>> {\n return requireNapplet().config.get();\n },\n\n /**\n * Subscribe to live configuration updates.\n * First delivery is an immediate snapshot; subsequent deliveries fire on change.\n * @param callback Invoked with the full ConfigValues on every change.\n * @returns A Subscription with close() to stop listening.\n */\n subscribe(\n callback: (values: Record<string, unknown>) => void,\n ): Subscription {\n return requireNapplet().config.subscribe(callback);\n },\n\n /**\n * Request the shell open its settings UI for this napplet.\n * @param options Optional { section } to deep-link by x-napplet-section name.\n */\n openSettings(options?: { section?: string }): void {\n requireNapplet().config.openSettings(options);\n },\n\n /**\n * Register a napplet configuration schema at runtime (escape hatch;\n * prefer manifest-declared via @napplet/vite-plugin's configSchema option).\n * @param schema JSON Schema (draft-07+) describing the config surface.\n * @param version Optional `$version` migration hint.\n */\n registerSchema(\n schema: Record<string, unknown>,\n version?: number,\n ): Promise<void> {\n return requireNapplet().config.registerSchema(schema, version);\n },\n\n /**\n * Listen for schema-registration errors pushed by the shell\n * (manifest parse failure, no-schema on subscribe-before-schema, etc.).\n * @param callback Invoked with { code, error } on every push.\n * @returns A plain teardown function that detaches the listener.\n */\n onSchemaError(\n callback: (err: { code: string; error: string }) => void,\n ): () => void {\n return requireNapplet().config.onSchemaError(callback);\n },\n\n /**\n * Current schema snapshot (readonly). Populated from the\n * `<meta name=\"napplet-config-schema\">` manifest tag at shim install,\n * updated on successful registerSchema responses.\n * @returns The registered schema, or null if none.\n */\n get schema(): Record<string, unknown> | null {\n return requireNapplet().config.schema;\n },\n};\n\n/**\n * Browser-enforced byte-fetching primitive: napplets request bytes by URL,\n * shell fetches and returns a Blob. URL space is scheme-pluggable\n * (`data:`, `https:`, `blossom:`, `nostr:`).\n *\n * @example\n * ```ts\n * import { resource } from '@napplet/sdk';\n *\n * const blob = await resource.bytes('https://example.com/avatar.png');\n * const handle = resource.bytesAsObjectURL('blossom:abc123...');\n * imgEl.src = handle.url;\n * imgEl.onload = () => handle.revoke();\n * ```\n */\nexport const resource = {\n /**\n * Fetch bytes for a URL through the shell's resource pipeline.\n * @param url URL identifying the resource (any registered scheme).\n * @returns Promise resolving to the fetched bytes as a Blob.\n */\n bytes(url: string): Promise<Blob> {\n return requireNapplet().resource.bytes(url);\n },\n\n /**\n * Fetch bytes and return a managed object URL handle.\n * Call `revoke()` to release the underlying Blob URL.\n * @param url URL identifying the resource.\n * @returns Synchronous handle `{ url, revoke }`.\n */\n bytesAsObjectURL(url: string): { url: string; revoke: () => void } {\n return requireNapplet().resource.bytesAsObjectURL(url);\n },\n};\n\nexport type { NostrEvent } from '@napplet/core';\nexport type { NostrFilter } from '@napplet/core';\nexport type { Subscription } from '@napplet/core';\nexport type { EventTemplate } from '@napplet/core';\nexport type { Rumor } from '@napplet/core';\nexport type { UnsignedEvent } from '@napplet/core';\n\nexport type { NappletMessage, NubDomain, NamespacedCapability, ShellSupports } from '@napplet/core';\nexport { NUB_DOMAINS } from '@napplet/core';\n\n// Relay NUB\nexport type {\n RelayMessage,\n RelaySubscribeMessage,\n RelayCloseMessage,\n RelayPublishMessage,\n RelayPublishEncryptedMessage,\n RelayQueryMessage,\n RelayEventMessage,\n RelayEoseMessage,\n RelayClosedMessage,\n RelayPublishResultMessage,\n RelayPublishEncryptedResultMessage,\n RelayQueryResultMessage,\n RelayOutboundMessage,\n RelayInboundMessage,\n RelayNubMessage,\n} from '@napplet/nub/relay';\n\n// Identity NUB\nexport type {\n ProfileData,\n ZapReceipt,\n Badge,\n RelayPermission as IdentityRelayPermission,\n IdentityMessage,\n IdentityGetPublicKeyMessage,\n IdentityGetRelaysMessage,\n IdentityGetProfileMessage,\n IdentityGetFollowsMessage,\n IdentityGetListMessage,\n IdentityGetZapsMessage,\n IdentityGetMutesMessage,\n IdentityGetBlockedMessage,\n IdentityGetBadgesMessage,\n IdentityGetPublicKeyResultMessage,\n IdentityGetRelaysResultMessage,\n IdentityGetProfileResultMessage,\n IdentityGetFollowsResultMessage,\n IdentityGetListResultMessage,\n IdentityGetZapsResultMessage,\n IdentityGetMutesResultMessage,\n IdentityGetBlockedResultMessage,\n IdentityGetBadgesResultMessage,\n IdentityRequestMessage,\n IdentityResultMessage,\n IdentityNubMessage,\n IdentityDecryptMessage,\n IdentityDecryptResultMessage,\n IdentityDecryptErrorMessage,\n IdentityDecryptErrorCode,\n} from '@napplet/nub/identity';\n\n// Storage NUB\nexport type {\n StorageMessage,\n StorageGetMessage,\n StorageSetMessage,\n StorageRemoveMessage,\n StorageKeysMessage,\n StorageGetResultMessage,\n StorageSetResultMessage,\n StorageRemoveResultMessage,\n StorageKeysResultMessage,\n StorageRequestMessage,\n StorageResultMessage,\n StorageNubMessage,\n} from '@napplet/nub/storage';\n\n// IFC NUB\nexport type {\n IfcMessage,\n IfcEmitMessage,\n IfcSubscribeMessage,\n IfcSubscribeResultMessage,\n IfcUnsubscribeMessage,\n IfcEventMessage,\n IfcChannelOpenMessage,\n IfcChannelOpenResultMessage,\n IfcChannelEmitMessage,\n IfcChannelEventMessage,\n IfcChannelBroadcastMessage,\n IfcChannelListMessage,\n IfcChannelListResultMessage,\n IfcChannelCloseMessage,\n IfcChannelClosedMessage,\n IfcTopicMessage,\n IfcChannelMessage,\n IfcOutboundMessage,\n IfcInboundMessage,\n IfcNubMessage,\n} from '@napplet/nub/ifc';\n\n// Theme NUB\nexport type {\n ThemeColors,\n ThemeFont,\n ThemeBackground,\n Theme,\n ThemeMessage,\n ThemeGetMessage,\n ThemeGetResultMessage,\n ThemeChangedMessage,\n ThemeRequestMessage,\n ThemeResultMessage,\n ThemeNubMessage,\n} from '@napplet/nub/theme';\n\n// Keys NUB\nexport type {\n Action,\n RegisterResult,\n KeyBinding,\n KeysMessage,\n KeysForwardMessage,\n KeysRegisterActionMessage,\n KeysRegisterActionResultMessage,\n KeysUnregisterActionMessage,\n KeysBindingsMessage,\n KeysActionMessage,\n KeysRequestMessage,\n KeysResultMessage,\n KeysNubMessage,\n} from '@napplet/nub/keys';\n\n// Media NUB\nexport type {\n MediaMetadata,\n MediaArtwork,\n MediaState,\n MediaAction,\n MediaMessage,\n MediaSessionCreateMessage,\n MediaSessionCreateResultMessage,\n MediaSessionUpdateMessage,\n MediaSessionDestroyMessage,\n MediaStateMessage,\n MediaCapabilitiesMessage,\n MediaCommandMessage,\n MediaControlsMessage,\n MediaRequestMessage,\n MediaResultMessage,\n MediaNubMessage,\n} from '@napplet/nub/media';\n\n// Notify NUB\nexport type {\n NotificationPriority,\n NotificationAction,\n NotificationChannel,\n NotifyControl,\n NotifyMessage,\n NotifySendMessage,\n NotifySendResultMessage,\n NotifyDismissMessage,\n NotifyBadgeMessage,\n NotifyChannelRegisterMessage,\n NotifyPermissionRequestMessage,\n NotifyPermissionResultMessage,\n NotifyActionMessage,\n NotifyClickedMessage,\n NotifyDismissedMessage,\n NotifyControlsMessage,\n NotifyRequestMessage,\n NotifyResultMessage,\n NotifyNubMessage,\n} from '@napplet/nub/notify';\n\n// Config NUB\nexport type {\n NappletConfigSchema,\n ConfigSchema,\n ConfigValues,\n ConfigSchemaErrorCode,\n NappletConfigSchemaExtensions,\n ConfigMessage,\n ConfigRegisterSchemaMessage,\n ConfigGetMessage,\n ConfigSubscribeMessage,\n ConfigUnsubscribeMessage,\n ConfigOpenSettingsMessage,\n ConfigRegisterSchemaResultMessage,\n ConfigValuesMessage,\n ConfigSchemaErrorMessage,\n ConfigRequestMessage,\n ConfigResultMessage,\n ConfigNubMessage,\n} from '@napplet/nub/config';\n\n// Resource NUB\nexport type {\n ResourceErrorCode,\n ResourceScheme,\n ResourceMessage,\n ResourceBytesMessage,\n ResourceCancelMessage,\n ResourceBytesResultMessage,\n ResourceBytesErrorMessage,\n ResourceSidecarEntry,\n ResourceRequestMessage,\n ResourceResultMessage,\n ResourceNubMessage,\n} from '@napplet/nub/resource';\n\n// Connect NUB\nexport type {\n NappletConnect,\n} from '@napplet/nub/connect';\n\n// Class NUB\nexport type {\n ClassMessage,\n ClassAssignedMessage,\n NappletClass,\n ClassNubMessage,\n} from '@napplet/nub/class';\n\nexport { DOMAIN as RELAY_DOMAIN } from '@napplet/nub/relay';\nexport { DOMAIN as IDENTITY_DOMAIN } from '@napplet/nub/identity';\nexport { DOMAIN as STORAGE_DOMAIN } from '@napplet/nub/storage';\nexport { DOMAIN as IFC_DOMAIN } from '@napplet/nub/ifc';\nexport { DOMAIN as THEME_DOMAIN } from '@napplet/nub/theme';\nexport { DOMAIN as KEYS_DOMAIN } from '@napplet/nub/keys';\nexport { DOMAIN as MEDIA_DOMAIN } from '@napplet/nub/media';\nexport { DOMAIN as NOTIFY_DOMAIN } from '@napplet/nub/notify';\nexport { DOMAIN as CONFIG_DOMAIN } from '@napplet/nub/config';\nexport { DOMAIN as RESOURCE_DOMAIN } from '@napplet/nub/resource';\nexport { DOMAIN as CONNECT_DOMAIN } from '@napplet/nub/connect';\nexport { DOMAIN as CLASS_DOMAIN } from '@napplet/nub/class';\n\nexport { installRelayShim } from '@napplet/nub/relay';\nexport { installIdentityShim } from '@napplet/nub/identity';\nexport { installStorageShim } from '@napplet/nub/storage';\nexport { installIfcShim } from '@napplet/nub/ifc';\nexport { installKeysShim } from '@napplet/nub/keys';\nexport { installMediaShim } from '@napplet/nub/media';\nexport { installNotifyShim } from '@napplet/nub/notify';\nexport { installConfigShim } from '@napplet/nub/config';\nexport { installResourceShim } from '@napplet/nub/resource';\nexport { installConnectShim } from '@napplet/nub/connect';\nexport { installClassShim } from '@napplet/nub/class';\n\nexport { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from '@napplet/nub/relay';\nexport { identityGetPublicKey, identityGetRelays, identityGetProfile, identityGetFollows, identityGetList, identityGetZaps, identityGetMutes, identityGetBlocked, identityGetBadges, identityDecrypt } from '@napplet/nub/identity';\nexport { storageGetItem, storageSetItem, storageRemoveItem, storageKeys } from '@napplet/nub/storage';\nexport { ifcEmit, ifcOn } from '@napplet/nub/ifc';\nexport { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from '@napplet/nub/keys';\nexport { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaOnCommand, mediaOnControls } from '@napplet/nub/media';\nexport { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from '@napplet/nub/notify';\nexport { resourceBytes, resourceBytesAsObjectURL } from '@napplet/nub/resource';\nexport { connectGranted, connectOrigins, normalizeConnectOrigin } from '@napplet/nub/connect';\nexport { getClass } from '@napplet/nub/class';\n"],"mappings":";AA+vBA,SAAS,mBAAmB;AA2N5B,SAAmB,cAAoB;AACvC,SAAmB,UAAVA,eAAiC;AAC1C,SAAmB,UAAVA,eAAgC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I;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,UACE,UACc;AACd,WAAO,eAAe,EAAE,OAAO,UAAU,QAAQ;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAa,SAAsC;AACjD,mBAAe,EAAE,OAAO,aAAa,OAAO;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eACE,QACA,SACe;AACf,WAAO,eAAe,EAAE,OAAO,eAAe,QAAQ,OAAO;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cACE,UACY;AACZ,WAAO,eAAe,EAAE,OAAO,cAAc,QAAQ;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,SAAyC;AAC3C,WAAO,eAAe,EAAE,OAAO;AAAA,EACjC;AACF;AAiBO,IAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,MAAM,KAA4B;AAChC,WAAO,eAAe,EAAE,SAAS,MAAM,GAAG;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,iBAAiB,KAAkD;AACjE,WAAO,eAAe,EAAE,SAAS,iBAAiB,GAAG;AAAA,EACvD;AACF;","names":["DOMAIN"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @napplet/sdk -- Typed named exports wrapping window.napplet.\n *\n * Provides `relay`, `ifc`, `storage`, and `keys` objects that delegate\n * to `window.napplet.*` at call time. Developers using a bundler can import\n * individual namespaces without depending on the shim's side-effect install:\n *\n * ```ts\n * import { relay, ifc } from '@napplet/sdk';\n * ```\n *\n * The shim must still be imported somewhere in the application to install\n * the `window.napplet` global. The SDK only wraps it -- it does not install it.\n *\n * Domain-specific SDK helpers are also available directly from NAP packages:\n * ```ts\n * import { relaySubscribe } from '@napplet/nap/relay';\n * import { storageGetItem } from '@napplet/nap/storage';\n * ```\n *\n * @packageDocumentation\n */\n\nimport type {\n NappletGlobal,\n NostrEvent,\n NostrFilter,\n Subscription,\n EventTemplate,\n} from '@napplet/core';\nimport type {\n MediaSessionCreate,\n MediaSessionResult,\n MediaMetadata,\n MediaState,\n MediaAction,\n} from '@napplet/nap/media';\n\n/**\n * Retrieve the `window.napplet` global, throwing a clear error if it is absent.\n *\n * Every SDK method calls this at invocation time -- not at module load time --\n * so the shim can be imported in any order relative to the SDK.\n */\nfunction requireNapplet(): NappletGlobal {\n const w = window as Window & { napplet?: NappletGlobal };\n if (!w.napplet) {\n throw new Error('window.napplet not installed -- import @napplet/shim first');\n }\n return w.napplet;\n}\n\n/**\n * NIP-01 relay operations: subscribe to events, publish events, one-shot queries.\n *\n * Each method delegates to `window.napplet.relay.*` at call time, which in turn\n * routes through the shell's relay pool via postMessage.\n *\n * @example\n * ```ts\n * import { relay } from '@napplet/sdk';\n *\n * const sub = relay.subscribe(\n * { kinds: [1], limit: 10 },\n * (event) => console.log(event),\n * () => console.log('EOSE'),\n * );\n * ```\n */\nexport const relay = {\n /**\n * Open a live NIP-01 subscription through the shell's relay pool.\n * @param filters One or more NIP-01 subscription filters\n * @param onEvent Called for each matching event\n * @param onEose Called when the shell signals end of stored events (EOSE)\n * @param options Optional: `{ relay, group }` for NIP-29 scoped relay subscriptions\n * @returns A Subscription handle with a `close()` method\n */\n subscribe(\n filters: NostrFilter | NostrFilter[],\n onEvent: (event: NostrEvent) => void,\n onEose: () => void,\n options?: { relay?: string; group?: string },\n ): Subscription {\n return requireNapplet().relay.subscribe(filters, onEvent, onEose, options);\n },\n\n /**\n * Sign and publish a Nostr event through the shell.\n * @param template Unsigned event template\n * @param options Optional: `{ relay: true }` to publish via scoped relay\n * @returns The signed NostrEvent after successful publication\n */\n publish(\n template: EventTemplate,\n options?: { relay?: boolean },\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publish(template, options);\n },\n\n /**\n * Publish an encrypted Nostr event through the shell.\n * @param template Unsigned event template\n * @param recipient Hex-encoded recipient public key\n * @param encryption Encryption scheme: 'nip44' (default) or 'nip04'\n * @returns The signed encrypted NostrEvent after successful publication\n */\n publishEncrypted(\n template: EventTemplate,\n recipient: string,\n encryption: 'nip44' | 'nip04' = 'nip44',\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publishEncrypted(template, recipient, encryption);\n },\n\n /**\n * One-shot query: subscribe, collect events until EOSE, then resolve.\n * @param filters NIP-01 subscription filters\n * @returns Promise resolving to array of matching NostrEvent objects\n */\n query(filters: NostrFilter | NostrFilter[]): Promise<NostrEvent[]> {\n return requireNapplet().relay.query(filters);\n },\n};\n\n/**\n * Inter-frame pubsub: broadcast and receive IFC-PEER events through the shell.\n *\n * @example\n * ```ts\n * import { ifc } from '@napplet/sdk';\n *\n * ifc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));\n *\n * const sub = ifc.on('profile:open', (payload) => {\n * console.log('Profile requested:', payload);\n * });\n * ```\n */\nexport const ifc = {\n /**\n * Broadcast an IFC-PEER event to other napplets via the shell.\n * @param topic The 't' tag value (e.g., 'profile:open')\n * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])\n * @param content Event content (default: empty string)\n */\n emit(topic: string, extraTags?: string[][], content?: string): void {\n requireNapplet().ifc.emit(topic, extraTags, content);\n },\n\n /**\n * Subscribe to IFC-PEER events on a specific topic.\n * @param topic The 't' tag value to listen for\n * @param callback Called with `(payload, event)` for each matching event\n * @returns A Subscription handle with a `close()` method\n */\n on(\n topic: string,\n callback: (payload: unknown, event: NostrEvent) => void,\n ): Subscription {\n return requireNapplet().ifc.on(topic, callback);\n },\n};\n\n/**\n * Napplet-scoped storage: async localStorage-like API proxied through the shell.\n * Each napplet's storage is isolated by identity.\n *\n * @example\n * ```ts\n * import { storage } from '@napplet/sdk';\n *\n * await storage.setItem('theme', 'dark');\n * const theme = await storage.getItem('theme'); // 'dark'\n * ```\n */\nexport const storage = {\n /**\n * Retrieve a stored value by key. Returns null if the key does not exist.\n * @param key The storage key\n * @returns The stored string value, or null if not found\n */\n getItem(key: string): Promise<string | null> {\n return requireNapplet().storage.getItem(key);\n },\n\n /**\n * Store a key-value pair.\n * @param key The storage key\n * @param value The string value to store\n */\n setItem(key: string, value: string): Promise<void> {\n return requireNapplet().storage.setItem(key, value);\n },\n\n /**\n * Remove a stored key.\n * @param key The storage key to remove\n */\n removeItem(key: string): Promise<void> {\n return requireNapplet().storage.removeItem(key);\n },\n\n /**\n * List all keys stored by this napplet.\n * @returns Array of storage key strings\n */\n keys(): Promise<string[]> {\n return requireNapplet().storage.keys();\n },\n};\n\n/**\n * Media session control: create sessions, report state and metadata,\n * declare capabilities, receive commands from the shell.\n *\n * @example\n * ```ts\n * import { media } from '@napplet/sdk';\n *\n * const { sessionId } = await media.createSession({\n * owner: 'napplet',\n * metadata: { title: 'My Song', artist: 'The Artist' },\n * });\n *\n * media.reportState(sessionId, { status: 'playing', position: 42.5 });\n * ```\n */\nexport const media = {\n /**\n * Create a new media session with the shell.\n * @param options Ownership-aware session options\n * @returns The shell result with canonical sessionId and owner, or error\n */\n createSession(options: MediaSessionCreate): Promise<MediaSessionResult> {\n return requireNapplet().media.createSession(options);\n },\n\n /**\n * Update metadata for an existing session.\n * @param sessionId The session to update\n * @param metadata Partial metadata fields to update\n */\n updateSession(sessionId: string, metadata: Partial<MediaMetadata>): void {\n requireNapplet().media.updateSession(sessionId, metadata);\n },\n\n /**\n * Destroy a media session.\n * @param sessionId The session to destroy\n */\n destroySession(sessionId: string): void {\n requireNapplet().media.destroySession(sessionId);\n },\n\n /**\n * Report current playback state for a session.\n * @param sessionId The session to report state for\n * @param state Current playback state\n */\n reportState(sessionId: string, state: MediaState): void {\n requireNapplet().media.reportState(sessionId, state);\n },\n\n /**\n * Declare which media actions the session currently supports.\n * @param sessionId The session to update capabilities for\n * @param actions Currently supported actions\n */\n reportCapabilities(sessionId: string, actions: MediaAction[]): void {\n requireNapplet().media.reportCapabilities(sessionId, actions);\n },\n\n /**\n * Send a command to the current playback owner.\n * @param sessionId The session to control\n * @param action The media action to request\n * @param value Optional value for seek/volume\n */\n sendCommand(sessionId: string, action: MediaAction, value?: number): void {\n requireNapplet().media.sendCommand(sessionId, action, value);\n },\n\n /**\n * Listen for media commands from the shell.\n * @param sessionId The session to listen for commands on\n * @param callback Called with (action, value?) when a command is received\n * @returns A Subscription with `close()` to stop listening\n */\n onCommand(\n sessionId: string,\n callback: (action: MediaAction, value?: number) => void,\n ): Subscription {\n return requireNapplet().media.onCommand(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported playback state for shell-owned sessions.\n * @param sessionId The session to listen for state on\n * @param callback Called with playback state\n * @returns A Subscription with `close()` to stop listening\n */\n onState(\n sessionId: string,\n callback: (state: MediaState) => void,\n ): Subscription {\n return requireNapplet().media.onState(sessionId, callback);\n },\n\n /**\n * Listen for shell-reported capabilities for shell-owned sessions.\n * @param sessionId The session to listen for capabilities on\n * @param callback Called with available actions\n * @returns A Subscription with `close()` to stop listening\n */\n onCapabilities(\n sessionId: string,\n callback: (actions: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onCapabilities(sessionId, callback);\n },\n\n /**\n * Listen for the shell's media control list.\n * @param sessionId The session to associate controls with\n * @param callback Called with the shell's supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n sessionId: string,\n callback: (controls: MediaAction[]) => void,\n ): Subscription {\n return requireNapplet().media.onControls(sessionId, callback);\n },\n};\n\n/**\n * Shell-rendered notifications: send notifications, set badge counts,\n * register channels, request permission, listen for user interaction.\n *\n * @example\n * ```ts\n * import { notify } from '@napplet/sdk';\n *\n * const { notificationId } = await notify.send({\n * title: 'New message', body: 'Alice: hey!',\n * });\n *\n * notify.badge(3);\n * ```\n */\nexport const notify = {\n /**\n * Send a notification to the shell.\n * @param notification Notification payload (title required)\n * @returns The shell-assigned notificationId\n */\n send(notification: {\n title: string;\n body?: string;\n icon?: string;\n actions?: { id: string; label: string }[];\n channel?: string;\n priority?: 'low' | 'normal' | 'high' | 'urgent';\n }): Promise<{ notificationId: string }> {\n return requireNapplet().notify.send(notification);\n },\n\n /**\n * Dismiss a notification by ID.\n * @param notificationId The notification to dismiss\n */\n dismiss(notificationId: string): void {\n requireNapplet().notify.dismiss(notificationId);\n },\n\n /**\n * Set the badge count for this napplet. Pass 0 to clear.\n * @param count Badge count\n */\n badge(count: number): void {\n requireNapplet().notify.badge(count);\n },\n\n /**\n * Register a notification channel.\n * @param channel Channel definition\n */\n registerChannel(channel: {\n channelId: string;\n label: string;\n description?: string;\n defaultPriority?: 'low' | 'normal' | 'high' | 'urgent';\n }): void {\n requireNapplet().notify.registerChannel(channel);\n },\n\n /**\n * Request permission to send notifications.\n * @param channel Optional channel to request permission for\n * @returns Whether permission was granted\n */\n requestPermission(channel?: string): Promise<{ granted: boolean }> {\n return requireNapplet().notify.requestPermission(channel);\n },\n\n /**\n * Listen for action button clicks on notifications.\n * @param callback Called with (notificationId, actionId)\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(\n callback: (notificationId: string, actionId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onAction(callback);\n },\n\n /**\n * Listen for notification body clicks.\n * @param callback Called with (notificationId)\n * @returns A Subscription with `close()` to stop listening\n */\n onClicked(\n callback: (notificationId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onClicked(callback);\n },\n\n /**\n * Listen for notification dismissals.\n * @param callback Called with (notificationId, reason?)\n * @returns A Subscription with `close()` to stop listening\n */\n onDismissed(\n callback: (notificationId: string, reason?: string) => void,\n ): Subscription {\n return requireNapplet().notify.onDismissed(callback);\n },\n\n /**\n * Listen for the shell's notification capability list.\n * @param callback Called with supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n callback: (controls: ('toasts' | 'badges' | 'actions' | 'channels' | 'system')[]) => void,\n ): Subscription {\n return requireNapplet().notify.onControls(callback);\n },\n};\n\n/**\n * Keyboard forwarding and action keybindings: register named actions the shell\n * can bind to keys, listen for shell-triggered actions locally.\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const result = await keys.registerAction({\n * id: 'editor.save',\n * label: 'Save',\n * defaultKey: 'Ctrl+S',\n * });\n *\n * const sub = keys.onAction('editor.save', () => {\n * console.log('Save triggered!');\n * });\n * ```\n */\nexport const keys = {\n /**\n * Declare a named action that the shell can bind to a key.\n * @param action The action to register (id, label, optional defaultKey)\n * @returns The assigned binding, if any\n */\n registerAction(action: {\n id: string;\n label: string;\n defaultKey?: string;\n }): Promise<{ actionId: string; binding?: string }> {\n return requireNapplet().keys.registerAction(action);\n },\n\n /**\n * Remove a previously registered action.\n * @param actionId The action to unregister\n */\n unregisterAction(actionId: string): void {\n requireNapplet().keys.unregisterAction(actionId);\n },\n\n /**\n * Register a local handler for when a bound key is pressed.\n * @param actionId The action to listen for\n * @param callback Called when the action is triggered\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(actionId: string, callback: () => void): Subscription {\n return requireNapplet().keys.onAction(actionId, callback);\n },\n\n /**\n * Convenience: register a named action AND wire a local handler in one call.\n * Returns a handle whose `close()` both unregisters the action and removes\n * the onAction listener.\n *\n * @param action The action to register (id, label, optional defaultKey)\n * @param handler Called when the shell triggers this action\n * @returns The assigned binding plus a `close()` teardown function\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const handle = await keys.register(\n * { id: 'editor.save', label: 'Save', defaultKey: 'Ctrl+S' },\n * () => saveDocument(),\n * );\n *\n * // Later, tear down both registration and listener:\n * handle.close();\n * ```\n */\n async register(\n action: { id: string; label: string; defaultKey?: string },\n handler: () => void,\n ): Promise<{ actionId: string; binding?: string; close: () => void }> {\n const n = requireNapplet();\n const result = await n.keys.registerAction(action);\n const sub = n.keys.onAction(action.id, handler);\n return {\n ...result,\n close() {\n sub.close();\n n.keys.unregisterAction(action.id);\n },\n };\n },\n};\n\n/**\n * Read-only user identity queries: public key, profile, follows, relays,\n * lists, zaps, mutes, blocked, badges.\n *\n * @example\n * ```ts\n * import { identity } from '@napplet/sdk';\n *\n * const pubkey = await identity.getPublicKey();\n * const profile = await identity.getProfile();\n * const follows = await identity.getFollows();\n * ```\n */\nexport const identity = {\n /**\n * Get the user's hex-encoded public key. Always succeeds.\n * @returns Hex-encoded public key string\n */\n getPublicKey(): Promise<string> {\n return requireNapplet().identity.getPublicKey();\n },\n\n /**\n * Listen for shell-pushed user identity changes.\n * @param handler Called with a hex pubkey, or \"\" when no user/signer is connected\n * @returns Subscription with close() to detach the handler\n */\n onChanged(handler: (pubkey: string) => void): Subscription {\n return requireNapplet().identity.onChanged(handler);\n },\n\n /**\n * Get the user's relay list (NIP-65).\n * @returns Record mapping relay URLs to read/write permissions\n */\n getRelays(): Promise<Record<string, { read: boolean; write: boolean }>> {\n return requireNapplet().identity.getRelays();\n },\n\n /**\n * Get the user's profile metadata (kind 0).\n * @returns Profile data, or null if not found\n */\n getProfile(): Promise<{\n name?: string;\n displayName?: string;\n about?: string;\n picture?: string;\n banner?: string;\n nip05?: string;\n lud16?: string;\n website?: string;\n } | null> {\n return requireNapplet().identity.getProfile();\n },\n\n /**\n * Get the user's follow list (kind 3 contact list).\n * @returns Array of hex-encoded public keys\n */\n getFollows(): Promise<string[]> {\n return requireNapplet().identity.getFollows();\n },\n\n /**\n * Get entries from a user's categorized list.\n * @param listType List category (e.g., \"bookmarks\", \"interests\", \"pins\")\n * @returns Array of list entry values\n */\n getList(listType: string): Promise<string[]> {\n return requireNapplet().identity.getList(listType);\n },\n\n /**\n * Get zap receipts sent to the user.\n * @returns Array of zap receipt objects\n */\n getZaps(): Promise<{\n eventId: string;\n sender: string;\n amount: number;\n content?: string;\n }[]> {\n return requireNapplet().identity.getZaps();\n },\n\n /**\n * Get the user's mute list (kind 10000).\n * @returns Array of hex-encoded muted public keys\n */\n getMutes(): Promise<string[]> {\n return requireNapplet().identity.getMutes();\n },\n\n /**\n * Get the user's block list.\n * @returns Array of hex-encoded blocked public keys\n */\n getBlocked(): Promise<string[]> {\n return requireNapplet().identity.getBlocked();\n },\n\n /**\n * Get badges awarded to the user (NIP-58).\n * @returns Array of badge objects\n */\n getBadges(): Promise<{\n id: string;\n name?: string;\n description?: string;\n image?: string;\n thumbs?: string[];\n awardedBy: string;\n }[]> {\n return requireNapplet().identity.getBadges();\n },\n};\n\n/**\n * Per-napplet declarative configuration (NAP-CONFIG): register a schema,\n * read current values, subscribe to live updates, deep-link into the\n * shell-owned settings UI, and listen for schema errors.\n *\n * @example\n * ```ts\n * import { config } from '@napplet/sdk';\n *\n * await config.registerSchema({\n * type: 'object',\n * properties: { theme: { type: 'string', enum: ['light', 'dark'], default: 'dark' } },\n * });\n *\n * const sub = config.subscribe((values) => { applyTheme(values.theme); });\n *\n * config.openSettings({ section: 'appearance' });\n * ```\n */\nexport const config = {\n /**\n * Snapshot current validated + defaulted config values.\n * @returns A one-shot ConfigValues object.\n */\n get(): Promise<Record<string, unknown>> {\n return requireNapplet().config.get();\n },\n\n /**\n * Subscribe to live configuration updates.\n * First delivery is an immediate snapshot; subsequent deliveries fire on change.\n * @param callback Invoked with the full ConfigValues on every change.\n * @returns A Subscription with close() to stop listening.\n */\n subscribe(\n callback: (values: Record<string, unknown>) => void,\n ): Subscription {\n return requireNapplet().config.subscribe(callback);\n },\n\n /**\n * Request the shell open its settings UI for this napplet.\n * @param options Optional { section } to deep-link by x-napplet-section name.\n */\n openSettings(options?: { section?: string }): void {\n requireNapplet().config.openSettings(options);\n },\n\n /**\n * Register a napplet configuration schema at runtime (escape hatch;\n * prefer manifest-declared via @napplet/vite-plugin's configSchema option).\n * @param schema JSON Schema (draft-07+) describing the config surface.\n * @param version Optional `$version` migration hint.\n */\n registerSchema(\n schema: Record<string, unknown>,\n version?: number,\n ): Promise<void> {\n return requireNapplet().config.registerSchema(schema, version);\n },\n\n /**\n * Listen for schema-registration errors pushed by the shell\n * (manifest parse failure, no-schema on subscribe-before-schema, etc.).\n * @param callback Invoked with { code, error } on every push.\n * @returns A plain teardown function that detaches the listener.\n */\n onSchemaError(\n callback: (err: { code: string; error: string }) => void,\n ): () => void {\n return requireNapplet().config.onSchemaError(callback);\n },\n\n /**\n * Current schema snapshot (readonly). Populated from the\n * `<meta name=\"napplet-config-schema\">` manifest tag at shim install,\n * updated on successful registerSchema responses.\n * @returns The registered schema, or null if none.\n */\n get schema(): Record<string, unknown> | null {\n return requireNapplet().config.schema;\n },\n};\n\n/**\n * Browser-enforced byte-fetching primitive: napplets request bytes by URL,\n * shell fetches and returns a Blob. URL space is scheme-pluggable\n * (`data:`, `https:`, `blossom:`, `nostr:`).\n *\n * @example\n * ```ts\n * import { resource } from '@napplet/sdk';\n *\n * const blob = await resource.bytes('https://example.com/avatar.png');\n * const handle = resource.bytesAsObjectURL('blossom:abc123...');\n * imgEl.src = handle.url;\n * imgEl.onload = () => handle.revoke();\n * ```\n */\nexport const resource = {\n /**\n * Fetch bytes for a URL through the shell's resource pipeline.\n * @param url URL identifying the resource (any registered scheme).\n * @returns Promise resolving to the fetched bytes as a Blob.\n */\n bytes(url: string): Promise<Blob> {\n return requireNapplet().resource.bytes(url);\n },\n\n /**\n * Fetch bytes and return a managed object URL handle.\n * Call `revoke()` to release the underlying Blob URL.\n * @param url URL identifying the resource.\n * @returns Synchronous handle `{ url, revoke }`.\n */\n bytesAsObjectURL(url: string): { url: string; revoke: () => void } {\n return requireNapplet().resource.bytesAsObjectURL(url);\n },\n};\n\nexport type { NostrEvent } from '@napplet/core';\nexport type { NostrFilter } from '@napplet/core';\nexport type { Subscription } from '@napplet/core';\nexport type { EventTemplate } from '@napplet/core';\n\nexport type {\n NappletMessage,\n NapDomain,\n NamespacedCapability,\n NapProtocolId,\n ProtocolId,\n ShellSupports,\n} from '@napplet/core';\nexport { NAP_DOMAINS } from '@napplet/core';\n\n// Relay NAP\nexport type {\n RelayMessage,\n RelaySubscribeMessage,\n RelayCloseMessage,\n RelayPublishMessage,\n RelayPublishEncryptedMessage,\n RelayQueryMessage,\n RelayEventMessage,\n RelayEoseMessage,\n RelayClosedMessage,\n RelayPublishResultMessage,\n RelayPublishEncryptedResultMessage,\n RelayQueryResultMessage,\n RelayOutboundMessage,\n RelayInboundMessage,\n RelayNapMessage,\n} from '@napplet/nap/relay';\n\n// Identity NAP\nexport type {\n ProfileData,\n ZapReceipt,\n Badge,\n RelayPermission as IdentityRelayPermission,\n IdentityMessage,\n IdentityGetPublicKeyMessage,\n IdentityGetRelaysMessage,\n IdentityGetProfileMessage,\n IdentityGetFollowsMessage,\n IdentityGetListMessage,\n IdentityGetZapsMessage,\n IdentityGetMutesMessage,\n IdentityGetBlockedMessage,\n IdentityGetBadgesMessage,\n IdentityGetPublicKeyResultMessage,\n IdentityGetRelaysResultMessage,\n IdentityGetProfileResultMessage,\n IdentityGetFollowsResultMessage,\n IdentityGetListResultMessage,\n IdentityGetZapsResultMessage,\n IdentityGetMutesResultMessage,\n IdentityGetBlockedResultMessage,\n IdentityGetBadgesResultMessage,\n IdentityChangedMessage,\n IdentityRequestMessage,\n IdentityResultMessage,\n IdentityNapMessage,\n} from '@napplet/nap/identity';\n\n// Storage NAP\nexport type {\n StorageMessage,\n StorageGetMessage,\n StorageSetMessage,\n StorageRemoveMessage,\n StorageKeysMessage,\n StorageGetResultMessage,\n StorageSetResultMessage,\n StorageRemoveResultMessage,\n StorageKeysResultMessage,\n StorageRequestMessage,\n StorageResultMessage,\n StorageNapMessage,\n} from '@napplet/nap/storage';\n\n// IFC NAP\nexport type {\n IfcMessage,\n IfcEmitMessage,\n IfcSubscribeMessage,\n IfcSubscribeResultMessage,\n IfcUnsubscribeMessage,\n IfcEventMessage,\n IfcChannelOpenMessage,\n IfcChannelOpenResultMessage,\n IfcChannelEmitMessage,\n IfcChannelEventMessage,\n IfcChannelBroadcastMessage,\n IfcChannelListMessage,\n IfcChannelListResultMessage,\n IfcChannelCloseMessage,\n IfcChannelClosedMessage,\n IfcTopicMessage,\n IfcChannelMessage,\n IfcOutboundMessage,\n IfcInboundMessage,\n IfcNapMessage,\n} from '@napplet/nap/ifc';\n\n// Theme NAP\nexport type {\n ThemeColors,\n ThemeFont,\n ThemeBackground,\n Theme,\n ThemeMessage,\n ThemeGetMessage,\n ThemeGetResultMessage,\n ThemeChangedMessage,\n ThemeRequestMessage,\n ThemeResultMessage,\n ThemeNapMessage,\n} from '@napplet/nap/theme';\n\n// Keys NAP\nexport type {\n Action,\n RegisterResult,\n KeyBinding,\n KeysMessage,\n KeysForwardMessage,\n KeysRegisterActionMessage,\n KeysRegisterActionResultMessage,\n KeysUnregisterActionMessage,\n KeysBindingsMessage,\n KeysActionMessage,\n KeysRequestMessage,\n KeysResultMessage,\n KeysNapMessage,\n} from '@napplet/nap/keys';\n\n// Media NAP\nexport type {\n MediaMetadata,\n MediaArtwork,\n MediaPlaybackOwner,\n MediaSourceRef,\n MediaSessionCreate,\n MediaSessionResult,\n MediaState,\n MediaAction,\n MediaMessage,\n MediaSessionCreateMessage,\n MediaSessionCreateResultMessage,\n MediaSessionUpdateMessage,\n MediaSessionDestroyMessage,\n MediaStateMessage,\n MediaCapabilitiesMessage,\n MediaCommandMessage,\n MediaControlsMessage,\n MediaRequestMessage,\n MediaResultMessage,\n MediaNapMessage,\n} from '@napplet/nap/media';\n\n// Notify NAP\nexport type {\n NotificationPriority,\n NotificationAction,\n NotificationChannel,\n NotifyControl,\n NotifyMessage,\n NotifySendMessage,\n NotifySendResultMessage,\n NotifyDismissMessage,\n NotifyBadgeMessage,\n NotifyChannelRegisterMessage,\n NotifyPermissionRequestMessage,\n NotifyPermissionResultMessage,\n NotifyActionMessage,\n NotifyClickedMessage,\n NotifyDismissedMessage,\n NotifyControlsMessage,\n NotifyRequestMessage,\n NotifyResultMessage,\n NotifyNapMessage,\n} from '@napplet/nap/notify';\n\n// Config NAP\nexport type {\n NappletConfigSchema,\n ConfigSchema,\n ConfigValues,\n ConfigSchemaErrorCode,\n NappletConfigSchemaExtensions,\n ConfigMessage,\n ConfigRegisterSchemaMessage,\n ConfigGetMessage,\n ConfigSubscribeMessage,\n ConfigUnsubscribeMessage,\n ConfigOpenSettingsMessage,\n ConfigRegisterSchemaResultMessage,\n ConfigValuesMessage,\n ConfigSchemaErrorMessage,\n ConfigRequestMessage,\n ConfigResultMessage,\n ConfigNapMessage,\n} from '@napplet/nap/config';\n\n// Resource NAP\nexport type {\n ResourceErrorCode,\n ResourceScheme,\n ResourceMessage,\n ResourceBytesMessage,\n ResourceCancelMessage,\n ResourceBytesResultMessage,\n ResourceBytesErrorMessage,\n ResourceSidecarEntry,\n ResourceRequestMessage,\n ResourceResultMessage,\n ResourceNapMessage,\n} from '@napplet/nap/resource';\n\n// Connect NAP\nexport type {\n NappletConnect,\n} from '@napplet/nap/connect';\n\n// Class NAP\nexport type {\n ClassMessage,\n ClassAssignedMessage,\n NappletClass,\n ClassNapMessage,\n} from '@napplet/nap/class';\n\nexport { DOMAIN as RELAY_DOMAIN } from '@napplet/nap/relay';\nexport { DOMAIN as IDENTITY_DOMAIN } from '@napplet/nap/identity';\nexport { DOMAIN as STORAGE_DOMAIN } from '@napplet/nap/storage';\nexport { DOMAIN as IFC_DOMAIN } from '@napplet/nap/ifc';\nexport { DOMAIN as THEME_DOMAIN } from '@napplet/nap/theme';\nexport { DOMAIN as KEYS_DOMAIN } from '@napplet/nap/keys';\nexport { DOMAIN as MEDIA_DOMAIN } from '@napplet/nap/media';\nexport { DOMAIN as NOTIFY_DOMAIN } from '@napplet/nap/notify';\nexport { DOMAIN as CONFIG_DOMAIN } from '@napplet/nap/config';\nexport { DOMAIN as RESOURCE_DOMAIN } from '@napplet/nap/resource';\nexport { DOMAIN as CONNECT_DOMAIN } from '@napplet/nap/connect';\nexport { DOMAIN as CLASS_DOMAIN } from '@napplet/nap/class';\n\nexport { installRelayShim } from '@napplet/nap/relay';\nexport { installIdentityShim } from '@napplet/nap/identity';\nexport { installStorageShim } from '@napplet/nap/storage';\nexport { installIfcShim } from '@napplet/nap/ifc';\nexport { installKeysShim } from '@napplet/nap/keys';\nexport { installMediaShim } from '@napplet/nap/media';\nexport { installNotifyShim } from '@napplet/nap/notify';\nexport { installConfigShim } from '@napplet/nap/config';\nexport { installResourceShim } from '@napplet/nap/resource';\nexport { installConnectShim } from '@napplet/nap/connect';\nexport { installClassShim } from '@napplet/nap/class';\n\nexport { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from '@napplet/nap/relay';\nexport {\n identityGetPublicKey,\n identityOnChanged,\n identityGetRelays,\n identityGetProfile,\n identityGetFollows,\n identityGetList,\n identityGetZaps,\n identityGetMutes,\n identityGetBlocked,\n identityGetBadges,\n} from '@napplet/nap/identity';\nexport { storageGetItem, storageSetItem, storageRemoveItem, storageKeys } from '@napplet/nap/storage';\nexport { ifcEmit, ifcOn } from '@napplet/nap/ifc';\nexport { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from '@napplet/nap/keys';\nexport { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaSendCommand, mediaOnCommand, mediaOnState, mediaOnCapabilities, mediaOnControls } from '@napplet/nap/media';\nexport { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from '@napplet/nap/notify';\nexport { resourceBytes, resourceBytesAsObjectURL } from '@napplet/nap/resource';\nexport { connectGranted, connectOrigins, normalizeConnectOrigin } from '@napplet/nap/connect';\nexport { getClass } from '@napplet/nap/class';\n"],"mappings":";AAwxBA,SAAS,mBAAmB;AA4N5B,SAAmB,cAAoB;AACvC,SAAmB,UAAVA,eAAiC;AAC1C,SAAmB,UAAVA,eAAgC;AACzC,SAAmB,UAAVA,eAA4B;AACrC,SAAmB,UAAVA,eAA8B;AACvC,SAAmB,UAAVA,eAA6B;AACtC,SAAmB,UAAVA,eAA8B;AACvC,SAAmB,UAAVA,eAA+B;AACxC,SAAmB,UAAVA,eAA+B;AACxC,SAAmB,UAAVA,gBAAiC;AAC1C,SAAmB,UAAVA,gBAAgC;AACzC,SAAmB,UAAVA,gBAA8B;AA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OK;AACH,WAAO,eAAe,EAAE,SAAS,UAAU;AAAA,EAC7C;AACF;AAqBO,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKpB,MAAwC;AACtC,WAAO,eAAe,EAAE,OAAO,IAAI;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,UACE,UACc;AACd,WAAO,eAAe,EAAE,OAAO,UAAU,QAAQ;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAa,SAAsC;AACjD,mBAAe,EAAE,OAAO,aAAa,OAAO;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eACE,QACA,SACe;AACf,WAAO,eAAe,EAAE,OAAO,eAAe,QAAQ,OAAO;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cACE,UACY;AACZ,WAAO,eAAe,EAAE,OAAO,cAAc,QAAQ;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,SAAyC;AAC3C,WAAO,eAAe,EAAE,OAAO;AAAA,EACjC;AACF;AAiBO,IAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtB,MAAM,KAA4B;AAChC,WAAO,eAAe,EAAE,SAAS,MAAM,GAAG;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,iBAAiB,KAAkD;AACjE,WAAO,eAAe,EAAE,SAAS,iBAAiB,GAAG;AAAA,EACvD;AACF;","names":["DOMAIN"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napplet/sdk",
3
- "version": "0.3.1",
3
+ "version": "0.6.0",
4
4
  "description": "Typed named exports wrapping window.napplet for bundler-consuming napplet developers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,8 +20,8 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@napplet/core": "0.3.1",
24
- "@napplet/nub": "0.3.1"
23
+ "@napplet/core": "0.6.0",
24
+ "@napplet/nap": "0.6.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "tsup": "^8.5.0",