diff --git a/typescript/common/src/utils/tachi-id.ts b/typescript/common/src/utils/tachi-id.ts index 8bc20a22b..4c6aa42b1 100644 --- a/typescript/common/src/utils/tachi-id.ts +++ b/typescript/common/src/utils/tachi-id.ts @@ -1,4 +1,4 @@ -export function randomHex(byteLength: number): string { +function randomHex(byteLength: number): string { const buf = new Uint8Array(byteLength); globalThis.crypto.getRandomValues(buf); diff --git a/typescript/seeds-scripts/rerunners/iidx/iidx-mdb-parse/merge-mdb.ts b/typescript/seeds-scripts/rerunners/iidx/iidx-mdb-parse/merge-mdb.ts index 37041ebfe..558277dc0 100644 --- a/typescript/seeds-scripts/rerunners/iidx/iidx-mdb-parse/merge-mdb.ts +++ b/typescript/seeds-scripts/rerunners/iidx/iidx-mdb-parse/merge-mdb.ts @@ -16,12 +16,17 @@ import { CreateChartID, CreateSongID, GetFreshSongIDGenerator, - randomHex, ReadCollection, WriteCollection, } from "../../../util"; import { ParseIIDXData } from "./convert"; +function randomHex(bytes: any) { + const buf = new Uint8Array(bytes); + globalThis.crypto.getRandomValues(buf); + return Array.from(buf, (b) => b.toString(16).padStart(2, "0")).join(""); +} + if (require.main !== module) { throw new Error(`This is a script. It should be ran directly from the command line with bun.`); } diff --git a/typescript/seeds-scripts/util.js b/typescript/seeds-scripts/util.js index 9fd63d9a7..1600f11e8 100644 --- a/typescript/seeds-scripts/util.js +++ b/typescript/seeds-scripts/util.js @@ -9,7 +9,6 @@ import { CreateQuestID, CreateSongID, CreateTableID, - randomHex, } from "tachi-common"; import DeterministicCollectionSort from "./sort-seeds.js"; @@ -136,5 +135,4 @@ export { CreateSongID, CreateTableID, GetSongCollectionGameGroup as GetSongCollectionGame, - randomHex, };