aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-12-30 21:53:52 -0800
committerAdam Soltys <[email protected]>2024-12-30 21:53:52 -0800
commit38e786c0d3c2280dd69f22ddf7cdf6ca804e6048 (patch)
tree48893b5eb0253104dfb2847fd0ac371eb1b492ce /src/lib
parentd96e1580757a1d0531fec0854e4238214ec8c00b (diff)
downloadcoinos-ui-38e786c0d3c2280dd69f22ddf7cdf6ca804e6048.tar.gz
coinos-ui-38e786c0d3c2280dd69f22ddf7cdf6ca804e6048.zip
scrap key generation
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/nostr.ts25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/lib/nostr.ts b/src/lib/nostr.ts
index bba46ef4..e45ce634 100644
--- a/src/lib/nostr.ts
+++ b/src/lib/nostr.ts
@@ -17,10 +17,10 @@ import {
} from "nostr-tools/nip49";
import { bech32m, hex } from "@scure/base";
-import { entropyToMnemonic, mnemonicToEntropy } from "@scure/bip39";
+import { entropyToMnemonic } from "@scure/bip39";
import { wordlist } from "@scure/bip39/wordlists/english";
-import { generateSeedWords, privateKeyFromSeedWords } from "nostr-tools/nip06";
+import { privateKeyFromSeedWords } from "nostr-tools/nip06";
type User = {
[key: string]: any;
@@ -34,27 +34,6 @@ type EncryptParams = {
const { encode, decode, toWords, fromWords } = bech32m;
-export const generate = async (user: any) => {
- const p = get(pin);
- if (p && p.length !== 6) return;
-
- const salt = crypto.getRandomValues(new Uint8Array(16));
- const mnemonic = generateSeedWords();
- const sk = privateKeyFromSeedWords(mnemonic);
-
- const bytes = new Uint8Array(
- await crypto.subtle.encrypt(
- { name: "AES-GCM", iv: new Uint8Array(16) },
- await stretch(await getPassword(), salt),
- mnemonicToEntropy(mnemonic, wordlist),
- ),
- );
-
- user.pubkey = getPublicKey(sk);
- user.cipher = encode("en", toWords(bytes), 180);
- user.salt = Buffer.from(salt).toString("hex");
-};
-
export const encrypt = async ({ message, recipient, user }: EncryptParams) => {
const sk = await getPrivateKey(user);
return nip04.encrypt(sk, recipient, message);