@waku/rln 0.1.5-76f86de.0 → 0.1.5-ea6daae.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -5
- package/bundle/_virtual/index2.js +1 -1
- package/bundle/_virtual/utils.js +2 -2
- package/bundle/_virtual/utils2.js +2 -2
- package/bundle/index.js +1 -1
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/checksum.js +3 -3
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/cipher.js +4 -4
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/class.js +7 -7
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/functional.js +7 -7
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/index.js +6 -6
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/kdf.js +5 -5
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/password.js +1 -1
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1 -1
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/schema-validation.js +2 -2
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/lib/types.js +1 -1
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/_assert.js +1 -1
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/_sha2.js +3 -3
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/_u64.js +1 -1
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/cryptoBrowser.js +1 -1
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/hmac.js +3 -3
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/pbkdf2.js +4 -4
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/scrypt.js +5 -5
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/sha256.js +3 -3
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/sha512.js +4 -4
- package/bundle/{packages/rln → node_modules/@chainsafe/bls-keystore}/node_modules/@noble/hashes/utils.js +2 -2
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +3 -3
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +7 -7
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +3 -3
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +3 -3
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +3 -3
- package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +7 -7
- package/bundle/node_modules/@ethersproject/abi/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/address/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/bignumber/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +1 -1
- package/bundle/node_modules/@ethersproject/hash/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +1 -1
- package/bundle/node_modules/@ethersproject/networks/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/networks/lib.esm/index.js +19 -1
- package/bundle/node_modules/@ethersproject/properties/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/providers/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +58 -10
- package/bundle/node_modules/@ethersproject/strings/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/transactions/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/web/lib.esm/_version.js +1 -1
- package/bundle/node_modules/{@ethersproject/keccak256/node_modules/js-sha3 → js-sha3}/src/sha3.js +2 -2
- package/bundle/packages/rln/dist/contract/abi.js +248 -502
- package/bundle/packages/rln/dist/contract/constants.js +4 -4
- package/bundle/packages/rln/dist/contract/rln_contract.js +36 -120
- package/bundle/packages/rln/dist/keystore/cipher.js +3 -3
- package/bundle/packages/rln/dist/keystore/keystore.js +2 -3
- package/bundle/packages/rln/dist/rln.js +4 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/contract/abi.d.ts +17 -21
- package/dist/contract/abi.js +248 -502
- package/dist/contract/abi.js.map +1 -1
- package/dist/contract/constants.d.ts +18 -22
- package/dist/contract/constants.js +3 -3
- package/dist/contract/constants.js.map +1 -1
- package/dist/contract/rln_contract.d.ts +3 -10
- package/dist/contract/rln_contract.js +36 -120
- package/dist/contract/rln_contract.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/keystore/keystore.js +1 -2
- package/dist/keystore/keystore.js.map +1 -1
- package/dist/keystore/types.d.ts +0 -1
- package/dist/rln.d.ts +1 -1
- package/dist/rln.js +4 -4
- package/dist/rln.js.map +1 -1
- package/package.json +1 -1
- package/src/contract/abi.ts +248 -502
- package/src/contract/constants.ts +3 -3
- package/src/contract/rln_contract.ts +46 -158
- package/src/index.ts +2 -13
- package/src/keystore/keystore.ts +1 -2
- package/src/keystore/types.ts +0 -1
- package/src/rln.ts +5 -5
- package/dist/codec.test-utils.d.ts +0 -36
- package/dist/codec.test-utils.js +0 -56
- package/dist/codec.test-utils.js.map +0 -1
- package/dist/contract/test-setup.d.ts +0 -26
- package/dist/contract/test-setup.js +0 -56
- package/dist/contract/test-setup.js.map +0 -1
- package/dist/contract/test-utils.d.ts +0 -39
- package/dist/contract/test-utils.js +0 -118
- package/dist/contract/test-utils.js.map +0 -1
- package/src/codec.test-utils.ts +0 -80
- package/src/contract/test-setup.ts +0 -86
- package/src/contract/test-utils.ts +0 -179
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/md5.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/nil.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/parse.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/regex.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/rng.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/sha1.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/stringify.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v1.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v3.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v35.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v4.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v5.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/validate.js +0 -0
- /package/bundle/{packages/rln/node_modules → node_modules}/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/version.js +0 -0
@@ -103,12 +103,15 @@ utils.encode = utils_1.encode;
|
|
103
103
|
// Represent num in a w-NAF form
|
104
104
|
function getNAF(num, w, bits) {
|
105
105
|
var naf = new Array(Math.max(num.bitLength(), bits) + 1);
|
106
|
-
|
106
|
+
var i;
|
107
|
+
for (i = 0; i < naf.length; i += 1) {
|
108
|
+
naf[i] = 0;
|
109
|
+
}
|
107
110
|
|
108
111
|
var ws = 1 << (w + 1);
|
109
112
|
var k = num.clone();
|
110
113
|
|
111
|
-
for (
|
114
|
+
for (i = 0; i < naf.length; i++) {
|
112
115
|
var z;
|
113
116
|
var mod = k.andln(ws - 1);
|
114
117
|
if (k.isOdd()) {
|
@@ -1994,8 +1997,8 @@ KeyPair.prototype.sign = function sign(msg, enc, options) {
|
|
1994
1997
|
return this.ec.sign(msg, this, enc, options);
|
1995
1998
|
};
|
1996
1999
|
|
1997
|
-
KeyPair.prototype.verify = function verify(msg, signature) {
|
1998
|
-
return this.ec.verify(msg, signature, this);
|
2000
|
+
KeyPair.prototype.verify = function verify(msg, signature, options) {
|
2001
|
+
return this.ec.verify(msg, signature, this, undefined, options);
|
1999
2002
|
};
|
2000
2003
|
|
2001
2004
|
KeyPair.prototype.inspect = function inspect() {
|
@@ -2041,6 +2044,10 @@ function getLength(buf, p) {
|
|
2041
2044
|
return false;
|
2042
2045
|
}
|
2043
2046
|
|
2047
|
+
if(buf[p.place] === 0x00) {
|
2048
|
+
return false;
|
2049
|
+
}
|
2050
|
+
|
2044
2051
|
var val = 0;
|
2045
2052
|
for (var i = 0, off = p.place; i < octetLen; i++, off++) {
|
2046
2053
|
val <<= 8;
|
@@ -2089,6 +2096,9 @@ Signature.prototype._importDER = function _importDER(data, enc) {
|
|
2089
2096
|
if (rlen === false) {
|
2090
2097
|
return false;
|
2091
2098
|
}
|
2099
|
+
if ((data[p.place] & 128) !== 0) {
|
2100
|
+
return false;
|
2101
|
+
}
|
2092
2102
|
var r = data.slice(p.place, rlen + p.place);
|
2093
2103
|
p.place += rlen;
|
2094
2104
|
if (data[p.place++] !== 0x02) {
|
@@ -2101,6 +2111,9 @@ Signature.prototype._importDER = function _importDER(data, enc) {
|
|
2101
2111
|
if (data.length !== slen + p.place) {
|
2102
2112
|
return false;
|
2103
2113
|
}
|
2114
|
+
if ((data[p.place] & 128) !== 0) {
|
2115
|
+
return false;
|
2116
|
+
}
|
2104
2117
|
var s = data.slice(p.place, slen + p.place);
|
2105
2118
|
if (r[0] === 0) {
|
2106
2119
|
if (r[1] & 0x80) {
|
@@ -2246,8 +2259,27 @@ EC.prototype.genKeyPair = function genKeyPair(options) {
|
|
2246
2259
|
}
|
2247
2260
|
};
|
2248
2261
|
|
2249
|
-
EC.prototype._truncateToN = function _truncateToN(msg, truncOnly) {
|
2250
|
-
var
|
2262
|
+
EC.prototype._truncateToN = function _truncateToN(msg, truncOnly, bitLength) {
|
2263
|
+
var byteLength;
|
2264
|
+
if (BN.isBN(msg) || typeof msg === 'number') {
|
2265
|
+
msg = new BN(msg, 16);
|
2266
|
+
byteLength = msg.byteLength();
|
2267
|
+
} else if (typeof msg === 'object') {
|
2268
|
+
// BN assumes an array-like input and asserts length
|
2269
|
+
byteLength = msg.length;
|
2270
|
+
msg = new BN(msg, 16);
|
2271
|
+
} else {
|
2272
|
+
// BN converts the value to string
|
2273
|
+
var str = msg.toString();
|
2274
|
+
// HEX encoding
|
2275
|
+
byteLength = (str.length + 1) >>> 1;
|
2276
|
+
msg = new BN(str, 16);
|
2277
|
+
}
|
2278
|
+
// Allow overriding
|
2279
|
+
if (typeof bitLength !== 'number') {
|
2280
|
+
bitLength = byteLength * 8;
|
2281
|
+
}
|
2282
|
+
var delta = bitLength - this.n.bitLength();
|
2251
2283
|
if (delta > 0)
|
2252
2284
|
msg = msg.ushrn(delta);
|
2253
2285
|
if (!truncOnly && msg.cmp(this.n) >= 0)
|
@@ -2264,8 +2296,18 @@ EC.prototype.sign = function sign(msg, key, enc, options) {
|
|
2264
2296
|
if (!options)
|
2265
2297
|
options = {};
|
2266
2298
|
|
2299
|
+
if (typeof msg !== 'string' && typeof msg !== 'number' && !BN.isBN(msg)) {
|
2300
|
+
assert$5(typeof msg === 'object' && msg && typeof msg.length === 'number',
|
2301
|
+
'Expected message to be an array-like, a hex string, or a BN instance');
|
2302
|
+
assert$5((msg.length >>> 0) === msg.length); // non-negative 32-bit integer
|
2303
|
+
for (var i = 0; i < msg.length; i++) assert$5((msg[i] & 255) === msg[i]);
|
2304
|
+
}
|
2305
|
+
|
2267
2306
|
key = this.keyFromPrivate(key, enc);
|
2268
|
-
msg = this._truncateToN(
|
2307
|
+
msg = this._truncateToN(msg, false, options.msgBitLength);
|
2308
|
+
|
2309
|
+
// Would fail further checks, but let's make the error message clear
|
2310
|
+
assert$5(!msg.isNeg(), 'Can not sign a negative message');
|
2269
2311
|
|
2270
2312
|
// Zero-extend key to provide enough entropy
|
2271
2313
|
var bytes = this.n.byteLength();
|
@@ -2274,6 +2316,9 @@ EC.prototype.sign = function sign(msg, key, enc, options) {
|
|
2274
2316
|
// Zero-extend nonce to have the same byte size as N
|
2275
2317
|
var nonce = msg.toArray('be', bytes);
|
2276
2318
|
|
2319
|
+
// Recheck nonce to be bijective to msg
|
2320
|
+
assert$5((new BN(nonce)).eq(msg), 'Can not sign message');
|
2321
|
+
|
2277
2322
|
// Instantiate Hmac_DRBG
|
2278
2323
|
var drbg = new hmacDrbg({
|
2279
2324
|
hash: this.hash,
|
@@ -2321,8 +2366,11 @@ EC.prototype.sign = function sign(msg, key, enc, options) {
|
|
2321
2366
|
}
|
2322
2367
|
};
|
2323
2368
|
|
2324
|
-
EC.prototype.verify = function verify(msg, signature$1, key, enc) {
|
2325
|
-
|
2369
|
+
EC.prototype.verify = function verify(msg, signature$1, key, enc, options) {
|
2370
|
+
if (!options)
|
2371
|
+
options = {};
|
2372
|
+
|
2373
|
+
msg = this._truncateToN(msg, false, options.msgBitLength);
|
2326
2374
|
key = this.keyFromPublic(key, enc);
|
2327
2375
|
signature$1 = new signature(signature$1, 'hex');
|
2328
2376
|
|
@@ -2414,7 +2462,7 @@ var elliptic_1 = createCommonjsModule(function (module, exports) {
|
|
2414
2462
|
|
2415
2463
|
var elliptic = exports;
|
2416
2464
|
|
2417
|
-
elliptic.version = /*RicMoo:ethers*/{ version: "6.
|
2465
|
+
elliptic.version = /*RicMoo:ethers*/{ version: "6.6.1" }.version;
|
2418
2466
|
elliptic.utils = utils_1$1;
|
2419
2467
|
elliptic.rand = /*RicMoo:ethers:require(brorand)*/(function() { throw new Error('unsupported'); });
|
2420
2468
|
elliptic.curve = curve_1;
|
package/bundle/node_modules/{@ethersproject/keccak256/node_modules/js-sha3 → js-sha3}/src/sha3.js
RENAMED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { getDefaultExportFromCjs, commonjsGlobal } from '
|
2
|
-
import { __module as sha3$1 } from '
|
1
|
+
import { getDefaultExportFromCjs, commonjsGlobal } from '../../../_virtual/_commonjsHelpers.js';
|
2
|
+
import { __module as sha3$1 } from '../../../_virtual/sha3.js';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|