livekit-server-sdk 2.18.0 → 2.19.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/README.md +1 -1
- package/dist/AccessToken.cjs +4 -1
- package/dist/AccessToken.cjs.map +1 -1
- package/dist/AccessToken.d.ts.map +1 -1
- package/dist/AccessToken.js +4 -1
- package/dist/AccessToken.js.map +1 -1
- package/dist/IngressClient.cjs +4 -1
- package/dist/IngressClient.cjs.map +1 -1
- package/dist/IngressClient.d.cts +10 -0
- package/dist/IngressClient.d.ts +10 -0
- package/dist/IngressClient.d.ts.map +1 -1
- package/dist/IngressClient.js +4 -1
- package/dist/IngressClient.js.map +1 -1
- package/dist/TwirpRPC.cjs +5 -0
- package/dist/TwirpRPC.cjs.map +1 -1
- package/dist/TwirpRPC.d.cts +2 -1
- package/dist/TwirpRPC.d.ts +2 -1
- package/dist/TwirpRPC.d.ts.map +1 -1
- package/dist/TwirpRPC.js +4 -0
- package/dist/TwirpRPC.js.map +1 -1
- package/dist/crypto/digest.cjs +4 -16
- package/dist/crypto/digest.cjs.map +1 -1
- package/dist/crypto/digest.d.ts.map +1 -1
- package/dist/crypto/digest.js +4 -6
- package/dist/crypto/digest.js.map +1 -1
- package/dist/crypto/uuid.cjs +25 -17
- package/dist/crypto/uuid.cjs.map +1 -1
- package/dist/crypto/uuid.d.cts +2 -1
- package/dist/crypto/uuid.d.ts +2 -1
- package/dist/crypto/uuid.d.ts.map +1 -1
- package/dist/crypto/uuid.js +23 -6
- package/dist/crypto/uuid.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +3 -3
- package/src/AccessToken.test.ts +13 -0
- package/src/AccessToken.ts +3 -0
- package/src/IngressClient.ts +14 -1
- package/src/TwirpRPC.test.ts +76 -4
- package/src/TwirpRPC.ts +8 -1
- package/src/crypto/digest.ts +5 -7
- package/src/crypto/uuid.ts +24 -6
- package/src/version.ts +1 -1
package/src/crypto/uuid.ts
CHANGED
|
@@ -2,12 +2,30 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// Web Crypto only — no import('node:crypto') so isolate/edge bundlers can resolve this module
|
|
6
6
|
export async function getRandomBytes(size: number = 16): Promise<Uint8Array> {
|
|
7
|
-
if (globalThis.crypto) {
|
|
8
|
-
|
|
9
|
-
} else {
|
|
10
|
-
const nodeCrypto = await import('node:crypto');
|
|
11
|
-
return nodeCrypto.getRandomValues(new Uint8Array(size));
|
|
7
|
+
if (!globalThis.crypto?.getRandomValues) {
|
|
8
|
+
throw new Error('Web Crypto API is required (globalThis.crypto.getRandomValues)');
|
|
12
9
|
}
|
|
10
|
+
return crypto.getRandomValues(new Uint8Array(size));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// A random RFC 4122 v4 UUID. Prefers the platform's randomUUID (Node 19+, edge
|
|
14
|
+
// runtimes, browsers in a secure context) and otherwise formats random bytes,
|
|
15
|
+
// so it works everywhere getRandomBytes does.
|
|
16
|
+
export async function randomUUID(): Promise<string> {
|
|
17
|
+
if (typeof globalThis.crypto?.randomUUID === 'function') {
|
|
18
|
+
return crypto.randomUUID();
|
|
19
|
+
}
|
|
20
|
+
const bytes = await getRandomBytes(16);
|
|
21
|
+
bytes[6] = (bytes[6]! & 0x0f) | 0x40; // version 4
|
|
22
|
+
bytes[8] = (bytes[8]! & 0x3f) | 0x80; // variant 1
|
|
23
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
|
|
24
|
+
return [
|
|
25
|
+
hex.slice(0, 8),
|
|
26
|
+
hex.slice(8, 12),
|
|
27
|
+
hex.slice(12, 16),
|
|
28
|
+
hex.slice(16, 20),
|
|
29
|
+
hex.slice(20),
|
|
30
|
+
].join('-');
|
|
13
31
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.
|
|
1
|
+
export const SDK_VERSION = "2.19.1";
|