@metamask/keyring-sdk
Advanced tools
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.encodeMnemonic = encodeMnemonic; | ||
| const english_1 = require("@metamask/scure-bip39/dist/wordlists/english.js"); | ||
| /** | ||
| * Encodes a mnemonic as an array of bytes (UTF-8). | ||
| * | ||
| * @param mnemonicIndicesBytes - An array of bytes (16-bit unsigned integers) representing the indices of the words in the mnemonic. | ||
| * @returns An array of bytes (UTF-8) representing the mnemonic. | ||
| */ | ||
| function encodeMnemonic(mnemonicIndicesBytes) { | ||
| const mnemonicIndices = Array.from( | ||
| // Create a new `Uint8Array` to ensure we have a proper view on the buffer | ||
| // without having to worry about `byteOffset` and `byteLength` of | ||
| // the inner buffer. | ||
| new Uint16Array(new Uint8Array(mnemonicIndicesBytes).buffer)); | ||
| const mnemonic = mnemonicIndices.map((i) => english_1.wordlist[i]).join(' '); | ||
| return Array.from(new TextEncoder().encode(mnemonic)); | ||
| } | ||
| //# sourceMappingURL=mnemonic.cjs.map |
| {"version":3,"file":"mnemonic.cjs","sourceRoot":"","sources":["../src/mnemonic.ts"],"names":[],"mappings":";;AAQA,wCASC;AAjBD,6EAAwE;AAExE;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,oBAAgC;IAC7D,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI;IAChC,0EAA0E;IAC1E,iEAAiE;IACjE,oBAAoB;IACpB,IAAI,WAAW,CAAC,IAAI,UAAU,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAC7D,CAAC;IACF,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { wordlist } from '@metamask/scure-bip39/dist/wordlists/english';\n\n/**\n * Encodes a mnemonic as an array of bytes (UTF-8).\n *\n * @param mnemonicIndicesBytes - An array of bytes (16-bit unsigned integers) representing the indices of the words in the mnemonic.\n * @returns An array of bytes (UTF-8) representing the mnemonic.\n */\nexport function encodeMnemonic(mnemonicIndicesBytes: Uint8Array): number[] {\n const mnemonicIndices = Array.from(\n // Create a new `Uint8Array` to ensure we have a proper view on the buffer\n // without having to worry about `byteOffset` and `byteLength` of\n // the inner buffer.\n new Uint16Array(new Uint8Array(mnemonicIndicesBytes).buffer),\n );\n const mnemonic = mnemonicIndices.map((i) => wordlist[i]).join(' ');\n return Array.from(new TextEncoder().encode(mnemonic));\n}\n"]} |
| /** | ||
| * Encodes a mnemonic as an array of bytes (UTF-8). | ||
| * | ||
| * @param mnemonicIndicesBytes - An array of bytes (16-bit unsigned integers) representing the indices of the words in the mnemonic. | ||
| * @returns An array of bytes (UTF-8) representing the mnemonic. | ||
| */ | ||
| export declare function encodeMnemonic(mnemonicIndicesBytes: Uint8Array): number[]; | ||
| //# sourceMappingURL=mnemonic.d.cts.map |
| {"version":3,"file":"mnemonic.d.cts","sourceRoot":"","sources":["../src/mnemonic.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,oBAAoB,EAAE,UAAU,GAAG,MAAM,EAAE,CASzE"} |
| /** | ||
| * Encodes a mnemonic as an array of bytes (UTF-8). | ||
| * | ||
| * @param mnemonicIndicesBytes - An array of bytes (16-bit unsigned integers) representing the indices of the words in the mnemonic. | ||
| * @returns An array of bytes (UTF-8) representing the mnemonic. | ||
| */ | ||
| export declare function encodeMnemonic(mnemonicIndicesBytes: Uint8Array): number[]; | ||
| //# sourceMappingURL=mnemonic.d.mts.map |
| {"version":3,"file":"mnemonic.d.mts","sourceRoot":"","sources":["../src/mnemonic.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,oBAAoB,EAAE,UAAU,GAAG,MAAM,EAAE,CASzE"} |
| import { wordlist } from "@metamask/scure-bip39/dist/wordlists/english.js"; | ||
| /** | ||
| * Encodes a mnemonic as an array of bytes (UTF-8). | ||
| * | ||
| * @param mnemonicIndicesBytes - An array of bytes (16-bit unsigned integers) representing the indices of the words in the mnemonic. | ||
| * @returns An array of bytes (UTF-8) representing the mnemonic. | ||
| */ | ||
| export function encodeMnemonic(mnemonicIndicesBytes) { | ||
| const mnemonicIndices = Array.from( | ||
| // Create a new `Uint8Array` to ensure we have a proper view on the buffer | ||
| // without having to worry about `byteOffset` and `byteLength` of | ||
| // the inner buffer. | ||
| new Uint16Array(new Uint8Array(mnemonicIndicesBytes).buffer)); | ||
| const mnemonic = mnemonicIndices.map((i) => wordlist[i]).join(' '); | ||
| return Array.from(new TextEncoder().encode(mnemonic)); | ||
| } | ||
| //# sourceMappingURL=mnemonic.mjs.map |
| {"version":3,"file":"mnemonic.mjs","sourceRoot":"","sources":["../src/mnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,wDAAqD;AAExE;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,oBAAgC;IAC7D,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI;IAChC,0EAA0E;IAC1E,iEAAiE;IACjE,oBAAoB;IACpB,IAAI,WAAW,CAAC,IAAI,UAAU,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAC7D,CAAC;IACF,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { wordlist } from '@metamask/scure-bip39/dist/wordlists/english';\n\n/**\n * Encodes a mnemonic as an array of bytes (UTF-8).\n *\n * @param mnemonicIndicesBytes - An array of bytes (16-bit unsigned integers) representing the indices of the words in the mnemonic.\n * @returns An array of bytes (UTF-8) representing the mnemonic.\n */\nexport function encodeMnemonic(mnemonicIndicesBytes: Uint8Array): number[] {\n const mnemonicIndices = Array.from(\n // Create a new `Uint8Array` to ensure we have a proper view on the buffer\n // without having to worry about `byteOffset` and `byteLength` of\n // the inner buffer.\n new Uint16Array(new Uint8Array(mnemonicIndicesBytes).buffer),\n );\n const mnemonic = mnemonicIndices.map((i) => wordlist[i]).join(' ');\n return Array.from(new TextEncoder().encode(mnemonic));\n}\n"]} |
+12
-1
@@ -10,2 +10,12 @@ # Changelog | ||
| ## [1.1.0] | ||
| ### Added | ||
| - Add `encodeMnemonic` ([#495](https://github.com/MetaMask/accounts/pull/495)) | ||
| ### Changed | ||
| - Bump `@metamask/utils` from `^11.1.0` to `^11.10.0` ([#489](https://github.com/MetaMask/accounts/pull/489)) | ||
| ## [1.0.0] | ||
@@ -17,3 +27,4 @@ | ||
| [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-sdk@1.0.0...HEAD | ||
| [Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-sdk@1.1.0...HEAD | ||
| [1.1.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-sdk@1.0.0...@metamask/keyring-sdk@1.1.0 | ||
| [1.0.0]: https://github.com/MetaMask/accounts/releases/tag/@metamask/keyring-sdk@1.0.0 |
+1
-0
@@ -19,3 +19,4 @@ "use strict"; | ||
| __exportStar(require("./keyring-account-registry.cjs"), exports); | ||
| __exportStar(require("./mnemonic.cjs"), exports); | ||
| __exportStar(require("./eth/index.cjs"), exports); | ||
| //# sourceMappingURL=index.cjs.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAkC;AAClC,iEAA2C;AAC3C,kDAAsB","sourcesContent":["export * from './keyring-wrapper';\nexport * from './keyring-account-registry';\nexport * from './eth';\n"]} | ||
| {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAkC;AAClC,iEAA2C;AAC3C,iDAA2B;AAC3B,kDAAsB","sourcesContent":["export * from './keyring-wrapper';\nexport * from './keyring-account-registry';\nexport * from './mnemonic';\nexport * from './eth';\n"]} |
+1
-0
| export * from "./keyring-wrapper.cjs"; | ||
| export * from "./keyring-account-registry.cjs"; | ||
| export * from "./mnemonic.cjs"; | ||
| export * from "./eth/index.cjs"; | ||
| //# sourceMappingURL=index.d.cts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,+CAA2C;AAC3C,gCAAsB"} | ||
| {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,+CAA2C;AAC3C,+BAA2B;AAC3B,gCAAsB"} |
+1
-0
| export * from "./keyring-wrapper.mjs"; | ||
| export * from "./keyring-account-registry.mjs"; | ||
| export * from "./mnemonic.mjs"; | ||
| export * from "./eth/index.mjs"; | ||
| //# sourceMappingURL=index.d.mts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,+CAA2C;AAC3C,gCAAsB"} | ||
| {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,+CAA2C;AAC3C,+BAA2B;AAC3B,gCAAsB"} |
+1
-0
| export * from "./keyring-wrapper.mjs"; | ||
| export * from "./keyring-account-registry.mjs"; | ||
| export * from "./mnemonic.mjs"; | ||
| export * from "./eth/index.mjs"; | ||
| //# sourceMappingURL=index.mjs.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,+CAA2C;AAC3C,gCAAsB","sourcesContent":["export * from './keyring-wrapper';\nexport * from './keyring-account-registry';\nexport * from './eth';\n"]} | ||
| {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAkC;AAClC,+CAA2C;AAC3C,+BAA2B;AAC3B,gCAAsB","sourcesContent":["export * from './keyring-wrapper';\nexport * from './keyring-account-registry';\nexport * from './mnemonic';\nexport * from './eth';\n"]} |
+3
-2
| { | ||
| "name": "@metamask/keyring-sdk", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "description": "MetaMask Keyring SDK", | ||
@@ -52,4 +52,5 @@ "keywords": [ | ||
| "@metamask/keyring-utils": "^3.2.0", | ||
| "@metamask/scure-bip39": "^2.1.1", | ||
| "@metamask/superstruct": "^3.1.0", | ||
| "@metamask/utils": "^11.1.0", | ||
| "@metamask/utils": "^11.10.0", | ||
| "async-mutex": "^0.5.0", | ||
@@ -56,0 +57,0 @@ "uuid": "^9.0.1" |
138372
4.85%51
18.6%926
4.16%9
12.5%+ Added
+ Added
+ Added
- Removed
Updated