@kyneta/random 1.5.2 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;AAOA;;iBAAgB,SAAA,CAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;AAOA;;iBAAgB,SAAA,CAAU,SAAiB;;AAAA;AAiB3C;;;;iBAAgB,YAAA,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// Avoids crypto.randomUUID() which is restricted to secure contexts\n// (HTTPS or localhost) and throws on plain HTTP over LAN addresses.\n// crypto.getRandomValues() has no such restriction.\n\n/**\n * Generate a random hex string from `n` cryptographically random bytes.\n */\nexport function randomHex(byteCount: number): string {\n if (byteCount === 0) return \"\"\n const bytes = new Uint8Array(byteCount)\n crypto.getRandomValues(bytes)\n let hex = \"\"\n for (let i = 0; i < bytes.length; i++) {\n hex += (bytes[i] ?? 0).toString(16).padStart(2, \"0\")\n }\n return hex\n}\n\n/**\n * Generate a random peer ID — a 16-character hex string.\n *\n * Used as keys in CRDT version vectors, so must be unique\n * but does not require cryptographic unpredictability.\n */\nexport function randomPeerId(): string {\n return randomHex(8)\n}\n"],"mappings":";;;;AAOA,SAAgB,UAAU,WAA2B;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// Avoids crypto.randomUUID() which is restricted to secure contexts\n// (HTTPS or localhost) and throws on plain HTTP over LAN addresses.\n// crypto.getRandomValues() has no such restriction.\n\n/**\n * Generate a random hex string from `n` cryptographically random bytes.\n */\nexport function randomHex(byteCount: number): string {\n if (byteCount === 0) return \"\"\n const bytes = new Uint8Array(byteCount)\n crypto.getRandomValues(bytes)\n let hex = \"\"\n for (let i = 0; i < bytes.length; i++) {\n hex += (bytes[i] ?? 0).toString(16).padStart(2, \"0\")\n }\n return hex\n}\n\n/**\n * Generate a random peer ID — a 16-character hex string.\n *\n * Used as keys in CRDT version vectors, so must be unique\n * but does not require cryptographic unpredictability.\n */\nexport function randomPeerId(): string {\n return randomHex(8)\n}\n"],"mappings":";;;;AAOA,SAAgB,UAAU,WAA2B;CACnD,IAAI,cAAc,GAAG,OAAO;CAC5B,MAAM,QAAQ,IAAI,WAAW,SAAS;CACtC,OAAO,gBAAgB,KAAK;CAC5B,IAAI,MAAM;CACV,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAChC,QAAQ,MAAM,MAAM,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;CAErD,OAAO;AACT;;;;;;;AAQA,SAAgB,eAAuB;CACrC,OAAO,UAAU,CAAC;AACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kyneta/random",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Secure-context-free random ID primitives for the kyneta monorepo",
|
|
5
5
|
"author": "Duane Johnson",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"./src/*": "./src/*"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"tsdown": "^0.
|
|
33
|
+
"tsdown": "^0.22.0",
|
|
34
34
|
"typescript": "^5.9.2",
|
|
35
35
|
"vitest": "^4.0.17"
|
|
36
36
|
},
|