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,IAAI,MAAM,sBAIpB,OAFA,EAAa,gBAAgB,EAAQ,KAAK,SAC1C,EAAM,cAAc,UAAU,OAAO,OAAO,CAAC,OAAO,KAAK,EAAW,MAAM,GAAI,KAAM,OAAO,KAAK,MACzF,CAAC,EAAc,CACd,QAAS,EACT,GAAI,OAAO,CAAE,OAAQ,EAAS,OAE9B,QAAS,KAAK,aAAa,SAAS,OACpC,OAAQ,CACJ,WAAY,EAAW,SAAS,OAChC,aAAc,CAAE,GAAI,EAAS,GAAG,SAAS,QACzC,OAAQ,EAAS,OACjB,IAAK,EAAS,IACd,UAAW,SAAS,SAAS,CAAC,EAAG,GAAY,CAAE,KAAM,EAAU,KAAK,SAAS,SAC7E,IAAK,EAAI,SAAS,UAI1C,GACJ,GACJ,EAIA,EAAO,UAAU,cAAgB,SAAU,GAavC,MAAO,CAAC,SADC,EAAY,IAAI,KAAK,GAAa,IAAI,MAC3B,SAAS,QAAQ,KAAM,KAAM,KAAM,KAAK,aAAa,SAAS,QAAQ,KAAK,GACnG,EACA,EAAO,UAAU,WAAa,SAAU,EAAU,GAC9C,OAAO,UAAU,UAAM,OAAQ,GAAQ,WACnC,IAAI,EAAI,EACR,OAAO,YAAY,MAAM,SAAU,GAC/B,OAAQ,EAAG,OACP,KAAK,EAED,OADA,GAAM,EAAK,MAAM,UACV,CAAC,EAAa,KAAK,KAAK,EAAU,IAC7C,KAAK,EAAG,MAAO,CAAC,EAAc,EAAG,MAAM,EAAI,CAAC,EAAG,UAEvD,GACJ,GACJ,EACO,CACX,CA5W2B,GA+W3B,SAAS,gBAAgB,EAAQ,GAC7B,OAAO,OAAO,OAAO,CAAC,EAAO,OAAO,GAAO,EAAO,SACtD,CACA,SAAS,UAAU,GACf,OAAO,OACX,CAPA,QAAQ,QAAU","file":"/npm/int4js-wallet@4.0.3/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/int4js-wallet@4.0.3/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n    __assign = Object.assign || function(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n            s = arguments[i];\n            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n                t[p] = s[p];\n        }\n        return t;\n    };\n    return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n    return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n    function verb(n) { return function (v) { return step([n, v]); }; }\n    function step(op) {\n        if (f) throw new TypeError(\"Generator is already executing.\");\n        while (_) try {\n            if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n            if (y = 0, t) op = [op[0] & 2, t.value];\n            switch (op[0]) {\n                case 0: case 1: t = op; break;\n                case 4: _.label++; return { value: op[1], done: false };\n                case 5: _.label++; y = op[1]; op = [0]; continue;\n                case 7: op = _.ops.pop(); _.trys.pop(); continue;\n                default:\n                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n                    if (t[2]) _.ops.pop();\n                    _.trys.pop(); continue;\n            }\n            op = body.call(thisArg, _);\n        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n    }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar crypto = require(\"crypto\");\nvar int4js_util_1 = require(\"int4js-util\");\nvar scrypt_js_1 = require(\"scrypt-js\");\nvar hdkey_1 = require(\"./hdkey\");\nObject.defineProperty(exports, \"hdkey\", { enumerable: true, get: function () { return hdkey_1.default; } });\nvar thirdparty_1 = require(\"./thirdparty\");\nObject.defineProperty(exports, \"thirdparty\", { enumerable: true, get: function () { return thirdparty_1.default; } });\nvar bs58check = require('bs58check');\nvar randomBytes = require('randombytes');\nvar uuidv4 = require('uuid/v4');\nfunction validateHexString(paramName, str, length) {\n    if (str.toLowerCase().startsWith('0x')) {\n        str = str.slice(2);\n    }\n    if (!str && !length) {\n        return str;\n    }\n    if (length % 2) {\n        throw new Error(\"Invalid length argument, must be an even number\");\n    }\n    if (typeof length === 'number' && str.length !== length) {\n        throw new Error(\"Invalid \" + paramName + \", string must be \" + length + \" hex characters\");\n    }\n    if (!/^([0-9a-f]{2})+$/i.test(str)) {\n        var howMany = typeof length === 'number' ? length : 'empty or a non-zero even number of';\n        throw new Error(\"Invalid \" + paramName + \", string must be \" + howMany + \" hex characters\");\n    }\n    return str;\n}\nfunction validateBuffer(paramName, buff, length) {\n    if (!Buffer.isBuffer(buff)) {\n        var howManyHex = typeof length === 'number' ? \"\" + length * 2 : 'empty or a non-zero even number of';\n        var howManyBytes = typeof length === 'number' ? \" (\" + length + \" bytes)\" : '';\n        throw new Error(\"Invalid \" + paramName + \", must be a string (\" + howManyHex + \" hex characters) or buffer\" + howManyBytes);\n    }\n    if (typeof length === 'number' && buff.length !== length) {\n        throw new Error(\"Invalid \" + paramName + \", buffer must be \" + length + \" bytes\");\n    }\n    return buff;\n}\nfunction mergeToV3ParamsWithDefaults(params) {\n    var v3Defaults = {\n        cipher: 'aes-128-ctr',\n        kdf: 'scrypt',\n        salt: randomBytes(32),\n        iv: randomBytes(16),\n        uuid: randomBytes(16),\n        dklen: 32,\n        c: 262144,\n        n: 262144,\n        r: 8,\n        p: 1,\n    };\n    if (!params) {\n        return v3Defaults;\n    }\n    if (typeof params.salt === 'string') {\n        params.salt = Buffer.from(validateHexString('salt', params.salt), 'hex');\n    }\n    if (typeof params.iv === 'string') {\n        params.iv = Buffer.from(validateHexString('iv', params.iv, 32), 'hex');\n    }\n    if (typeof params.uuid === 'string') {\n        params.uuid = Buffer.from(validateHexString('uuid', params.uuid, 32), 'hex');\n    }\n    if (params.salt) {\n        validateBuffer('salt', params.salt);\n    }\n    if (params.iv) {\n        validateBuffer('iv', params.iv, 16);\n    }\n    if (params.uuid) {\n        validateBuffer('uuid', params.uuid, 16);\n    }\n    return __assign(__assign({}, v3Defaults), params);\n}\nfunction kdfParamsForPBKDF(opts) {\n    return {\n        dklen: opts.dklen,\n        salt: opts.salt,\n        c: opts.c,\n        prf: 'hmac-sha256',\n    };\n}\nfunction kdfParamsForScrypt(opts) {\n    return {\n        dklen: opts.dklen,\n        salt: opts.salt,\n        n: opts.n,\n        r: opts.r,\n        p: opts.p,\n    };\n}\n// wallet implementation\nvar Wallet = /** @class */ (function () {\n    function Wallet(privateKey, publicKey) {\n        if (publicKey === void 0) { publicKey = undefined; }\n        this.privateKey = privateKey;\n        this.publicKey = publicKey;\n        if (privateKey && publicKey) {\n            throw new Error('Cannot supply both a private and a public key to the constructor');\n        }\n        if (privateKey && !int4js_util_1.isValidPrivate(privateKey)) {\n            throw new Error('Private key does not satisfy the curve requirements (ie. it is invalid)');\n        }\n        if (publicKey && !int4js_util_1.isValidPublic(publicKey)) {\n            throw new Error('Invalid public key');\n        }\n    }\n    // static methods\n    /**\n     * Create an instance based on a new random key.\n     *\n     * @param icapDirect setting this to `true` will generate an address suitable for the `ICAP Direct mode`\n     */\n    Wallet.generate = function (icapDirect) {\n        if (icapDirect === void 0) { icapDirect = false; }\n        if (icapDirect) {\n            var max = new int4js_util_1.BN('088f924eeceeda7fe92e1f5b0fffffffffffffff', 16);\n            while (true) {\n                var privateKey = randomBytes(32);\n                if (new int4js_util_1.BN(int4js_util_1.privateToAddress(privateKey)).lte(max)) {\n                    return new Wallet(privateKey);\n                }\n            }\n        }\n        else {\n            return new Wallet(randomBytes(32));\n        }\n    };\n    /**\n     * Create an instance where the address is valid against the supplied pattern (**this will be very slow**)\n     */\n    Wallet.generateVanityAddress = function (pattern) {\n        if (!(pattern instanceof RegExp)) {\n            pattern = new RegExp(pattern);\n        }\n        while (true) {\n            var privateKey = randomBytes(32);\n            var address = int4js_util_1.privateToAddress(privateKey);\n            if (pattern.test(address.toString('hex'))) {\n                return new Wallet(privateKey);\n            }\n        }\n    };\n    /**\n     * Create an instance based on a public key (certain methods will not be available)\n     *\n     * This method only accepts uncompressed Ethereum-style public keys, unless\n     * the `nonStrict` flag is set to true.\n     */\n    Wallet.fromPublicKey = function (publicKey, nonStrict) {\n        if (nonStrict === void 0) { nonStrict = false; }\n        if (nonStrict) {\n            publicKey = int4js_util_1.importPublic(publicKey);\n        }\n        return new Wallet(undefined, publicKey);\n    };\n    /**\n     * Create an instance based on a BIP32 extended public key (xpub)\n     */\n    Wallet.fromExtendedPublicKey = function (extendedPublicKey) {\n        if (extendedPublicKey.slice(0, 4) !== 'xpub') {\n            throw new Error('Not an extended public key');\n        }\n        var publicKey = bs58check.decode(extendedPublicKey).slice(45);\n        // Convert to an Ethereum public key\n        return Wallet.fromPublicKey(publicKey, true);\n    };\n    /**\n     * Create an instance based on a raw private key\n     */\n    Wallet.fromPrivateKey = function (privateKey) {\n        return new Wallet(privateKey);\n    };\n    /**\n     * Create an instance based on a BIP32 extended private key (xprv)\n     */\n    Wallet.fromExtendedPrivateKey = function (extendedPrivateKey) {\n        if (extendedPrivateKey.slice(0, 4) !== 'xprv') {\n            throw new Error('Not an extended private key');\n        }\n        var tmp = bs58check.decode(extendedPrivateKey);\n        if (tmp[45] !== 0) {\n            throw new Error('Invalid extended private key');\n        }\n        return Wallet.fromPrivateKey(tmp.slice(46));\n    };\n    /**\n     * Import a wallet (Version 1 of the Ethereum wallet format).\n     *\n     * @param input A JSON serialized string, or an object representing V1 Keystore.\n     * @param password The keystore password.\n     */\n    Wallet.fromV1 = function (input, password) {\n        return __awaiter(this, void 0, void 0, function () {\n            var json, kdfparams, derivedKey, ciphertext, mac, decipher, seed;\n            return __generator(this, function (_a) {\n                switch (_a.label) {\n                    case 0:\n                        json = typeof input === 'object' ? input : JSON.parse(input);\n                        if (json.Version !== '1') {\n                            throw new Error('Not a V1 Wallet');\n                        }\n                        if (json.Crypto.KeyHeader.Kdf !== 'scrypt') {\n                            throw new Error('Unsupported key derivation scheme');\n                        }\n                        kdfparams = json.Crypto.KeyHeader.KdfParams;\n                        return [4 /*yield*/, scrypt_js_1.scrypt(Buffer.from(password), Buffer.from(json.Crypto.Salt, 'hex'), kdfparams.N, kdfparams.R, kdfparams.P, kdfparams.DkLen)];\n                    case 1:\n                        derivedKey = _a.sent();\n                        ciphertext = Buffer.from(json.Crypto.CipherText, 'hex');\n                        mac = int4js_util_1.keccak256(Buffer.concat([derivedKey.slice(16, 32), ciphertext]));\n                        if (mac.toString('hex') !== json.Crypto.MAC) {\n                            throw new Error('Key derivation failed - possibly wrong passphrase');\n                        }\n                        decipher = crypto.createDecipheriv('aes-128-cbc', int4js_util_1.keccak256(derivedKey.slice(0, 16)).slice(0, 16), Buffer.from(json.Crypto.IV, 'hex'));\n                        seed = runCipherBuffer(decipher, ciphertext);\n                        return [2 /*return*/, new Wallet(seed)];\n                }\n            });\n        });\n    };\n    /**\n     * Import a wallet (Version 3 of the Ethereum wallet format). Set `nonStrict` true to accept files with mixed-caps.\n     *\n     * @param input A JSON serialized string, or an object representing V3 Keystore.\n     * @param password The keystore password.\n     */\n    Wallet.fromV3 = function (input, password, nonStrict) {\n        if (nonStrict === void 0) { nonStrict = false; }\n        return __awaiter(this, void 0, void 0, function () {\n            var json, derivedKey, kdfparams, ciphertext, mac, decipher, seed;\n            return __generator(this, function (_a) {\n                switch (_a.label) {\n                    case 0:\n                        json = typeof input === 'object' ? input : JSON.parse(nonStrict ? input.toLowerCase() : input);\n                        if (json.version !== 3) {\n                            throw new Error('Not a V3 wallet');\n                        }\n                        if (!(json.crypto.kdf === 'scrypt')) return [3 /*break*/, 2];\n                        kdfparams = json.crypto.kdfparams;\n                        return [4 /*yield*/, scrypt_js_1.scrypt(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen)];\n                    case 1:\n                        // FIXME: support progress reporting callback\n                        derivedKey = _a.sent();\n                        return [3 /*break*/, 3];\n                    case 2:\n                        if (json.crypto.kdf === 'pbkdf2') {\n                            kdfparams = json.crypto.kdfparams;\n                            if (kdfparams.prf !== 'hmac-sha256') {\n                                throw new Error('Unsupported parameters to PBKDF2');\n                            }\n                            derivedKey = crypto.pbkdf2Sync(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.c, kdfparams.dklen, 'sha256');\n                        }\n                        else {\n                            throw new Error('Unsupported key derivation scheme');\n                        }\n                        _a.label = 3;\n                    case 3:\n                        ciphertext = Buffer.from(json.crypto.ciphertext, 'hex');\n                        mac = int4js_util_1.keccak256(Buffer.concat([Buffer.from(derivedKey.slice(16, 32)), ciphertext]));\n                        if (mac.toString('hex') !== json.crypto.mac) {\n                            throw new Error('Key derivation failed - possibly wrong passphrase');\n                        }\n                        decipher = crypto.createDecipheriv(json.crypto.cipher, derivedKey.slice(0, 16), Buffer.from(json.crypto.cipherparams.iv, 'hex'));\n                        seed = runCipherBuffer(decipher, ciphertext);\n                        return [2 /*return*/, new Wallet(seed)];\n                }\n            });\n        });\n    };\n    /*\n     * Import an Ethereum Pre Sale wallet.\n     * Based on https://github.com/ethereum/pyethsaletool/blob/master/pyethsaletool.py\n     * JSON fields: encseed, ethaddr, btcaddr, email\n     *\n     * @param input A JSON serialized string, or an object representing EthSale Keystore.\n     * @param password The keystore password.\n     */\n    Wallet.fromEthSale = function (input, password) {\n        var json = typeof input === 'object' ? input : JSON.parse(input);\n        var encseed = Buffer.from(json.encseed, 'hex');\n        // key derivation\n        var derivedKey = crypto.pbkdf2Sync(password, password, 2000, 32, 'sha256').slice(0, 16);\n        // seed decoding (IV is first 16 bytes)\n        // NOTE: crypto (derived from openssl) when used with aes-*-cbc will handle PKCS#7 padding internally\n        //       see also http://stackoverflow.com/a/31614770/4964819\n        var decipher = crypto.createDecipheriv('aes-128-cbc', derivedKey, encseed.slice(0, 16));\n        var seed = runCipherBuffer(decipher, encseed.slice(16));\n        var wallet = new Wallet(int4js_util_1.keccak256(seed));\n        if (wallet.getAddress().toString('hex') !== json.ethaddr) {\n            throw new Error('Decoded key mismatch - possibly wrong passphrase');\n        }\n        return wallet;\n    };\n    Object.defineProperty(Wallet.prototype, \"pubKey\", {\n        // private getters\n        /**\n         * Returns the wallet's public key.\n         */\n        get: function () {\n            if (!keyExists(this.publicKey)) {\n                this.publicKey = int4js_util_1.privateToPublic(this.privateKey);\n            }\n            return this.publicKey;\n        },\n        enumerable: false,\n        configurable: true\n    });\n    Object.defineProperty(Wallet.prototype, \"privKey\", {\n        /**\n         * Returns the wallet's private key.\n         */\n        get: function () {\n            if (!keyExists(this.privateKey)) {\n                throw new Error('This is a public key only wallet');\n            }\n            return this.privateKey;\n        },\n        enumerable: false,\n        configurable: true\n    });\n    // public instance methods\n    /**\n     * Returns the wallet's private key.\n     *\n     */\n    // tslint:disable-next-line\n    Wallet.prototype.getPrivateKey = function () {\n        return this.privKey;\n    };\n    Wallet.prototype.getPrivateKeyString = function () {\n        return int4js_util_1.bufferToHex(this.privKey);\n    };\n    /**\n     * Returns the wallet's public key.\n     */\n    // tslint:disable-next-line\n    Wallet.prototype.getPublicKey = function () {\n        return this.pubKey;\n    };\n    /**\n     * Returns the wallet's public key as a \"0x\" prefixed hex string\n     */\n    Wallet.prototype.getPublicKeyString = function () {\n        return int4js_util_1.bufferToHex(this.getPublicKey());\n    };\n    /**\n     * Returns the wallet's address.\n     */\n    Wallet.prototype.getAddress = function () {\n        return int4js_util_1.publicToAddress(this.pubKey);\n    };\n    /**\n     * Returns the wallet's address as a \"INT\" prefixed hex string\n     */\n    Wallet.prototype.getAddressString = function () {\n        return this.getAddress().toString();\n    };\n    /**\n     * Returns the wallet's private key as a \"0x\" prefixed hex string checksummed\n     * according to [EIP 55](https://github.com/ethereum/EIPs/issues/55).\n     */\n    Wallet.prototype.getChecksumAddressString = function () {\n        return int4js_util_1.toChecksumAddress(this.getAddressString());\n    };\n    /**\n     * Returns an Etherem Version 3 Keystore Format object representing the wallet\n     *\n     * @param password The password used to encrypt the Keystore.\n     * @param opts The options for the keystore. See [its spec](https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition) for more info.\n     */\n    Wallet.prototype.toV3 = function (password, opts) {\n        return __awaiter(this, void 0, void 0, function () {\n            var v3Params, kdfParams, derivedKey, _a, cipher, ciphertext, mac;\n            return __generator(this, function (_b) {\n                switch (_b.label) {\n                    case 0:\n                        if (!keyExists(this.privateKey)) {\n                            throw new Error('This is a public key only wallet');\n                        }\n                        v3Params = mergeToV3ParamsWithDefaults(opts);\n                        _a = v3Params.kdf;\n                        switch (_a) {\n                            case \"pbkdf2\" /* PBKDF */: return [3 /*break*/, 1];\n                            case \"scrypt\" /* Scrypt */: return [3 /*break*/, 2];\n                        }\n                        return [3 /*break*/, 4];\n                    case 1:\n                        kdfParams = kdfParamsForPBKDF(v3Params);\n                        derivedKey = crypto.pbkdf2Sync(Buffer.from(password), kdfParams.salt, kdfParams.c, kdfParams.dklen, 'sha256');\n                        return [3 /*break*/, 5];\n                    case 2:\n                        kdfParams = kdfParamsForScrypt(v3Params);\n                        return [4 /*yield*/, scrypt_js_1.scrypt(Buffer.from(password), kdfParams.salt, kdfParams.n, kdfParams.r, kdfParams.p, kdfParams.dklen)];\n                    case 3:\n                        // FIXME: support progress reporting callback\n                        derivedKey = _b.sent();\n                        return [3 /*break*/, 5];\n                    case 4: throw new Error('Unsupported kdf');\n                    case 5:\n                        cipher = crypto.createCipheriv(v3Params.cipher, derivedKey.slice(0, 16), v3Params.iv);\n                        if (!cipher) {\n                            throw new Error('Unsupported cipher');\n                        }\n                        ciphertext = runCipherBuffer(cipher, this.privKey);\n                        mac = int4js_util_1.keccak256(Buffer.concat([Buffer.from(derivedKey.slice(16, 32)), Buffer.from(ciphertext)]));\n                        return [2 /*return*/, {\n                                version: 3,\n                                id: uuidv4({ random: v3Params.uuid }),\n                                // @ts-ignore - the official V3 keystore spec omits the address key\n                                address: this.getAddress().toString('hex'),\n                                crypto: {\n                                    ciphertext: ciphertext.toString('hex'),\n                                    cipherparams: { iv: v3Params.iv.toString('hex') },\n                                    cipher: v3Params.cipher,\n                                    kdf: v3Params.kdf,\n                                    kdfparams: __assign(__assign({}, kdfParams), { salt: kdfParams.salt.toString('hex') }),\n                                    mac: mac.toString('hex'),\n                                },\n                            }];\n                }\n            });\n        });\n    };\n    /**\n     * Return the suggested filename for V3 keystores.\n     */\n    Wallet.prototype.getV3Filename = function (timestamp) {\n        /*\n         * We want a timestamp like 2016-03-15T17-11-33.007598288Z. Date formatting\n         * is a pain in Javascript, everbody knows that. We could use moment.js,\n         * but decide to do it manually in order to save space.\n         *\n         * toJSON() returns a pretty close version, so let's use it. It is not UTC though,\n         * but does it really matter?\n         *\n         * Alternative manual way with padding and Date fields: http://stackoverflow.com/a/7244288/4964819\n         *\n         */\n        var ts = timestamp ? new Date(timestamp) : new Date();\n        return ['UTC--', ts.toJSON().replace(/:/g, '-'), '--', this.getAddress().toString('hex')].join('');\n    };\n    Wallet.prototype.toV3String = function (password, opts) {\n        return __awaiter(this, void 0, void 0, function () {\n            var _a, _b;\n            return __generator(this, function (_c) {\n                switch (_c.label) {\n                    case 0:\n                        _b = (_a = JSON).stringify;\n                        return [4 /*yield*/, this.toV3(password, opts)];\n                    case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];\n                }\n            });\n        });\n    };\n    return Wallet;\n}());\nexports.default = Wallet;\n// helpers\nfunction runCipherBuffer(cipher, data) {\n    return Buffer.concat([cipher.update(data), cipher.final()]);\n}\nfunction keyExists(k) {\n    return k !== undefined && k !== null;\n}\n"]}