@droponair/sdk-js 0.24.3 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.selectTransport = exports.WebTransportTransport = exports.SseTransport = exports.PAYLOAD_FORMAT_VERSION = exports.PROTOCOL_VERSION = exports.SDK_VERSION = void 0;
3
+ exports.MemoryIdentityRecordStore = exports.IndexedDbIdentityRecordStore = exports.WebCryptoIdentityProvider = exports.selectTransport = exports.WebTransportTransport = exports.SseTransport = exports.PAYLOAD_FORMAT_VERSION = exports.PROTOCOL_VERSION = exports.SDK_VERSION = void 0;
4
+ exports.createSecureIdentity = createSecureIdentity;
4
5
  exports.initialize = initialize;
5
6
  const messaging_client_1 = require("./core/messaging-client");
6
7
  const session_manager_1 = require("./core/session-manager");
7
8
  const crypto_service_1 = require("./crypto/crypto-service");
8
9
  const indexeddb_key_storage_1 = require("./storage/indexeddb-key-storage");
10
+ const webcrypto_identity_provider_1 = require("./crypto/webcrypto-identity-provider");
9
11
  var version_1 = require("./version");
10
12
  Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return version_1.SDK_VERSION; } });
11
13
  Object.defineProperty(exports, "PROTOCOL_VERSION", { enumerable: true, get: function () { return version_1.PROTOCOL_VERSION; } });
@@ -16,23 +18,65 @@ function resolveStorage(adapter) {
16
18
  }
17
19
  return new indexeddb_key_storage_1.IndexedDbKeyStorage();
18
20
  }
21
+ /**
22
+ * An identity whose private key script cannot read, or `null` where the platform
23
+ * cannot provide one.
24
+ *
25
+ * Returns `null` rather than throwing, and rather than quietly handing back a
26
+ * weaker implementation, because those are the two ways a caller ends up
27
+ * believing it has a guarantee it does not have. A `null` here means: this engine
28
+ * cannot do it, carry on with the ordinary path and know that you did.
29
+ *
30
+ * Two separate conditions are checked, and both matter. `isSupported` asks
31
+ * whether the primitive exists. `canPersist` asks whether a key survives being
32
+ * stored and read back, which WebKit fails for X25519 while reporting the write
33
+ * as successful. An identity that silently regenerates every load makes every
34
+ * previous conversation undecryptable, with nothing raised to explain it, so the
35
+ * check is worth its round trip.
36
+ *
37
+ * Migration is the caller's to trigger, via `migrateFromKeyStorage`, because it
38
+ * removes the raw key and that is not a decision to take on someone's behalf.
39
+ */
40
+ async function createSecureIdentity(store) {
41
+ if (!(await webcrypto_identity_provider_1.WebCryptoIdentityProvider.isSupported())) {
42
+ return null;
43
+ }
44
+ const recordStore = store ?? new webcrypto_identity_provider_1.IndexedDbIdentityRecordStore();
45
+ if (!(await webcrypto_identity_provider_1.WebCryptoIdentityProvider.canPersist(recordStore))) {
46
+ return null;
47
+ }
48
+ return new webcrypto_identity_provider_1.WebCryptoIdentityProvider(recordStore);
49
+ }
19
50
  async function initialize(options) {
20
51
  const storage = resolveStorage(options.storage);
21
52
  const sessionManager = new session_manager_1.SessionManager();
22
- const cryptoService = new crypto_service_1.CryptoService(storage, sessionManager);
53
+ // An explicitly supplied identity provider owns the key agreement; otherwise
54
+ // the storage adapter does, exactly as in every previous release.
55
+ const cryptoService = new crypto_service_1.CryptoService(options.identity ?? storage, sessionManager);
23
56
  const client = new messaging_client_1.MessagingClient(options, cryptoService, sessionManager, storage);
24
57
  if (options.autoConnect !== false) {
25
58
  await client.connect();
26
59
  }
27
60
  return client;
28
61
  }
29
- // Phase 4.2.1: HTTP fallback lane primitive for restrictive networks.
62
+ // HTTP fallback lane primitive for restrictive networks.
30
63
  var sse_transport_1 = require("./transport/sse-transport");
31
64
  Object.defineProperty(exports, "SseTransport", { enumerable: true, get: function () { return sse_transport_1.SseTransport; } });
