diff options
Diffstat (limited to 'js/src/id')
| -rw-r--r-- | js/src/id/id.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/js/src/id/id.ts b/js/src/id/id.ts index e4744f172..39ee5326f 100644 --- a/js/src/id/id.ts +++ b/js/src/id/id.ts @@ -1,4 +1,4 @@ -import { z } from "zod"; +import { z } from "zod/v4"; import { randomBytes } from "crypto"; export namespace Identifier { @@ -11,7 +11,7 @@ export namespace Identifier { return z.string().startsWith(prefixes[prefix]); } - const LENGTH = 24; + const LENGTH = 26; export function ascending(prefix: keyof typeof prefixes, given?: string) { return generateID(prefix, false, given); @@ -45,6 +45,11 @@ export namespace Identifier { const randLength = (LENGTH - 12) / 2; const random = randomBytes(randLength); - return prefix + "_" + timeBytes.toString("hex") + random.toString("hex"); + return ( + prefixes[prefix] + + "_" + + timeBytes.toString("hex") + + random.toString("hex") + ); } } |
