10 lines
357 B
TypeScript
10 lines
357 B
TypeScript
import { uuidv7 } from '@pipu/core';
|
|
|
|
/** Hermes has no Web Crypto. Expo's installed native runtime supplies secure UUID randomness. */
|
|
export function eventId(now: number): string {
|
|
return uuidv7(now, () => {
|
|
const hex = globalThis.expo.uuidv4().replace(/-/g, '');
|
|
return Uint8Array.from(hex.match(/../g)!, (byte) => parseInt(byte, 16));
|
|
});
|
|
}
|