32
- // Phase 4.3: WebTransport (HTTP/3) lane primitive.
65
+ // WebTransport (HTTP/3) lane primitive.
33
66
  var webtransport_transport_1 = require("./transport/webtransport-transport");
34
67
  Object.defineProperty(exports, "WebTransportTransport", { enumerable: true, get: function () { return webtransport_transport_1.WebTransportTransport; } });
35
- // Phase 4.6: transport auto-select - intersects runtime + platform support.
68
+ // transport auto-select - intersects runtime + platform support.
36
69
  var auto_select_1 = require("./transport/auto-select");
37
70
  Object.defineProperty(exports, "selectTransport", { enumerable: true, get: function () { return auto_select_1.selectTransport; } });
71
+ /**
72
+ * Identity providers, for a private key that script cannot read.
73
+ *
74
+ * Exported so a consumer can construct one deliberately, supply its own record
75
+ * store, or implement {@link SecureIdentityProvider} against custody of its own.
76
+ * The platform offers the capability; it does not impose an implementation.
77
+ */
78
+ var webcrypto_identity_provider_2 = require("./crypto/webcrypto-identity-provider");
79
+ Object.defineProperty(exports, "WebCryptoIdentityProvider", { enumerable: true, get: function () { return webcrypto_identity_provider_2.WebCryptoIdentityProvider; } });
80
+ Object.defineProperty(exports, "IndexedDbIdentityRecordStore", { enumerable: true, get: function () { return webcrypto_identity_provider_2.IndexedDbIdentityRecordStore; } });
81
+ Object.defineProperty(exports, "MemoryIdentityRecordStore", { enumerable: true, get: function () { return webcrypto_identity_provider_2.MemoryIdentityRecordStore; } });
38
82
  exports.default = { initialize };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Transport auto-select (Phase 4.6).
2
+ * Transport auto-select.
3
3
  *
4
4
  * Tiny helper that probes which transport lanes the runtime AND the platform
5
5
  * BOTH support, and returns the best one for this client/host pair.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Transport auto-select (Phase 4.6).
3
+ * Transport auto-select.
4
4
  *
5
5
  * Tiny helper that probes which transport lanes the runtime AND the platform
6
6
  * BOTH support, and returns the best one for this client/host pair.
@@ -116,7 +116,7 @@ export interface WireGroupCallFrame {
116
116
  groupId: string;
117
117
  targetUserId?: string;
118
118
  payload?: string;
119
- /** Set instead of groupId when the multi-party call belongs to a Room (Feature 3.1). */
119
+ /** Set instead of groupId when the multi-party call belongs to a Room. */
120
120
  roomId?: string;
121
121
  }
122
122
  /**
@@ -404,7 +404,7 @@ class ProtobufCodec {
404
404
  // Event.type is a SCREAMING_SNAKE_CASE enum string (e.g. LIMIT_REACHED).
405
405
  // A GroupMessageNotification, BroadcastNotification, or Ack decoded here
406
406
  // carries a UUID (messageId / broadcastId) in field 1, which never matches
407
- // this shape so this reliably rejects those overlapping frame types and
407
+ // this shape, so this reliably rejects those overlapping frame types and
408
408
  // lets Event be probed before them.
409
409
  if (!decoded.type || !/^[A-Z][A-Z0-9_]*$/.test(decoded.type)) {
410
410
  return null;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SSE-lane primitive (Phase 4.2.1 v1).
2
+ * SSE-lane primitive.
3
3
  *
4
4
  * Standalone client for the platform's HTTP fallback transport
5
5
  * (`GET /v1/transport/stream` for receive, `POST /v1/transport/send` for
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * SSE-lane primitive (Phase 4.2.1 v1).
3
+ * SSE-lane primitive.
4
4
  *
5
5
  * Standalone client for the platform's HTTP fallback transport
6
6
  * (`GET /v1/transport/stream` for receive, `POST /v1/transport/send` for
@@ -1,8 +1,8 @@
1
1
  /**
2
- * WebTransport (HTTP/3) lane primitive (Phase 4.3).
2
+ * WebTransport (HTTP/3) lane primitive.
3
3
  *
4
- * Standalone client for the platform's WebTransport endpoint, terminated by
5
- * the `droponair-webtransport` Go sidecar and bridged into sdk-be `/ws`.
4
+ * Standalone client for the platform's WebTransport endpoint, which carries
5
+ * the same session as the WebSocket lane.
6
6
  * Browser-native `WebTransport` API; no polyfill ships with the SDK.
7
7
  *
8
8
  * Browser support as of 2026-05:
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * WebTransport (HTTP/3) lane primitive (Phase 4.3).
3
+ * WebTransport (HTTP/3) lane primitive.
4
4
  *
5
- * Standalone client for the platform's WebTransport endpoint, terminated by
6
- * the `droponair-webtransport` Go sidecar and bridged into sdk-be `/ws`.
5
+ * Standalone client for the platform's WebTransport endpoint, which carries
6
+ * the same session as the WebSocket lane.
7
7
  * Browser-native `WebTransport` API; no polyfill ships with the SDK.
8
8
  *
9
9
  * Browser support as of 2026-05:
package/dist/version.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * MINOR, additive feature (e.g. multi-device payloads, new call event type)
8
8
  * PATCH, bug-fix / perf improvement with no wire or API change
9
9
  */
