aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/envshare/pkg/id.ts
blob: efdfb5e5b5c787e45f345d1cdbb1c9c016a4a8b7 (plain) (blame)
1
2
3
4
5
6
7
8
import { toBase58 } from "../util/base58";
import { ID_LENGTH } from "./constants";

export function generateId(): string {
  const bytes = new Uint8Array(ID_LENGTH);
  crypto.getRandomValues(bytes);
  return toBase58(bytes);
}