Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/app-server/src/modules/shared/utils/random.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { ulidFactory } from 'ulid-workers';

export { generateId };

const createUlid = ulidFactory();
// monotonic: false — in monotonic mode ids created within the same millisecond
// are a deterministic +1 of the previous random suffix instead of fresh entropy,
// making burst-created ids partly predictable. We don't need sortability for a
// capability id, so keep the full 80 bits of randomness per id.
const createUlid = ulidFactory({ monotonic: false });

function generateId() {
return createUlid().toLowerCase();
Expand Down