From eecf21aec4ff22b68b546dd94b0c6e20829f62a2 Mon Sep 17 00:00:00 2001 From: Daniel Krol Date: Wed, 4 May 2022 12:05:41 -0400 Subject: [PATCH] Get rid of some functions we won't need soon (this won't compile) This and the next few commits won't be clean; I made a bunch of changes and I need to start committing in chunks. --- src/app/crypto.service.ts | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/src/app/crypto.service.ts b/src/app/crypto.service.ts index 1239c7a..cfb0d3c 100644 --- a/src/app/crypto.service.ts +++ b/src/app/crypto.service.ts @@ -165,40 +165,6 @@ export class CryptoService { return hmac === this.accessLevelHmac(accessLevel, seedHex); } - encryptedSeedHexToPrivateKey(encryptedSeedHex: string, domain: string): EC.KeyPair { - const seedHex = this.decryptSeedHex(encryptedSeedHex, domain); - return this.seedHexToPrivateKey(seedHex); - } - - mnemonicToKeychain(mnemonic: string, extraText?: string, nonStandard?: boolean): HDNode { - const seed = bip39.mnemonicToSeedSync(mnemonic, extraText); - // @ts-ignore - return HDKey.fromMasterSeed(seed).derive('m/44\'/0\'/0\'/0/0', nonStandard); - } - - keychainToSeedHex(keychain: HDNode): string { - return keychain.privateKey.toString('hex'); - } - - seedHexToPrivateKey(seedHex: string): EC.KeyPair { - const ec = new EC('secp256k1'); - return ec.keyFromPrivate(seedHex); - } - - privateKeyToDeSoPublicKey(privateKey: EC.KeyPair, network: Network): string { - const prefix = CryptoService.PUBLIC_KEY_PREFIXES[network].deso; - const key = privateKey.getPublic().encode('array', true); - const prefixAndKey = Uint8Array.from([...prefix, ...key]); - - return bs58check.encode(prefixAndKey); - } - - publicKeyToDeSoPublicKey(publicKey: EC.KeyPair, network: Network): string { - const prefix = CryptoService.PUBLIC_KEY_PREFIXES[network].deso; - const key = publicKey.getPublic().encode('array', true); - return bs58check.encode(Buffer.from([...prefix, ...key])); - } - // Decode public key base58check to Buffer of secp256k1 public key publicKeyToECBuffer(publicKey: string): Buffer { // Sanity check similar to Base58CheckDecodePrefix from core/lib/base58.go