We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use the @nimiq/core.MnemonicUtils function in @nimiq/core

To help you get started, we’ve selected a few @nimiq/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
importWalletFromMnemonic(words) {
		let mnemonic = null;

		if (typeof words == "string") {
			mnemonic = words.split(" ");
		} else {
			mnemonic = words;
		}

		if (mnemonic == null) {
			this.theWrapper.callbacks.error("AccountHelper:importWalletFromMnemonic", NimiqWrapper.ERROR_MESSAGES.BAD_PARAM_TYPE);
		} else {
			let entropy = null;
			if (Nimiq.MnemonicUtils.getMnemonicType(mnemonic) == Nimiq.MnemonicUtils.MnemonicType.LEGACY) {
				entropy = Nimiq.MnemonicUtils.legacyMnemonicToEntropy(mnemonic);
			} else {
				entropy = Nimiq.MnemonicUtils.mnemonicToEntropy(mnemonic);
			}

			let keypair = Nimiq.KeyPair.derive(entropy);
			return new Nimiq.Wallet(keypair);
		}
	}
github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
exportWalletToMnemonic(wallet, legacy = false) {
		let privateKey = wallet._keyPair.privateKey;

		if (legacy) {
			return Nimiq.MnemonicUtils.entropyToLegacyMnemonic(privateKey.serialize());
		} else {
			return Nimiq.MnemonicUtils.entropyToMnemonic(privateKey.serialize());
		}
	}