@ulixee/commons
Advanced tools
Comparing version 2.0.0-alpha.10 to 2.0.0-alpha.11
/// <reference types="node" /> | ||
export declare const hashMessagePrefix = "\u0018Ulixee Signed Message:\n"; | ||
export declare function sha3(data: Buffer | string): Buffer; | ||
@@ -3,0 +4,0 @@ export declare function sortedJsonStringify<T>(obj: T | null, ignoreProperties?: (keyof T)[]): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hashObject = exports.sortedJsonStringify = exports.sha3 = void 0; | ||
exports.hashObject = exports.sortedJsonStringify = exports.sha3 = exports.hashMessagePrefix = void 0; | ||
const crypto_1 = require("crypto"); | ||
const TypeSerializer_1 = require("./TypeSerializer"); | ||
exports.hashMessagePrefix = '\x18Ulixee Signed Message:\n'; | ||
function sha3(data) { | ||
@@ -23,3 +24,3 @@ return (0, crypto_1.createHash)('sha3-256').update(data).digest(); | ||
const json = sortedJsonStringify(obj, options?.ignoreProperties); | ||
let buffer = Buffer.from(json); | ||
let buffer = Buffer.from(`${exports.hashMessagePrefix}${json.length}${json}`); | ||
if (options?.prefix) | ||
@@ -26,0 +27,0 @@ buffer = Buffer.concat([options.prefix, buffer]); |
@@ -56,3 +56,3 @@ "use strict"; | ||
static replace(object, options) { | ||
if (!object) | ||
if (object === undefined || object === null) | ||
return object; | ||
@@ -59,0 +59,0 @@ const replaced = this.replacer(null, object); |
{ | ||
"name": "@ulixee/commons", | ||
"version": "2.0.0-alpha.10", | ||
"version": "2.0.0-alpha.11", | ||
"description": "Common utilities for Ulixee", | ||
@@ -19,3 +19,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "b8c2419605a7e1558fa442247834d2daf60fdb06" | ||
"gitHead": "64ca2766fa3d206479dc8bfb3e887e8b133ee8b5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
219937
123
3199
34