@anizoptera/uuid-slug 0.4.0 → 0.6.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 +232 -1062
- package/dist/alphabet.d.ts +1 -3
- package/dist/alphabet.d.ts.map +1 -1
- package/dist/alphabet.js +32 -90
- package/dist/alphabet.js.map +1 -1
- package/dist/base64url-name.d.ts +1 -3
- package/dist/base64url-name.d.ts.map +1 -1
- package/dist/base64url-name.js +2 -3
- package/dist/errors.d.ts +1 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +7 -24
- package/dist/errors.js.map +1 -1
- package/dist/feistel.js +1 -2
- package/dist/generation-options.js +2 -3
- package/dist/index.d.ts +10 -10
- package/dist/index.js +21 -21
- package/dist/instant.js +2 -3
- package/dist/mask-handle.d.ts +1 -3
- package/dist/mask-handle.d.ts.map +1 -1
- package/dist/mask-handle.js +19 -17
- package/dist/mask-handle.js.map +1 -1
- package/dist/mask.d.ts +1 -3
- package/dist/mask.d.ts.map +1 -1
- package/dist/mask.js +23 -24
- package/dist/mask.js.map +1 -1
- package/dist/masked-bytes.js +74 -0
- package/dist/masked-bytes.js.map +1 -0
- package/dist/masking-codec-protocol.js +2 -3
- package/dist/masking-codec-types.d.ts +60 -19
- package/dist/masking-codec-types.d.ts.map +1 -1
- package/dist/masking-codec.d.ts +1 -3
- package/dist/masking-codec.d.ts.map +1 -1
- package/dist/masking-codec.js +115 -111
- package/dist/masking-codec.js.map +1 -1
- package/dist/migration.js +39 -40
- package/dist/migration.js.map +1 -1
- package/dist/node/runtime.js +2 -3
- package/dist/payload.d.ts +1 -3
- package/dist/payload.d.ts.map +1 -1
- package/dist/payload.js +65 -64
- package/dist/payload.js.map +1 -1
- package/dist/runtime/pool.js +2 -3
- package/dist/runtime/portable.js +2 -3
- package/dist/runtime/portable.js.map +1 -1
- package/dist/sentinel.js +2 -3
- package/dist/siphash.js +1 -2
- package/dist/slug.d.ts +14 -13
- package/dist/slug.d.ts.map +1 -1
- package/dist/slug.js +144 -152
- package/dist/slug.js.map +1 -1
- package/dist/timestamp.d.ts +1 -3
- package/dist/timestamp.d.ts.map +1 -1
- package/dist/timestamp.js +2 -3
- package/dist/types.d.ts +38 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -3
- package/dist/types.js.map +1 -1
- package/dist/uuid-value-protocol.js +2 -3
- package/dist/uuid-value.d.ts +3 -5
- package/dist/uuid-value.d.ts.map +1 -1
- package/dist/uuid-value.js +74 -78
- package/dist/uuid-value.js.map +1 -1
- package/dist/uuid.d.ts +6 -8
- package/dist/uuid.d.ts.map +1 -1
- package/dist/uuid.js +34 -45
- package/dist/uuid.js.map +1 -1
- package/dist/v4-slug.d.ts +2 -4
- package/dist/v4-slug.d.ts.map +1 -1
- package/dist/v4-slug.js +6 -7
- package/dist/v4.d.ts +8 -6
- package/dist/v4.d.ts.map +1 -1
- package/dist/v4.js +3 -9
- package/dist/v4.js.map +1 -1
- package/dist/v7-bounds.d.ts +3 -5
- package/dist/v7-bounds.d.ts.map +1 -1
- package/dist/v7-bounds.js +8 -9
- package/dist/v7-bounds.js.map +1 -1
- package/dist/v7-generator-input.js +10 -11
- package/dist/v7-generator-input.js.map +1 -1
- package/dist/v7-generator.d.ts +1 -3
- package/dist/v7-generator.d.ts.map +1 -1
- package/dist/v7-generator.js +13 -14
- package/dist/v7-keyless.d.ts +12 -4
- package/dist/v7-keyless.d.ts.map +1 -1
- package/dist/v7-keyless.js +2 -3
- package/dist/v7-keyless.js.map +1 -1
- package/dist/v7-payload.js +2 -3
- package/dist/v7-slug.d.ts +8 -5
- package/dist/v7-slug.d.ts.map +1 -1
- package/dist/v7-slug.js +28 -29
- package/dist/v7-slug.js.map +1 -1
- package/dist/v7-timestamp.js +2 -3
- package/dist/v7-value-options.js +2 -3
- package/dist/v7-value.d.ts +5 -8
- package/dist/v7-value.d.ts.map +1 -1
- package/dist/v7-value.js +10 -11
- package/dist/v7-value.js.map +1 -1
- package/dist/v7.js +16 -17
- package/dist/v7.js.map +1 -1
- package/package.json +6 -4
- package/src/alphabet.ts +84 -239
- package/src/errors.ts +30 -43
- package/src/feistel.ts +4 -4
- package/src/generation-options.ts +1 -1
- package/src/index.ts +3 -0
- package/src/mask-handle.ts +7 -11
- package/src/mask.ts +16 -14
- package/src/masked-bytes.ts +203 -0
- package/src/masking-codec-protocol.ts +1 -1
- package/src/masking-codec-types.ts +124 -24
- package/src/masking-codec.ts +44 -43
- package/src/migration.ts +8 -7
- package/src/payload.ts +71 -53
- package/src/runtime/bun.ts +1 -1
- package/src/runtime/node.ts +2 -2
- package/src/runtime/pool.ts +1 -1
- package/src/runtime/portable.ts +3 -3
- package/src/runtime/types.ts +2 -4
- package/src/slug.ts +45 -54
- package/src/types.ts +108 -17
- package/src/uuid-value-protocol.ts +1 -1
- package/src/uuid-value.ts +3 -10
- package/src/uuid.ts +27 -41
- package/src/v4.ts +14 -11
- package/src/v7-bounds.ts +7 -5
- package/src/v7-generator-input.ts +4 -7
- package/src/v7-generator.ts +2 -2
- package/src/v7-keyless.ts +35 -6
- package/src/v7-payload.ts +1 -1
- package/src/v7-slug.ts +21 -2
- package/src/v7-value.ts +9 -4
- package/src/v7.ts +27 -1
package/dist/mask-handle.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// @anizoptera/uuid-slug 0.
|
|
2
|
+
// @anizoptera/uuid-slug 0.6.0 | https://github.com/Anizoptera/uuid-slug#readme
|
|
3
3
|
import { UuidSlugError } from "./errors.js";
|
|
4
4
|
import { CustomUuidV7MaskOptions, UuidV7Mask } from "./types.js";
|
|
5
|
-
//#region src/mask-handle.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Build an immutable mask from reversible 16-byte callbacks. Each callback receives isolated bytes,
|
|
8
7
|
* so returning the same array is safe. Invalid results and thrown values return `UuidSlugError`.
|
|
@@ -12,5 +11,4 @@ import { CustomUuidV7MaskOptions, UuidV7Mask } from "./types.js";
|
|
|
12
11
|
* @returns The validated mask, or `UuidSlugError` for an invalid contract or callback result.
|
|
13
12
|
*/
|
|
14
13
|
export declare function createCustomUuidV7Mask(options: CustomUuidV7MaskOptions): UuidV7Mask | UuidSlugError;
|
|
15
|
-
//#endregion
|
|
16
14
|
//# sourceMappingURL=mask-handle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask-handle.d.ts","names":[],"sources":["../src/mask-handle.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mask-handle.d.ts","names":[],"sources":["../src/mask-handle.ts"],"mappings":";;;;;;;;;;;;wBAuFgB,uBACd,SAAS,0BACR,aAAa"}
|
package/dist/mask-handle.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// @anizoptera/uuid-slug 0.
|
|
2
|
+
// @anizoptera/uuid-slug 0.6.0 | https://github.com/Anizoptera/uuid-slug#readme
|
|
3
3
|
import { INVALID_MASK as e, UuidSlugError as t, findUnknownOption as n, isUint8Array as r, isUuidSlugError as i, stringInput as a } from "./errors.js";
|
|
4
|
-
|
|
5
|
-
const o = Symbol.for("@anizoptera/uuid-slug/mask/1"), s = "
|
|
4
|
+
// src/mask-handle.ts
|
|
5
|
+
const o = Symbol.for("@anizoptera/uuid-slug/mask/1"), s = "mask", c = {
|
|
6
6
|
diagnosticLabel: !0,
|
|
7
|
-
[
|
|
7
|
+
[s]: !0,
|
|
8
8
|
unmask: !0
|
|
9
9
|
};
|
|
10
10
|
/*#__NO_SIDE_EFFECTS__*/
|
|
@@ -34,27 +34,29 @@ function runCustom(n, a) {
|
|
|
34
34
|
function createCustomUuidV7Mask(r) {
|
|
35
35
|
try {
|
|
36
36
|
if (typeof r != "object" || !r || Array.isArray(r)) return new t(e, "Custom mask options must be an object.");
|
|
37
|
-
let o = /* @__PURE__ */ n(r,
|
|
37
|
+
let o = /* @__PURE__ */ n(r, c);
|
|
38
38
|
if (o !== void 0) return new t(e, `Unknown custom mask option: ${o}.`);
|
|
39
|
-
let { mask:
|
|
40
|
-
if (typeof
|
|
39
|
+
let { mask: l, unmask: u } = r, d = /* @__PURE__ */ a(r.diagnosticLabel);
|
|
40
|
+
if (typeof d != "string" || typeof l != "function" || typeof u != "function") return new t(e, "A custom UUIDv7 mask requires a string diagnosticLabel plus mask and unmask functions.");
|
|
41
41
|
for (let n of [/* @__PURE__ */ new Uint8Array(16), Uint8Array.from({ length: 16 }, (e, t) => t * 17)]) {
|
|
42
|
-
let r = runCustom(
|
|
43
|
-
if (/* @__PURE__ */ i(r)) return
|
|
44
|
-
let a = runCustom(
|
|
45
|
-
if (/* @__PURE__ */ i(a)) return
|
|
46
|
-
if (a.some((e, t) => e !== n[t])) return new t(e, `UUIDv7 mask "${
|
|
42
|
+
let r = runCustom(l, n);
|
|
43
|
+
if (/* @__PURE__ */ i(r)) return customMaskFailure(r);
|
|
44
|
+
let a = runCustom(u, r);
|
|
45
|
+
if (/* @__PURE__ */ i(a)) return customMaskFailure(a);
|
|
46
|
+
if (a.some((e, t) => e !== n[t])) return new t(e, `UUIDv7 mask "${d}" does not unmask its own masked output.`);
|
|
47
47
|
}
|
|
48
|
-
return /* @__PURE__ */ createMaskHandle(
|
|
49
|
-
let r = runCustom(n ===
|
|
48
|
+
return /* @__PURE__ */ createMaskHandle(d, (e, t, n) => {
|
|
49
|
+
let r = runCustom(n === s ? l : u, e);
|
|
50
50
|
if (/* @__PURE__ */ i(r)) return r;
|
|
51
51
|
t.set(r);
|
|
52
52
|
});
|
|
53
|
-
} catch (
|
|
54
|
-
return
|
|
53
|
+
} catch (e) {
|
|
54
|
+
return customMaskFailure(e);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
function customMaskFailure(n) {
|
|
58
|
+
return new t(e, "Custom mask construction failed.", { cause: n });
|
|
59
|
+
}
|
|
58
60
|
export { applyMask, createCustomUuidV7Mask, createMaskHandle, isMaskHandle };
|
|
59
61
|
|
|
60
62
|
//# sourceMappingURL=mask-handle.js.map
|
package/dist/mask-handle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask-handle.js","names":["MASK_PROTOCOL","
|
|
1
|
+
{"version":3,"file":"mask-handle.js","names":["MASK_PROTOCOL","MASK_DIRECTION","CUSTOM_MASK_OPTIONS","mask","protocol","input","output","direction","UuidSlugError","INVALID_MASK","transform","options","unknown","diagnosticLabel","unmask","probe","index","mixed","restored","byte","cause"],"sources":["../src/mask-handle.ts"],"mappings":";;;;AAYA,MAAMA,IAAgB,OAAO,IAAI,8BAA8B,GAEzDC,IAAiB,QACjBC,IAAsB;CAC1B,iBAAiB;EAChBD,IAAiB;CAClB,QAAQ;AACV;;AAkBA,SAAgB,iBAAiB,GAAyB,GAAsC;CAC9F,IAAME,IAAO,EAAE,mBAAgB;CAI/B,OAHA,OAAO,eAAeA,GAAMH,GAAe,EACzC,OAAO,OAAO,OAAqB;EAAE,SAAS;EAAG;CAAI,CAAC,EACxD,CAAC,GACM,OAAO,OAAOG,CAAI;AAC3B;AAEA,SAAS,aAAa,GAA4C;CAChE,IAAI,OAAOA,KAAS,aAAYA,GAAe;CAC/C,IAAMC,IAAYD,EAA6BH;CAC/C,OAAOI,GAAU,YAAY,KAAK,OAAOA,EAAS,OAAQ,aAAaA,IAAW,KAAA;AACpF;AAEA,SAAgB,aAAa,GAAmC;CAC9D,OAAO,aAAaD,CAAkB,MAAM,KAAA;AAC9C;AAEA,SAAgB,UACd,GACA,GACA,GACA,GAC2B;CAC3B,IAAMC,IAAW,aAAaD,CAAI;CAElC,OADKC,IACEA,EAAS,IAAIC,GAAOC,GAAQC,CAAS,IADtB,IAAIC,EAAcC,GAAc,yCAAyC;AAEjG;AAEA,SAAS,UACP,GACA,GAC4B;CAG5B,IAAMH,IAASI,EAAUL,EAAM,MAAM,CAAC;CAItC,OAHI,kBAAgBC,CAAM,IAAUA,I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AkB,GAA+B;CACxD,OAAO,IAAIZ,EAAcC,GAAc,oCAA6B,EAAE,SAAM,CAAC;AAC/E"}
|
package/dist/mask.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// @anizoptera/uuid-slug 0.
|
|
2
|
+
// @anizoptera/uuid-slug 0.6.0 | https://github.com/Anizoptera/uuid-slug#readme
|
|
3
3
|
import { UuidSlugError } from "./errors.js";
|
|
4
4
|
import { AsyncUuidV7MaskOptions, UuidV7Mask, UuidV7MaskOptions } from "./types.js";
|
|
5
|
-
//#region src/mask.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Derive an immutable mask from a secret seed of at least 16 bytes. The seed and iteration count
|
|
8
7
|
* define the wire format; retain the old mask in `previousMasks` before changing either. Invalid
|
|
@@ -23,5 +22,4 @@ export declare function deriveUuidV7Mask(options: UuidV7MaskOptions): UuidV7Mask
|
|
|
23
22
|
export declare function deriveUuidV7MaskAsync(options: AsyncUuidV7MaskOptions): Promise<UuidV7Mask | UuidSlugError>;
|
|
24
23
|
/** Public-key mask for deterministic tests and examples. Never use it to hide production IDs. */
|
|
25
24
|
export declare const UUID_V7_TEST_MASK: UuidV7Mask;
|
|
26
|
-
//#endregion
|
|
27
25
|
//# sourceMappingURL=mask.d.ts.map
|
package/dist/mask.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask.d.ts","names":[],"sources":["../src/mask.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mask.d.ts","names":[],"sources":["../src/mask.ts"],"mappings":";;;;;;;;;;;;wBA4LgB,iBAAiB,SAAS,oBAAoB,aAAa;;;;;;;;;wBA0IrD,sBACpB,SAAS,yBACR,QAAQ,aAAa;;qBAmDX,mBAAmB"}
|
package/dist/mask.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// @anizoptera/uuid-slug 0.
|
|
2
|
+
// @anizoptera/uuid-slug 0.6.0 | https://github.com/Anizoptera/uuid-slug#readme
|
|
3
3
|
import { ABORTED as e, INVALID_MASK as t, UuidSlugError as n, findUnknownOption as r, isUint8Array as i, stringInput as a } from "./errors.js";
|
|
4
4
|
import { feistel16 as o } from "./feistel.js";
|
|
5
5
|
import { createMaskHandle as s } from "./mask-handle.js";
|
|
6
6
|
import { halfSipHash as c } from "./siphash.js";
|
|
7
7
|
import { encodeUtf8 as l } from "#runtime";
|
|
8
|
-
|
|
8
|
+
// src/mask.ts
|
|
9
9
|
const u = "Mask construction failed.", d = "seed", f = {
|
|
10
10
|
keyDerivationIterations: !0,
|
|
11
11
|
diagnosticLabel: !0,
|
|
@@ -13,12 +13,12 @@ const u = "Mask construction failed.", d = "seed", f = {
|
|
|
13
13
|
}, p = {
|
|
14
14
|
...f,
|
|
15
15
|
signal: !0
|
|
16
|
-
}, m = 1 << 24, h = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1
|
|
16
|
+
}, m = 1 << 24, h = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
|
|
17
17
|
/*#__NO_SIDE_EFFECTS__*/
|
|
18
|
-
function
|
|
19
|
-
return h && !(e.byteOffset & 3) && !(e.length & 3);
|
|
18
|
+
function seedWordView(e) {
|
|
19
|
+
return e.length >= 4096 && h && !(e.byteOffset & 3) && !(e.length & 3) ? new Int32Array(e.buffer, e.byteOffset, e.length >>> 2) : void 0;
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const g = 1097297011, _ = 1114074227, v = 1684632949;
|
|
22
22
|
function seedBytes(e) {
|
|
23
23
|
return typeof e == "string" ? l(e) : new Uint8Array(e);
|
|
24
24
|
}
|
|
@@ -39,9 +39,10 @@ function validateOptions(e, o) {
|
|
|
39
39
|
}
|
|
40
40
|
/*#__NO_SIDE_EFFECTS__*/
|
|
41
41
|
function seedWords(e) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
let t = /* @__PURE__ */ seedWordView(e);
|
|
43
|
+
if (t) return t;
|
|
44
|
+
let n = new Int32Array(Math.ceil(e.length / 4) + 1);
|
|
45
|
+
return writeSeedWords(e, n), n;
|
|
45
46
|
}
|
|
46
47
|
function writeSeedWords(e, t, n = 0, r = 0, i = e.length) {
|
|
47
48
|
for (let a = r; a < i; a += 1) {
|
|
@@ -51,15 +52,14 @@ function writeSeedWords(e, t, n = 0, r = 0, i = e.length) {
|
|
|
51
52
|
}
|
|
52
53
|
/*#__NO_SIDE_EFFECTS__*/
|
|
53
54
|
function chain(e, t, n, r, i) {
|
|
54
|
-
let a =
|
|
55
|
-
c(
|
|
56
|
-
for (let e = 1; e < i; e += 1) c(a[0], a[1], n, r, a);
|
|
55
|
+
let a = Int32Array.of(e, t);
|
|
56
|
+
for (let e = 0; e < i; e += 1) c(a[0], a[1], n, r, a);
|
|
57
57
|
return a;
|
|
58
58
|
}
|
|
59
59
|
/*#__NO_SIDE_EFFECTS__*/
|
|
60
60
|
function derivedKeys(e, t) {
|
|
61
61
|
let n = /* @__PURE__ */ seedWords(e);
|
|
62
|
-
return /* @__PURE__ */ roundKeys(/* @__PURE__ */ chain(
|
|
62
|
+
return /* @__PURE__ */ roundKeys(/* @__PURE__ */ chain(v, g, n, e.length, t), /* @__PURE__ */ chain(v, _, n, e.length, t));
|
|
63
63
|
}
|
|
64
64
|
/*#__NO_SIDE_EFFECTS__*/
|
|
65
65
|
function roundKeys(e, t) {
|
|
@@ -94,9 +94,9 @@ function invalidSeedLength(e) {
|
|
|
94
94
|
function validatedIterations(e) {
|
|
95
95
|
return typeof e != "number" || !Number.isInteger(e) || e < 1 || e > m ? new n(t, `Mask keyDerivationIterations must be a whole number in 1..${m}, got ${String(e)}.`) : e;
|
|
96
96
|
}
|
|
97
|
-
const
|
|
97
|
+
const y = 4096, b = globalThis, x = b.setImmediate?.bind(b);
|
|
98
98
|
function yieldToHost() {
|
|
99
|
-
return
|
|
99
|
+
return x ? new Promise((e) => x(e)) : new Promise((e) => {
|
|
100
100
|
let t = new MessageChannel();
|
|
101
101
|
t.port1.onmessage = () => {
|
|
102
102
|
t.port1.close(), t.port2.close(), e();
|
|
@@ -106,11 +106,11 @@ function yieldToHost() {
|
|
|
106
106
|
function* cooperativeChain(e, t, n, r, i) {
|
|
107
107
|
let a = /* @__PURE__ */ new Int32Array(2);
|
|
108
108
|
a[0] = e, a[1] = t;
|
|
109
|
-
let o = Math.max(1, Math.floor(
|
|
109
|
+
let o = Math.max(1, Math.floor(y / (r + 4))), s = 0;
|
|
110
110
|
for (let e = 0; e < i; e += 1) {
|
|
111
111
|
let e;
|
|
112
112
|
do
|
|
113
|
-
e = c(a[0], a[1], n, r, a, e,
|
|
113
|
+
e = c(a[0], a[1], n, r, a, e, y / 4), e && (yield);
|
|
114
114
|
while (e);
|
|
115
115
|
s += 1, s >= o && (s = 0, yield);
|
|
116
116
|
}
|
|
@@ -119,7 +119,7 @@ function* cooperativeChain(e, t, n, r, i) {
|
|
|
119
119
|
function* cooperativeKeys(e, t) {
|
|
120
120
|
let n = [], r = 0;
|
|
121
121
|
if (typeof e == "string") for (let t = 0; t < e.length;) {
|
|
122
|
-
let i = Math.min(e.length, t +
|
|
122
|
+
let i = Math.min(e.length, t + y), a = e.charCodeAt(i - 1), o = e.charCodeAt(i);
|
|
123
123
|
i < e.length && a >= 55296 && a <= 56319 && o >= 56320 && o <= 57343 && --i;
|
|
124
124
|
let s = l(e.slice(t, i));
|
|
125
125
|
n.push(s), r += s.length, t = i, yield;
|
|
@@ -127,15 +127,15 @@ function* cooperativeKeys(e, t) {
|
|
|
127
127
|
else n.push(e), r = e.length;
|
|
128
128
|
let i = /* @__PURE__ */ invalidSeedLength(r);
|
|
129
129
|
if (i) return i;
|
|
130
|
-
let a = typeof e
|
|
130
|
+
let a = typeof e == "string" ? void 0 : /* @__PURE__ */ seedWordView(e), o = a ?? new Int32Array(Math.ceil(r / 4) + 1);
|
|
131
131
|
if (!a) {
|
|
132
132
|
let e = 0;
|
|
133
133
|
for (let t of n) {
|
|
134
|
-
for (let n = 0; n < t.length; n +=
|
|
134
|
+
for (let n = 0; n < t.length; n += y) writeSeedWords(t, o, e, n, Math.min(t.length, n + y)), yield;
|
|
135
135
|
e += t.length;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
return n.length = 0, /* @__PURE__ */ roundKeys(yield* cooperativeChain(
|
|
138
|
+
return n.length = 0, /* @__PURE__ */ roundKeys(yield* cooperativeChain(v, g, o, r, t), yield* cooperativeChain(v, _, o, r, t));
|
|
139
139
|
}
|
|
140
140
|
async function deriveUuidV7MaskAsync(r) {
|
|
141
141
|
try {
|
|
@@ -157,8 +157,7 @@ async function deriveUuidV7MaskAsync(r) {
|
|
|
157
157
|
return new n(t, u, { cause: e });
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
export { C as UUID_V7_TEST_MASK, deriveUuidV7Mask, deriveUuidV7MaskAsync };
|
|
160
|
+
const S = /*#__PURE__*/ feistelMask("default", /*#__PURE__*/ seedBytes("anizoptera.uuid-slug.default-mask.v1"), 1);
|
|
161
|
+
export { S as UUID_V7_TEST_MASK, deriveUuidV7Mask, deriveUuidV7MaskAsync };
|
|
163
162
|
|
|
164
163
|
//# sourceMappingURL=mask.js.map
|
package/dist/mask.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask.js","names":["MASK_CONSTRUCTION_FAILURE_MESSAGE","SEED_PROPERTY","MASK_OPTIONS","ASYNC_MASK_OPTIONS","MAX_KEY_ITERATIONS","LITTLE_ENDIAN","
|
|
1
|
+
{"version":3,"file":"mask.js","names":["MASK_CONSTRUCTION_FAILURE_MESSAGE","SEED_PROPERTY","MASK_OPTIONS","ASYNC_MASK_OPTIONS","MAX_KEY_ITERATIONS","LITTLE_ENDIAN","seed","CHAIN_A_KEY1","CHAIN_B_KEY1","CHAIN_KEY0","encodeUtf8","options","UuidSlugError","INVALID_MASK","input","unknown","accepted","givenSeed","givenLabel","normalizedLabel","givenIterations","iterations","view","words","index","start","end","absolute","offset","out","key0","key1","i","length","keys","fromA","fromB","word","halfSipHash","chainA","chainB","diagnosticLabel","direction","output","validated","cause","CHUNK_BYTES","host","immediate","resolve","channel","hashesPerChunk","sinceCheckpoint","continuation","chunks","last","next","bytes","short","signal","ABORTED","steps","deadline","failure","step","UUID_V7_TEST_MASK"],"sources":["../src/mask.ts"],"mappings":";;;;;;;;AAiBA,MAAMA,IAAoC,6BACpCC,IAAgB,QAChBC,IAAe;CACnB,yBAAyB;CACzB,iBAAiB;EAChBD,IAAgB;AACnB,GACME,IAAqB;CACzB,GAAGD;CACH,QAAQ;AACV,GAMME,IAAqB,KAAK,IAG1BC,IAAgB,IAAI,WAAW,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO;;AAIzE,SAAS,aAAa,GAA0C;CAE9D,OAAOC,EAAK,UAAU,QACpBD,KAAA,EACCC,EAAK,aAAa,MAAO,EACzBA,EAAK,SAAS,KACb,IAAI,WAAWA,EAAK,QAAQA,EAAK,YAAYA,EAAK,WAAW,CAAC,IAC9D,KAAA;AACN;AASA,MAAMC,IAAe,YACfC,IAAe,YACfC,IAAa;AAEnB,SAAS,UAAU,GAA2B;CAE5C,OADI,OAAOH,KAAS,WACbI,EAAWJ,CAAI,IADe,IAAI,WAAWA,CAAI;AAE1D;AAGA,SAAS,gBAAgB,GAAkB,GAA0C;CACnF,IAAI,OAAOK,KAAY,aAAYA,GACjC,OAAO,IAAIC,EACTC,GACA,wDACF;CACF,IAAMC,IAAQH,GAKRI,IAAU,kBAAkBD,GAAOE,CAAQ;CACjD,IAAID,MAAY,KAAA,GACd,OAAO,IAAIH,EAAcC,GAAc,wBAAwBE,EAAQ,EAAE;CAG3E,IAAME,IAAYH,EAAM,MAClBR,IACJ,OAAOW,KAAc,YAAY,kBAAaA,CAAS,IAAIA,IAAY,kBAAYA,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SAAS,OAAO,QAAQ;EACpC,IAAMf,IAAY,gBAAgBjC,GAASR,CAAkB;EAC7D,IAAI,EAAEF,KAAiB2C,IAAY,OAAOA;EAG1C,IAAMiB,IAAQ,gBADZ,OAAOjB,EAAU,QAAS,WAAWA,EAAU,OAAO,IAAI,WAAWA,EAAU,IAAI,GACjDA,EAAU,UAAU,GACpDkB,IAAW,YAAY,IAAI,IAAI;EACnC,SAAa;GACX,IAAIH,GAAQ,SAAS;IACnB,IAAMI,IAAU,QAAQ;IAExB,OADAF,EAAM,OAAOE,CAAO,GACbA;GACT;GACA,IAAMC,IAAOH,EAAM,KAAK;GACxB,IAAIG,EAAK,MACP,OAAO,YAAY,OAAOA,EAAK,KAAK,IAChC,6BAAapB,EAAU,iBAAiBoB,EAAK,KAAK,IAClDA,EAAK;GACX,AAAI,YAAY,IAAI,KAAKF,MAEvB,MAAM,YAAY,GAClB,IAAW,YAAY,IAAI,IAAI;EAEnC;CACF,SAASjB,GAAO;EACd,OAAO,IAAIjC,EAAcC,GAAcb,GAAmC,EAAE,SAAM,CAAC;CACrF;AACF;AAUA,MAOaiE,IAA8C,0BACzD,WACc,wBAAU,sCAAY,GACpC,CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// @anizoptera/uuid-slug 0.6.0 | https://github.com/Anizoptera/uuid-slug#readme
|
|
3
|
+
import { INVALID_MASK as e, INVALID_OPTIONS as t, INVALID_UUID_SLUG as n, INVALID_UUID_VERSION as r, UuidSlugError as i, checkByteRange as a, checkRange as o, isSuccessfulUuidBytes as s, isUint8Array as c, isUuidSlugError as l } from "./errors.js";
|
|
4
|
+
import { maskUuidV7Block as u, unmix as d } from "./payload.js";
|
|
5
|
+
import { exactUuidByteView as f, formatUuidBytesUnchecked as p, isUuidV7Bytes as m, resolveUuidTextCase as h } from "./uuid.js";
|
|
6
|
+
import { UUID_TEXT_LOWERCASE as g } from "./types.js";
|
|
7
|
+
// src/masked-bytes.ts
|
|
8
|
+
function readMaskedByteSource(e, n) {
|
|
9
|
+
return n === void 0 ? /* @__PURE__ */ f(e) : /* @__PURE__ */ c(e) ? /* @__PURE__ */ o(e.length, n, 16) ?? e : /* @__PURE__ */ l(e) ? e : n === 0 ? /* @__PURE__ */ f(e) : new i(t, "A non-zero byteOffset requires Uint8Array input.");
|
|
10
|
+
}
|
|
11
|
+
function createMaskedByteMethods(t, o, c, l) {
|
|
12
|
+
function sentinel(e, t = 0) {
|
|
13
|
+
for (let n of l) {
|
|
14
|
+
let r = 0;
|
|
15
|
+
for (; r < 16 && n.bytes[r] === e[t + r];) r += 1;
|
|
16
|
+
if (r === 16) return n.bytes;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function uuidToMaskedBytes(n, c, l = 0) {
|
|
20
|
+
let d = t(n);
|
|
21
|
+
if (!s(d)) return d;
|
|
22
|
+
if (c !== void 0) {
|
|
23
|
+
let e = /* @__PURE__ */ a(c, l, 16);
|
|
24
|
+
if (e) return e;
|
|
25
|
+
}
|
|
26
|
+
if (!/* @__PURE__ */ m(d)) return new i(r, "Masking requires an RFC-variant UUIDv7.");
|
|
27
|
+
let f = new Uint8Array(d);
|
|
28
|
+
if (!sentinel(d)) {
|
|
29
|
+
let t = u(f, o.mask, o.timestampRangeStartUnixMs);
|
|
30
|
+
if (typeof t != "number") return t;
|
|
31
|
+
if (sentinel(f)) return new i(e, "Masked output collides with a reserved sentinel. Configure a different mask or sentinel set.");
|
|
32
|
+
}
|
|
33
|
+
return c ? (c.set(f, l), c) : f;
|
|
34
|
+
}
|
|
35
|
+
function read(e, t) {
|
|
36
|
+
let r = sentinel(e, t);
|
|
37
|
+
if (r) return new Uint8Array(r);
|
|
38
|
+
let a = t === void 0 ? new Uint8Array(e) : /* @__PURE__ */ new Uint8Array(16);
|
|
39
|
+
if (t !== void 0) for (let n = 0; n < 16; n += 1) a[n] = e[t + n];
|
|
40
|
+
let s = c.length ? a.slice() : void 0, l = d(a, void 0, o);
|
|
41
|
+
if (l !== void 0) return l;
|
|
42
|
+
if (s) {
|
|
43
|
+
for (let e of c) if (a.set(s), l = d(a, void 0, e), l !== void 0) return l;
|
|
44
|
+
}
|
|
45
|
+
return new i(n, "No configured mask and timestamp range accepts these masked bytes; use the codec configuration that issued them.");
|
|
46
|
+
}
|
|
47
|
+
function maskedBytesToUuidBytes(e, t, n, r = 0) {
|
|
48
|
+
let i = typeof t == "number", o = i ? t : void 0, c = readMaskedByteSource(e, o);
|
|
49
|
+
if (!s(c)) return c;
|
|
50
|
+
let l = i ? n : t, u = i ? r : n ?? 0;
|
|
51
|
+
if (l !== void 0) {
|
|
52
|
+
let e = /* @__PURE__ */ a(l, u, 16);
|
|
53
|
+
if (e) return e;
|
|
54
|
+
}
|
|
55
|
+
let d = read(c, o);
|
|
56
|
+
return d instanceof Error || !l ? d : (l.set(d, u), l);
|
|
57
|
+
}
|
|
58
|
+
function maskedBytesToUuidString(e, t = g, n = g) {
|
|
59
|
+
let r = typeof t == "number", i = r ? t : void 0, a = readMaskedByteSource(e, i);
|
|
60
|
+
if (!s(a)) return a;
|
|
61
|
+
let o = h(r ? n : t);
|
|
62
|
+
if (o instanceof Error) return o;
|
|
63
|
+
let c = read(a, i);
|
|
64
|
+
return c instanceof Error ? c : /* @__PURE__ */ p(c, 0, o);
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
uuidToMaskedBytes,
|
|
68
|
+
maskedBytesToUuidBytes,
|
|
69
|
+
maskedBytesToUuidString
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export { createMaskedByteMethods };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=masked-bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masked-bytes.js","names":["byteOffset","value","UuidSlugError","INVALID_OPTIONS","entry","sentinels","index","bytes","source","decodeUuid","uuid","isSuccessfulUuidBytes","output","invalid","outputOffset","INVALID_UUID_VERSION","tail","maskUuidV7Block","current","INVALID_MASK","reserved","ciphertext","previous","candidate","unmix","range","INVALID_UUID_SLUG","readsAtOffset","outputOrByteOffset","maskedUuidBytes","outputOrOutputOffset","offsetAfterOutput","UUID_TEXT_LOWERCASE","offsetOrCase","selectedCase","resolveUuidTextCase","textCaseAfterOffset"],"sources":["../src/masked-bytes.ts"],"mappings":";;;;;;;AAyCA,SAAS,qBAAqB,GAAgB,GAAiD;CAM7F,OALIA,MAAe,KAAA,IAAkB,kBAAkBC,CAAK,IACxD,kBAAaA,CAAK,IAAU,kBAAWA,EAAM,QAAQD,GAAY,EAAE,KAAKC,IACxE,kBAAgBA,CAAK,IAAUA,IAE/BD,MAAe,IAAU,kBAAkBC,CAAK,IAC7C,IAAIC,EAAcC,GAAiB,kDAAkD;AAC9F;AAGA,SAAgB,wBACd,GACA,GACA,GACA,GACe;CACf,SAAS,SAAS,GAAmB,IAAa,GAA2B;EAE3E,KAAK,IAAMC,KAASC,GAAW;GAC7B,IAAIC,IAAQ;GACZ,OAAOA,IAAQ,MAAMF,EAAM,MAAME,OAAWC,EAAMP,IAAaM,KAAQ,KAAS;GAChF,IAAIA,MAAU,IAAI,OAAOF,EAAM;EACjC;CAEF;CAUA,SAAS,kBACP,GACA,GACA,IAAe,GACa;EAC5B,IAAMI,IAASC,EAAWC,CAAI;EAC9B,IAAI,CAACC,EAAsBH,CAAM,GAAG,OAAOA;EAC3C,IAAII,MAAW,KAAA,GAAW;GACxB,IAAMC,IAAU,kBAAeD,GAAQE,GAAc,EAAE;GACvD,IAAID,GAAS,OAAOA;EACtB;EACA,IAAI,CAAC,kBAAcL,CAAM,GACvB,OAAO,IAAIN,EAAca,GAAsB,yCAAyC;EAE1F,IAAMR,IAAQ,IAAI,WAAWC,CAAM;EACnC,IAAI,CAAC,SAASA,CAAM,GAAG;GACrB,IAAMQ,IAAOC,EAAgBV,GAAOW,EAAQ,MAAMA,EAAQ,yBAAyB;GACnF,IAAI,OAAOF,KAAS,UAAU,OAAOA;GAEr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rC,OAHIO,aAAiB,SACjB,CAACK,IAAeL,KACpBK,EAAO,IAAIL,GAAOO,CAAY,GACvBF;CACT;CAWA,SAAS,wBACP,GACA,IAAsCoB,GACtC,IAAoCA,GACZ;EACxB,IAAML,IAAgB,OAAOM,KAAiB,UACxCjC,IAAa2B,IAAgBM,IAAe,KAAA,GAC5CzB,IAAS,qBAAqBqB,GAAiB7B,CAAU;EAC/D,IAAI,CAACW,EAAsBH,CAAM,GAAG,OAAOA;EAC3C,IAAM0B,IAAeC,EAAoBR,IAAgBS,IAAsBH,CAAY;EAC3F,IAAIC,aAAwB,OAAO,OAAOA;EAC1C,IAAM3B,IAAQ,KAAKC,GAAQR,CAAU;EACrC,OAAOO,aAAiB,QAAQA,IAAQ,kBAAyBA,GAAO,GAAG2B,CAAY;CACzF;CAEA,OAAO;EAAE;EAAmB;EAAwB;CAAwB;AAC9E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// @anizoptera/uuid-slug 0.
|
|
3
|
-
|
|
2
|
+
// @anizoptera/uuid-slug 0.6.0 | https://github.com/Anizoptera/uuid-slug#readme
|
|
3
|
+
// src/masking-codec-protocol.ts
|
|
4
4
|
var ReturnCodec = class {
|
|
5
5
|
constructor(e) {
|
|
6
6
|
return e;
|
|
@@ -17,7 +17,6 @@ function registerMaskingCodec(e) {
|
|
|
17
17
|
function isLocalMaskingCodec(e) {
|
|
18
18
|
return PackageMaskingCodec.is(e);
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { isLocalMaskingCodec, registerMaskingCodec };
|
|
22
21
|
|
|
23
22
|
//# sourceMappingURL=masking-codec-protocol.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// @anizoptera/uuid-slug 0.
|
|
2
|
+
// @anizoptera/uuid-slug 0.6.0 | https://github.com/Anizoptera/uuid-slug#readme
|
|
3
3
|
import { UuidSlugError } from "./errors.js";
|
|
4
4
|
import { SlugAlphabet } from "./slug.js";
|
|
5
|
-
import { EnabledMigrationFormat, GenerateUuidV7WithMaskedSlugOptions, GeneratedUuidV7, MaskedOrSentinelUuidV7Slug, MaskingCodecUuidInput, ParsedUuidResult, PlainUuidSlug, PlainUuidSlugResult, PlainUuidV7Slug, PlainUuidV7SlugInput, SEEDED_MASK_FORMAT, SlugStringInput, UUID_TEXT_LOWERCASE, Uuid, UuidBytesResult, UuidInput, UuidOutput, UuidSlugMigrationDecoder, UuidSlugMigrationOptions, UuidStringResult, UuidTextCase, UuidTextCaseArguments, UuidV7Bytes, UuidV7Mask, UuidV7MaskOptions, UuidV7MaskingCodecValueOptions, UuidV7Payload, UuidV7PayloadLayout, UuidV7Sentinel, UuidV7SentinelConfig, UuidV7StringFor, UuidV7TimestampWindow, UuidV7ValueInput } from "./types.js";
|
|
6
|
-
//#region src/masking-codec-types.d.ts
|
|
5
|
+
import { EnabledMigrationFormat, GenerateUuidV7WithMaskedSlugOptions, GeneratedUuidV7, MaskedOrSentinelUuidV7Bytes, MaskedOrSentinelUuidV7Slug, MaskingCodecUuidInput, ParsedUuidResult, PlainUuidSlug, PlainUuidSlugResult, PlainUuidV7Slug, PlainUuidV7SlugInput, SEEDED_MASK_FORMAT, SlugStringInput, UUID_TEXT_LOWERCASE, UnmaskedUuidInput, Uuid, UuidByteInput, UuidBytesResult, UuidGenerationInput, UuidGenerationTextCase, UuidInput, UuidOutput, UuidSlugMigrationDecoder, UuidSlugMigrationOptions, UuidStringResult, UuidTextCase, UuidTextCaseArguments, UuidV7Bytes, UuidV7Mask, UuidV7MaskOptions, UuidV7MaskingCodecValueOptions, UuidV7Payload, UuidV7PayloadLayout, UuidV7Sentinel, UuidV7SentinelConfig, UuidV7StringFor, UuidV7TimestampWindow, UuidV7ValueInput } from "./types.js";
|
|
7
6
|
/** Key rotation, sentinel, and output options shared by both ways of supplying the writer mask. */
|
|
8
7
|
export interface UuidV7MaskingCodecSharedOptions {
|
|
9
8
|
/**
|
|
@@ -17,7 +16,8 @@ export interface UuidV7MaskingCodecSharedOptions {
|
|
|
17
16
|
/**
|
|
18
17
|
* Decode-only masks tried after the writer mask, in caller order. Each item accepts a mask or its
|
|
19
18
|
* derivation options. A returned `UuidSlugError` passes through unchanged. Keep the list short:
|
|
20
|
-
* every mask adds decoding work and another chance for a random input to pass its
|
|
19
|
+
* every mask adds decoding work and another chance for a random input to pass its check
|
|
20
|
+
* (16 bits for text, 12 for binary).
|
|
21
21
|
*
|
|
22
22
|
* @defaultValue No previous masks.
|
|
23
23
|
*/
|
|
@@ -79,47 +79,49 @@ export interface UuidV7MaskingCodec {
|
|
|
79
79
|
/** Generate an immutable UUIDv7 with this masking codec retained. */
|
|
80
80
|
generateUuidV7Value(this: void, options?: UuidV7MaskingCodecValueOptions): Uuid<7, true, true> | UuidSlugError;
|
|
81
81
|
/** Parse any accepted UUID form, retain this codec and preserve an existing payload layout. A plain-v4 slug brand cannot exclude a masked-v7 reading. */
|
|
82
|
-
parseUuid<Input extends UuidInput>(this: void, uuid: Input): ParsedUuidResult<Input, true> | UuidSlugError;
|
|
82
|
+
parseUuid<Input extends UuidInput>(this: void, uuid: UnmaskedUuidInput<Input>): ParsedUuidResult<Input, true> | UuidSlugError;
|
|
83
83
|
/**
|
|
84
84
|
* Convert any accepted UUID form to normalized UUID text. A 22-character slug is read as masked
|
|
85
85
|
* when it passes this codec's check and as plain otherwise.
|
|
86
86
|
* A plain UUIDv4 slug can therefore return UUIDv4 or UUIDv7 text.
|
|
87
87
|
*/
|
|
88
|
-
uuidToString<Input extends UuidInput, Case extends UuidTextCase = typeof UUID_TEXT_LOWERCASE>(this: void, uuid: Input
|
|
88
|
+
uuidToString<Input extends UuidInput, Case extends UuidTextCase = typeof UUID_TEXT_LOWERCASE>(this: void, uuid: UnmaskedUuidInput<Input>, ...textCase: UuidTextCaseArguments<Case>): UuidStringResult<MaskingCodecUuidInput<Input>, Case>;
|
|
89
89
|
/**
|
|
90
|
-
* Read
|
|
90
|
+
* Read raw UUID bytes out of a larger array as normalized UUID text.
|
|
91
|
+
* Decode masked bytes with `maskedBytesToUuidString` instead.
|
|
91
92
|
*
|
|
92
93
|
* @param byteOffset - Zero-based index where the UUID starts. Omit for a standalone UUID.
|
|
93
94
|
*/
|
|
94
|
-
uuidToString<Case extends UuidTextCase = typeof UUID_TEXT_LOWERCASE>(this: void, uuid:
|
|
95
|
+
uuidToString<Case extends UuidTextCase = typeof UUID_TEXT_LOWERCASE, Input extends Uint8Array = Uint8Array>(this: void, uuid: UnmaskedUuidInput<Input>, byteOffset: number, ...textCase: UuidTextCaseArguments<Case>): UuidStringResult<Uint8Array, Case>;
|
|
95
96
|
/**
|
|
96
97
|
* Convert any accepted UUID form to a new plain 16-byte array. A 22-character slug is read as
|
|
97
98
|
* masked when it passes this codec's check and as plain otherwise.
|
|
98
99
|
* A plain UUIDv4 slug can therefore return UUIDv4 or UUIDv7 bytes.
|
|
99
100
|
*/
|
|
100
|
-
uuidToBytes<Input extends UuidInput>(this: void, uuid: Input): UuidBytesResult<MaskingCodecUuidInput<Input>>;
|
|
101
|
+
uuidToBytes<Input extends UuidInput>(this: void, uuid: UnmaskedUuidInput<Input>): UuidBytesResult<MaskingCodecUuidInput<Input>>;
|
|
101
102
|
/** Convert any accepted UUID form into caller-owned storage after complete validation. */
|
|
102
|
-
uuidToBytes<Output extends Uint8Array>(this: void, uuid:
|
|
103
|
+
uuidToBytes<Output extends Uint8Array, Input extends UuidInput = UuidInput>(this: void, uuid: UnmaskedUuidInput<Input>, output: Output, outputOffset?: number): UuidOutput<Output> | UuidSlugError;
|
|
103
104
|
/**
|
|
104
|
-
* Copy
|
|
105
|
+
* Copy raw UUID bytes out of a larger array. Decode masked bytes with `maskedBytesToUuidBytes` instead.
|
|
105
106
|
*
|
|
106
107
|
* @param byteOffset - Zero-based index where the UUID starts. Omit for a standalone UUID.
|
|
107
108
|
*/
|
|
108
|
-
uuidToBytes(this: void, uuid:
|
|
109
|
+
uuidToBytes<Input extends Uint8Array>(this: void, uuid: UnmaskedUuidInput<Input>, byteOffset: number): UuidBytesResult<Uint8Array>;
|
|
109
110
|
/** Copy one UUID out of a larger array into caller-owned storage. */
|
|
110
|
-
uuidToBytes<Output extends Uint8Array>(this: void, uuid:
|
|
111
|
+
uuidToBytes<Output extends Uint8Array, Input extends Uint8Array = Uint8Array>(this: void, uuid: UnmaskedUuidInput<Input>, byteOffset: number, output: Output, outputOffset?: number): UuidOutput<Output> | UuidSlugError;
|
|
111
112
|
/**
|
|
112
113
|
* Convert any accepted UUID form to a plain UUID slug. A 22-character slug is read as masked
|
|
113
114
|
* when it passes this codec's check and as plain otherwise.
|
|
114
115
|
* A plain UUIDv4 slug can therefore return a plain UUIDv4 or UUIDv7 slug.
|
|
115
116
|
*/
|
|
116
|
-
uuidToPlainSlug<Input extends UuidInput>(this: void, uuid: Input
|
|
117
|
+
uuidToPlainSlug<Input extends UuidInput>(this: void, uuid: UnmaskedUuidInput<Input>, alphabet?: SlugAlphabet): PlainUuidSlugResult<MaskingCodecUuidInput<Input>>;
|
|
117
118
|
/**
|
|
118
|
-
* Read
|
|
119
|
+
* Read raw UUID bytes out of a larger array as a plain UUID slug.
|
|
120
|
+
* Decode masked bytes with `maskedBytesToUuidBytes` before plain-slug conversion.
|
|
119
121
|
*
|
|
120
122
|
* @param byteOffset - Zero-based index where the UUID starts. Omit for a standalone UUID.
|
|
121
123
|
*/
|
|
122
|
-
uuidToPlainSlug(this: void, uuid:
|
|
124
|
+
uuidToPlainSlug<Input extends Uint8Array>(this: void, uuid: UnmaskedUuidInput<Input>, byteOffset: number, alphabet?: SlugAlphabet): PlainUuidSlugResult<Uint8Array>;
|
|
123
125
|
/**
|
|
124
126
|
* Create a reader for current and explicitly enabled old formats without changing this codec.
|
|
125
127
|
* Omitted options return the reader directly. Configured construction returns `invalid_options`
|
|
@@ -128,9 +130,9 @@ export interface UuidV7MaskingCodec {
|
|
|
128
130
|
*
|
|
129
131
|
* @param options - Old formats this application has actually issued. Omit for current formats only.
|
|
130
132
|
*/
|
|
131
|
-
createUuidSlugMigrationDecoder(this: void
|
|
133
|
+
createUuidSlugMigrationDecoder(this: void): UuidSlugMigrationDecoder<typeof SEEDED_MASK_FORMAT>;
|
|
132
134
|
/** Create a reusable reader with explicitly enabled old formats; check configuration failure once. */
|
|
133
|
-
createUuidSlugMigrationDecoder<const Options extends UuidSlugMigrationOptions>(this: void, options: Options
|
|
135
|
+
createUuidSlugMigrationDecoder<const Options extends UuidSlugMigrationOptions | undefined>(this: void, options: Options): UuidSlugMigrationDecoder<EnabledMigrationFormat<NonNullable<Options>>> | (Options extends undefined ? never : UuidSlugError);
|
|
134
136
|
/**
|
|
135
137
|
* Generate and encode a UUIDv7 as a masked slug or its registered raw sentinel slug.
|
|
136
138
|
* Options may select an explicit time and a generator whose sequence this call joins.
|
|
@@ -152,6 +154,8 @@ export interface UuidV7MaskingCodec {
|
|
|
152
154
|
generateUuidV7WithMaskedSlug<Case extends UuidTextCase = typeof UUID_TEXT_LOWERCASE>(this: void, ...textCase: UuidTextCaseArguments<Case>): GeneratedUuidV7<MaskedOrSentinelUuidV7Slug, Case> | UuidSlugError;
|
|
153
155
|
/** Generate the pair through selected sequence state at an explicit time or the current clock. */
|
|
154
156
|
generateUuidV7WithMaskedSlug<Case extends UuidTextCase = typeof UUID_TEXT_LOWERCASE>(this: void, options: GenerateUuidV7WithMaskedSlugOptions<Case>): GeneratedUuidV7<MaskedOrSentinelUuidV7Slug, Case> | UuidSlugError;
|
|
157
|
+
/** Forward a text-case preset or optional settings with this masking codec retained. */
|
|
158
|
+
generateUuidV7WithMaskedSlug<const Input extends UuidTextCase | GenerateUuidV7WithMaskedSlugOptions<UuidTextCase> | undefined>(this: void, textCaseOrOptions: UuidGenerationInput<Input, GenerateUuidV7WithMaskedSlugOptions<UuidTextCase>>): GeneratedUuidV7<MaskedOrSentinelUuidV7Slug, UuidGenerationTextCase<Input>> | UuidSlugError;
|
|
155
159
|
/**
|
|
156
160
|
* Convert UUID text, 16 UUID bytes, a plain slug, or a masked slug to this masking codec's
|
|
157
161
|
* current masked spelling. A 22-character slug is read as masked when it passes this codec's
|
|
@@ -165,6 +169,44 @@ export interface UuidV7MaskingCodec {
|
|
|
165
169
|
* @param uuid - Any supported UUIDv7 text, bytes, plain slug, masked slug, or sentinel.
|
|
166
170
|
*/
|
|
167
171
|
uuidToMaskedSlug<Input extends UuidInput>(this: void, uuid: UuidV7ValueInput<Input>): MaskedOrSentinelUuidV7Slug | UuidSlugError;
|
|
172
|
+
/**
|
|
173
|
+
* Convert UUIDv7 text, raw bytes, a parsed UUID, or a plain or masked slug to 16 masked bytes.
|
|
174
|
+
* Registered sentinels retain raw UUID bytes and their full timestamp range. Binary carries 12 inner check bits;
|
|
175
|
+
* current masked text carries four more. Returns owned plain bytes or an unchanged prior error.
|
|
176
|
+
* Range, version and mask failures follow masked-slug conversion. A mixed block matching a
|
|
177
|
+
* registered raw sentinel returns `invalid_mask` instead of losing the original UUID.
|
|
178
|
+
*/
|
|
179
|
+
uuidToMaskedBytes<Input extends UuidInput>(this: void, uuid: UuidV7ValueInput<Input>): MaskedOrSentinelUuidV7Bytes | UuidSlugError;
|
|
180
|
+
/** Write 16 masked bytes at `outputOffset` (default zero); preserve output identity and all bytes on failure. */
|
|
181
|
+
uuidToMaskedBytes<Input extends UuidInput, Output extends Uint8Array>(this: void, uuid: UuidV7ValueInput<Input>, output: Output, outputOffset?: number): UuidOutput<Output> | UuidSlugError;
|
|
182
|
+
/**
|
|
183
|
+
* Read exactly 16 masked bytes using registered-sentinel priority and current-first key order.
|
|
184
|
+
* A 12-bit check can accept a wrong key by chance; it is not authorization. Input remains unchanged
|
|
185
|
+
* unless it is also the supplied output storage.
|
|
186
|
+
* A preceding error propagates unchanged; malformed storage or no passing key returns a package error.
|
|
187
|
+
*/
|
|
188
|
+
maskedBytesToUuidBytes(this: void, maskedUuidBytes: UuidByteInput | UuidSlugError): UuidV7Bytes | UuidSlugError;
|
|
189
|
+
/** Write the decoded UUID at `outputOffset` (default zero), preserving output identity and bytes on failure. */
|
|
190
|
+
maskedBytesToUuidBytes<Output extends Uint8Array>(this: void, maskedUuidBytes: UuidByteInput | UuidSlugError, output: Output, outputOffset?: number): UuidOutput<Output> | UuidSlugError;
|
|
191
|
+
/**
|
|
192
|
+
* Read 16 masked bytes at `byteOffset` from a larger array. Uses the same keys, checks and failures
|
|
193
|
+
* as the standalone reader; an invalid range returns `invalid_buffer`.
|
|
194
|
+
* @param byteOffset - Zero-based index where the masked UUID starts. Omit for a standalone value.
|
|
195
|
+
*/
|
|
196
|
+
maskedBytesToUuidBytes(this: void, maskedUuidBytes: Uint8Array | UuidSlugError, byteOffset: number): UuidV7Bytes | UuidSlugError;
|
|
197
|
+
/**
|
|
198
|
+
* Decode 16 masked bytes at `byteOffset` into caller storage at `outputOffset` (default zero).
|
|
199
|
+
* Input and output may overlap; return output by identity and leave it unchanged on failure.
|
|
200
|
+
*/
|
|
201
|
+
maskedBytesToUuidBytes<Output extends Uint8Array>(this: void, maskedUuidBytes: Uint8Array | UuidSlugError, byteOffset: number, output: Output, outputOffset?: number): UuidOutput<Output> | UuidSlugError;
|
|
202
|
+
/** Read masked bytes as UUIDv7 text; `textCase` defaults to lowercase. Uses the same keys, checks and failures as the byte reader. */
|
|
203
|
+
maskedBytesToUuidString<Case extends UuidTextCase = typeof UUID_TEXT_LOWERCASE>(this: void, maskedUuidBytes: UuidByteInput | UuidSlugError, ...textCase: UuidTextCaseArguments<Case>): UuidV7StringFor<Case> | UuidSlugError;
|
|
204
|
+
/**
|
|
205
|
+
* Read 16 masked bytes at `byteOffset` from a larger array as UUIDv7 text; lowercase is the default.
|
|
206
|
+
* Uses the standalone reader's keys, checks and failures; an invalid range returns `invalid_buffer`.
|
|
207
|
+
* @param byteOffset - Zero-based index where the masked UUID starts. Omit for a standalone value.
|
|
208
|
+
*/
|
|
209
|
+
maskedBytesToUuidString<Case extends UuidTextCase = typeof UUID_TEXT_LOWERCASE>(this: void, maskedUuidBytes: Uint8Array | UuidSlugError, byteOffset: number, ...textCase: UuidTextCaseArguments<Case>): UuidV7StringFor<Case> | UuidSlugError;
|
|
168
210
|
/**
|
|
169
211
|
* Convert either plain UUIDv7 slug spelling to this codec's current masked or sentinel spelling.
|
|
170
212
|
* TypeScript rejects known UUIDv4 slugs. Other UUIDv4 input returns `invalid_uuid_version`;
|
|
@@ -241,5 +283,4 @@ export interface UuidV7MaskingCodec {
|
|
|
241
283
|
*/
|
|
242
284
|
validateMaskedUuidV7SlugUnixMs<Input extends string | UuidSlugError>(this: void, maskedUuidSlug: SlugStringInput<Input>, window: UuidV7TimestampWindow): (Input extends PlainUuidSlug | MaskedOrSentinelUuidV7Slug ? Input & MaskedOrSentinelUuidV7Slug : MaskedOrSentinelUuidV7Slug) | UuidSlugError;
|
|
243
285
|
}
|
|
244
|
-
//#endregion
|
|
245
286
|
//# sourceMappingURL=masking-codec-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masking-codec-types.d.ts","names":[],"sources":["../src/masking-codec-types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"masking-codec-types.d.ts","names":[],"sources":["../src/masking-codec-types.ts"],"mappings":";;;;;;iBA8CiB;;;;;;;;WAQN;;;;;;;;;WASA,0BACL,aACA,oBACA,qBACA;;;;;;WAOK,qBAAqB;;;;;;;;;WASrB,qBAAqB;;;;;;;YAQpB,6BACP;;;;;;WAMU,MAAM,aAAa,oBAAoB;WACvC;MAEV;WACU;;;;;;;WAOA,mBAAmB;;;iBAIjB;;WAEN,MAAM,aAAa,oBAAoB;;WAEvC;;;;;;;iBAQM;;WAEN,oBAAoB;;EAE7B,oBAAA,YAEE,UAAU,iCACT,sBAAsB;;EAEzB,UAAU,cAAc,WAAA,YAEtB,MAAM,kBAAkB,SACvB,iBAAiB,eAAe;;;;;;EAMnC,aAAa,cAAc,WAAW,aAAa,sBAAsB,qBAEvE,YAAA,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;;;;;;;EAQxB,0BAA0B,uBAAuB,eAAA,YAE/C,gBAAgB,gBAAgB,kBACtB;;;;;;;;;;EAUZ,2BAA2B,uBAAuB,eAAA,YAEhD,gBAAgB,gBAAgB,QAChC,QAAQ,sBACP,gBAAgB;;;;;;;;;;;EAWnB,+BAA+B,uBAAuB,eAAA,YAEpD,gBAAgB,gBAAgB,QAChC,QAAQ,yBAEL,cAAc,gBAAgB,6BAC3B,QAAQ,6BACR,8BACJ"}
|
package/dist/masking-codec.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// @anizoptera/uuid-slug 0.
|
|
2
|
+
// @anizoptera/uuid-slug 0.6.0 | https://github.com/Anizoptera/uuid-slug#readme
|
|
3
3
|
import { UuidSlugError } from "./errors.js";
|
|
4
4
|
import { UuidV7MaskingCodec, UuidV7MaskingCodecOptions } from "./masking-codec-types.js";
|
|
5
|
-
//#region src/masking-codec.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Build an immutable UUIDv7 masking codec from a private `maskSeed`, or from an explicit `mask` when
|
|
8
7
|
* it is derived elsewhere or needs a label or work factor. It reads the writer first, then
|
|
@@ -15,5 +14,4 @@ import { UuidV7MaskingCodec, UuidV7MaskingCodecOptions } from "./masking-codec-t
|
|
|
15
14
|
* @returns The masking codec, or `UuidSlugError` when its configuration is invalid.
|
|
16
15
|
*/
|
|
17
16
|
export declare function createUuidV7MaskingCodec(options: UuidV7MaskingCodecOptions): UuidV7MaskingCodec | UuidSlugError;
|
|
18
|
-
//#endregion
|
|
19
17
|
//# sourceMappingURL=masking-codec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masking-codec.d.ts","names":[],"sources":["../src/masking-codec.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"masking-codec.d.ts","names":[],"sources":["../src/masking-codec.ts"],"mappings":";;;;;;;;;;;;;;;wBAmVgB,yBACd,SAAS,4BACR,qBAAqB"}
|