aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/envshare/pkg/id.ts
diff options
context:
space:
mode:
author简律纯 <hsiangnianian@outlook.com>2023-04-18 03:02:17 +0800
committer简律纯 <hsiangnianian@outlook.com>2023-04-18 03:02:17 +0800
commit4919f028c884a041da7ff098abb02389b4eac598 (patch)
treeb0f482568c4b8c8a680ce6e2e70a7b7ca87dc190 /envshare/pkg/id.ts
parentb135aac8531c1e1488147ad8c6f98eddbdbe0c99 (diff)
downloadHydroRoll-4919f028c884a041da7ff098abb02389b4eac598.tar.gz
HydroRoll-4919f028c884a041da7ff098abb02389b4eac598.zip
✨add envshare docs
Diffstat (limited to 'envshare/pkg/id.ts')
-rw-r--r--envshare/pkg/id.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/envshare/pkg/id.ts b/envshare/pkg/id.ts
new file mode 100644
index 0000000..efdfb5e
--- /dev/null
+++ b/envshare/pkg/id.ts
@@ -0,0 +1,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);
+}