@waku/rln 0.1.5-cad3e7a.0 → 0.1.5-d0da8f8.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/bundle/_virtual/utils.js +2 -2
- package/bundle/_virtual/utils2.js +2 -2
- package/bundle/index.js +4 -3
- package/bundle/packages/rln/dist/contract/constants.js +2 -1
- package/bundle/packages/rln/dist/contract/{rln_light_contract.js → rln_base_contract.js} +189 -186
- package/bundle/packages/rln/dist/contract/rln_contract.js +10 -420
- package/bundle/packages/rln/dist/contract/types.js +9 -0
- package/bundle/packages/rln/dist/create.js +1 -1
- package/bundle/packages/rln/dist/{rln_light.js → credentials_manager.js} +114 -48
- package/bundle/packages/rln/dist/identity.js +0 -9
- package/bundle/packages/rln/dist/keystore/keystore.js +31 -17
- package/bundle/packages/rln/dist/rln.js +57 -167
- package/bundle/packages/rln/dist/utils/bytes.js +8 -2
- package/bundle/packages/rln/dist/utils/metamask.js +2 -2
- package/bundle/packages/rln/dist/zerokit.js +5 -5
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +2 -2
- package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/contract/constants.d.ts +1 -1
- package/dist/contract/constants.js +1 -1
- package/dist/contract/constants.js.map +1 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +1 -0
- package/dist/contract/index.js.map +1 -1
- package/dist/contract/{rln_light_contract.d.ts → rln_base_contract.d.ts} +24 -58
- package/dist/contract/{rln_light_contract.js → rln_base_contract.js} +187 -184
- package/dist/contract/rln_base_contract.js.map +1 -0
- package/dist/contract/rln_contract.d.ts +5 -122
- package/dist/contract/rln_contract.js +8 -417
- package/dist/contract/rln_contract.js.map +1 -1
- package/dist/contract/types.d.ts +45 -0
- package/dist/contract/types.js +8 -0
- package/dist/contract/types.js.map +1 -0
- package/dist/create.js +1 -1
- package/dist/create.js.map +1 -1
- package/dist/credentials_manager.d.ts +44 -0
- package/dist/credentials_manager.js +197 -0
- package/dist/credentials_manager.js.map +1 -0
- package/dist/identity.d.ts +0 -1
- package/dist/identity.js +0 -9
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/keystore/keystore.d.ts +1 -0
- package/dist/keystore/keystore.js +31 -17
- package/dist/keystore/keystore.js.map +1 -1
- package/dist/keystore/types.d.ts +3 -3
- package/dist/rln.d.ts +9 -52
- package/dist/rln.js +55 -164
- package/dist/rln.js.map +1 -1
- package/dist/types.d.ts +27 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/bytes.js +8 -2
- package/dist/utils/bytes.js.map +1 -1
- package/dist/zerokit.d.ts +3 -3
- package/dist/zerokit.js +5 -5
- package/dist/zerokit.js.map +1 -1
- package/package.json +1 -1
- package/src/contract/constants.ts +1 -1
- package/src/contract/index.ts +1 -0
- package/src/contract/{rln_light_contract.ts → rln_base_contract.ts} +306 -323
- package/src/contract/rln_contract.ts +9 -663
- package/src/contract/types.ts +53 -0
- package/src/create.ts +1 -1
- package/src/credentials_manager.ts +282 -0
- package/src/identity.ts +0 -10
- package/src/index.ts +7 -5
- package/src/keystore/keystore.ts +57 -31
- package/src/keystore/types.ts +3 -3
- package/src/rln.ts +68 -259
- package/src/types.ts +31 -0
- package/src/utils/bytes.ts +10 -2
- package/src/zerokit.ts +3 -3
- package/bundle/_virtual/__node-resolve_empty.js +0 -6
- package/bundle/_virtual/_node-resolve_empty.js +0 -3
- package/bundle/_virtual/bn.js +0 -3
- package/bundle/_virtual/common.js +0 -3
- package/bundle/_virtual/common2.js +0 -3
- package/bundle/_virtual/hash.js +0 -3
- package/bundle/_virtual/inherits_browser.js +0 -3
- package/bundle/_virtual/ripemd.js +0 -3
- package/bundle/_virtual/sha.js +0 -3
- package/bundle/_virtual/sha3.js +0 -3
- package/bundle/_virtual/utils3.js +0 -3
- package/bundle/node_modules/@ethersproject/abi/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/abi/lib.esm/abi-coder.js +0 -96
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +0 -148
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/address.js +0 -26
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js +0 -20
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/array.js +0 -210
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/boolean.js +0 -18
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/bytes.js +0 -30
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js +0 -26
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/null.js +0 -22
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/number.js +0 -43
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/string.js +0 -19
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/tuple.js +0 -58
- package/bundle/node_modules/@ethersproject/abi/lib.esm/fragments.js +0 -854
- package/bundle/node_modules/@ethersproject/abi/lib.esm/interface.js +0 -609
- package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/index.js +0 -66
- package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/index.js +0 -302
- package/bundle/node_modules/@ethersproject/address/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/address/lib.esm/index.js +0 -110
- package/bundle/node_modules/@ethersproject/base64/lib.esm/base64.js +0 -20
- package/bundle/node_modules/@ethersproject/basex/lib.esm/index.js +0 -120
- package/bundle/node_modules/@ethersproject/bignumber/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js +0 -287
- package/bundle/node_modules/@ethersproject/bytes/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/bytes/lib.esm/index.js +0 -402
- package/bundle/node_modules/@ethersproject/constants/lib.esm/addresses.js +0 -3
- package/bundle/node_modules/@ethersproject/constants/lib.esm/bignumbers.js +0 -8
- package/bundle/node_modules/@ethersproject/constants/lib.esm/hashes.js +0 -3
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +0 -893
- package/bundle/node_modules/@ethersproject/hash/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/decoder.js +0 -256
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/include.js +0 -36
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +0 -135
- package/bundle/node_modules/@ethersproject/hash/lib.esm/id.js +0 -8
- package/bundle/node_modules/@ethersproject/hash/lib.esm/namehash.js +0 -64
- package/bundle/node_modules/@ethersproject/hash/lib.esm/typed-data.js +0 -443
- package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +0 -8
- package/bundle/node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +0 -660
- package/bundle/node_modules/@ethersproject/logger/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/logger/lib.esm/index.js +0 -352
- package/bundle/node_modules/@ethersproject/networks/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/networks/lib.esm/index.js +0 -248
- package/bundle/node_modules/@ethersproject/properties/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/properties/lib.esm/index.js +0 -127
- package/bundle/node_modules/@ethersproject/providers/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/providers/lib.esm/base-provider.js +0 -2007
- package/bundle/node_modules/@ethersproject/providers/lib.esm/formatter.js +0 -422
- package/bundle/node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +0 -674
- package/bundle/node_modules/@ethersproject/providers/lib.esm/web3-provider.js +0 -132
- package/bundle/node_modules/@ethersproject/rlp/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/rlp/lib.esm/index.js +0 -120
- package/bundle/node_modules/@ethersproject/sha2/lib.esm/sha2.js +0 -8
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +0 -2430
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/index.js +0 -76
- package/bundle/node_modules/@ethersproject/strings/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/strings/lib.esm/utf8.js +0 -219
- package/bundle/node_modules/@ethersproject/transactions/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/transactions/lib.esm/index.js +0 -279
- package/bundle/node_modules/@ethersproject/web/lib.esm/_version.js +0 -3
- package/bundle/node_modules/@ethersproject/web/lib.esm/geturl.js +0 -69
- package/bundle/node_modules/@ethersproject/web/lib.esm/index.js +0 -404
- package/bundle/node_modules/bech32/index.js +0 -187
- package/bundle/node_modules/bn.js/lib/bn.js +0 -3361
- package/bundle/node_modules/hash.js/lib/hash/common.js +0 -97
- package/bundle/node_modules/hash.js/lib/hash/hmac.js +0 -51
- package/bundle/node_modules/hash.js/lib/hash/ripemd.js +0 -152
- package/bundle/node_modules/hash.js/lib/hash/sha/1.js +0 -81
- package/bundle/node_modules/hash.js/lib/hash/sha/224.js +0 -33
- package/bundle/node_modules/hash.js/lib/hash/sha/256.js +0 -113
- package/bundle/node_modules/hash.js/lib/hash/sha/384.js +0 -39
- package/bundle/node_modules/hash.js/lib/hash/sha/512.js +0 -336
- package/bundle/node_modules/hash.js/lib/hash/sha/common.js +0 -53
- package/bundle/node_modules/hash.js/lib/hash/sha.js +0 -14
- package/bundle/node_modules/hash.js/lib/hash/utils.js +0 -282
- package/bundle/node_modules/hash.js/lib/hash.js +0 -33
- package/bundle/node_modules/inherits/inherits_browser.js +0 -33
- package/bundle/node_modules/minimalistic-assert/index.js +0 -13
- package/dist/contract/rln_light_contract.js.map +0 -1
- package/dist/rln_light.d.ts +0 -64
- package/dist/rln_light.js +0 -144
- package/dist/rln_light.js.map +0 -1
- package/src/rln_light.ts +0 -235
@@ -1,127 +0,0 @@
|
|
1
|
-
import { Logger } from '../../logger/lib.esm/index.js';
|
2
|
-
import { version } from './_version.js';
|
3
|
-
|
4
|
-
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
11
|
-
});
|
12
|
-
};
|
13
|
-
const logger = new Logger(version);
|
14
|
-
function defineReadOnly(object, name, value) {
|
15
|
-
Object.defineProperty(object, name, {
|
16
|
-
enumerable: true,
|
17
|
-
value: value,
|
18
|
-
writable: false,
|
19
|
-
});
|
20
|
-
}
|
21
|
-
// Crawl up the constructor chain to find a static method
|
22
|
-
function getStatic(ctor, key) {
|
23
|
-
for (let i = 0; i < 32; i++) {
|
24
|
-
if (ctor[key]) {
|
25
|
-
return ctor[key];
|
26
|
-
}
|
27
|
-
if (!ctor.prototype || typeof (ctor.prototype) !== "object") {
|
28
|
-
break;
|
29
|
-
}
|
30
|
-
ctor = Object.getPrototypeOf(ctor.prototype).constructor;
|
31
|
-
}
|
32
|
-
return null;
|
33
|
-
}
|
34
|
-
function resolveProperties(object) {
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
36
|
-
const promises = Object.keys(object).map((key) => {
|
37
|
-
const value = object[key];
|
38
|
-
return Promise.resolve(value).then((v) => ({ key: key, value: v }));
|
39
|
-
});
|
40
|
-
const results = yield Promise.all(promises);
|
41
|
-
return results.reduce((accum, result) => {
|
42
|
-
accum[(result.key)] = result.value;
|
43
|
-
return accum;
|
44
|
-
}, {});
|
45
|
-
});
|
46
|
-
}
|
47
|
-
function checkProperties(object, properties) {
|
48
|
-
if (!object || typeof (object) !== "object") {
|
49
|
-
logger.throwArgumentError("invalid object", "object", object);
|
50
|
-
}
|
51
|
-
Object.keys(object).forEach((key) => {
|
52
|
-
if (!properties[key]) {
|
53
|
-
logger.throwArgumentError("invalid object key - " + key, "transaction:" + key, object);
|
54
|
-
}
|
55
|
-
});
|
56
|
-
}
|
57
|
-
function shallowCopy(object) {
|
58
|
-
const result = {};
|
59
|
-
for (const key in object) {
|
60
|
-
result[key] = object[key];
|
61
|
-
}
|
62
|
-
return result;
|
63
|
-
}
|
64
|
-
const opaque = { bigint: true, boolean: true, "function": true, number: true, string: true };
|
65
|
-
function _isFrozen(object) {
|
66
|
-
// Opaque objects are not mutable, so safe to copy by assignment
|
67
|
-
if (object === undefined || object === null || opaque[typeof (object)]) {
|
68
|
-
return true;
|
69
|
-
}
|
70
|
-
if (Array.isArray(object) || typeof (object) === "object") {
|
71
|
-
if (!Object.isFrozen(object)) {
|
72
|
-
return false;
|
73
|
-
}
|
74
|
-
const keys = Object.keys(object);
|
75
|
-
for (let i = 0; i < keys.length; i++) {
|
76
|
-
let value = null;
|
77
|
-
try {
|
78
|
-
value = object[keys[i]];
|
79
|
-
}
|
80
|
-
catch (error) {
|
81
|
-
// If accessing a value triggers an error, it is a getter
|
82
|
-
// designed to do so (e.g. Result) and is therefore "frozen"
|
83
|
-
continue;
|
84
|
-
}
|
85
|
-
if (!_isFrozen(value)) {
|
86
|
-
return false;
|
87
|
-
}
|
88
|
-
}
|
89
|
-
return true;
|
90
|
-
}
|
91
|
-
return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object);
|
92
|
-
}
|
93
|
-
// Returns a new copy of object, such that no properties may be replaced.
|
94
|
-
// New properties may be added only to objects.
|
95
|
-
function _deepCopy(object) {
|
96
|
-
if (_isFrozen(object)) {
|
97
|
-
return object;
|
98
|
-
}
|
99
|
-
// Arrays are mutable, so we need to create a copy
|
100
|
-
if (Array.isArray(object)) {
|
101
|
-
return Object.freeze(object.map((item) => deepCopy(item)));
|
102
|
-
}
|
103
|
-
if (typeof (object) === "object") {
|
104
|
-
const result = {};
|
105
|
-
for (const key in object) {
|
106
|
-
const value = object[key];
|
107
|
-
if (value === undefined) {
|
108
|
-
continue;
|
109
|
-
}
|
110
|
-
defineReadOnly(result, key, deepCopy(value));
|
111
|
-
}
|
112
|
-
return result;
|
113
|
-
}
|
114
|
-
return logger.throwArgumentError(`Cannot deepCopy ${typeof (object)}`, "object", object);
|
115
|
-
}
|
116
|
-
function deepCopy(object) {
|
117
|
-
return _deepCopy(object);
|
118
|
-
}
|
119
|
-
class Description {
|
120
|
-
constructor(info) {
|
121
|
-
for (const key in info) {
|
122
|
-
this[key] = deepCopy(info[key]);
|
123
|
-
}
|
124
|
-
}
|
125
|
-
}
|
126
|
-
|
127
|
-
export { Description, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy };
|