Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing Atomic Wallet Private Keys #76

Open
NeoBeum opened this issue Jul 4, 2020 · 1 comment
Open

Importing Atomic Wallet Private Keys #76

NeoBeum opened this issue Jul 4, 2020 · 1 comment

Comments

@NeoBeum
Copy link

NeoBeum commented Jul 4, 2020

Using Atomic Wallet's 12 Word Phrase - the paired address do not match

Expected Behavior
Public Address to match Atomic Wallet's Private Key: (WIF)

Current Behavior
This is the arkecosystem-crypto/hdwallet.js for Atomic Wallet
https://github.com/Atomicwallet/arkecosystem-crypto/blob/master/dist/crypto/hdwallet.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const bip32_1 = require("bip32");
const bip39_1 = require("bip39");
const managers_1 = require("../managers");
class HDWallet {
    /**
     * Get root node from the given mnemonic with an optional passphrase.
     */
    static fromMnemonic(mnemonic, passphrase) {
        return bip32_1.fromSeed(bip39_1.mnemonicToSeedSync(mnemonic, passphrase), managers_1.configManager.get("network"));
    }
    /**
     * Get bip32 node from keys.
     */
    static fromKeys(keys, chainCode) {
        if (!keys.compressed) {
            throw new TypeError("BIP32 only allows compressed keys.");
        }
        return bip32_1.fromPrivateKey(Buffer.from(keys.privateKey, "hex"), chainCode, managers_1.configManager.get("network"));
    }
    /**
     * Get key pair from the given node.
     */
    static getKeys(node) {
        return {
            publicKey: node.publicKey.toString("hex"),
            privateKey: node.privateKey.toString("hex"),
            compressed: true,
        };
    }
    /**
     * Derives a node from the coin type as specified by slip44.
     */
    static deriveSlip44(root, hardened = true) {
        return root.derivePath(`m/44'/${this.slip44}${hardened ? "'" : ""}`);
    }
    /**
     * Derives a node from the network as specified by AIP20.
     */
    static deriveNetwork(root) {
        return this.deriveSlip44(root).deriveHardened(managers_1.configManager.get("network.aip20") || 1);
    }
}
exports.HDWallet = HDWallet;
HDWallet.slip44 = 111;
//# sourceMappingURL=hdwallet.js.map

Possible Solution
Perhaps include option to import wallets by WIF? To allow Atomic Wallet imports.

Steps to Reproduce (for bugs)

Import Using Atomic Wallet's 12 Word Phrase

Context

Your Environment

  • Version used: Desktop, and Android
  • Environment name and version (e.g. node.js v10.15.3): Atomic Wallet v2.17
@ghost
Copy link

ghost commented Jul 4, 2020

Thanks for opening this issue! A maintainer will review this in the next few days and explicitly select labels so you know what's going on.

If no reviewer appears after a week, a reminder will be sent out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant