@open-e2ee/signal-protocol-sdk 0.4.0 → 2.0.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/CHANGELOG.md +126 -5
- package/COMMERCIAL.md +1 -1
- package/README.md +10 -7
- package/SECURITY.md +2 -2
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/device/README.md +7 -5
- package/dist/client/client.d.ts +3 -2
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +58 -25
- package/dist/client/client.js.map +1 -1
- package/dist/client/config.d.ts +46 -7
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js +2 -2
- package/dist/client/config.js.map +1 -1
- package/dist/client/constants.d.ts +4 -2
- package/dist/client/constants.d.ts.map +1 -1
- package/dist/client/constants.js +4 -2
- package/dist/client/constants.js.map +1 -1
- package/dist/client/group-outbox.d.ts +38 -0
- package/dist/client/group-outbox.d.ts.map +1 -0
- package/dist/client/group-outbox.js +224 -0
- package/dist/client/group-outbox.js.map +1 -0
- package/dist/client/group-sealed-sender.d.ts +28 -0
- package/dist/client/group-sealed-sender.d.ts.map +1 -0
- package/dist/client/group-sealed-sender.js +74 -0
- package/dist/client/group-sealed-sender.js.map +1 -0
- package/dist/client/hosted-connection.d.ts +16 -0
- package/dist/client/hosted-connection.d.ts.map +1 -0
- package/dist/client/hosted-connection.js +255 -0
- package/dist/client/hosted-connection.js.map +1 -0
- package/dist/client/hosted-push.d.ts +57 -0
- package/dist/client/hosted-push.d.ts.map +1 -0
- package/dist/client/hosted-push.js +115 -0
- package/dist/client/hosted-push.js.map +1 -0
- package/dist/client/hosted-transport.d.ts +158 -0
- package/dist/client/hosted-transport.d.ts.map +1 -0
- package/dist/client/hosted-transport.js +926 -0
- package/dist/client/hosted-transport.js.map +1 -0
- package/dist/client/hosted.d.ts +223 -0
- package/dist/client/hosted.d.ts.map +1 -0
- package/dist/client/hosted.js +541 -0
- package/dist/client/hosted.js.map +1 -0
- package/dist/client/index.d.ts +5 -3
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/messages.d.ts.map +1 -1
- package/dist/client/messages.js +4 -5
- package/dist/client/messages.js.map +1 -1
- package/dist/client/relay-subscription.d.ts.map +1 -1
- package/dist/client/relay-subscription.js +37 -7
- package/dist/client/relay-subscription.js.map +1 -1
- package/dist/client/{sealed-sender-ops.d.ts → sealed-sender.d.ts} +39 -22
- package/dist/client/sealed-sender.d.ts.map +1 -0
- package/dist/client/sealed-sender.js +296 -0
- package/dist/client/sealed-sender.js.map +1 -0
- package/dist/client/signal-service-cipher.d.ts +23 -26
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +468 -706
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/types.d.ts +18 -3
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js +6 -0
- package/dist/client/types.js.map +1 -1
- package/dist/device/index.d.ts +2 -2
- package/dist/device/index.d.ts.map +1 -1
- package/dist/device/index.js +1 -1
- package/dist/device/index.js.map +1 -1
- package/dist/device/transfer.d.ts +7 -43
- package/dist/device/transfer.d.ts.map +1 -1
- package/dist/device/transfer.js +31 -150
- package/dist/device/transfer.js.map +1 -1
- package/dist/device/types.d.ts +6 -47
- package/dist/device/types.d.ts.map +1 -1
- package/dist/device/types.js +1 -1
- package/dist/device/types.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/encoding/proto/pq-ratchet-serialize.js +1 -1
- package/dist/internal/encoding/proto/pq-ratchet-serialize.js.map +1 -1
- package/dist/internal/encoding/proto/primitives.js +1 -1
- package/dist/internal/encoding/proto/primitives.js.map +1 -1
- package/dist/internal/groups/manager.d.ts +3 -3
- package/dist/internal/groups/manager.d.ts.map +1 -1
- package/dist/internal/groups/manager.js +5 -4
- package/dist/internal/groups/manager.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/certificate.d.ts +10 -4
- package/dist/internal/protocol/sealed-sender/certificate.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/certificate.js +64 -7
- package/dist/internal/protocol/sealed-sender/certificate.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/decryption.d.ts +34 -47
- package/dist/internal/protocol/sealed-sender/decryption.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/decryption.js +95 -182
- package/dist/internal/protocol/sealed-sender/decryption.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/encryption.d.ts +49 -64
- package/dist/internal/protocol/sealed-sender/encryption.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/encryption.js +120 -123
- package/dist/internal/protocol/sealed-sender/encryption.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/index.d.ts +5 -7
- package/dist/internal/protocol/sealed-sender/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/index.js +4 -12
- package/dist/internal/protocol/sealed-sender/index.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/{v2-helpers.d.ts → multi-recipient-crypto.d.ts} +1 -1
- package/dist/internal/protocol/sealed-sender/multi-recipient-crypto.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/{v2-helpers.js → multi-recipient-crypto.js} +1 -1
- package/dist/internal/protocol/sealed-sender/multi-recipient-crypto.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/{v2-binary.d.ts → multi-recipient-message.d.ts} +3 -2
- package/dist/internal/protocol/sealed-sender/multi-recipient-message.d.ts.map +1 -0
- package/dist/internal/protocol/sealed-sender/{v2-binary.js → multi-recipient-message.js} +16 -8
- package/dist/internal/protocol/sealed-sender/multi-recipient-message.js.map +1 -0
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts +3 -0
- package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/proto/index.js +25 -2
- package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/trust-root.d.ts +11 -1
- package/dist/internal/protocol/sealed-sender/trust-root.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/trust-root.js +13 -1
- package/dist/internal/protocol/sealed-sender/trust-root.js.map +1 -1
- package/dist/internal/protocol/sealed-sender/types.d.ts +20 -135
- package/dist/internal/protocol/sealed-sender/types.d.ts.map +1 -1
- package/dist/internal/protocol/sealed-sender/types.js +15 -6
- package/dist/internal/protocol/sealed-sender/types.js.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.d.ts +22 -1
- package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
- package/dist/internal/protocol/sender-keys/manager.js +39 -4
- package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
- package/dist/internal/protocol/spqr/braid-serialize.js +1 -1
- package/dist/internal/protocol/spqr/braid-serialize.js.map +1 -1
- package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js +4 -4
- package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js.map +1 -1
- package/dist/internal/protocol/zk/groups/index.d.ts +1 -1
- package/dist/internal/protocol/zk/groups/index.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/index.js +1 -1
- package/dist/internal/protocol/zk/groups/index.js.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts +37 -12
- package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts.map +1 -1
- package/dist/internal/protocol/zk/groups/profile-key-credential.js +104 -31
- package/dist/internal/protocol/zk/groups/profile-key-credential.js.map +1 -1
- package/dist/local/store/expo/adapter.d.ts +1 -0
- package/dist/local/store/expo/adapter.d.ts.map +1 -1
- package/dist/local/store/expo/adapter.js +3 -0
- package/dist/local/store/expo/adapter.js.map +1 -1
- package/dist/local/store/expo/key-storage.d.ts +1 -0
- package/dist/local/store/expo/key-storage.d.ts.map +1 -1
- package/dist/local/store/expo/key-storage.js +4 -0
- package/dist/local/store/expo/key-storage.js.map +1 -1
- package/dist/local/store/memory/adapter.d.ts +1 -0
- package/dist/local/store/memory/adapter.d.ts.map +1 -1
- package/dist/local/store/memory/adapter.js +4 -0
- package/dist/local/store/memory/adapter.js.map +1 -1
- package/dist/local/store/node/adapter.d.ts +1 -0
- package/dist/local/store/node/adapter.d.ts.map +1 -1
- package/dist/local/store/node/adapter.js +3 -0
- package/dist/local/store/node/adapter.js.map +1 -1
- package/dist/local/store/node/database.d.ts +1 -0
- package/dist/local/store/node/database.d.ts.map +1 -1
- package/dist/local/store/node/database.js +5 -0
- package/dist/local/store/node/database.js.map +1 -1
- package/dist/local/store/react-native/adapter.d.ts +1 -0
- package/dist/local/store/react-native/adapter.d.ts.map +1 -1
- package/dist/local/store/react-native/adapter.js +4 -0
- package/dist/local/store/react-native/adapter.js.map +1 -1
- package/dist/local/store/react-native/reference-backend.js +1 -1
- package/dist/local/store/react-native/reference-backend.js.map +1 -1
- package/dist/local/store/reliability.d.ts +63 -0
- package/dist/local/store/reliability.d.ts.map +1 -0
- package/dist/local/store/reliability.js +219 -0
- package/dist/local/store/reliability.js.map +1 -0
- package/dist/local/store/web/adapter.d.ts +1 -0
- package/dist/local/store/web/adapter.d.ts.map +1 -1
- package/dist/local/store/web/adapter.js +5 -0
- package/dist/local/store/web/adapter.js.map +1 -1
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +7 -4
- package/dist/media/index.js.map +1 -1
- package/dist/remote/object-store/convex-r2/server.d.ts +4 -2
- package/dist/remote/object-store/convex-r2/server.d.ts.map +1 -1
- package/dist/remote/object-store/convex-r2/server.js +8 -0
- package/dist/remote/object-store/convex-r2/server.js.map +1 -1
- package/dist/remote/object-store/convex-r2/storage.d.ts +5 -1
- package/dist/remote/object-store/convex-r2/storage.d.ts.map +1 -1
- package/dist/remote/object-store/convex-r2/storage.js +1 -0
- package/dist/remote/object-store/convex-r2/storage.js.map +1 -1
- package/dist/remote/object-store/types.d.ts +2 -0
- package/dist/remote/object-store/types.d.ts.map +1 -1
- package/dist/remote/object-store/validation.d.ts.map +1 -1
- package/dist/remote/object-store/validation.js +3 -0
- package/dist/remote/object-store/validation.js.map +1 -1
- package/dist/remote/relay/convex/backend.d.ts +7 -18
- package/dist/remote/relay/convex/backend.d.ts.map +1 -1
- package/dist/remote/relay/convex/backend.js +15 -24
- package/dist/remote/relay/convex/backend.js.map +1 -1
- package/dist/remote/relay/convex/component/_generated/component.d.ts +10 -18
- package/dist/remote/relay/convex/component/_generated/component.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/certificates.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/certificates.js +14 -5
- package/dist/remote/relay/convex/component/certificates.js.map +1 -1
- package/dist/remote/relay/convex/component/messages.d.ts +3 -17
- package/dist/remote/relay/convex/component/messages.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/messages.js +28 -56
- package/dist/remote/relay/convex/component/messages.js.map +1 -1
- package/dist/remote/relay/convex/component/schema.d.ts +6 -6
- package/dist/remote/relay/convex/component/schema.js +2 -2
- package/dist/remote/relay/convex/component/schema.js.map +1 -1
- package/dist/remote/relay/convex/component/zkAuth.d.ts +7 -1
- package/dist/remote/relay/convex/component/zkAuth.d.ts.map +1 -1
- package/dist/remote/relay/convex/component/zkAuth.js +29 -14
- package/dist/remote/relay/convex/component/zkAuth.js.map +1 -1
- package/dist/remote/relay/convex/relay.d.ts +3 -6
- package/dist/remote/relay/convex/relay.d.ts.map +1 -1
- package/dist/remote/relay/convex/relay.js +23 -50
- package/dist/remote/relay/convex/relay.js.map +1 -1
- package/dist/remote/relay/index.d.ts +1 -1
- package/dist/remote/relay/index.d.ts.map +1 -1
- package/dist/remote/relay/index.js.map +1 -1
- package/dist/remote/relay/memory/adapter.d.ts +5 -11
- package/dist/remote/relay/memory/adapter.d.ts.map +1 -1
- package/dist/remote/relay/memory/adapter.js +41 -34
- package/dist/remote/relay/memory/adapter.js.map +1 -1
- package/dist/remote/relay/types.d.ts +19 -29
- package/dist/remote/relay/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +2 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/errors.d.ts +8 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +9 -2
- package/dist/types/errors.js.map +1 -1
- package/dist/types/protocol-config.d.ts +1 -1
- package/dist/username/link.d.ts.map +1 -1
- package/dist/username/link.js +1 -1
- package/dist/username/link.js.map +1 -1
- package/docs/ASSURANCE.md +5 -5
- package/docs/DEVIATIONS.md +32 -61
- package/docs/GETTING_STARTED.md +7 -0
- package/docs/SECURITY.md +6 -0
- package/package.json +2 -2
- package/remote/relay/convex/component/README.md +28 -24
- package/scripts/oe-groups.mjs +5 -1
- package/dist/client/sealed-sender-ops.d.ts.map +0 -1
- package/dist/client/sealed-sender-ops.js +0 -203
- package/dist/client/sealed-sender-ops.js.map +0 -1
- package/dist/internal/protocol/sealed-sender/decryption-v2.d.ts +0 -46
- package/dist/internal/protocol/sealed-sender/decryption-v2.d.ts.map +0 -1
- package/dist/internal/protocol/sealed-sender/decryption-v2.js +0 -198
- package/dist/internal/protocol/sealed-sender/decryption-v2.js.map +0 -1
- package/dist/internal/protocol/sealed-sender/encryption-v2.d.ts +0 -56
- package/dist/internal/protocol/sealed-sender/encryption-v2.d.ts.map +0 -1
- package/dist/internal/protocol/sealed-sender/encryption-v2.js +0 -163
- package/dist/internal/protocol/sealed-sender/encryption-v2.js.map +0 -1
- package/dist/internal/protocol/sealed-sender/v2-binary.d.ts.map +0 -1
- package/dist/internal/protocol/sealed-sender/v2-binary.js.map +0 -1
- package/dist/internal/protocol/sealed-sender/v2-helpers.d.ts.map +0 -1
- package/dist/internal/protocol/sealed-sender/v2-helpers.js.map +0 -1
|
@@ -0,0 +1,926 @@
|
|
|
1
|
+
import { createCompositeIdentityV1, decodeCompositeIdentityV1, encodeCompositeIdentityV1, } from '../keys/identity.js';
|
|
2
|
+
import { base64ToBytes, bytesToBase64, bytesToUrlSafeBase64, concatBytes, generateUuidV4, sha256, stringToBytes, urlSafeToBase64, } from '../internal/crypto/index.js';
|
|
3
|
+
const SESSION_METADATA_PREFIX = 'hostedRelay.session.v1:';
|
|
4
|
+
const DEVICE_TOKEN_REFRESH_SECONDS = 60;
|
|
5
|
+
const MAXIMUM_RESPONSE_BYTES = 1024 * 1024;
|
|
6
|
+
const HOSTED_ONE_TIME_PREKEY_LIMIT = 100;
|
|
7
|
+
const PREKEY_EXPIRY_MILLISECONDS = 30 * 24 * 60 * 60 * 1000;
|
|
8
|
+
const POLL_MILLISECONDS = 2_000;
|
|
9
|
+
const DELIVERY_WIRE_VERSION = 1;
|
|
10
|
+
const DEVICE_AUTHENTICATION_SIGNATURE_LABEL = stringToBytes('OpenE2EE Relay device authentication v1\0');
|
|
11
|
+
const REGISTRATION_MATERIAL_LABEL = stringToBytes('OpenE2EE Relay registration material v1\0');
|
|
12
|
+
const REGISTRATION_CHALLENGE_LABEL = stringToBytes('OpenE2EE Relay registration challenge v1\0');
|
|
13
|
+
const RECOVERY_CHALLENGE_LABEL = stringToBytes('OpenE2EE Relay recovery challenge v1\0');
|
|
14
|
+
const TOKEN_REFRESH_CHALLENGE_LABEL = stringToBytes('OpenE2EE Relay device token refresh challenge v1\0');
|
|
15
|
+
export class HostedRelayHttpError extends Error {
|
|
16
|
+
code;
|
|
17
|
+
data;
|
|
18
|
+
status;
|
|
19
|
+
constructor(status, code, message, data) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = 'HostedRelayHttpError';
|
|
22
|
+
this.status = status;
|
|
23
|
+
this.code = code;
|
|
24
|
+
this.data = data;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function record(value) {
|
|
28
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
29
|
+
}
|
|
30
|
+
function uint32be(value) {
|
|
31
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > 0xffff_ffff) {
|
|
32
|
+
throw new Error('Hosted Relay unsigned integer is invalid');
|
|
33
|
+
}
|
|
34
|
+
return new Uint8Array([value >>> 24, value >>> 16, value >>> 8, value]);
|
|
35
|
+
}
|
|
36
|
+
function lengthPrefixed(value) {
|
|
37
|
+
return concatBytes(uint32be(value.length), value);
|
|
38
|
+
}
|
|
39
|
+
function text(value) {
|
|
40
|
+
return lengthPrefixed(stringToBytes(value));
|
|
41
|
+
}
|
|
42
|
+
function equalBytes(left, right) {
|
|
43
|
+
if (left.length !== right.length)
|
|
44
|
+
return false;
|
|
45
|
+
let difference = 0;
|
|
46
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
47
|
+
difference |= left[index] ^ right[index];
|
|
48
|
+
}
|
|
49
|
+
return difference === 0;
|
|
50
|
+
}
|
|
51
|
+
function canonicalBase64(value) {
|
|
52
|
+
return bytesToBase64(value);
|
|
53
|
+
}
|
|
54
|
+
function decodeCanonicalBase64(value, label) {
|
|
55
|
+
if (typeof value !== 'string')
|
|
56
|
+
throw new Error(`${label} is invalid`);
|
|
57
|
+
const decoded = base64ToBytes(value);
|
|
58
|
+
if (bytesToBase64(decoded) !== value)
|
|
59
|
+
throw new Error(`${label} is invalid`);
|
|
60
|
+
return decoded;
|
|
61
|
+
}
|
|
62
|
+
function decodeBase64Url(value, label) {
|
|
63
|
+
try {
|
|
64
|
+
const decoded = base64ToBytes(urlSafeToBase64(value));
|
|
65
|
+
if (bytesToUrlSafeBase64(decoded) !== value)
|
|
66
|
+
throw new Error();
|
|
67
|
+
return decoded;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
throw new Error(`${label} is invalid`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function relayScopeId(connection) {
|
|
74
|
+
return bytesToUrlSafeBase64(connection.relayScopeId);
|
|
75
|
+
}
|
|
76
|
+
function identifiedEndpoint(connection) {
|
|
77
|
+
return connection.protocolEndpoint.replace(/\/$/u, '');
|
|
78
|
+
}
|
|
79
|
+
async function parseResponse(response) {
|
|
80
|
+
const body = await response.text();
|
|
81
|
+
if (body.length > MAXIMUM_RESPONSE_BYTES) {
|
|
82
|
+
throw new Error('Managed Relay response is too large');
|
|
83
|
+
}
|
|
84
|
+
if (response.ok && response.status === 204) {
|
|
85
|
+
if (body.length !== 0) {
|
|
86
|
+
throw new Error('Managed Relay returned an invalid response');
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
let parsed;
|
|
91
|
+
try {
|
|
92
|
+
parsed = JSON.parse(body);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
throw new Error('Managed Relay returned invalid JSON');
|
|
96
|
+
}
|
|
97
|
+
if (!response.ok) {
|
|
98
|
+
const error = record(parsed) && record(parsed.error) ? parsed.error : {};
|
|
99
|
+
const code = typeof error.code === 'string' ? error.code : 'UNKNOWN';
|
|
100
|
+
const message = typeof error.message === 'string'
|
|
101
|
+
? error.message
|
|
102
|
+
: 'Managed Relay request failed';
|
|
103
|
+
throw new HostedRelayHttpError(response.status, code, message);
|
|
104
|
+
}
|
|
105
|
+
return parsed;
|
|
106
|
+
}
|
|
107
|
+
async function postJson(connection, path, body, token) {
|
|
108
|
+
const headers = new Headers({
|
|
109
|
+
accept: 'application/json',
|
|
110
|
+
'content-type': 'application/json',
|
|
111
|
+
});
|
|
112
|
+
if (token !== undefined)
|
|
113
|
+
headers.set('authorization', `Bearer ${token}`);
|
|
114
|
+
let response;
|
|
115
|
+
try {
|
|
116
|
+
response = await fetch(`${identifiedEndpoint(connection)}${path}`, {
|
|
117
|
+
body: JSON.stringify(body),
|
|
118
|
+
headers,
|
|
119
|
+
method: 'POST',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
catch (cause) {
|
|
123
|
+
throw new Error('Managed Relay request could not be completed', { cause });
|
|
124
|
+
}
|
|
125
|
+
return parseResponse(response);
|
|
126
|
+
}
|
|
127
|
+
function assertionIdentifier(assertion) {
|
|
128
|
+
const parts = assertion.split('.');
|
|
129
|
+
if (parts.length !== 3) {
|
|
130
|
+
throw new Error('Identity provider returned an invalid assertion');
|
|
131
|
+
}
|
|
132
|
+
let claims;
|
|
133
|
+
try {
|
|
134
|
+
claims = JSON.parse(new TextDecoder().decode(decodeBase64Url(parts[1], 'Assertion claims')));
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
throw new Error('Identity provider returned an invalid assertion');
|
|
138
|
+
}
|
|
139
|
+
if (!record(claims) || typeof claims.jti !== 'string' || !claims.jti) {
|
|
140
|
+
throw new Error('Identity provider returned an invalid assertion');
|
|
141
|
+
}
|
|
142
|
+
return claims.jti;
|
|
143
|
+
}
|
|
144
|
+
function serializedPreKey(prekey) {
|
|
145
|
+
return {
|
|
146
|
+
algorithm: prekey.algorithm,
|
|
147
|
+
keyId: prekey.keyId,
|
|
148
|
+
publicKey: canonicalBase64(prekey.publicKey),
|
|
149
|
+
...(prekey.signature === undefined
|
|
150
|
+
? {}
|
|
151
|
+
: { signature: canonicalBase64(prekey.signature) }),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function signalRegistration(identity, registrationId, prekeys) {
|
|
155
|
+
return {
|
|
156
|
+
identity,
|
|
157
|
+
oneTimePreKeys: prekeys.oneTimePreKeys.map(serializedPreKey),
|
|
158
|
+
registrationId,
|
|
159
|
+
signedPreKeys: prekeys.signedPreKeys.map(serializedPreKey),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
async function registrationMaterialFingerprint(identity, registrationId, prekeys) {
|
|
163
|
+
const entries = [
|
|
164
|
+
...prekeys.signedPreKeys.map((prekey) => ({
|
|
165
|
+
...prekey,
|
|
166
|
+
kind: 'signed',
|
|
167
|
+
})),
|
|
168
|
+
...prekeys.oneTimePreKeys.map((prekey) => ({
|
|
169
|
+
...prekey,
|
|
170
|
+
kind: 'one-time',
|
|
171
|
+
})),
|
|
172
|
+
].sort((left, right) => `${left.kind}:${left.algorithm}:${String(left.keyId)}`.localeCompare(`${right.kind}:${right.algorithm}:${String(right.keyId)}`));
|
|
173
|
+
return bytesToUrlSafeBase64(await sha256(concatBytes(REGISTRATION_MATERIAL_LABEL, text('aci'), text('signal-composite-v1'), uint32be(registrationId), lengthPrefixed(encodeCompositeIdentityV1(identity)), ...entries.flatMap((prekey) => [
|
|
174
|
+
text(prekey.kind),
|
|
175
|
+
text(prekey.algorithm),
|
|
176
|
+
uint32be(prekey.keyId),
|
|
177
|
+
lengthPrefixed(prekey.publicKey),
|
|
178
|
+
lengthPrefixed(prekey.signature ?? new Uint8Array()),
|
|
179
|
+
]))));
|
|
180
|
+
}
|
|
181
|
+
async function registrationChallenge(request) {
|
|
182
|
+
return sha256(concatBytes(request.assertionPurpose === 'recover'
|
|
183
|
+
? RECOVERY_CHALLENGE_LABEL
|
|
184
|
+
: REGISTRATION_CHALLENGE_LABEL, text(relayScopeId(request.connection)), text(assertionIdentifier(request.assertion)), text(request.operationId), text(await registrationMaterialFingerprint(request.signalIdentity, request.registrationId, request.registrationPreKeys))));
|
|
185
|
+
}
|
|
186
|
+
async function sessionMetadataKey(connection) {
|
|
187
|
+
return `${SESSION_METADATA_PREFIX}${bytesToUrlSafeBase64(await sha256(concatBytes(stringToBytes(connection.publishableKey), new Uint8Array([0]), connection.relayScopeId)))}`;
|
|
188
|
+
}
|
|
189
|
+
function parseSession(value, connection) {
|
|
190
|
+
let parsed;
|
|
191
|
+
try {
|
|
192
|
+
parsed = JSON.parse(value);
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
throw new Error('Stored hosted Relay session is invalid');
|
|
196
|
+
}
|
|
197
|
+
if (!record(parsed) ||
|
|
198
|
+
Object.keys(parsed).sort().join(',') !==
|
|
199
|
+
'canonicalAccountId,deviceId,deviceToken,generation,mailboxGeneration,relayScopeId' ||
|
|
200
|
+
typeof parsed.canonicalAccountId !== 'string' ||
|
|
201
|
+
!parsed.canonicalAccountId ||
|
|
202
|
+
!Number.isSafeInteger(parsed.deviceId) ||
|
|
203
|
+
parsed.deviceId < 1 ||
|
|
204
|
+
typeof parsed.deviceToken !== 'string' ||
|
|
205
|
+
!parsed.deviceToken ||
|
|
206
|
+
!Number.isSafeInteger(parsed.generation) ||
|
|
207
|
+
parsed.generation < 0 ||
|
|
208
|
+
!Number.isSafeInteger(parsed.mailboxGeneration) ||
|
|
209
|
+
parsed.mailboxGeneration < 0 ||
|
|
210
|
+
parsed.relayScopeId !== relayScopeId(connection)) {
|
|
211
|
+
throw new Error('Stored hosted Relay session is invalid');
|
|
212
|
+
}
|
|
213
|
+
return parsed;
|
|
214
|
+
}
|
|
215
|
+
function tokenExpiration(token, session) {
|
|
216
|
+
const parts = token.split('.');
|
|
217
|
+
if (parts.length !== 3)
|
|
218
|
+
return 0;
|
|
219
|
+
try {
|
|
220
|
+
const claims = JSON.parse(new TextDecoder().decode(decodeBase64Url(parts[1], 'Device token')));
|
|
221
|
+
if (!record(claims) ||
|
|
222
|
+
claims.account_id !== session.canonicalAccountId ||
|
|
223
|
+
claims.device_id !== session.deviceId ||
|
|
224
|
+
claims.generation !== session.generation ||
|
|
225
|
+
claims.mailbox_generation !== session.mailboxGeneration ||
|
|
226
|
+
claims.relay_scope_id !== session.relayScopeId ||
|
|
227
|
+
!Number.isSafeInteger(claims.exp)) {
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
230
|
+
return claims.exp;
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
return 0;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function requiredNumber(object, key) {
|
|
237
|
+
const value = object[key];
|
|
238
|
+
if (!Number.isSafeInteger(value))
|
|
239
|
+
throw new Error('Managed Relay returned invalid data');
|
|
240
|
+
return value;
|
|
241
|
+
}
|
|
242
|
+
function requiredString(object, key) {
|
|
243
|
+
const value = object[key];
|
|
244
|
+
if (typeof value !== 'string' || !value)
|
|
245
|
+
throw new Error('Managed Relay returned invalid data');
|
|
246
|
+
return value;
|
|
247
|
+
}
|
|
248
|
+
function unsupported(operation) {
|
|
249
|
+
throw new Error(`Managed Relay does not support ${operation} through this contract`);
|
|
250
|
+
}
|
|
251
|
+
function encodeDeliveryWire(envelope) {
|
|
252
|
+
const ciphertext = envelope.ciphertext instanceof Uint8Array
|
|
253
|
+
? bytesToBase64(envelope.ciphertext)
|
|
254
|
+
: envelope.ciphertext;
|
|
255
|
+
if (bytesToBase64(base64ToBytes(ciphertext)) !== ciphertext) {
|
|
256
|
+
throw new Error('Managed Relay envelope ciphertext is invalid');
|
|
257
|
+
}
|
|
258
|
+
const wire = {
|
|
259
|
+
ciphertext,
|
|
260
|
+
...(envelope.contentHint === undefined
|
|
261
|
+
? {}
|
|
262
|
+
: { contentHint: envelope.contentHint }),
|
|
263
|
+
messageType: envelope.messageType,
|
|
264
|
+
timestamp: envelope.timestamp,
|
|
265
|
+
version: DELIVERY_WIRE_VERSION,
|
|
266
|
+
};
|
|
267
|
+
return stringToBytes(JSON.stringify(wire));
|
|
268
|
+
}
|
|
269
|
+
function decodeDeliveryWire(value) {
|
|
270
|
+
let wire;
|
|
271
|
+
try {
|
|
272
|
+
wire = JSON.parse(new TextDecoder().decode(value));
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
throw new Error('Managed Relay mailbox envelope is invalid');
|
|
276
|
+
}
|
|
277
|
+
if (!record(wire) ||
|
|
278
|
+
typeof wire.ciphertext !== 'string' ||
|
|
279
|
+
bytesToBase64(base64ToBytes(wire.ciphertext)) !== wire.ciphertext ||
|
|
280
|
+
(wire.contentHint !== undefined && !Number.isSafeInteger(wire.contentHint)) ||
|
|
281
|
+
typeof wire.messageType !== 'string' ||
|
|
282
|
+
!Number.isSafeInteger(wire.timestamp) ||
|
|
283
|
+
wire.version !== DELIVERY_WIRE_VERSION) {
|
|
284
|
+
throw new Error('Managed Relay mailbox envelope is invalid');
|
|
285
|
+
}
|
|
286
|
+
return wire;
|
|
287
|
+
}
|
|
288
|
+
export class HostedRelayHttpTransport {
|
|
289
|
+
connection;
|
|
290
|
+
storage;
|
|
291
|
+
deviceAuthentication;
|
|
292
|
+
session;
|
|
293
|
+
refreshPromise;
|
|
294
|
+
destinationGenerations = new Map();
|
|
295
|
+
constructor(connection, storage, deviceAuthentication, session) {
|
|
296
|
+
this.connection = connection;
|
|
297
|
+
this.storage = storage;
|
|
298
|
+
this.deviceAuthentication = deviceAuthentication;
|
|
299
|
+
this.session = session;
|
|
300
|
+
}
|
|
301
|
+
get accountId() {
|
|
302
|
+
return this.session.canonicalAccountId;
|
|
303
|
+
}
|
|
304
|
+
get deviceId() {
|
|
305
|
+
return this.session.deviceId;
|
|
306
|
+
}
|
|
307
|
+
objectStore = {
|
|
308
|
+
createUpload: async (input) => this.createObjectUpload(input),
|
|
309
|
+
createDownload: async (input) => this.createObjectDownload(input),
|
|
310
|
+
completeUpload: async ({ objectId }) => {
|
|
311
|
+
await this.authenticatedPost('/objects/commit-upload', {
|
|
312
|
+
objectId,
|
|
313
|
+
publishableKey: this.connection.publishableKey,
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
deleteObject: async ({ objectId }) => {
|
|
317
|
+
await this.authenticatedPost('/objects/delete', {
|
|
318
|
+
objectId,
|
|
319
|
+
publishableKey: this.connection.publishableKey,
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
async persistSession() {
|
|
324
|
+
await this.storage.setMetadata(await sessionMetadataKey(this.connection), JSON.stringify(this.session));
|
|
325
|
+
}
|
|
326
|
+
async refreshToken() {
|
|
327
|
+
const requestedAtSeconds = Math.floor(Date.now() / 1_000);
|
|
328
|
+
const nonce = crypto.getRandomValues(new Uint8Array(32));
|
|
329
|
+
const challenge = await sha256(concatBytes(TOKEN_REFRESH_CHALLENGE_LABEL, text(this.session.relayScopeId), text(this.session.canonicalAccountId), uint32be(this.session.deviceId), uint32be(this.session.generation), uint32be(this.session.mailboxGeneration), text(String(requestedAtSeconds)), lengthPrefixed(nonce)));
|
|
330
|
+
const proof = await this.deviceAuthentication.signChallenge(challenge);
|
|
331
|
+
const value = await postJson(this.connection, '/identity/token', {
|
|
332
|
+
accountAddress: this.session.canonicalAccountId,
|
|
333
|
+
deviceId: this.session.deviceId,
|
|
334
|
+
deviceProof: bytesToBase64(proof),
|
|
335
|
+
nonce: bytesToUrlSafeBase64(nonce),
|
|
336
|
+
publishableKey: this.connection.publishableKey,
|
|
337
|
+
requestedAtSeconds,
|
|
338
|
+
});
|
|
339
|
+
if (!record(value) || typeof value.deviceToken !== 'string') {
|
|
340
|
+
throw new Error('Managed Relay returned an invalid device token');
|
|
341
|
+
}
|
|
342
|
+
this.session = { ...this.session, deviceToken: value.deviceToken };
|
|
343
|
+
if (tokenExpiration(this.session.deviceToken, this.session) <= requestedAtSeconds) {
|
|
344
|
+
throw new Error('Managed Relay returned an invalid device token');
|
|
345
|
+
}
|
|
346
|
+
await this.persistSession();
|
|
347
|
+
}
|
|
348
|
+
async token(force = false) {
|
|
349
|
+
const now = Math.floor(Date.now() / 1_000);
|
|
350
|
+
if (!force &&
|
|
351
|
+
tokenExpiration(this.session.deviceToken, this.session) >
|
|
352
|
+
now + DEVICE_TOKEN_REFRESH_SECONDS) {
|
|
353
|
+
return this.session.deviceToken;
|
|
354
|
+
}
|
|
355
|
+
this.refreshPromise ??= this.refreshToken().finally(() => {
|
|
356
|
+
this.refreshPromise = undefined;
|
|
357
|
+
});
|
|
358
|
+
await this.refreshPromise;
|
|
359
|
+
return this.session.deviceToken;
|
|
360
|
+
}
|
|
361
|
+
/** Verify that the stored device authority can obtain a current token. */
|
|
362
|
+
async ensureAuthenticated(force = false) {
|
|
363
|
+
await this.token(force);
|
|
364
|
+
}
|
|
365
|
+
async authenticatedPost(path, body) {
|
|
366
|
+
let token = await this.token();
|
|
367
|
+
try {
|
|
368
|
+
return await postJson(this.connection, path, body, token);
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
if (!(error instanceof HostedRelayHttpError) || error.code !== 'TOKEN_INVALID') {
|
|
372
|
+
throw error;
|
|
373
|
+
}
|
|
374
|
+
token = await this.token(true);
|
|
375
|
+
return postJson(this.connection, path, body, token);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
assertCurrentIdentity(userId, deviceId, identityType = 'aci') {
|
|
379
|
+
if (userId !== this.session.canonicalAccountId ||
|
|
380
|
+
deviceId !== this.session.deviceId ||
|
|
381
|
+
identityType !== 'aci') {
|
|
382
|
+
throw new Error('Managed Relay operation crossed the current device authority');
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
async directory(userId) {
|
|
386
|
+
const value = await this.authenticatedPost('/identity/devices', {
|
|
387
|
+
accountAddress: userId,
|
|
388
|
+
publishableKey: this.connection.publishableKey,
|
|
389
|
+
});
|
|
390
|
+
if (!record(value) || value.accountAddress !== userId || !Array.isArray(value.devices)) {
|
|
391
|
+
throw new Error('Managed Relay returned an invalid device directory');
|
|
392
|
+
}
|
|
393
|
+
return value.devices.map((candidate) => {
|
|
394
|
+
if (!record(candidate))
|
|
395
|
+
throw new Error('Managed Relay returned an invalid device directory');
|
|
396
|
+
const device = {
|
|
397
|
+
deviceId: requiredNumber(candidate, 'deviceId'),
|
|
398
|
+
generation: requiredNumber(candidate, 'generation'),
|
|
399
|
+
mailboxGeneration: requiredNumber(candidate, 'mailboxGeneration'),
|
|
400
|
+
};
|
|
401
|
+
if (device.deviceId < 1 || device.generation < 0 || device.mailboxGeneration < 0) {
|
|
402
|
+
throw new Error('Managed Relay returned an invalid device directory');
|
|
403
|
+
}
|
|
404
|
+
this.destinationGenerations.set(`${userId}\0${String(device.deviceId)}`, device.mailboxGeneration);
|
|
405
|
+
return device;
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
async prekeyStatus(userId, deviceId, identityType = 'aci') {
|
|
409
|
+
if (identityType !== 'aci')
|
|
410
|
+
unsupported('PNI prekey authority');
|
|
411
|
+
const value = await this.authenticatedPost('/prekeys/status', {
|
|
412
|
+
accountAddress: userId,
|
|
413
|
+
deviceId,
|
|
414
|
+
identityType,
|
|
415
|
+
publishableKey: this.connection.publishableKey,
|
|
416
|
+
});
|
|
417
|
+
if (!record(value) ||
|
|
418
|
+
typeof value.identityPublicMaterial !== 'string' ||
|
|
419
|
+
!record(value.oneTimePreKeyCounts) ||
|
|
420
|
+
typeof value.profile !== 'string' ||
|
|
421
|
+
!Array.isArray(value.signedPreKeys)) {
|
|
422
|
+
throw new Error('Managed Relay returned invalid prekey status');
|
|
423
|
+
}
|
|
424
|
+
const signedPreKeys = value.signedPreKeys.map((candidate) => {
|
|
425
|
+
if (!record(candidate))
|
|
426
|
+
throw new Error('Managed Relay returned invalid prekey status');
|
|
427
|
+
return {
|
|
428
|
+
acceptedAtMilliseconds: requiredNumber(candidate, 'acceptedAtMilliseconds'),
|
|
429
|
+
algorithm: requiredString(candidate, 'algorithm'),
|
|
430
|
+
keyId: requiredNumber(candidate, 'keyId'),
|
|
431
|
+
publicKey: decodeCanonicalBase64(candidate.publicKey, 'Prekey public key'),
|
|
432
|
+
signature: decodeCanonicalBase64(candidate.signature, 'Prekey signature'),
|
|
433
|
+
};
|
|
434
|
+
});
|
|
435
|
+
const counts = {};
|
|
436
|
+
for (const [algorithm, count] of Object.entries(value.oneTimePreKeyCounts)) {
|
|
437
|
+
if (!Number.isSafeInteger(count) || count < 0) {
|
|
438
|
+
throw new Error('Managed Relay returned invalid prekey status');
|
|
439
|
+
}
|
|
440
|
+
counts[algorithm] = count;
|
|
441
|
+
}
|
|
442
|
+
return {
|
|
443
|
+
identityPublicMaterial: decodeCanonicalBase64(value.identityPublicMaterial, 'Signal identity'),
|
|
444
|
+
oneTimePreKeyCounts: counts,
|
|
445
|
+
profile: value.profile,
|
|
446
|
+
registrationId: requiredNumber(value, 'registrationId'),
|
|
447
|
+
signedPreKeys,
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
async currentRegistration() {
|
|
451
|
+
const identity = await this.storage.getIdentityKey('aci');
|
|
452
|
+
const ecSigned = await this.storage.getEcSignedPreKey(undefined, 'aci');
|
|
453
|
+
const kemSigned = await this.storage.getKyberPreKey('aci');
|
|
454
|
+
const [ecOneTime, kemOneTime] = await Promise.all([
|
|
455
|
+
this.storage.getEcOneTimePreKeys('aci'),
|
|
456
|
+
this.storage.getKemOneTimePreKeys('aci'),
|
|
457
|
+
]);
|
|
458
|
+
if (!identity || !ecSigned || !kemSigned || ecOneTime.length === 0 || kemOneTime.length === 0) {
|
|
459
|
+
throw new Error('Hosted Relay local prekey inventory is incomplete');
|
|
460
|
+
}
|
|
461
|
+
const boundedEcOneTime = [...ecOneTime]
|
|
462
|
+
.sort((left, right) => right.keyId - left.keyId)
|
|
463
|
+
.slice(0, HOSTED_ONE_TIME_PREKEY_LIMIT)
|
|
464
|
+
.sort((left, right) => left.keyId - right.keyId);
|
|
465
|
+
const boundedKemOneTime = [...kemOneTime]
|
|
466
|
+
.sort((left, right) => right.keyId - left.keyId)
|
|
467
|
+
.slice(0, HOSTED_ONE_TIME_PREKEY_LIMIT)
|
|
468
|
+
.sort((left, right) => left.keyId - right.keyId);
|
|
469
|
+
return {
|
|
470
|
+
identity: createCompositeIdentityV1(identity),
|
|
471
|
+
registrationId: identity.registrationId,
|
|
472
|
+
prekeys: {
|
|
473
|
+
signedPreKeys: [
|
|
474
|
+
{
|
|
475
|
+
algorithm: 'ec-x25519',
|
|
476
|
+
keyId: ecSigned.keyId,
|
|
477
|
+
publicKey: base64ToBytes(ecSigned.publicKey),
|
|
478
|
+
signature: base64ToBytes(ecSigned.signature),
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
algorithm: 'kem-ml-kem-1024',
|
|
482
|
+
keyId: kemSigned.keyId,
|
|
483
|
+
publicKey: base64ToBytes(kemSigned.publicKey),
|
|
484
|
+
signature: base64ToBytes(kemSigned.signature),
|
|
485
|
+
},
|
|
486
|
+
],
|
|
487
|
+
oneTimePreKeys: [
|
|
488
|
+
...boundedEcOneTime.map((prekey) => ({
|
|
489
|
+
algorithm: 'ec-x25519',
|
|
490
|
+
keyId: prekey.keyId,
|
|
491
|
+
publicKey: base64ToBytes(prekey.publicKey),
|
|
492
|
+
})),
|
|
493
|
+
...boundedKemOneTime.map((prekey) => ({
|
|
494
|
+
algorithm: 'kem-ml-kem-1024',
|
|
495
|
+
keyId: prekey.keyId,
|
|
496
|
+
publicKey: base64ToBytes(prekey.publicKey),
|
|
497
|
+
signature: base64ToBytes(prekey.signature),
|
|
498
|
+
})),
|
|
499
|
+
],
|
|
500
|
+
},
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
async publishCurrentPrekeys() {
|
|
504
|
+
const current = await this.currentRegistration();
|
|
505
|
+
const fingerprint = await registrationMaterialFingerprint(current.identity, current.registrationId, current.prekeys);
|
|
506
|
+
const result = await this.authenticatedPost('/prekeys/publish', {
|
|
507
|
+
operationId: fingerprint,
|
|
508
|
+
publishableKey: this.connection.publishableKey,
|
|
509
|
+
signalRegistration: signalRegistration(current.identity, current.registrationId, current.prekeys),
|
|
510
|
+
});
|
|
511
|
+
if (!record(result) || result.published !== true) {
|
|
512
|
+
throw new Error('Managed Relay returned an invalid prekey publication');
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
async pullIncoming() {
|
|
516
|
+
const value = await this.authenticatedPost('/mailbox/pull', {
|
|
517
|
+
publishableKey: this.connection.publishableKey,
|
|
518
|
+
});
|
|
519
|
+
if (!record(value) || !Array.isArray(value.messages)) {
|
|
520
|
+
throw new Error('Managed Relay returned an invalid mailbox page');
|
|
521
|
+
}
|
|
522
|
+
return value.messages.map((candidate) => {
|
|
523
|
+
if (!record(candidate) || !record(candidate.sender)) {
|
|
524
|
+
throw new Error('Managed Relay returned an invalid mailbox message');
|
|
525
|
+
}
|
|
526
|
+
const wire = decodeDeliveryWire(decodeCanonicalBase64(candidate.envelope, 'Mailbox envelope'));
|
|
527
|
+
return {
|
|
528
|
+
id: requiredString(candidate, 'messageId'),
|
|
529
|
+
senderUserId: requiredString(candidate.sender, 'accountId'),
|
|
530
|
+
senderDeviceId: requiredNumber(candidate.sender, 'deviceId'),
|
|
531
|
+
ciphertext: wire.ciphertext,
|
|
532
|
+
timestamp: wire.timestamp,
|
|
533
|
+
serverTimestamp: requiredNumber(candidate, 'enqueuedAt'),
|
|
534
|
+
messageType: wire.messageType,
|
|
535
|
+
...(wire.contentHint === undefined ? {} : { contentHint: wire.contentHint }),
|
|
536
|
+
};
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
async acknowledge(messageIds) {
|
|
540
|
+
const value = await this.authenticatedPost('/mailbox/acknowledge', {
|
|
541
|
+
messageIds: [...messageIds],
|
|
542
|
+
publishableKey: this.connection.publishableKey,
|
|
543
|
+
});
|
|
544
|
+
if (!record(value) || requiredNumber(value, 'acknowledged') < 0) {
|
|
545
|
+
throw new Error('Managed Relay returned an invalid acknowledgment');
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
async registerPush(registration) {
|
|
549
|
+
const value = await this.authenticatedPost('/push/register', {
|
|
550
|
+
...registration,
|
|
551
|
+
publishableKey: this.connection.publishableKey,
|
|
552
|
+
});
|
|
553
|
+
if (value !== undefined) {
|
|
554
|
+
throw new Error('Managed Relay returned an invalid push result');
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
async removePush() {
|
|
558
|
+
const value = await this.authenticatedPost('/push/remove', {
|
|
559
|
+
publishableKey: this.connection.publishableKey,
|
|
560
|
+
});
|
|
561
|
+
if (value !== undefined) {
|
|
562
|
+
throw new Error('Managed Relay returned an invalid push result');
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
async pullMailbox() {
|
|
566
|
+
return this.pullIncoming();
|
|
567
|
+
}
|
|
568
|
+
async acknowledgeMailbox(messageIds) {
|
|
569
|
+
await this.acknowledge(messageIds);
|
|
570
|
+
}
|
|
571
|
+
async createObjectUpload(input) {
|
|
572
|
+
const value = await this.authenticatedPost('/objects/authorize-upload', {
|
|
573
|
+
contentLength: input.contentLength,
|
|
574
|
+
digest: bytesToUrlSafeBase64(input.digest),
|
|
575
|
+
publishableKey: this.connection.publishableKey,
|
|
576
|
+
requestId: input.requestId,
|
|
577
|
+
});
|
|
578
|
+
if (!record(value) || !record(value.headers)) {
|
|
579
|
+
throw new Error('Managed Relay returned an invalid upload grant');
|
|
580
|
+
}
|
|
581
|
+
return {
|
|
582
|
+
expiresAt: requiredNumber(value, 'expiresAt'),
|
|
583
|
+
headers: Object.fromEntries(Object.entries(value.headers).map(([name, header]) => {
|
|
584
|
+
if (typeof header !== 'string')
|
|
585
|
+
throw new Error('Managed Relay returned an invalid upload grant');
|
|
586
|
+
return [name, header];
|
|
587
|
+
})),
|
|
588
|
+
objectId: requiredString(value, 'objectId'),
|
|
589
|
+
protocol: 'put',
|
|
590
|
+
uploadUrl: requiredString(value, 'uploadUrl'),
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
async createObjectDownload(input) {
|
|
594
|
+
const value = await this.authenticatedPost('/objects/authorize-download', {
|
|
595
|
+
objectId: input.objectId,
|
|
596
|
+
publishableKey: this.connection.publishableKey,
|
|
597
|
+
});
|
|
598
|
+
if (!record(value))
|
|
599
|
+
throw new Error('Managed Relay returned an invalid download grant');
|
|
600
|
+
return {
|
|
601
|
+
downloadUrl: requiredString(value, 'downloadUrl'),
|
|
602
|
+
expiresAt: requiredNumber(value, 'expiresAt'),
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
async send(envelope) {
|
|
606
|
+
if (envelope.senderUserId !== this.session.canonicalAccountId ||
|
|
607
|
+
envelope.senderDeviceId !== this.session.deviceId ||
|
|
608
|
+
envelope.clientMessageId === '') {
|
|
609
|
+
throw new Error('Managed Relay send authority or operation ID is invalid');
|
|
610
|
+
}
|
|
611
|
+
const messageId = envelope.clientMessageId ?? await generateUuidV4();
|
|
612
|
+
const key = `${envelope.targetUserId}\0${String(envelope.targetDeviceId)}`;
|
|
613
|
+
let generation = this.destinationGenerations.get(key);
|
|
614
|
+
if (generation === undefined) {
|
|
615
|
+
await this.directory(envelope.targetUserId);
|
|
616
|
+
generation = this.destinationGenerations.get(key);
|
|
617
|
+
}
|
|
618
|
+
if (generation === undefined)
|
|
619
|
+
throw new Error('Managed Relay destination device does not exist');
|
|
620
|
+
let value;
|
|
621
|
+
try {
|
|
622
|
+
value = await this.authenticatedPost('/delivery/send', {
|
|
623
|
+
deliveryClass: envelope.deliveryClass,
|
|
624
|
+
destination: {
|
|
625
|
+
accountAddress: envelope.targetUserId,
|
|
626
|
+
deviceId: envelope.targetDeviceId,
|
|
627
|
+
generation,
|
|
628
|
+
},
|
|
629
|
+
envelope: bytesToBase64(encodeDeliveryWire(envelope)),
|
|
630
|
+
messageId,
|
|
631
|
+
operationEpochMilliseconds: envelope.timestamp,
|
|
632
|
+
publishableKey: this.connection.publishableKey,
|
|
633
|
+
...(envelope.recipientRegistrationId === undefined
|
|
634
|
+
? {}
|
|
635
|
+
: { recipientRegistrationId: envelope.recipientRegistrationId }),
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
if (error instanceof HostedRelayHttpError && error.code === 'STALE_DEVICE') {
|
|
640
|
+
throw new HostedRelayHttpError(error.status, error.code, error.message, {
|
|
641
|
+
code: 'STALE_DEVICE',
|
|
642
|
+
message: error.message,
|
|
643
|
+
reason: 'device_reinstalled',
|
|
644
|
+
staleDevices: [envelope.targetDeviceId],
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
throw error;
|
|
648
|
+
}
|
|
649
|
+
if (!record(value) || requiredString(value, 'messageId') !== messageId) {
|
|
650
|
+
throw new Error('Managed Relay returned an invalid delivery receipt');
|
|
651
|
+
}
|
|
652
|
+
return {
|
|
653
|
+
messageId,
|
|
654
|
+
serverTimestamp: typeof value.enqueuedAt === 'number' ? value.enqueuedAt : envelope.timestamp,
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
subscribe(userId, deviceId, onEnvelope, options) {
|
|
658
|
+
this.assertCurrentIdentity(userId, deviceId);
|
|
659
|
+
let active = true;
|
|
660
|
+
let timer;
|
|
661
|
+
const poll = async () => {
|
|
662
|
+
try {
|
|
663
|
+
const messages = await this.pullIncoming();
|
|
664
|
+
if (messages.length > 0)
|
|
665
|
+
options?.onBatchStart?.();
|
|
666
|
+
for (const message of messages)
|
|
667
|
+
onEnvelope(message);
|
|
668
|
+
if (messages.length > 0)
|
|
669
|
+
options?.onBatchEnd?.();
|
|
670
|
+
}
|
|
671
|
+
catch {
|
|
672
|
+
// The durable mailbox keeps the messages. Retry on the next poll.
|
|
673
|
+
}
|
|
674
|
+
finally {
|
|
675
|
+
if (active)
|
|
676
|
+
timer = setTimeout(() => void poll(), POLL_MILLISECONDS);
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
void poll();
|
|
680
|
+
return () => {
|
|
681
|
+
active = false;
|
|
682
|
+
if (timer !== undefined)
|
|
683
|
+
clearTimeout(timer);
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
async markDelivered(envelopeId) {
|
|
687
|
+
await this.acknowledge([envelopeId]);
|
|
688
|
+
}
|
|
689
|
+
async getDevices(userId) {
|
|
690
|
+
return (await this.directory(userId)).map((device) => ({
|
|
691
|
+
deviceId: device.deviceId,
|
|
692
|
+
registered: true,
|
|
693
|
+
linked: device.deviceId > 1,
|
|
694
|
+
enabled: true,
|
|
695
|
+
}));
|
|
696
|
+
}
|
|
697
|
+
async getActiveDevices(userId) {
|
|
698
|
+
return (await this.directory(userId)).map((device) => ({
|
|
699
|
+
userId,
|
|
700
|
+
deviceId: device.deviceId,
|
|
701
|
+
}));
|
|
702
|
+
}
|
|
703
|
+
async provisionIdentityKey(request) {
|
|
704
|
+
this.assertCurrentIdentity(request.userId, request.deviceId, request.identityType);
|
|
705
|
+
const status = await this.prekeyStatus(request.userId, request.deviceId, request.identityType);
|
|
706
|
+
if (status.registrationId !== request.registrationId ||
|
|
707
|
+
!equalBytes(status.identityPublicMaterial, encodeCompositeIdentityV1(request.identity))) {
|
|
708
|
+
throw new Error('Managed Relay canonical Signal identity does not match local state');
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
async getIdentityKey(userId, identityType = 'aci') {
|
|
712
|
+
try {
|
|
713
|
+
return decodeCompositeIdentityV1((await this.prekeyStatus(userId, 1, identityType)).identityPublicMaterial);
|
|
714
|
+
}
|
|
715
|
+
catch (error) {
|
|
716
|
+
if (error instanceof HostedRelayHttpError && error.code === 'NOT_FOUND')
|
|
717
|
+
return null;
|
|
718
|
+
throw error;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
async uploadPreKeys(userId, deviceId, _keys, identityType = 'aci') {
|
|
722
|
+
this.assertCurrentIdentity(userId, deviceId, identityType);
|
|
723
|
+
await this.publishCurrentPrekeys();
|
|
724
|
+
}
|
|
725
|
+
async fetchPreKeyBundle(userId, deviceId, _fetcherUserId, identityType = 'aci') {
|
|
726
|
+
if (identityType !== 'aci')
|
|
727
|
+
unsupported('PNI prekey authority');
|
|
728
|
+
let value;
|
|
729
|
+
try {
|
|
730
|
+
value = await this.authenticatedPost('/prekeys/consume', {
|
|
731
|
+
accountAddress: userId,
|
|
732
|
+
deviceId,
|
|
733
|
+
identityType,
|
|
734
|
+
publishableKey: this.connection.publishableKey,
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
catch (error) {
|
|
738
|
+
if (error instanceof HostedRelayHttpError && error.code === 'NOT_FOUND')
|
|
739
|
+
return null;
|
|
740
|
+
throw error;
|
|
741
|
+
}
|
|
742
|
+
if (!record(value) || !Array.isArray(value.signedPreKeys) || !Array.isArray(value.oneTimePreKeys)) {
|
|
743
|
+
throw new Error('Managed Relay returned an invalid prekey bundle');
|
|
744
|
+
}
|
|
745
|
+
const signed = value.signedPreKeys.map((candidate) => {
|
|
746
|
+
if (!record(candidate))
|
|
747
|
+
throw new Error('Managed Relay returned an invalid prekey bundle');
|
|
748
|
+
return {
|
|
749
|
+
algorithm: requiredString(candidate, 'algorithm'),
|
|
750
|
+
keyId: requiredNumber(candidate, 'keyId'),
|
|
751
|
+
publicKey: requiredString(candidate, 'publicKey'),
|
|
752
|
+
signature: requiredString(candidate, 'signature'),
|
|
753
|
+
};
|
|
754
|
+
});
|
|
755
|
+
const oneTime = value.oneTimePreKeys.map((candidate) => {
|
|
756
|
+
if (!record(candidate))
|
|
757
|
+
throw new Error('Managed Relay returned an invalid prekey bundle');
|
|
758
|
+
return {
|
|
759
|
+
algorithm: requiredString(candidate, 'algorithm'),
|
|
760
|
+
keyId: requiredNumber(candidate, 'keyId'),
|
|
761
|
+
publicKey: requiredString(candidate, 'publicKey'),
|
|
762
|
+
...(candidate.signature === undefined
|
|
763
|
+
? {}
|
|
764
|
+
: { signature: requiredString(candidate, 'signature') }),
|
|
765
|
+
};
|
|
766
|
+
});
|
|
767
|
+
const ecSigned = signed.find((key) => key.algorithm === 'ec-x25519');
|
|
768
|
+
const kemSigned = signed.find((key) => key.algorithm === 'kem-ml-kem-1024');
|
|
769
|
+
if (!ecSigned || !kemSigned)
|
|
770
|
+
throw new Error('Managed Relay returned an invalid prekey bundle');
|
|
771
|
+
const ecOneTime = oneTime.find((key) => key.algorithm === 'ec-x25519');
|
|
772
|
+
const kemOneTime = oneTime.find((key) => key.algorithm === 'kem-ml-kem-1024');
|
|
773
|
+
return {
|
|
774
|
+
deviceId,
|
|
775
|
+
registrationId: requiredNumber(value, 'registrationId'),
|
|
776
|
+
identity: decodeCompositeIdentityV1(decodeCanonicalBase64(value.identityPublicMaterial, 'Signal identity')),
|
|
777
|
+
ecSignedPreKey: {
|
|
778
|
+
keyId: ecSigned.keyId,
|
|
779
|
+
publicKey: ecSigned.publicKey,
|
|
780
|
+
signature: ecSigned.signature,
|
|
781
|
+
},
|
|
782
|
+
ecOneTimePreKey: ecOneTime
|
|
783
|
+
? { keyId: ecOneTime.keyId, publicKey: ecOneTime.publicKey }
|
|
784
|
+
: null,
|
|
785
|
+
kemLastResortPreKey: {
|
|
786
|
+
keyId: kemSigned.keyId,
|
|
787
|
+
publicKey: kemSigned.publicKey,
|
|
788
|
+
signature: kemSigned.signature,
|
|
789
|
+
},
|
|
790
|
+
kemOneTimePreKey: kemOneTime
|
|
791
|
+
? {
|
|
792
|
+
keyId: kemOneTime.keyId,
|
|
793
|
+
publicKey: kemOneTime.publicKey,
|
|
794
|
+
signature: kemOneTime.signature,
|
|
795
|
+
}
|
|
796
|
+
: null,
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
async getPreKeyCount(userId, deviceId, type, identityType = 'aci') {
|
|
800
|
+
const status = await this.prekeyStatus(userId, deviceId, identityType);
|
|
801
|
+
return status.oneTimePreKeyCounts[type === 'ec' ? 'ec-x25519' : 'kem-ml-kem-1024'] ?? 0;
|
|
802
|
+
}
|
|
803
|
+
async getEcSignedPreKeyMetadata(userId, deviceId, identityType = 'aci') {
|
|
804
|
+
const key = (await this.prekeyStatus(userId, deviceId, identityType)).signedPreKeys.find((candidate) => candidate.algorithm === 'ec-x25519');
|
|
805
|
+
return key
|
|
806
|
+
? {
|
|
807
|
+
keyId: key.keyId,
|
|
808
|
+
createdAt: key.acceptedAtMilliseconds,
|
|
809
|
+
expiresAt: key.acceptedAtMilliseconds + PREKEY_EXPIRY_MILLISECONDS,
|
|
810
|
+
publicKey: bytesToBase64(key.publicKey),
|
|
811
|
+
}
|
|
812
|
+
: null;
|
|
813
|
+
}
|
|
814
|
+
async getKemLastResortPreKeyMetadata(userId, deviceId, identityType = 'aci') {
|
|
815
|
+
const key = (await this.prekeyStatus(userId, deviceId, identityType)).signedPreKeys.find((candidate) => candidate.algorithm === 'kem-ml-kem-1024');
|
|
816
|
+
return key
|
|
817
|
+
? {
|
|
818
|
+
keyId: key.keyId,
|
|
819
|
+
createdAt: key.acceptedAtMilliseconds,
|
|
820
|
+
expiresAt: key.acceptedAtMilliseconds + PREKEY_EXPIRY_MILLISECONDS,
|
|
821
|
+
publicKey: bytesToBase64(key.publicKey),
|
|
822
|
+
}
|
|
823
|
+
: null;
|
|
824
|
+
}
|
|
825
|
+
async clearStaleKemPreKeys(userId, deviceId, identityType = 'aci') {
|
|
826
|
+
this.assertCurrentIdentity(userId, deviceId, identityType);
|
|
827
|
+
const value = await this.authenticatedPost('/prekeys/clear-stale-kem', {
|
|
828
|
+
publishableKey: this.connection.publishableKey,
|
|
829
|
+
});
|
|
830
|
+
if (!record(value))
|
|
831
|
+
throw new Error('Managed Relay returned an invalid prekey result');
|
|
832
|
+
return { cleared: requiredNumber(value, 'cleared') };
|
|
833
|
+
}
|
|
834
|
+
async uploadEcSignedPreKey(userId, _key, identityType = 'aci') {
|
|
835
|
+
this.assertCurrentIdentity(userId, this.session.deviceId, identityType);
|
|
836
|
+
await this.publishCurrentPrekeys();
|
|
837
|
+
}
|
|
838
|
+
async uploadKemLastResortPreKey(userId, _key, identityType = 'aci') {
|
|
839
|
+
this.assertCurrentIdentity(userId, this.session.deviceId, identityType);
|
|
840
|
+
await this.publishCurrentPrekeys();
|
|
841
|
+
}
|
|
842
|
+
async rotateIdentityKey(_request) {
|
|
843
|
+
unsupported('identity rotation outside the hosted recovery flow');
|
|
844
|
+
}
|
|
845
|
+
async registerDevice(_userId, _device) {
|
|
846
|
+
unsupported('direct device registration');
|
|
847
|
+
}
|
|
848
|
+
async removeDevice(_userId, _deviceId) { unsupported('direct device removal'); }
|
|
849
|
+
async markDeviceConnected(_deviceId) { unsupported('connection presence'); }
|
|
850
|
+
async markDeviceDisconnected(_deviceId) { unsupported('connection presence'); }
|
|
851
|
+
async heartbeat(_deviceId) { unsupported('connection presence'); }
|
|
852
|
+
async createProvisioningSession(_userId, _key) { unsupported('legacy provisioning sessions'); }
|
|
853
|
+
async connectNewDevice(_sessionId, _key, _metadata) { unsupported('legacy provisioning sessions'); }
|
|
854
|
+
async sendProvisioningMessage(_sessionId, _message, _userId) { unsupported('legacy provisioning sessions'); }
|
|
855
|
+
async getProvisioningMessage(_sessionId) { unsupported('legacy provisioning sessions'); }
|
|
856
|
+
async completeProvisioning(_sessionId, _metadata) { unsupported('legacy provisioning sessions'); }
|
|
857
|
+
async acknowledgeProvisioning(_sessionId) { unsupported('legacy provisioning sessions'); }
|
|
858
|
+
async rollbackProvisioning(_sessionId) { unsupported('legacy provisioning sessions'); }
|
|
859
|
+
async deleteProvisioningSession(_sessionId, _userId) { unsupported('legacy provisioning sessions'); }
|
|
860
|
+
async createGroupState(_groupId, _state, _authorization) { unsupported('hosted group-state transport'); }
|
|
861
|
+
async getGroupState(_groupId, _authorization, _version) { unsupported('hosted group-state transport'); }
|
|
862
|
+
async getGroupJoinInfo(_groupId, _password, _authorization) { unsupported('hosted group-state transport'); }
|
|
863
|
+
async getGroupChanges(_groupId, _fromVersion, _authorization) { unsupported('hosted group-state transport'); }
|
|
864
|
+
async submitGroupChange(_groupId, _expectedVersion, _actions, _password, _authorization) { unsupported('hosted group-state transport'); }
|
|
865
|
+
async issueAuthCredential(_userId) { unsupported('hosted group credentials'); }
|
|
866
|
+
}
|
|
867
|
+
export async function bootstrapHostedRelayTransport(request) {
|
|
868
|
+
const proof = await request.deviceAuthentication.signChallenge(await registrationChallenge(request));
|
|
869
|
+
const value = await postJson(request.connection, request.assertionPurpose === 'recover'
|
|
870
|
+
? '/identity/recover'
|
|
871
|
+
: '/identity/register', {
|
|
872
|
+
assertion: request.assertion,
|
|
873
|
+
assertionPurpose: request.assertionPurpose,
|
|
874
|
+
deviceAuthenticationPublicKey: bytesToBase64(request.deviceAuthentication.publicKey),
|
|
875
|
+
deviceProof: bytesToBase64(proof),
|
|
876
|
+
operationId: request.operationId,
|
|
877
|
+
publishableKey: request.connection.publishableKey,
|
|
878
|
+
signalRegistration: signalRegistration(request.signalIdentity, request.registrationId, request.registrationPreKeys),
|
|
879
|
+
});
|
|
880
|
+
if (!record(value))
|
|
881
|
+
throw new Error('Managed Relay returned an invalid registration');
|
|
882
|
+
const session = {
|
|
883
|
+
canonicalAccountId: requiredString(value, 'canonicalAccountId'),
|
|
884
|
+
deviceId: requiredNumber(value, 'deviceId'),
|
|
885
|
+
deviceToken: requiredString(value, 'deviceToken'),
|
|
886
|
+
generation: requiredNumber(value, request.assertionPurpose === 'recover'
|
|
887
|
+
? 'deviceAuthorizationGeneration'
|
|
888
|
+
: 'generation'),
|
|
889
|
+
mailboxGeneration: requiredNumber(value, 'mailboxGeneration'),
|
|
890
|
+
relayScopeId: requiredString(value, 'relayScopeId'),
|
|
891
|
+
};
|
|
892
|
+
if (session.relayScopeId !== relayScopeId(request.connection) ||
|
|
893
|
+
session.deviceId < 1 ||
|
|
894
|
+
session.generation < 0 ||
|
|
895
|
+
session.mailboxGeneration < 0 ||
|
|
896
|
+
tokenExpiration(session.deviceToken, session) <= Math.floor(Date.now() / 1_000)) {
|
|
897
|
+
throw new Error('Managed Relay returned an invalid registration');
|
|
898
|
+
}
|
|
899
|
+
await request.storage.setMetadata(await sessionMetadataKey(request.connection), JSON.stringify(session));
|
|
900
|
+
const transport = new HostedRelayHttpTransport(request.connection, request.storage, request.deviceAuthentication, session);
|
|
901
|
+
return {
|
|
902
|
+
canonicalAccountId: session.canonicalAccountId,
|
|
903
|
+
deviceId: session.deviceId,
|
|
904
|
+
relay: transport,
|
|
905
|
+
relayScopeId: request.connection.relayScopeId.slice(),
|
|
906
|
+
remoteObjectStore: transport.objectStore,
|
|
907
|
+
transport,
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
export async function resumeHostedRelayTransport(options) {
|
|
911
|
+
const stored = await options.storage.getMetadata(await sessionMetadataKey(options.connection));
|
|
912
|
+
if (!stored)
|
|
913
|
+
return undefined;
|
|
914
|
+
const session = parseSession(stored, options.connection);
|
|
915
|
+
const transport = new HostedRelayHttpTransport(options.connection, options.storage, options.deviceAuthentication, session);
|
|
916
|
+
await transport.ensureAuthenticated(true);
|
|
917
|
+
return {
|
|
918
|
+
canonicalAccountId: session.canonicalAccountId,
|
|
919
|
+
deviceId: session.deviceId,
|
|
920
|
+
relay: transport,
|
|
921
|
+
relayScopeId: options.connection.relayScopeId.slice(),
|
|
922
|
+
remoteObjectStore: transport.objectStore,
|
|
923
|
+
transport,
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
//# sourceMappingURL=hosted-transport.js.map
|