10
- export declare const SDK_VERSION = "0.24.3";
10
+ export declare const SDK_VERSION = "0.25.1";
11
11
  /**
12
12
  * Binary encrypted-payload format version.
13
13
  * Included as the first byte of every encrypted payload so receivers can
package/dist/version.js CHANGED
@@ -10,7 +10,7 @@ exports.PROTOCOL_VERSION = exports.PAYLOAD_FORMAT_VERSION = exports.SDK_VERSION
10
10
  * MINOR, additive feature (e.g. multi-device payloads, new call event type)
11
11
  * PATCH, bug-fix / perf improvement with no wire or API change
12
12
  */
13
- exports.SDK_VERSION = '0.24.3';
13
+ exports.SDK_VERSION = '0.25.1';
14
14
  /**
15
15
  * Binary encrypted-payload format version.
16
16
  * Included as the first byte of every encrypted payload so receivers can
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@droponair/sdk-js",
3
- "version": "0.24.3",
4
- "description": "DropOnAir SDK for end-to-end encrypted messaging",
3
+ "version": "0.25.1",
4
+ "description": "End-to-end encrypted messaging, voice and video calling SDK. The relay never sees your keys or message content.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
@@ -18,19 +18,30 @@
18
18
  "prepublishOnly": "npm run build"
19
19
  },
20
20
  "keywords": [
21
- "droponair",
22
- "messaging",
23
21
  "e2ee",
24
- "encryption",
25
- "end-to-end",
26
- "sdk"
22
+ "end-to-end-encryption",
23
+ "encrypted-chat",
24
+ "chat-api",
25
+ "chat-sdk",
26
+ "messaging",
27
+ "messaging-sdk",
28
+ "realtime",
29
+ "websocket",
30
+ "webrtc",
31
+ "voice-calls",
32
+ "video-calls",
33
+ "video-calling",
34
+ "group-chat",
35
+ "push-notifications",
36
+ "sdk",
37
+ "droponair"
27
38
  ],
28
39
  "author": "DropOnAir",
29
40
  "license": "MIT",
30
41
  "publishConfig": {
31
42
  "access": "public"
32
43
  },
33
- "homepage": "https://droponair.com",
44
+ "homepage": "https://www.droponair.com/",
34
45
  "engines": {
35
46
  "node": ">=18.0.0"
36
47
  },
@@ -40,10 +51,18 @@
40
51
  "tweetnacl-util": "^0.15.1"
41
52
  },
42
53
  "devDependencies": {
54
+ "@playwright/test": "^1.62.1",
55
+ "@types/jest": "^30.0.0",
43
56
  "@types/node": "^20.0.0",
57
+ "esbuild": "^0.28.2",
44
58
  "eslint": "^8.0.0",
45
59
  "jest": "^29.0.0",
60
+ "ts-jest": "^29.4.12",
46
61
  "ts-node": "^10.9.2",
47
62
  "typescript": "^5.0.0"
63
+ },
64
+ "bugs": {
65
+ "url": "https://www.droponair.com/contact/",
66
+ "email": "info@droponair.com"
48
67
  }
49
68
  }