@toruslabs/openlogin-utils
Advanced tools
Comparing version 0.3.4 to 0.4.0
@@ -85,3 +85,3 @@ module.exports = | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 14); | ||
/******/ return __webpack_require__(__webpack_require__.s = 16); | ||
/******/ }) | ||
@@ -117,3 +117,3 @@ /************************************************************************/ | ||
module.exports = require("randombytes"); | ||
module.exports = require("@babel/runtime/helpers/toConsumableArray"); | ||
@@ -124,3 +124,3 @@ /***/ }), | ||
module.exports = require("@babel/runtime/helpers/classCallCheck"); | ||
module.exports = require("randombytes"); | ||
@@ -131,3 +131,3 @@ /***/ }), | ||
module.exports = require("@babel/runtime/helpers/createClass"); | ||
module.exports = require("@babel/runtime/helpers/classCallCheck"); | ||
@@ -138,3 +138,3 @@ /***/ }), | ||
module.exports = require("@babel/runtime/helpers/assertThisInitialized"); | ||
module.exports = require("@babel/runtime/helpers/createClass"); | ||
@@ -145,3 +145,3 @@ /***/ }), | ||
module.exports = require("@babel/runtime/helpers/get"); | ||
module.exports = require("@babel/runtime/helpers/assertThisInitialized"); | ||
@@ -152,3 +152,3 @@ /***/ }), | ||
module.exports = require("@babel/runtime/helpers/inherits"); | ||
module.exports = require("@babel/runtime/helpers/get"); | ||
@@ -159,3 +159,3 @@ /***/ }), | ||
module.exports = require("@babel/runtime/helpers/possibleConstructorReturn"); | ||
module.exports = require("@babel/runtime/helpers/inherits"); | ||
@@ -166,3 +166,3 @@ /***/ }), | ||
module.exports = require("@babel/runtime/helpers/wrapNativeSuper"); | ||
module.exports = require("@babel/runtime/helpers/possibleConstructorReturn"); | ||
@@ -173,3 +173,3 @@ /***/ }), | ||
module.exports = require("@babel/runtime/helpers/defineProperty"); | ||
module.exports = require("@babel/runtime/helpers/wrapNativeSuper"); | ||
@@ -180,6 +180,18 @@ /***/ }), | ||
module.exports = require("@babel/runtime/helpers/defineProperty"); | ||
/***/ }), | ||
/* 14 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("@toruslabs/tweetnacl-js"); | ||
/***/ }), | ||
/* 15 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("base64url"); | ||
/***/ }), | ||
/* 14 */ | ||
/* 16 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -201,2 +213,3 @@ | ||
__webpack_require__.d(__webpack_exports__, "URLWithHashParams", function() { return /* reexport */ url_URLWithHashParams; }); | ||
__webpack_require__.d(__webpack_exports__, "getED25519Key", function() { return /* reexport */ getED25519Key; }); | ||
__webpack_require__.d(__webpack_exports__, "keccak", function() { return /* reexport */ keccak; }); | ||
@@ -340,3 +353,3 @@ __webpack_require__.d(__webpack_exports__, "base64url", function() { return /* reexport */ base64url; }); | ||
// EXTERNAL MODULE: external "randombytes" | ||
var external_randombytes_ = __webpack_require__(4); | ||
var external_randombytes_ = __webpack_require__(5); | ||
var external_randombytes_default = /*#__PURE__*/__webpack_require__.n(external_randombytes_); | ||
@@ -351,23 +364,23 @@ | ||
// EXTERNAL MODULE: external "@babel/runtime/helpers/classCallCheck" | ||
var classCallCheck_ = __webpack_require__(5); | ||
var classCallCheck_ = __webpack_require__(6); | ||
var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck_); | ||
// EXTERNAL MODULE: external "@babel/runtime/helpers/createClass" | ||
var createClass_ = __webpack_require__(6); | ||
var createClass_ = __webpack_require__(7); | ||
var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass_); | ||
// EXTERNAL MODULE: external "@babel/runtime/helpers/assertThisInitialized" | ||
var assertThisInitialized_ = __webpack_require__(7); | ||
var assertThisInitialized_ = __webpack_require__(8); | ||
var assertThisInitialized_default = /*#__PURE__*/__webpack_require__.n(assertThisInitialized_); | ||
// EXTERNAL MODULE: external "@babel/runtime/helpers/get" | ||
var get_ = __webpack_require__(8); | ||
var get_ = __webpack_require__(9); | ||
var get_default = /*#__PURE__*/__webpack_require__.n(get_); | ||
// EXTERNAL MODULE: external "@babel/runtime/helpers/inherits" | ||
var inherits_ = __webpack_require__(9); | ||
var inherits_ = __webpack_require__(10); | ||
var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits_); | ||
// EXTERNAL MODULE: external "@babel/runtime/helpers/possibleConstructorReturn" | ||
var possibleConstructorReturn_ = __webpack_require__(10); | ||
var possibleConstructorReturn_ = __webpack_require__(11); | ||
var possibleConstructorReturn_default = /*#__PURE__*/__webpack_require__.n(possibleConstructorReturn_); | ||
@@ -380,7 +393,7 @@ | ||
// EXTERNAL MODULE: external "@babel/runtime/helpers/wrapNativeSuper" | ||
var wrapNativeSuper_ = __webpack_require__(11); | ||
var wrapNativeSuper_ = __webpack_require__(12); | ||
var wrapNativeSuper_default = /*#__PURE__*/__webpack_require__.n(wrapNativeSuper_); | ||
// EXTERNAL MODULE: external "@babel/runtime/helpers/defineProperty" | ||
var defineProperty_ = __webpack_require__(12); | ||
var defineProperty_ = __webpack_require__(13); | ||
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_); | ||
@@ -434,4 +447,12 @@ | ||
}( /*#__PURE__*/wrapNativeSuper_default()(URL)); | ||
// EXTERNAL MODULE: external "@babel/runtime/helpers/toConsumableArray" | ||
var toConsumableArray_ = __webpack_require__(4); | ||
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray_); | ||
// EXTERNAL MODULE: external "@toruslabs/tweetnacl-js" | ||
var tweetnacl_js_ = __webpack_require__(14); | ||
var tweetnacl_js_default = /*#__PURE__*/__webpack_require__.n(tweetnacl_js_); | ||
// EXTERNAL MODULE: external "base64url" | ||
var external_base64url_ = __webpack_require__(13); | ||
var external_base64url_ = __webpack_require__(15); | ||
var external_base64url_default = /*#__PURE__*/__webpack_require__.n(external_base64url_); | ||
@@ -442,2 +463,42 @@ | ||
var l = tweetnacl_js_default.a.lowlevel; | ||
function getED25519Key(privateKey) { | ||
var privKey; | ||
if (typeof privateKey === "string") { | ||
privKey = Buffer.from(privateKey, "hex"); | ||
} else { | ||
privKey = privateKey; | ||
} // Implementation copied from tweetnacl | ||
var d = new Uint8Array(64); | ||
var sk = new Uint8Array([].concat(toConsumableArray_default()(new Uint8Array(privKey)), toConsumableArray_default()(new Uint8Array(32)))); | ||
var pk = new Uint8Array(32); | ||
var p = [l.gf(), l.gf(), l.gf(), l.gf()]; | ||
for (var i = 0; i < 32; i += 1) { | ||
d[i] = sk[i]; | ||
} // eslint-disable-next-line no-bitwise | ||
d[0] &= 248; // eslint-disable-next-line no-bitwise | ||
d[31] &= 127; // eslint-disable-next-line no-bitwise | ||
d[31] |= 64; | ||
l.scalarbase(p, d); | ||
l.pack(pk, p); | ||
for (var _i = 0; _i < 32; _i += 1) { | ||
sk[_i + 32] = pk[_i]; | ||
} | ||
return { | ||
sk: Buffer.from(sk), | ||
pk: Buffer.from(pk) | ||
}; | ||
} | ||
var keccak = external_keccak_default.a; | ||
@@ -444,0 +505,0 @@ var base64url = external_base64url_default.a; |
{ | ||
"name": "@toruslabs/openlogin-utils", | ||
"version": "0.3.4", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/torusresearch/OpenLoginSdk#readme", | ||
@@ -24,2 +24,3 @@ "license": "ISC", | ||
"dependencies": { | ||
"@toruslabs/tweetnacl-js": "^1.0.3", | ||
"base64url": "^3.0.1", | ||
@@ -60,3 +61,3 @@ "bn.js": "^5.2.0", | ||
}, | ||
"gitHead": "c1f7022f233c8e146616b80d58891f87df6c9974" | ||
"gitHead": "700a6a1d02582e7c1939b9ea2ec2bd040b34acae" | ||
} |
@@ -0,2 +1,11 @@ | ||
/// <reference types="node" /> | ||
import keccakLib from "keccak"; | ||
export declare type SECP256K1KeyType = "secp256k1"; | ||
export declare type ED25519KeyType = "ed25519"; | ||
export declare type SECP256K1Key = Buffer; | ||
export declare type ED25519Key = Buffer; | ||
export declare function getED25519Key(privateKey: string | Buffer): { | ||
sk: Buffer; | ||
pk: Buffer; | ||
}; | ||
export declare const keccak: typeof keccakLib; | ||
@@ -3,0 +12,0 @@ export declare type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex"; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1881292
12767
7
+ Added@toruslabs/tweetnacl-js@1.0.4(transitive)