@metamask/snaps-simulation
Version:
A simulation framework for MetaMask Snaps, enabling headless testing of Snaps in a controlled environment
29 lines • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getGetMnemonicImplementation = void 0;
const key_tree_1 = require("@metamask/key-tree");
const constants_1 = require("../../constants.cjs");
/**
* Get the implementation of the `getMnemonic` method.
*
* @param defaultSecretRecoveryPhrase - The default secret recovery phrase to
* use.
* @returns The implementation of the `getMnemonic` method.
*/
function getGetMnemonicImplementation(defaultSecretRecoveryPhrase = constants_1.DEFAULT_SRP) {
return async (source) => {
if (!source) {
return (0, key_tree_1.mnemonicPhraseToBytes)(defaultSecretRecoveryPhrase);
}
switch (source) {
case 'default':
return (0, key_tree_1.mnemonicPhraseToBytes)(defaultSecretRecoveryPhrase);
case 'alternative':
return (0, key_tree_1.mnemonicPhraseToBytes)(constants_1.DEFAULT_ALTERNATIVE_SRP);
default:
throw new Error(`Entropy source with ID "${source}" not found.`);
}
};
}
exports.getGetMnemonicImplementation = getGetMnemonicImplementation;
//# sourceMappingURL=get-mnemonic.cjs.map