@multiversx/sdk-wallet
Advanced tools
Comparing version 4.0.1-alpha.1 to 4.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Randomness = void 0; | ||
const ed = require("../noble/ed25519/lib/index"); | ||
const ed25519_1 = require("@noble/ed25519"); | ||
const uuid_1 = require("uuid"); | ||
@@ -9,4 +9,4 @@ const crypto = require("crypto"); | ||
constructor(init) { | ||
this.salt = (init === null || init === void 0 ? void 0 : init.salt) || Buffer.from(ed.utils.randomBytes(32)); | ||
this.iv = (init === null || init === void 0 ? void 0 : init.iv) || Buffer.from(ed.utils.randomBytes(16)); | ||
this.salt = (init === null || init === void 0 ? void 0 : init.salt) || Buffer.from(ed25519_1.utils.randomBytes(32)); | ||
this.iv = (init === null || init === void 0 ? void 0 : init.iv) || Buffer.from(ed25519_1.utils.randomBytes(16)); | ||
this.id = (init === null || init === void 0 ? void 0 : init.id) || uuid_1.v4({ random: crypto.randomBytes(16) }); | ||
@@ -13,0 +13,0 @@ } |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UserPublicKey = exports.UserSecretKey = exports.USER_PUBKEY_LENGTH = exports.USER_SEED_LENGTH = void 0; | ||
const ed = require("./noble/ed25519/lib/index"); | ||
const ed = __importStar(require("@noble/ed25519")); | ||
const sha512_1 = require("@noble/hashes/sha512"); | ||
@@ -6,0 +25,0 @@ const assertions_1 = require("./assertions"); |
@@ -18,3 +18,3 @@ /// <reference types="node" /> | ||
constructor(secretKey: IUserSecretKey); | ||
static fromWallet(keyFileObject: any, password: string): UserSigner; | ||
static fromWallet(keyFileObject: any, password: string, addressIndex?: number): UserSigner; | ||
static fromPem(text: string, index?: number): UserSigner; | ||
@@ -21,0 +21,0 @@ sign(data: Buffer): Promise<Buffer>; |
@@ -24,4 +24,4 @@ "use strict"; | ||
} | ||
static fromWallet(keyFileObject, password) { | ||
let secretKey = userWallet_1.UserWallet.decryptSecretKey(keyFileObject, password); | ||
static fromWallet(keyFileObject, password, addressIndex) { | ||
const secretKey = userWallet_1.UserWallet.decrypt(keyFileObject, password, addressIndex); | ||
return new UserSigner(secretKey); | ||
@@ -28,0 +28,0 @@ } |
@@ -29,2 +29,3 @@ /// <reference types="node" /> | ||
}): UserWallet; | ||
static decrypt(keyFileObject: any, password: string, addressIndex?: number): UserSecretKey; | ||
/** | ||
@@ -31,0 +32,0 @@ * Copied from: https://github.com/multiversx/mx-deprecated-core-js/blob/v1.28.0/src/account.js#L42 |
@@ -41,2 +41,16 @@ "use strict"; | ||
} | ||
static decrypt(keyFileObject, password, addressIndex) { | ||
const kind = keyFileObject.kind || UserWalletKind.SecretKey; | ||
if (kind == UserWalletKind.SecretKey) { | ||
if (addressIndex !== undefined) { | ||
throw new errors_1.Err("addressIndex must not be provided when kind == 'secretKey'"); | ||
} | ||
return UserWallet.decryptSecretKey(keyFileObject, password); | ||
} | ||
if (kind == UserWalletKind.Mnemonic) { | ||
const mnemonic = this.decryptMnemonic(keyFileObject, password); | ||
return mnemonic.deriveKey(addressIndex || 0); | ||
} | ||
throw new errors_1.Err(`Unknown kind: ${kind}`); | ||
} | ||
/** | ||
@@ -43,0 +57,0 @@ * Copied from: https://github.com/multiversx/mx-deprecated-core-js/blob/v1.28.0/src/account.js#L42 |
{ | ||
"name": "@multiversx/sdk-wallet", | ||
"version": "4.0.1-alpha.1", | ||
"version": "4.1.0", | ||
"description": "Wallet components for MultiversX", | ||
@@ -31,2 +31,3 @@ "main": "out/index.js", | ||
"tweetnacl": "1.0.3", | ||
"@noble/ed25519": "1.7.3", | ||
"@noble/hashes": "1.3.0", | ||
@@ -33,0 +34,0 @@ "uuid": "8.3.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
83251
12
72
1391
+ Added@noble/ed25519@1.7.3
+ Added@noble/ed25519@1.7.3(transitive)