@neko-makura/railid 3.1.0 → 4.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/README.md +27 -0
- package/index.d.ts +9 -0
- package/no-tpm.d.ts +6 -0
- package/no-tpm.js +3 -0
- package/package.json +1 -1
- package/railid-tpm.linux-x64-gnu.node +0 -0
- package/railid.darwin-arm64.node +0 -0
- package/railid.darwin-x64.node +0 -0
- package/railid.linux-arm-gnu.node +0 -0
- package/railid.linux-arm64-gnu.node +0 -0
- package/railid.linux-arm64-musl.node +0 -0
- package/railid.linux-riscv64-gnu.node +0 -0
- package/railid.linux-x64-gnu.node +0 -0
- package/railid.linux-x64-musl.node +0 -0
- package/railid.win32-arm64-msvc.node +0 -0
- package/railid.win32-x64-msvc.node +0 -0
package/README.md
CHANGED
|
@@ -91,6 +91,8 @@ still never falls back implicitly.
|
|
|
91
91
|
| `generateOsOnly()` | `string` | Explicit degraded profile |
|
|
92
92
|
| `generateBuffer()` | `Buffer` | TPM profile as 32 ASCII bytes, no JS string |
|
|
93
93
|
| `generateOsOnlyBuffer()` | `Buffer` | OS-only as 32 ASCII bytes, no JS string |
|
|
94
|
+
| `generateV4()` | `string` | 126-bit v4; TPM hybrid profile, fails closed |
|
|
95
|
+
| `generateV4OsOnly()` | `string` | 126-bit v4; explicit degraded OS-only profile |
|
|
94
96
|
| `generateMany(count, osOnly?)` | `string[]` | Sync; `osOnly` defaults to `false` |
|
|
95
97
|
| `generateManyEncoded(count, osOnly?)` | `Buffer` | Sync; `count * 32` bytes |
|
|
96
98
|
| `generateManyAsync(count, osOnly?)` | `Promise<string[]>` | Bulk work off the JS thread |
|
|
@@ -115,6 +117,31 @@ Counts above the limit are rejected before allocation.
|
|
|
115
117
|
call; for throughput use `generateManyEncoded()` or
|
|
116
118
|
`generateManyEncodedAsync()`, which allocate one contiguous buffer.
|
|
117
119
|
|
|
120
|
+
## RailID v4 (126-bit)
|
|
121
|
+
|
|
122
|
+
v4 is a distinct 126-bit format that encodes to exactly 21 characters of
|
|
123
|
+
unpadded Base64URL. It is a single-string API for now:
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
const railid = require('@neko-makura/railid');
|
|
127
|
+
|
|
128
|
+
// TPM hybrid profile; throws TpmUnavailable instead of falling back.
|
|
129
|
+
const id = railid.generateV4();
|
|
130
|
+
console.log(id); // 21 characters
|
|
131
|
+
|
|
132
|
+
// Explicit degraded OS-only profile.
|
|
133
|
+
const osId = railid.generateV4OsOnly();
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
- `generateV4()` uses the TPM hybrid profile, which is fail-closed: if no TPM
|
|
137
|
+
or TSS transport is available it throws `TpmUnavailable` and never silently
|
|
138
|
+
uses the OS CSPRNG.
|
|
139
|
+
- `generateV4OsOnly()` is the explicit OS-only opt-in. The `no-tpm` entry
|
|
140
|
+
point maps `generateV4()` to it.
|
|
141
|
+
- The v1 192-bit API above is unchanged: `generate()` and `generateOsOnly()`
|
|
142
|
+
still return 32-character v1 IDs. v4 does **not** reuse those names.
|
|
143
|
+
- There is no v4 Buffer or batch API yet; those are planned for v4.2.0.
|
|
144
|
+
|
|
118
145
|
## RailID v2
|
|
119
146
|
|
|
120
147
|
v2 is a separate format generation for variable-length values with an optional
|
package/index.d.ts
CHANGED
|
@@ -21,6 +21,15 @@ export declare function generateBuffer(): Buffer;
|
|
|
21
21
|
/** Generate one OS-only RailID as 32 ASCII bytes, without a JS string. */
|
|
22
22
|
export declare function generateOsOnlyBuffer(): Buffer;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Generate one 126-bit v4 RailID as a 21-character string with the TPM hybrid
|
|
26
|
+
* profile. Throws `TpmUnavailable` rather than falling back to OS-only.
|
|
27
|
+
*/
|
|
28
|
+
export declare function generateV4(): string;
|
|
29
|
+
|
|
30
|
+
/** Generate one 126-bit v4 RailID as a 21-character string with the OS-only profile. */
|
|
31
|
+
export declare function generateV4OsOnly(): string;
|
|
32
|
+
|
|
24
33
|
/** Generate `count` IDs synchronously as strings. */
|
|
25
34
|
export declare function generateMany(count: number, osOnly?: boolean): string[];
|
|
26
35
|
|
package/no-tpm.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ export declare function generateBuffer(): Buffer;
|
|
|
15
15
|
/** Same as `generateBuffer()`; kept for symmetry. */
|
|
16
16
|
export declare function generateOsOnlyBuffer(): Buffer;
|
|
17
17
|
|
|
18
|
+
/** Generate one 126-bit v4 RailID as a 21-character string with the OS-only profile. */
|
|
19
|
+
export declare function generateV4(): string;
|
|
20
|
+
|
|
21
|
+
/** Same as `generateV4()`; kept for symmetry. */
|
|
22
|
+
export declare function generateV4OsOnly(): string;
|
|
23
|
+
|
|
18
24
|
/** Generate `count` IDs synchronously as strings. */
|
|
19
25
|
export declare function generateMany(count: number): string[];
|
|
20
26
|
|
package/no-tpm.js
CHANGED
|
@@ -12,6 +12,9 @@ module.exports = {
|
|
|
12
12
|
...core,
|
|
13
13
|
generate: core.generateOsOnly,
|
|
14
14
|
generateBuffer: core.generateOsOnlyBuffer,
|
|
15
|
+
// The v4 default profile is fail-closed too; this entry point is the
|
|
16
|
+
// explicit OS-only opt-in.
|
|
17
|
+
generateV4: core.generateV4OsOnly,
|
|
15
18
|
// The `osOnly` argument is accepted for signature compatibility and always
|
|
16
19
|
// resolves to the OS-only profile.
|
|
17
20
|
generateMany: (count) => core.generateMany(count, true),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neko-makura/railid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Native N-API bindings for RailID: 192-bit v1 and variable-length v2 timestamp-first identifiers with TPM 2.0 + OS CSPRNG randomness",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
Binary file
|
package/railid.darwin-arm64.node
CHANGED
|
Binary file
|
package/railid.darwin-x64.node
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|