@neko-makura/railid 4.3.2 → 4.4.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/no-tpm.d.ts CHANGED
@@ -1,104 +1,125 @@
1
- import type { DecodedRailId, RailIdError, RailIdErrorCode } from "./index";
2
-
3
- export type { DecodedRailId, RailIdError, RailIdErrorCode };
4
- export type Backend = "os-only";
5
-
6
- /** Generate one RailID with the explicitly degraded OS-only profile. */
7
- export declare function generate(): string;
8
-
9
- /** Same as `generate()`; kept for symmetry with the default entry point. */
10
- export declare function generateOsOnly(): string;
11
-
12
- /** Generate one OS-only RailID as 32 ASCII bytes, without a JS string. */
13
- export declare function generateBuffer(): Buffer;
14
-
15
- /** Same as `generateBuffer()`; kept for symmetry. */
16
- export declare function generateOsOnlyBuffer(): Buffer;
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
-
24
- /** Generate one 126-bit v4 RailID as 21 ASCII bytes with the OS-only profile. */
25
- export declare function generateV4Buffer(): Buffer;
26
-
27
- /** Same as `generateV4Buffer()`; kept for symmetry. */
28
- export declare function generateV4BufferOsOnly(): Buffer;
29
-
30
- /**
31
- * Generate `count` v4 IDs as one contiguous `count * 21` Buffer with the
32
- * OS-only profile. Capped at 1,000,000 IDs.
33
- */
34
- export declare function generateV4ManyEncoded(count: number): Buffer;
35
-
36
- /** Same as `generateV4ManyEncoded()`; kept for symmetry. */
37
- export declare function generateV4ManyEncodedOsOnly(count: number): Buffer;
38
-
39
- /**
40
- * Generate `count` v4 IDs asynchronously with the OS-only profile. Resolves to
41
- * a `count * 21` Buffer after running on the libuv thread pool. Capped at
42
- * 1,000,000 IDs; invalid counts throw `InvalidInput` synchronously.
43
- */
44
- export declare function generateV4ManyEncodedAsync(count: number): Promise<Buffer>;
45
-
46
- /** Same as `generateV4ManyEncodedAsync()`; kept for symmetry. */
47
- export declare function generateV4ManyEncodedOsOnlyAsync(
48
- count: number,
49
- ): Promise<Buffer>;
50
-
51
- /**
52
- * Generate v4 IDs with the OS-only profile into a caller-provided Buffer. The
53
- * buffer length must be an exact multiple of 21 and determines the count;
54
- * capped at 1,000,000 IDs. Nothing is returned. Invalid lengths throw
55
- * `InvalidInput` before any bytes are written. This avoids the `count * 21`
56
- * external allocation and is the recommended high-throughput path.
57
- */
58
- export declare function generateV4ManyEncodedInto(buffer: Buffer): void;
59
-
60
- /** Same as `generateV4ManyEncodedInto()`; kept for symmetry. */
61
- export declare function generateV4ManyEncodedOsOnlyInto(buffer: Buffer): void;
62
-
63
- /** Generate `count` IDs synchronously as strings. */
64
- export declare function generateMany(count: number): string[];
65
-
66
- /** Generate `count` IDs synchronously as one contiguous `count * 32` Buffer. */
67
- export declare function generateManyEncoded(count: number): Buffer;
68
-
69
- /** Generate `count` IDs asynchronously as strings. */
70
- export declare function generateManyAsync(count: number): Promise<string[]>;
71
-
72
- /** Generate `count` IDs asynchronously as one contiguous `count * 32` Buffer. */
73
- export declare function generateManyEncodedAsync(count: number): Promise<Buffer>;
74
-
75
- /** Decode and validate a RailID. */
76
- export declare function decode(input: string): DecodedRailId;
77
-
78
- /** RailID crate version. */
79
- export declare function version(): string;
80
-
81
- /** Always `"os-only"` for this entry point. */
82
- export declare function backend(): Backend;
83
-
84
- import type { V2Decoded, V2Format, V2FormatInfo } from "./index";
85
-
86
- export type { V2Decoded, V2Format, V2FormatInfo };
87
-
88
- /** Generate one OS-only v2 value. */
89
- export declare function generateV2(format: V2Format): string;
90
-
91
- /** Generate one OS-only v2 value as 3-171 ASCII bytes. */
92
- export declare function generateV2Buffer(format: V2Format): Buffer;
93
-
94
- /** Generate `count` OS-only v2 values as a string array. */
95
- export declare function generateV2Many(format: V2Format, count: number): string[];
96
-
97
- /** Generate `count` OS-only v2 values as one contiguous `count * encodedLen` Buffer. */
98
- export declare function generateV2ManyEncoded(format: V2Format, count: number): Buffer;
99
-
100
- /** Decode a v2 value with the expected format. */
101
- export declare function decodeV2(input: string, format: V2Format): V2Decoded;
102
-
103
- /** Normalize and validate a v2 format. */
104
- export declare function formatV2(format: V2Format): V2FormatInfo;
1
+ import type { DecodedRailId, RailIdError, RailIdErrorCode } from "./index";
2
+
3
+ export type { DecodedRailId, RailIdError, RailIdErrorCode };
4
+ export type Backend = "os-only";
5
+
6
+ /** Generate one RailID with the explicitly degraded OS-only profile. */
7
+ export declare function generate(): string;
8
+
9
+ /** Same as `generate()`; kept for symmetry with the default entry point. */
10
+ export declare function generateOsOnly(): string;
11
+
12
+ /** Generate one OS-only RailID as 32 ASCII bytes, without a JS string. */
13
+ export declare function generateBuffer(): Buffer;
14
+
15
+ /** Same as `generateBuffer()`; kept for symmetry. */
16
+ export declare function generateOsOnlyBuffer(): Buffer;
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
+
24
+ /** Generate one 126-bit v4 RailID as 21 ASCII bytes with the OS-only profile. */
25
+ export declare function generateV4Buffer(): Buffer;
26
+
27
+ /** Same as `generateV4Buffer()`; kept for symmetry. */
28
+ export declare function generateV4BufferOsOnly(): Buffer;
29
+
30
+ /**
31
+ * Generate `count` v4 IDs as one contiguous `count * 21` Buffer with the
32
+ * OS-only profile. Capped at 1,000,000 IDs.
33
+ */
34
+ export declare function generateV4ManyEncoded(count: number): Buffer;
35
+
36
+ /** Same as `generateV4ManyEncoded()`; kept for symmetry. */
37
+ export declare function generateV4ManyEncodedOsOnly(count: number): Buffer;
38
+
39
+ /**
40
+ * Generate `count` v4 IDs asynchronously with the OS-only profile. Resolves to
41
+ * a `count * 21` Buffer after running on the libuv thread pool. Capped at
42
+ * 1,000,000 IDs; invalid counts throw `InvalidInput` synchronously.
43
+ */
44
+ export declare function generateV4ManyEncodedAsync(count: number): Promise<Buffer>;
45
+
46
+ /** Same as `generateV4ManyEncodedAsync()`; kept for symmetry. */
47
+ export declare function generateV4ManyEncodedOsOnlyAsync(
48
+ count: number,
49
+ ): Promise<Buffer>;
50
+
51
+ /**
52
+ * Generate v4 IDs with the OS-only profile into a caller-provided Buffer. The
53
+ * buffer length must be an exact multiple of 21 and determines the count;
54
+ * capped at 1,000,000 IDs. Nothing is returned. Invalid lengths throw
55
+ * `InvalidInput` before any bytes are written. This avoids the `count * 21`
56
+ * external allocation and is the recommended high-throughput path.
57
+ */
58
+ export declare function generateV4ManyEncodedInto(buffer: Buffer): void;
59
+
60
+ /** Same as `generateV4ManyEncodedInto()`; kept for symmetry. */
61
+ export declare function generateV4ManyEncodedOsOnlyInto(buffer: Buffer): void;
62
+
63
+ /** Generate `count` IDs synchronously as strings. */
64
+ export declare function generateMany(count: number): string[];
65
+
66
+ /** Generate `count` IDs synchronously as one contiguous `count * 32` Buffer. */
67
+ export declare function generateManyEncoded(count: number): Buffer;
68
+
69
+ /** Generate `count` IDs asynchronously as strings. */
70
+ export declare function generateManyAsync(count: number): Promise<string[]>;
71
+
72
+ /** Generate `count` IDs asynchronously as one contiguous `count * 32` Buffer. */
73
+ export declare function generateManyEncodedAsync(count: number): Promise<Buffer>;
74
+
75
+ /** Decode and validate a RailID. */
76
+ export declare function decode(input: string): DecodedRailId;
77
+
78
+ /** RailID crate version. */
79
+ export declare function version(): string;
80
+
81
+ /** Always `"os-only"` for this entry point. */
82
+ export declare function backend(): Backend;
83
+
84
+ import type { V2Decoded, V2Format, V2FormatInfo } from "./index";
85
+
86
+ export type { V2Decoded, V2Format, V2FormatInfo };
87
+
88
+ /** Generate one OS-only v2 value. */
89
+ export declare function generateV2(format: V2Format): string;
90
+
91
+ /** Generate one OS-only v2 value as 3-171 ASCII bytes. */
92
+ export declare function generateV2Buffer(format: V2Format): Buffer;
93
+
94
+ /** Generate `count` OS-only v2 values as a string array. */
95
+ export declare function generateV2Many(format: V2Format, count: number): string[];
96
+
97
+ /** Generate `count` OS-only v2 values as one contiguous `count * encodedLen` Buffer. */
98
+ export declare function generateV2ManyEncoded(format: V2Format, count: number): Buffer;
99
+
100
+ /**
101
+ * Generate `count` OS-only v2 values asynchronously as a string array. The
102
+ * batch runs on a libuv worker thread and is capped at 1,000,000 IDs. Invalid
103
+ * formats and counts throw `InvalidInput` synchronously.
104
+ */
105
+ export declare function generateV2ManyAsync(
106
+ format: V2Format,
107
+ count: number,
108
+ ): Promise<string[]>;
109
+
110
+ /**
111
+ * Generate `count` OS-only v2 values asynchronously as one contiguous
112
+ * `count * encodedLen` Buffer. The batch runs on a libuv worker thread and is
113
+ * capped at 1,000,000 IDs. Invalid formats and counts throw `InvalidInput`
114
+ * synchronously.
115
+ */
116
+ export declare function generateV2ManyEncodedAsync(
117
+ format: V2Format,
118
+ count: number,
119
+ ): Promise<Buffer>;
120
+
121
+ /** Decode a v2 value with the expected format. */
122
+ export declare function decodeV2(input: string, format: V2Format): V2Decoded;
123
+
124
+ /** Normalize and validate a v2 format. */
125
+ export declare function formatV2(format: V2Format): V2FormatInfo;
package/no-tpm.js CHANGED
@@ -1,37 +1,41 @@
1
- 'use strict';
2
-
3
- // TPM-less entry point.
4
- //
5
- // The default entry point keeps the fail-closed TPM hybrid profile: `generate()`
6
- // throws when no TPM is available. This module is the explicit opt-in for hosts
7
- // that never have a TPM. Every generator here uses the degraded OS-only
8
- // profile, and the choice is visible at the import site.
9
- const core = require('./index.js');
10
-
11
- module.exports = {
12
- ...core,
13
- generate: core.generateOsOnly,
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,
18
- generateV4Buffer: core.generateV4BufferOsOnly,
19
- generateV4ManyEncoded: (count) => core.generateV4ManyEncodedOsOnly(count),
20
- generateV4ManyEncodedAsync: (count) => core.generateV4ManyEncodedOsOnlyAsync(count),
21
- generateV4ManyEncodedInto: (buffer) => core.generateV4ManyEncodedOsOnlyInto(buffer),
22
- // The `osOnly` argument is accepted for signature compatibility and always
23
- // resolves to the OS-only profile.
24
- generateMany: (count) => core.generateMany(count, true),
25
- generateManyEncoded: (count) => core.generateManyEncoded(count, true),
26
- generateManyAsync: (count) => core.generateManyAsync(count, true),
27
- generateManyEncodedAsync: (count) => core.generateManyEncodedAsync(count, true),
28
- // v2 generation uses the OS-only profile; decoding is profile-independent.
29
- generateV2: (format) => core.generateV2(format, 'os-only'),
30
- generateV2Buffer: (format) => core.generateV2Buffer(format, 'os-only'),
31
- generateV2Many: (format, count) => core.generateV2Many(format, count, 'os-only'),
32
- generateV2ManyEncoded: (format, count) =>
33
- core.generateV2ManyEncoded(format, count, 'os-only'),
34
- // The loaded binary may still contain the TPM backend, but this module never
35
- // calls it.
36
- backend: () => 'os-only',
37
- };
1
+ 'use strict';
2
+
3
+ // TPM-less entry point.
4
+ //
5
+ // The default entry point keeps the fail-closed TPM hybrid profile: `generate()`
6
+ // throws when no TPM is available. This module is the explicit opt-in for hosts
7
+ // that never have a TPM. Every generator here uses the degraded OS-only
8
+ // profile, and the choice is visible at the import site.
9
+ const core = require('./index.js');
10
+
11
+ module.exports = {
12
+ ...core,
13
+ generate: core.generateOsOnly,
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,
18
+ generateV4Buffer: core.generateV4BufferOsOnly,
19
+ generateV4ManyEncoded: (count) => core.generateV4ManyEncodedOsOnly(count),
20
+ generateV4ManyEncodedAsync: (count) => core.generateV4ManyEncodedOsOnlyAsync(count),
21
+ generateV4ManyEncodedInto: (buffer) => core.generateV4ManyEncodedOsOnlyInto(buffer),
22
+ // The `osOnly` argument is accepted for signature compatibility and always
23
+ // resolves to the OS-only profile.
24
+ generateMany: (count) => core.generateMany(count, true),
25
+ generateManyEncoded: (count) => core.generateManyEncoded(count, true),
26
+ generateManyAsync: (count) => core.generateManyAsync(count, true),
27
+ generateManyEncodedAsync: (count) => core.generateManyEncodedAsync(count, true),
28
+ // v2 generation uses the OS-only profile; decoding is profile-independent.
29
+ generateV2: (format) => core.generateV2(format, 'os-only'),
30
+ generateV2Buffer: (format) => core.generateV2Buffer(format, 'os-only'),
31
+ generateV2Many: (format, count) => core.generateV2Many(format, count, 'os-only'),
32
+ generateV2ManyEncoded: (format, count) =>
33
+ core.generateV2ManyEncoded(format, count, 'os-only'),
34
+ generateV2ManyAsync: (format, count) =>
35
+ core.generateV2ManyAsync(format, count, 'os-only'),
36
+ generateV2ManyEncodedAsync: (format, count) =>
37
+ core.generateV2ManyEncodedAsync(format, count, 'os-only'),
38
+ // The loaded binary may still contain the TPM backend, but this module never
39
+ // calls it.
40
+ backend: () => 'os-only',
41
+ };
package/package.json CHANGED
@@ -1,45 +1,57 @@
1
- {
2
- "name": "@neko-makura/railid",
3
- "version": "4.3.2",
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
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "license": "MIT",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/nekomakura-nyan/rail-id.git",
11
- "directory": "node"
12
- },
13
- "homepage": "https://github.com/nekomakura-nyan/rail-id",
14
- "bugs": {
15
- "url": "https://github.com/nekomakura-nyan/rail-id/issues"
16
- },
17
- "keywords": [
18
- "railid",
19
- "identifier",
20
- "uuid",
21
- "tpm",
22
- "napi",
23
- "native"
24
- ],
25
- "engines": {
26
- "node": ">=18"
27
- },
28
- "files": [
29
- "index.js",
30
- "index.d.ts",
31
- "errors.js",
32
- "no-tpm.js",
33
- "no-tpm.d.ts",
34
- "v2.js",
35
- "*.node",
36
- "README.md",
37
- "LICENSE"
38
- ],
39
- "scripts": {
40
- "build": "node scripts/build.js",
41
- "verify": "node scripts/verify.js",
42
- "test": "node test.js",
43
- "pack:check": "npm pack --dry-run"
44
- }
45
- }
1
+ {
2
+ "name": "@neko-makura/railid",
3
+ "version": "4.4.0",
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
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/LunaLaboratory/Rail-ID.git",
11
+ "directory": "node"
12
+ },
13
+ "homepage": "https://github.com/LunaLaboratory/Rail-ID",
14
+ "bugs": {
15
+ "url": "https://github.com/LunaLaboratory/Rail-ID/issues"
16
+ },
17
+ "keywords": [
18
+ "railid",
19
+ "identifier",
20
+ "uuid",
21
+ "tpm",
22
+ "napi",
23
+ "native"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "files": [
29
+ "index.js",
30
+ "index.d.ts",
31
+ "errors.js",
32
+ "no-tpm.js",
33
+ "no-tpm.d.ts",
34
+ "v2.js",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "scripts": {
39
+ "build": "node scripts/build.js",
40
+ "npm-dirs": "node scripts/create-npm-dirs.js",
41
+ "verify": "node scripts/verify.js",
42
+ "test": "node test.js",
43
+ "pack:check": "npm pack --dry-run"
44
+ },
45
+ "optionalDependencies": {
46
+ "@neko-makura/railid-darwin-arm64": ">=4.3.3 <5",
47
+ "@neko-makura/railid-darwin-x64": ">=4.3.3 <5",
48
+ "@neko-makura/railid-linux-arm-gnu": ">=4.4.0 <5",
49
+ "@neko-makura/railid-linux-arm64-gnu": ">=4.4.0 <5",
50
+ "@neko-makura/railid-linux-arm64-musl": ">=4.4.0 <5",
51
+ "@neko-makura/railid-linux-riscv64-gnu": ">=4.4.0 <5",
52
+ "@neko-makura/railid-linux-x64-gnu": ">=4.4.0 <5",
53
+ "@neko-makura/railid-linux-x64-musl": ">=4.4.0 <5",
54
+ "@neko-makura/railid-win32-arm64-msvc": ">=4.4.0 <5",
55
+ "@neko-makura/railid-win32-x64-msvc": ">=4.4.0 <5"
56
+ }
57
+ }