migrating cjs -> esm
This commit is contained in:
8 files changed
+27
-18
No files matched your search
@@ -0,0 +1 @@
|
||||
dist/
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
(()=>{var e={724:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var f;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{f="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(654).Buffer}catch(e){}function d(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(e,t,n){var r=d(e,n);return n-1>=t&&(r|=d(e,n-1)<<4),r}function o(e,t,n,r){for(var i=0,a=Math.min(e.length,n),f=t;f<a;f++){var d=e.charCodeAt(f)-48;i*=r,i+=d>=49?d-49+10:d>=17?d-17+10:d}return i}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},a.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,f,d=0;if("be"===n)for(i=e.length-1,a=0;i>=0;i-=3)f=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=f<<d&67108863,this.words[a+1]=f>>>26-d&67108863,(d+=24)>=26&&(d-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)f=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=f<<d&67108863,this.words[a+1]=f>>>26-d&67108863,(d+=24)>=26&&(d-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,a=0,f=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<a,this.words[f]|=67108863&i,a>=18?(a-=18,f+=1,this.words[f]|=i>>>26):a+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<a,this.words[f]|=67108863&i,a>=18?(a-=18,f+=1,this.words[f]|=i>>>26):a+=8;this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,f=a%r,d=Math.min(a,a-f)+n,s=0,c=n;c<d;c+=r)s=o(e,c,c+r,t),this.imuln(i),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s);if(0!==f){var h=1;for(s=o(e,c,e.length,t),c=0;c<f;c++)h*=t;this.imuln(h),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s)}this.strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],u=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function b(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],a=0|t.words[0],f=i*a,d=67108863&f,s=f/67108864|0;n.words[0]=d;for(var o=1;o<r;o++){for(var c=s>>>26,h=67108863&s,u=Math.min(o,t.length-1),b=Math.max(0,o-e.length+1);b<=u;b++){var l=o-b|0;c+=(f=(i=0|e.woLine truncated
|
||||
(()=>{var e={724:function(e,t,n){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function a(e,t,n){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var f;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{f="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(654).Buffer}catch(e){}function d(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(e,t,n){var r=d(e,n);return n-1>=t&&(r|=d(e,n-1)<<4),r}function o(e,t,n,r){for(var i=0,a=Math.min(e.length,n),f=t;f<a;f++){var d=e.charCodeAt(f)-48;i*=r,i+=d>=49?d-49+10:d>=17?d-17+10:d}return i}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},a.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},a.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,f,d=0;if("be"===n)for(i=e.length-1,a=0;i>=0;i-=3)f=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=f<<d&67108863,this.words[a+1]=f>>>26-d&67108863,(d+=24)>=26&&(d-=26,a++);else if("le"===n)for(i=0,a=0;i<e.length;i+=3)f=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=f<<d&67108863,this.words[a+1]=f>>>26-d&67108863,(d+=24)>=26&&(d-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,a=0,f=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<a,this.words[f]|=67108863&i,a>=18?(a-=18,f+=1,this.words[f]|=i>>>26):a+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<a,this.words[f]|=67108863&i,a>=18?(a-=18,f+=1,this.words[f]|=i>>>26):a+=8;this.strip()},a.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,f=a%r,d=Math.min(a,a-f)+n,s=0,c=n;c<d;c+=r)s=o(e,c,c+r,t),this.imuln(i),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s);if(0!==f){var h=1;for(s=o(e,c,e.length,t),c=0;c<f;c++)h*=t;this.imuln(h),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s)}this.strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],u=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function b(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],a=0|t.words[0],f=i*a,d=67108863&f,s=f/67108864|0;n.words[0]=d;for(var o=1;o<r;o++){for(var c=s>>>26,h=67108863&s,u=Math.min(o,t.length-1),b=Math.max(0,o-e.length+1);b<=u;b++){var l=o-b|0;c+=(f=(i=0|e.woLine truncated
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>ZKL Key Derivation Service Demo</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script src="bundle.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { generateKeypair } from "./key-derivation.js";
|
||||
import { generateKeypair } from "../key-derivation.js";
|
||||
|
||||
(async () => {
|
||||
console.log("start");
|
||||
@@ -1,9 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>ZKL Key Derivation Service Demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="dist/bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+1
-1
@@ -4,7 +4,7 @@ import {
|
||||
} from "@scure/bip39";
|
||||
import { wordlist } from "@scure/bip39/wordlists/english";
|
||||
import elliptic from "elliptic";
|
||||
import { Key } from "./key";
|
||||
import { Key } from "./key.js";
|
||||
|
||||
const MNEMONIC_STRENGTH = 192;
|
||||
//const CURVE = "curve25519"
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"name": "@zklx/kds",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "zk-Lokomotive key derivation service",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
|
||||
+9
-5
@@ -1,9 +1,13 @@
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const TerserPlugin = require("terser-webpack-plugin");
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import webpack from "webpack";
|
||||
import TerserPlugin from "terser-webpack-plugin";
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
export default {
|
||||
entry: "./dist/index.js",
|
||||
output: {
|
||||
filename: "bundle.js",
|
||||
path: path.resolve(__dirname, "dist")
|
||||
|
||||
Reference in new issue
Block a user