@ethersproject/json-wallets
Advanced tools
Comparing version 5.0.2 to 5.0.3
@@ -1,1 +0,1 @@ | ||
export declare const version = "json-wallets/5.0.2"; | ||
export declare const version = "json-wallets/5.0.3"; |
@@ -1,2 +0,2 @@ | ||
export const version = "json-wallets/5.0.2"; | ||
export const version = "json-wallets/5.0.3"; | ||
//# sourceMappingURL=_version.js.map |
@@ -13,3 +13,2 @@ "use strict"; | ||
import * as scrypt from "scrypt-js"; | ||
import uuid from "uuid"; | ||
import { getAddress } from "@ethersproject/address"; | ||
@@ -23,3 +22,3 @@ import { arrayify, concat, hexlify } from "@ethersproject/bytes"; | ||
import { computeAddress } from "@ethersproject/transactions"; | ||
import { getPassword, looseArrayify, searchPath, zpad } from "./utils"; | ||
import { getPassword, looseArrayify, searchPath, uuidV4, zpad } from "./utils"; | ||
import { Logger } from "@ethersproject/logger"; | ||
@@ -274,3 +273,3 @@ import { version } from "./_version"; | ||
address: account.address.substring(2).toLowerCase(), | ||
id: uuid.v4({ random: uuidRandom }), | ||
id: uuidV4(uuidRandom), | ||
version: 3, | ||
@@ -277,0 +276,0 @@ Crypto: { |
@@ -1,2 +0,2 @@ | ||
import { Bytes } from "@ethersproject/bytes"; | ||
import { Bytes, BytesLike } from "@ethersproject/bytes"; | ||
export declare function looseArrayify(hexString: string): Uint8Array; | ||
@@ -6,1 +6,2 @@ export declare function zpad(value: String | number, length: number): String; | ||
export declare function searchPath(object: any, path: string): string; | ||
export declare function uuidV4(randomBytes: BytesLike): string; |
"use strict"; | ||
import { arrayify } from "@ethersproject/bytes"; | ||
import { arrayify, hexlify } from "@ethersproject/bytes"; | ||
import { toUtf8Bytes, UnicodeNormalizationForm } from '@ethersproject/strings'; | ||
@@ -44,2 +44,21 @@ export function looseArrayify(hexString) { | ||
} | ||
// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) | ||
export function uuidV4(randomBytes) { | ||
const bytes = arrayify(randomBytes); | ||
// Section: 4.1.3: | ||
// - time_hi_and_version[12:16] = 0b0100 | ||
bytes[6] = (bytes[6] & 0x0f) | 0x40; | ||
// Section 4.4 | ||
// - clock_seq_hi_and_reserved[6] = 0b0 | ||
// - clock_seq_hi_and_reserved[7] = 0b1 | ||
bytes[8] = (bytes[8] & 0x3f) | 0x80; | ||
const value = hexlify(bytes); | ||
return [ | ||
value.substring(2, 10), | ||
value.substring(10, 14), | ||
value.substring(14, 18), | ||
value.substring(18, 22), | ||
value.substring(22, 34), | ||
].join("-"); | ||
} | ||
//# sourceMappingURL=utils.js.map |
@@ -1,1 +0,1 @@ | ||
export declare const version = "json-wallets/5.0.2"; | ||
export declare const version = "json-wallets/5.0.3"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = "json-wallets/5.0.2"; | ||
exports.version = "json-wallets/5.0.3"; | ||
//# sourceMappingURL=_version.js.map |
@@ -64,3 +64,2 @@ "use strict"; | ||
var scrypt = __importStar(require("scrypt-js")); | ||
var uuid_1 = __importDefault(require("uuid")); | ||
var address_1 = require("@ethersproject/address"); | ||
@@ -340,3 +339,3 @@ var bytes_1 = require("@ethersproject/bytes"); | ||
address: account.address.substring(2).toLowerCase(), | ||
id: uuid_1.default.v4({ random: uuidRandom }), | ||
id: utils_1.uuidV4(uuidRandom), | ||
version: 3, | ||
@@ -343,0 +342,0 @@ Crypto: { |
@@ -1,2 +0,2 @@ | ||
import { Bytes } from "@ethersproject/bytes"; | ||
import { Bytes, BytesLike } from "@ethersproject/bytes"; | ||
export declare function looseArrayify(hexString: string): Uint8Array; | ||
@@ -6,1 +6,2 @@ export declare function zpad(value: String | number, length: number): String; | ||
export declare function searchPath(object: any, path: string): string; | ||
export declare function uuidV4(randomBytes: BytesLike): string; |
@@ -49,2 +49,22 @@ "use strict"; | ||
exports.searchPath = searchPath; | ||
// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) | ||
function uuidV4(randomBytes) { | ||
var bytes = bytes_1.arrayify(randomBytes); | ||
// Section: 4.1.3: | ||
// - time_hi_and_version[12:16] = 0b0100 | ||
bytes[6] = (bytes[6] & 0x0f) | 0x40; | ||
// Section 4.4 | ||
// - clock_seq_hi_and_reserved[6] = 0b0 | ||
// - clock_seq_hi_and_reserved[7] = 0b1 | ||
bytes[8] = (bytes[8] & 0x3f) | 0x80; | ||
var value = bytes_1.hexlify(bytes); | ||
return [ | ||
value.substring(2, 10), | ||
value.substring(10, 14), | ||
value.substring(14, 18), | ||
value.substring(18, 22), | ||
value.substring(22, 34), | ||
].join("-"); | ||
} | ||
exports.uuidV4 = uuidV4; | ||
//# sourceMappingURL=utils.js.map |
@@ -16,4 +16,3 @@ { | ||
"aes-js": "3.0.0", | ||
"scrypt-js": "3.0.1", | ||
"uuid": "2.0.1" | ||
"scrypt-js": "3.0.1" | ||
}, | ||
@@ -40,5 +39,5 @@ "description": "Wallet management utilities for KeyStore and Crowdsale JSON wallets.", | ||
}, | ||
"tarballHash": "0x73d9217aa697804e2ef8b6887f6aaabf5726ed550e2b5f58764c390b6dfd4a71", | ||
"tarballHash": "0x4a441a1d1289da6181565c45bd43c8636a15488ab9aafb2bc5c0e8d6c0c87376", | ||
"types": "./lib/index.d.ts", | ||
"version": "5.0.2" | ||
"version": "5.0.3" | ||
} |
@@ -23,8 +23,1 @@ declare module "aes-js" { | ||
} | ||
declare module "uuid" { | ||
export type Options = { | ||
random: Uint8Array; | ||
}; | ||
export function v4(options?: Options): string; | ||
} |
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
92299
13
1277
- Removeduuid@2.0.1
- Removeduuid@2.0.1(transitive)