mirror of
https://github.com/pezkuwichain/pezkuwi-mobile-app.git
synced 2026-05-30 04:11:02 +00:00
1 line
16 KiB
Plaintext
1 line
16 KiB
Plaintext
{"dependencies":[{"name":"@polkadot/util","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":55,"index":55}}],"key":"ISHU1ovvPMrCldqRjtd1JhW9dyo=","exportNames":["*"],"imports":1}},{"name":"../pbkdf2/index.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":2,"column":0,"index":56},"end":{"line":2,"column":50,"index":106}}],"key":"kAhtydLaGib5axTZv2SXELXyHME=","exportNames":["*"],"imports":1}},{"name":"../random/index.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":3,"column":0,"index":107},"end":{"line":3,"column":49,"index":156}}],"key":"fs0NIAKgnDxe+m4TASa020rC/3o=","exportNames":["*"],"imports":1}},{"name":"../sha/index.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":4,"column":0,"index":157},"end":{"line":4,"column":46,"index":203}}],"key":"1KD9PtL8hODqC3U94zG/Olwd7OM=","exportNames":["*"],"imports":1}},{"name":"./wordlists/en.js","data":{"asyncType":null,"isESMImport":true,"locs":[{"start":{"line":5,"column":0,"index":204},"end":{"line":5,"column":49,"index":253}}],"key":"e7Ovsp825DpV6r3Q5HtQ5NzvMjI=","exportNames":["*"],"imports":1}}],"output":[{"data":{"code":"__d(function (global, require, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {\n \"use strict\";\n\n Object.defineProperty(exports, '__esModule', {\n value: true\n });\n function _interopDefault(e) {\n return e && e.__esModule ? e : {\n default: e\n };\n }\n exports.mnemonicToSeedSync = mnemonicToSeedSync;\n exports.mnemonicToEntropy = mnemonicToEntropy;\n exports.entropyToMnemonic = entropyToMnemonic;\n exports.generateMnemonic = generateMnemonic;\n exports.validateMnemonic = validateMnemonic;\n var _polkadotUtil = require(_dependencyMap[0], \"@polkadot/util\");\n var _pbkdf2IndexJs = require(_dependencyMap[1], \"../pbkdf2/index.js\");\n var _randomIndexJs = require(_dependencyMap[2], \"../random/index.js\");\n var _shaIndexJs = require(_dependencyMap[3], \"../sha/index.js\");\n var _wordlistsEnJs = require(_dependencyMap[4], \"./wordlists/en.js\");\n var DEFAULT_WORDLIST = _interopDefault(_wordlistsEnJs);\n const INVALID_MNEMONIC = 'Invalid mnemonic';\n const INVALID_ENTROPY = 'Invalid entropy';\n const INVALID_CHECKSUM = 'Invalid mnemonic checksum';\n /** @internal */\n function normalize(str) {\n return (str || '').normalize('NFKD');\n }\n /** @internal */\n function binaryToByte(bin) {\n return parseInt(bin, 2);\n }\n /** @internal */\n function bytesToBinary(bytes) {\n return bytes.map(x => x.toString(2).padStart(8, '0')).join('');\n }\n /** @internal */\n function deriveChecksumBits(entropyBuffer) {\n return bytesToBinary(Array.from((0, _shaIndexJs.sha256AsU8a)(entropyBuffer))).slice(0, entropyBuffer.length * 8 / 32);\n }\n function mnemonicToSeedSync(mnemonic, password) {\n return (0, _pbkdf2IndexJs.pbkdf2Encode)((0, _polkadotUtil.stringToU8a)(normalize(mnemonic)), (0, _polkadotUtil.stringToU8a)(`mnemonic${normalize(password)}`)).password;\n }\n function mnemonicToEntropy(mnemonic, wordlist = DEFAULT_WORDLIST.default) {\n const words = normalize(mnemonic).split(' ');\n if (words.length % 3 !== 0) {\n throw new Error(INVALID_MNEMONIC);\n }\n // convert word indices to 11 bit binary strings\n const bits = words.map(word => {\n const index = wordlist.indexOf(word);\n if (index === -1) {\n throw new Error(INVALID_MNEMONIC);\n }\n return index.toString(2).padStart(11, '0');\n }).join('');\n // split the binary string into ENT/CS\n const dividerIndex = Math.floor(bits.length / 33) * 32;\n const entropyBits = bits.slice(0, dividerIndex);\n const checksumBits = bits.slice(dividerIndex);\n // calculate the checksum and compare\n const matched = entropyBits.match(/(.{1,8})/g);\n const entropyBytes = matched?.map(binaryToByte);\n if (!entropyBytes || entropyBytes.length % 4 !== 0 || entropyBytes.length < 16 || entropyBytes.length > 32) {\n throw new Error(INVALID_ENTROPY);\n }\n const entropy = (0, _polkadotUtil.u8aToU8a)(entropyBytes);\n if (deriveChecksumBits(entropy) !== checksumBits) {\n throw new Error(INVALID_CHECKSUM);\n }\n return entropy;\n }\n function entropyToMnemonic(entropy, wordlist = DEFAULT_WORDLIST.default) {\n // 128 <= ENT <= 256\n if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {\n throw new Error(INVALID_ENTROPY);\n }\n const matched = `${bytesToBinary(Array.from(entropy))}${deriveChecksumBits(entropy)}`.match(/(.{1,11})/g);\n const mapped = matched?.map(b => wordlist[binaryToByte(b)]);\n if (!mapped || mapped.length < 12) {\n throw new Error('Unable to map entropy to mnemonic');\n }\n return mapped.join(' ');\n }\n function generateMnemonic(numWords, wordlist) {\n return entropyToMnemonic((0, _randomIndexJs.randomAsU8a)(numWords / 3 * 4), wordlist);\n }\n function validateMnemonic(mnemonic, wordlist) {\n try {\n mnemonicToEntropy(mnemonic, wordlist);\n } catch {\n return false;\n }\n return true;\n }\n});","lineCount":97,"map":[[12,2,25,0,"exports"],[12,9,25,0],[12,10,25,0,"mnemonicToSeedSync"],[12,28,25,0],[12,31,25,0,"mnemonicToSeedSync"],[12,49,25,0],[13,2,28,0,"exports"],[13,9,28,0],[13,10,28,0,"mnemonicToEntropy"],[13,27,28,0],[13,30,28,0,"mnemonicToEntropy"],[13,47,28,0],[14,2,59,0,"exports"],[14,9,59,0],[14,10,59,0,"entropyToMnemonic"],[14,27,59,0],[14,30,59,0,"entropyToMnemonic"],[14,47,59,0],[15,2,71,0,"exports"],[15,9,71,0],[15,10,71,0,"generateMnemonic"],[15,26,71,0],[15,29,71,0,"generateMnemonic"],[15,45,71,0],[16,2,74,0,"exports"],[16,9,74,0],[16,10,74,0,"validateMnemonic"],[16,26,74,0],[16,29,74,0,"validateMnemonic"],[16,45,74,0],[17,2,1,0],[17,6,1,0,"_polkadotUtil"],[17,19,1,0],[17,22,1,0,"require"],[17,29,1,0],[17,30,1,0,"_dependencyMap"],[17,44,1,0],[18,2,2,0],[18,6,2,0,"_pbkdf2IndexJs"],[18,20,2,0],[18,23,2,0,"require"],[18,30,2,0],[18,31,2,0,"_dependencyMap"],[18,45,2,0],[19,2,3,0],[19,6,3,0,"_randomIndexJs"],[19,20,3,0],[19,23,3,0,"require"],[19,30,3,0],[19,31,3,0,"_dependencyMap"],[19,45,3,0],[20,2,4,0],[20,6,4,0,"_shaIndexJs"],[20,17,4,0],[20,20,4,0,"require"],[20,27,4,0],[20,28,4,0,"_dependencyMap"],[20,42,4,0],[21,2,5,0],[21,6,5,0,"_wordlistsEnJs"],[21,20,5,0],[21,23,5,0,"require"],[21,30,5,0],[21,31,5,0,"_dependencyMap"],[21,45,5,0],[22,2,5,0],[22,6,5,0,"DEFAULT_WORDLIST"],[22,22,5,0],[22,25,5,0,"_interopDefault"],[22,40,5,0],[22,41,5,0,"_wordlistsEnJs"],[22,55,5,0],[23,2,6,0],[23,8,6,6,"INVALID_MNEMONIC"],[23,24,6,22],[23,27,6,25],[23,45,6,43],[24,2,7,0],[24,8,7,6,"INVALID_ENTROPY"],[24,23,7,21],[24,26,7,24],[24,43,7,41],[25,2,8,0],[25,8,8,6,"INVALID_CHECKSUM"],[25,24,8,22],[25,27,8,25],[25,54,8,52],[26,2,9,0],[27,2,10,0],[27,11,10,9,"normalize"],[27,20,10,18,"normalize"],[27,21,10,19,"str"],[27,24,10,22],[27,26,10,24],[28,4,11,4],[28,11,11,11],[28,12,11,12,"str"],[28,15,11,15],[28,19,11,19],[28,21,11,21],[28,23,11,23,"normalize"],[28,32,11,32],[28,33,11,33],[28,39,11,39],[28,40,11,40],[29,2,12,0],[30,2,13,0],[31,2,14,0],[31,11,14,9,"binaryToByte"],[31,23,14,21,"binaryToByte"],[31,24,14,22,"bin"],[31,27,14,25],[31,29,14,27],[32,4,15,4],[32,11,15,11,"parseInt"],[32,19,15,19],[32,20,15,20,"bin"],[32,23,15,23],[32,25,15,25],[32,26,15,26],[32,27,15,27],[33,2,16,0],[34,2,17,0],[35,2,18,0],[35,11,18,9,"bytesToBinary"],[35,24,18,22,"bytesToBinary"],[35,25,18,23,"bytes"],[35,30,18,28],[35,32,18,30],[36,4,19,4],[36,11,19,11,"bytes"],[36,16,19,16],[36,17,19,17,"map"],[36,20,19,20],[36,21,19,22,"x"],[36,22,19,23],[36,26,19,28,"x"],[36,27,19,29],[36,28,19,30,"toString"],[36,36,19,38],[36,37,19,39],[36,38,19,40],[36,39,19,41],[36,40,19,42,"padStart"],[36,48,19,50],[36,49,19,51],[36,50,19,52],[36,52,19,54],[36,55,19,57],[36,56,19,58],[36,57,19,59],[36,58,19,60,"join"],[36,62,19,64],[36,63,19,65],[36,65,19,67],[36,66,19,68],[37,2,20,0],[38,2,21,0],[39,2,22,0],[39,11,22,9,"deriveChecksumBits"],[39,29,22,27,"deriveChecksumBits"],[39,30,22,28,"entropyBuffer"],[39,43,22,41],[39,45,22,43],[40,4,23,4],[40,11,23,11,"bytesToBinary"],[40,24,23,24],[40,25,23,25,"Array"],[40,30,23,30],[40,31,23,31,"from"],[40,35,23,35],[40,36,23,36],[40,40,23,36,"sha256AsU8a"],[40,51,23,47],[40,52,23,47,"sha256AsU8a"],[40,63,23,47],[40,65,23,48,"entropyBuffer"],[40,78,23,61],[40,79,23,62],[40,80,23,63],[40,81,23,64],[40,82,23,65,"slice"],[40,87,23,70],[40,88,23,71],[40,89,23,72],[40,91,23,75,"entropyBuffer"],[40,104,23,88],[40,105,23,89,"length"],[40,111,23,95],[40,114,23,98],[40,115,23,99],[40,118,23,103],[40,120,23,105],[40,121,23,106],[41,2,24,0],[42,2,25,7],[42,11,25,16,"mnemonicToSeedSync"],[42,29,25,34,"mnemonicToSeedSync"],[42,30,25,35,"mnemonic"],[42,38,25,43],[42,40,25,45,"password"],[42,48,25,53],[42,50,25,55],[43,4,26,4],[43,11,26,11],[43,15,26,11,"pbkdf2Encode"],[43,29,26,23],[43,30,26,23,"pbkdf2Encode"],[43,42,26,23],[43,44,26,24],[43,48,26,24,"stringToU8a"],[43,61,26,35],[43,62,26,35,"stringToU8a"],[43,73,26,35],[43,75,26,36,"normalize"],[43,84,26,45],[43,85,26,46,"mnemonic"],[43,93,26,54],[43,94,26,55],[43,95,26,56],[43,97,26,58],[43,101,26,58,"stringToU8a"],[43,114,26,69],[43,115,26,69,"stringToU8a"],[43,126,26,69],[43,128,26,70],[43,139,26,81,"normalize"],[43,148,26,90],[43,149,26,91,"password"],[43,157,26,99],[43,158,26,100],[43,160,26,102],[43,161,26,103],[43,162,26,104],[43,163,26,105,"password"],[43,171,26,113],[44,2,27,0],[45,2,28,7],[45,11,28,16,"mnemonicToEntropy"],[45,28,28,33,"mnemonicToEntropy"],[45,29,28,34,"mnemonic"],[45,37,28,42],[45,39,28,44,"wordlist"],[45,47,28,52],[45,50,28,55,"DEFAULT_WORDLIST"],[45,66,28,71],[45,67,28,71,"default"],[45,74,28,71],[45,76,28,73],[46,4,29,4],[46,10,29,10,"words"],[46,15,29,15],[46,18,29,18,"normalize"],[46,27,29,27],[46,28,29,28,"mnemonic"],[46,36,29,36],[46,37,29,37],[46,38,29,38,"split"],[46,43,29,43],[46,44,29,44],[46,47,29,47],[46,48,29,48],[47,4,30,4],[47,8,30,8,"words"],[47,13,30,13],[47,14,30,14,"length"],[47,20,30,20],[47,23,30,23],[47,24,30,24],[47,29,30,29],[47,30,30,30],[47,32,30,32],[48,6,31,8],[48,12,31,14],[48,16,31,18,"Error"],[48,21,31,23],[48,22,31,24,"INVALID_MNEMONIC"],[48,38,31,40],[48,39,31,41],[49,4,32,4],[50,4,33,4],[51,4,34,4],[51,10,34,10,"bits"],[51,14,34,14],[51,17,34,17,"words"],[51,22,34,22],[51,23,35,9,"map"],[51,26,35,12],[51,27,35,14,"word"],[51,31,35,18],[51,35,35,23],[52,6,36,8],[52,12,36,14,"index"],[52,17,36,19],[52,20,36,22,"wordlist"],[52,28,36,30],[52,29,36,31,"indexOf"],[52,36,36,38],[52,37,36,39,"word"],[52,41,36,43],[52,42,36,44],[53,6,37,8],[53,10,37,12,"index"],[53,15,37,17],[53,20,37,22],[53,21,37,23],[53,22,37,24],[53,24,37,26],[54,8,38,12],[54,14,38,18],[54,18,38,22,"Error"],[54,23,38,27],[54,24,38,28,"INVALID_MNEMONIC"],[54,40,38,44],[54,41,38,45],[55,6,39,8],[56,6,40,8],[56,13,40,15,"index"],[56,18,40,20],[56,19,40,21,"toString"],[56,27,40,29],[56,28,40,30],[56,29,40,31],[56,30,40,32],[56,31,40,33,"padStart"],[56,39,40,41],[56,40,40,42],[56,42,40,44],[56,44,40,46],[56,47,40,49],[56,48,40,50],[57,4,41,4],[57,5,41,5],[57,6,41,6],[57,7,42,9,"join"],[57,11,42,13],[57,12,42,14],[57,14,42,16],[57,15,42,17],[58,4,43,4],[59,4,44,4],[59,10,44,10,"dividerIndex"],[59,22,44,22],[59,25,44,25,"Math"],[59,29,44,29],[59,30,44,30,"floor"],[59,35,44,35],[59,36,44,36,"bits"],[59,40,44,40],[59,41,44,41,"length"],[59,47,44,47],[59,50,44,50],[59,52,44,52],[59,53,44,53],[59,56,44,56],[59,58,44,58],[60,4,45,4],[60,10,45,10,"entropyBits"],[60,21,45,21],[60,24,45,24,"bits"],[60,28,45,28],[60,29,45,29,"slice"],[60,34,45,34],[60,35,45,35],[60,36,45,36],[60,38,45,38,"dividerIndex"],[60,50,45,50],[60,51,45,51],[61,4,46,4],[61,10,46,10,"checksumBits"],[61,22,46,22],[61,25,46,25,"bits"],[61,29,46,29],[61,30,46,30,"slice"],[61,35,46,35],[61,36,46,36,"dividerIndex"],[61,48,46,48],[61,49,46,49],[62,4,47,4],[63,4,48,4],[63,10,48,10,"matched"],[63,17,48,17],[63,20,48,20,"entropyBits"],[63,31,48,31],[63,32,48,32,"match"],[63,37,48,37],[63,38,48,38],[63,49,48,49],[63,50,48,50],[64,4,49,4],[64,10,49,10,"entropyBytes"],[64,22,49,22],[64,25,49,25,"matched"],[64,32,49,32],[64,34,49,34,"map"],[64,37,49,37],[64,38,49,38,"binaryToByte"],[64,50,49,50],[64,51,49,51],[65,4,50,4],[65,8,50,8],[65,9,50,9,"entropyBytes"],[65,21,50,21],[65,25,50,26,"entropyBytes"],[65,37,50,38],[65,38,50,39,"length"],[65,44,50,45],[65,47,50,48],[65,48,50,49],[65,53,50,54],[65,54,50,56],[65,58,50,61,"entropyBytes"],[65,70,50,73],[65,71,50,74,"length"],[65,77,50,80],[65,80,50,83],[65,82,50,86],[65,86,50,91,"entropyBytes"],[65,98,50,103],[65,99,50,104,"length"],[65,105,50,110],[65,108,50,113],[65,110,50,116],[65,112,50,118],[66,6,51,8],[66,12,51,14],[66,16,51,18,"Error"],[66,21,51,23],[66,22,51,24,"INVALID_ENTROPY"],[66,37,51,39],[66,38,51,40],[67,4,52,4],[68,4,53,4],[68,10,53,10,"entropy"],[68,17,53,17],[68,20,53,20],[68,24,53,20,"u8aToU8a"],[68,37,53,28],[68,38,53,28,"u8aToU8a"],[68,46,53,28],[68,48,53,29,"entropyBytes"],[68,60,53,41],[68,61,53,42],[69,4,54,4],[69,8,54,8,"deriveChecksumBits"],[69,26,54,26],[69,27,54,27,"entropy"],[69,34,54,34],[69,35,54,35],[69,40,54,40,"checksumBits"],[69,52,54,52],[69,54,54,54],[70,6,55,8],[70,12,55,14],[70,16,55,18,"Error"],[70,21,55,23],[70,22,55,24,"INVALID_CHECKSUM"],[70,38,55,40],[70,39,55,41],[71,4,56,4],[72,4,57,4],[72,11,57,11,"entropy"],[72,18,57,18],[73,2,58,0],[74,2,59,7],[74,11,59,16,"entropyToMnemonic"],[74,28,59,33,"entropyToMnemonic"],[74,29,59,34,"entropy"],[74,36,59,41],[74,38,59,43,"wordlist"],[74,46,59,51],[74,49,59,54,"DEFAULT_WORDLIST"],[74,65,59,70],[74,66,59,70,"default"],[74,73,59,70],[74,75,59,72],[75,4,60,4],[76,4,61,4],[76,8,61,9,"entropy"],[76,15,61,16],[76,16,61,17,"length"],[76,22,61,23],[76,25,61,26],[76,26,61,27],[76,31,61,32],[76,32,61,33],[76,36,61,39,"entropy"],[76,43,61,46],[76,44,61,47,"length"],[76,50,61,53],[76,53,61,56],[76,55,61,59],[76,59,61,64,"entropy"],[76,66,61,71],[76,67,61,72,"length"],[76,73,61,78],[76,76,61,81],[76,78,61,84],[76,80,61,86],[77,6,62,8],[77,12,62,14],[77,16,62,18,"Error"],[77,21,62,23],[77,22,62,24,"INVALID_ENTROPY"],[77,37,62,39],[77,38,62,40],[78,4,63,4],[79,4,64,4],[79,10,64,10,"matched"],[79,17,64,17],[79,20,64,20],[79,23,64,23,"bytesToBinary"],[79,36,64,36],[79,37,64,37,"Array"],[79,42,64,42],[79,43,64,43,"from"],[79,47,64,47],[79,48,64,48,"entropy"],[79,55,64,55],[79,56,64,56],[79,57,64,57],[79,60,64,60,"deriveChecksumBits"],[79,78,64,78],[79,79,64,79,"entropy"],[79,86,64,86],[79,87,64,87],[79,89,64,89],[79,90,64,90,"match"],[79,95,64,95],[79,96,64,96],[79,108,64,108],[79,109,64,109],[80,4,65,4],[80,10,65,10,"mapped"],[80,16,65,16],[80,19,65,19,"matched"],[80,26,65,26],[80,28,65,28,"map"],[80,31,65,31],[80,32,65,33,"b"],[80,33,65,34],[80,37,65,39,"wordlist"],[80,45,65,47],[80,46,65,48,"binaryToByte"],[80,58,65,60],[80,59,65,61,"b"],[80,60,65,62],[80,61,65,63],[80,62,65,64],[80,63,65,65],[81,4,66,4],[81,8,66,8],[81,9,66,9,"mapped"],[81,15,66,15],[81,19,66,20,"mapped"],[81,25,66,26],[81,26,66,27,"length"],[81,32,66,33],[81,35,66,36],[81,37,66,39],[81,39,66,41],[82,6,67,8],[82,12,67,14],[82,16,67,18,"Error"],[82,21,67,23],[82,22,67,24],[82,57,67,59],[82,58,67,60],[83,4,68,4],[84,4,69,4],[84,11,69,11,"mapped"],[84,17,69,17],[84,18,69,18,"join"],[84,22,69,22],[84,23,69,23],[84,26,69,26],[84,27,69,27],[85,2,70,0],[86,2,71,7],[86,11,71,16,"generateMnemonic"],[86,27,71,32,"generateMnemonic"],[86,28,71,33,"numWords"],[86,36,71,41],[86,38,71,43,"wordlist"],[86,46,71,51],[86,48,71,53],[87,4,72,4],[87,11,72,11,"entropyToMnemonic"],[87,28,72,28],[87,29,72,29],[87,33,72,29,"randomAsU8a"],[87,47,72,40],[87,48,72,40,"randomAsU8a"],[87,59,72,40],[87,61,72,42,"numWords"],[87,69,72,50],[87,72,72,53],[87,73,72,54],[87,76,72,58],[87,77,72,59],[87,78,72,60],[87,80,72,62,"wordlist"],[87,88,72,70],[87,89,72,71],[88,2,73,0],[89,2,74,7],[89,11,74,16,"validateMnemonic"],[89,27,74,32,"validateMnemonic"],[89,28,74,33,"mnemonic"],[89,36,74,41],[89,38,74,43,"wordlist"],[89,46,74,51],[89,48,74,53],[90,4,75,4],[90,8,75,8],[91,6,76,8,"mnemonicToEntropy"],[91,23,76,25],[91,24,76,26,"mnemonic"],[91,32,76,34],[91,34,76,36,"wordlist"],[91,42,76,44],[91,43,76,45],[92,4,77,4],[92,5,77,5],[92,6,78,4],[92,12,78,10],[93,6,79,8],[93,13,79,15],[93,18,79,20],[94,4,80,4],[95,4,81,4],[95,11,81,11],[95,15,81,15],[96,2,82,0],[97,0,82,1],[97,3]],"functionMap":{"names":["<global>","normalize","binaryToByte","bytesToBinary","bytes.map$argument_0","deriveChecksumBits","mnemonicToSeedSync","mnemonicToEntropy","words.map$argument_0","entropyToMnemonic","matched.map$argument_0","generateMnemonic","validateMnemonic"],"mappings":"AAA;ACS;CDE;AEE;CFE;AGE;qBCC,qCD;CHC;AKE;CLE;OMC;CNE;OOC;aCO;KDM;CPiB;OSC;gCCM,gCD;CTK;OWC;CXE;OYC;CZQ"},"hasCjsExports":false},"type":"js/module"}]} |