UNPKG

@metamask/snaps-simulation

Version:

A simulation framework for MetaMask Snaps, enabling headless testing of Snaps in a controlled environment

25 lines 968 B
import { mnemonicPhraseToBytes } from "@metamask/key-tree"; import { DEFAULT_ALTERNATIVE_SRP, DEFAULT_SRP } from "../../constants.mjs"; /** * Get the implementation of the `getMnemonic` method. * * @param defaultSecretRecoveryPhrase - The default secret recovery phrase to * use. * @returns The implementation of the `getMnemonic` method. */ export function getGetMnemonicImplementation(defaultSecretRecoveryPhrase = DEFAULT_SRP) { return async (source) => { if (!source) { return mnemonicPhraseToBytes(defaultSecretRecoveryPhrase); } switch (source) { case 'default': return mnemonicPhraseToBytes(defaultSecretRecoveryPhrase); case 'alternative': return mnemonicPhraseToBytes(DEFAULT_ALTERNATIVE_SRP); default: throw new Error(`Entropy source with ID "${source}" not found.`); } }; } //# sourceMappingURL=get-mnemonic.mjs.map