@pezkuwi/keyring 14.0.6 → 14.0.10
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/build/LICENSE +201 -0
- package/build/README.md +17 -0
- package/{bundle-pezkuwi-keyring.js → build/bundle-pezkuwi-keyring.js} +1 -1
- package/build/bundle.js +7 -0
- package/build/cjs/bundle.d.ts +7 -0
- package/build/cjs/bundle.js +19 -0
- package/build/cjs/defaults.js +5 -0
- package/build/cjs/index.js +7 -0
- package/build/cjs/keyring.js +261 -0
- package/build/cjs/packageInfo.js +4 -0
- package/build/cjs/pair/decode.js +45 -0
- package/build/cjs/pair/defaults.js +15 -0
- package/build/cjs/pair/encode.js +22 -0
- package/build/cjs/pair/index.js +183 -0
- package/build/cjs/pair/nobody.js +43 -0
- package/build/cjs/pair/toJson.js +11 -0
- package/build/cjs/pair/types.js +2 -0
- package/build/cjs/pairs.js +28 -0
- package/build/cjs/testing.js +126 -0
- package/build/cjs/testingPairs.js +16 -0
- package/build/cjs/types.js +2 -0
- package/build/defaults.d.ts +2 -0
- package/build/defaults.js +2 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +4 -0
- package/build/keyring.d.ts +145 -0
- package/build/keyring.js +257 -0
- package/build/package.json +294 -0
- package/build/packageDetect.d.ts +1 -0
- package/build/packageDetect.js +5 -0
- package/build/packageInfo.d.ts +6 -0
- package/build/packageInfo.js +1 -0
- package/build/pair/decode.d.ts +12 -0
- package/build/pair/decode.js +42 -0
- package/build/pair/defaults.d.ts +12 -0
- package/build/pair/defaults.js +12 -0
- package/build/pair/encode.d.ts +5 -0
- package/build/pair/encode.js +19 -0
- package/build/pair/index.d.ts +40 -0
- package/build/pair/index.js +180 -0
- package/build/pair/nobody.d.ts +2 -0
- package/build/pair/nobody.js +40 -0
- package/build/pair/toJson.d.ts +8 -0
- package/build/pair/toJson.js +8 -0
- package/build/pair/types.d.ts +5 -0
- package/build/pair/types.js +1 -0
- package/build/pairs.d.ts +8 -0
- package/build/pairs.js +24 -0
- package/build/testing.d.ts +20 -0
- package/build/testing.js +122 -0
- package/build/testingPairs.d.ts +25 -0
- package/build/testingPairs.js +13 -0
- package/build/types.d.ts +111 -0
- package/build/types.js +1 -0
- package/build-deno/README.md +17 -0
- package/build-deno/bundle.ts +10 -0
- package/build-deno/defaults.ts +4 -0
- package/build-deno/index.ts +8 -0
- package/build-deno/keyring.ts +305 -0
- package/build-deno/mod.ts +2 -0
- package/build-deno/packageDetect.ts +9 -0
- package/build-deno/packageInfo.ts +3 -0
- package/build-deno/pair/decode.ts +54 -0
- package/build-deno/pair/defaults.ts +18 -0
- package/build-deno/pair/encode.ts +28 -0
- package/build-deno/pair/index.ts +218 -0
- package/build-deno/pair/nobody.ts +58 -0
- package/build-deno/pair/toJson.ts +18 -0
- package/build-deno/pair/types.ts +6 -0
- package/build-deno/pairs.ts +39 -0
- package/build-deno/testing.ts +150 -0
- package/build-deno/testingPairs.ts +54 -0
- package/build-deno/types.ts +129 -0
- package/build-tsc-cjs/packageDetect.js +7 -0
- package/{cjs → build-tsc-cjs}/packageInfo.js +1 -1
- package/{packageInfo.js → build-tsc-esm/packageInfo.js} +1 -1
- package/package.json +9 -271
- package/src/bundle.ts +16 -0
- package/src/defaults.ts +8 -0
- package/src/index.spec.ts +609 -0
- package/src/index.ts +10 -0
- package/src/keyring.ts +307 -0
- package/src/mod.ts +4 -0
- package/src/packageDetect.ts +13 -0
- package/src/packageInfo.ts +6 -0
- package/src/pair/decode.spec.ts +26 -0
- package/src/pair/decode.ts +56 -0
- package/src/pair/defaults.ts +20 -0
- package/src/pair/encode.spec.ts +28 -0
- package/src/pair/encode.ts +30 -0
- package/src/pair/index.spec.ts +189 -0
- package/src/pair/index.ts +220 -0
- package/src/pair/nobody.ts +62 -0
- package/src/pair/toJson.spec.ts +42 -0
- package/src/pair/toJson.ts +20 -0
- package/src/pair/types.ts +8 -0
- package/src/pair/vrf.spec.ts +47 -0
- package/src/pairs.ts +41 -0
- package/src/suri.spec.ts +109 -0
- package/src/testing.ts +156 -0
- package/src/testingPairs.spec.ts +79 -0
- package/src/testingPairs.ts +56 -0
- package/src/types.ts +131 -0
- package/tsconfig.build.json +16 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.spec.json +18 -0
- package/tsconfig.spec.tsbuildinfo +1 -0
- /package/{cjs → build}/bundle.d.ts +0 -0
- /package/{defaults.d.ts → build/cjs/defaults.d.ts} +0 -0
- /package/{index.d.ts → build/cjs/index.d.ts} +0 -0
- /package/{keyring.d.ts → build/cjs/keyring.d.ts} +0 -0
- /package/{cjs → build/cjs}/package.json +0 -0
- /package/{packageDetect.d.ts → build/cjs/packageDetect.d.ts} +0 -0
- /package/{cjs → build/cjs}/packageDetect.js +0 -0
- /package/{packageInfo.d.ts → build/cjs/packageInfo.d.ts} +0 -0
- /package/{pair → build/cjs/pair}/decode.d.ts +0 -0
- /package/{pair → build/cjs/pair}/defaults.d.ts +0 -0
- /package/{pair → build/cjs/pair}/encode.d.ts +0 -0
- /package/{pair → build/cjs/pair}/index.d.ts +0 -0
- /package/{pair → build/cjs/pair}/nobody.d.ts +0 -0
- /package/{pair → build/cjs/pair}/toJson.d.ts +0 -0
- /package/{pair → build/cjs/pair}/types.d.ts +0 -0
- /package/{pairs.d.ts → build/cjs/pairs.d.ts} +0 -0
- /package/{testing.d.ts → build/cjs/testing.d.ts} +0 -0
- /package/{testingPairs.d.ts → build/cjs/testingPairs.d.ts} +0 -0
- /package/{types.d.ts → build/cjs/types.d.ts} +0 -0
- /package/{bundle.d.ts → build-tsc/bundle.d.ts} +0 -0
- /package/{cjs → build-tsc}/defaults.d.ts +0 -0
- /package/{cjs → build-tsc}/index.d.ts +0 -0
- /package/{cjs → build-tsc}/keyring.d.ts +0 -0
- /package/{cjs → build-tsc}/packageDetect.d.ts +0 -0
- /package/{cjs → build-tsc}/packageInfo.d.ts +0 -0
- /package/{cjs → build-tsc}/pair/decode.d.ts +0 -0
- /package/{cjs → build-tsc}/pair/defaults.d.ts +0 -0
- /package/{cjs → build-tsc}/pair/encode.d.ts +0 -0
- /package/{cjs → build-tsc}/pair/index.d.ts +0 -0
- /package/{cjs → build-tsc}/pair/nobody.d.ts +0 -0
- /package/{cjs → build-tsc}/pair/toJson.d.ts +0 -0
- /package/{cjs → build-tsc}/pair/types.d.ts +0 -0
- /package/{cjs → build-tsc}/pairs.d.ts +0 -0
- /package/{cjs → build-tsc}/testing.d.ts +0 -0
- /package/{cjs → build-tsc}/testingPairs.d.ts +0 -0
- /package/{cjs → build-tsc}/types.d.ts +0 -0
- /package/{cjs → build-tsc-cjs}/bundle.js +0 -0
- /package/{cjs → build-tsc-cjs}/defaults.js +0 -0
- /package/{cjs → build-tsc-cjs}/index.js +0 -0
- /package/{cjs → build-tsc-cjs}/keyring.js +0 -0
- /package/{cjs → build-tsc-cjs}/pair/decode.js +0 -0
- /package/{cjs → build-tsc-cjs}/pair/defaults.js +0 -0
- /package/{cjs → build-tsc-cjs}/pair/encode.js +0 -0
- /package/{cjs → build-tsc-cjs}/pair/index.js +0 -0
- /package/{cjs → build-tsc-cjs}/pair/nobody.js +0 -0
- /package/{cjs → build-tsc-cjs}/pair/toJson.js +0 -0
- /package/{cjs → build-tsc-cjs}/pair/types.js +0 -0
- /package/{cjs → build-tsc-cjs}/pairs.js +0 -0
- /package/{cjs → build-tsc-cjs}/testing.js +0 -0
- /package/{cjs → build-tsc-cjs}/testingPairs.js +0 -0
- /package/{cjs → build-tsc-cjs}/types.js +0 -0
- /package/{bundle.js → build-tsc-esm/bundle.js} +0 -0
- /package/{defaults.js → build-tsc-esm/defaults.js} +0 -0
- /package/{index.js → build-tsc-esm/index.js} +0 -0
- /package/{keyring.js → build-tsc-esm/keyring.js} +0 -0
- /package/{packageDetect.js → build-tsc-esm/packageDetect.js} +0 -0
- /package/{pair → build-tsc-esm/pair}/decode.js +0 -0
- /package/{pair → build-tsc-esm/pair}/defaults.js +0 -0
- /package/{pair → build-tsc-esm/pair}/encode.js +0 -0
- /package/{pair → build-tsc-esm/pair}/index.js +0 -0
- /package/{pair → build-tsc-esm/pair}/nobody.js +0 -0
- /package/{pair → build-tsc-esm/pair}/toJson.js +0 -0
- /package/{pair → build-tsc-esm/pair}/types.js +0 -0
- /package/{pairs.js → build-tsc-esm/pairs.js} +0 -0
- /package/{testing.js → build-tsc-esm/testing.js} +0 -0
- /package/{testingPairs.js → build-tsc-esm/testingPairs.js} +0 -0
- /package/{types.js → build-tsc-esm/types.js} +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPair = createPair;
|
|
4
|
+
const util_1 = require("@pezkuwi/util");
|
|
5
|
+
const util_crypto_1 = require("@pezkuwi/util-crypto");
|
|
6
|
+
const decode_js_1 = require("./decode.js");
|
|
7
|
+
const encode_js_1 = require("./encode.js");
|
|
8
|
+
const toJson_js_1 = require("./toJson.js");
|
|
9
|
+
const SIG_TYPE_NONE = new Uint8Array();
|
|
10
|
+
const TYPE_FROM_SEED = {
|
|
11
|
+
ecdsa: util_crypto_1.secp256k1PairFromSeed,
|
|
12
|
+
ed25519: util_crypto_1.ed25519PairFromSeed,
|
|
13
|
+
ethereum: util_crypto_1.secp256k1PairFromSeed,
|
|
14
|
+
sr25519: util_crypto_1.sr25519PairFromSeed
|
|
15
|
+
};
|
|
16
|
+
const TYPE_PREFIX = {
|
|
17
|
+
ecdsa: new Uint8Array([2]),
|
|
18
|
+
ed25519: new Uint8Array([0]),
|
|
19
|
+
ethereum: new Uint8Array([2]),
|
|
20
|
+
sr25519: new Uint8Array([1])
|
|
21
|
+
};
|
|
22
|
+
const TYPE_SIGNATURE = {
|
|
23
|
+
ecdsa: (m, p) => (0, util_crypto_1.secp256k1Sign)(m, p, 'blake2'),
|
|
24
|
+
ed25519: util_crypto_1.ed25519Sign,
|
|
25
|
+
ethereum: (m, p) => (0, util_crypto_1.secp256k1Sign)(m, p, 'keccak'),
|
|
26
|
+
sr25519: util_crypto_1.sr25519Sign
|
|
27
|
+
};
|
|
28
|
+
const TYPE_ADDRESS = {
|
|
29
|
+
ecdsa: (p) => p.length > 32 ? (0, util_crypto_1.blake2AsU8a)(p) : p,
|
|
30
|
+
ed25519: (p) => p,
|
|
31
|
+
ethereum: (p) => p.length === 20 ? p : (0, util_crypto_1.keccakAsU8a)((0, util_crypto_1.secp256k1Expand)(p)),
|
|
32
|
+
sr25519: (p) => p
|
|
33
|
+
};
|
|
34
|
+
function isLocked(secretKey) {
|
|
35
|
+
return !secretKey || (0, util_1.u8aEmpty)(secretKey);
|
|
36
|
+
}
|
|
37
|
+
function vrfHash(proof, context, extra) {
|
|
38
|
+
return (0, util_crypto_1.blake2AsU8a)((0, util_1.u8aConcat)(context || '', extra || '', proof));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @name createPair
|
|
42
|
+
* @summary Creates a keyring pair object
|
|
43
|
+
* @description Creates a keyring pair object with provided account public key, metadata, and encoded arguments.
|
|
44
|
+
* The keyring pair stores the account state including the encoded address and associated metadata.
|
|
45
|
+
*
|
|
46
|
+
* It has properties whose values are functions that may be called to perform account actions:
|
|
47
|
+
*
|
|
48
|
+
* - `address` function retrieves the address associated with the account.
|
|
49
|
+
* - `decodedPkcs8` function is called with the account passphrase and account encoded public key.
|
|
50
|
+
* It decodes the encoded public key using the passphrase provided to obtain the decoded account public key
|
|
51
|
+
* and associated secret key that are then available in memory, and changes the account address stored in the
|
|
52
|
+
* state of the pair to correspond to the address of the decoded public key.
|
|
53
|
+
* - `encodePkcs8` function when provided with the correct passphrase associated with the account pair
|
|
54
|
+
* and when the secret key is in memory (when the account pair is not locked) it returns an encoded
|
|
55
|
+
* public key of the account.
|
|
56
|
+
* - `meta` is the metadata that is stored in the state of the pair, either when it was originally
|
|
57
|
+
* created or set via `setMeta`.
|
|
58
|
+
* - `publicKey` returns the public key stored in memory for the pair.
|
|
59
|
+
* - `sign` may be used to return a signature by signing a provided message with the secret
|
|
60
|
+
* key (if it is in memory) using Nacl.
|
|
61
|
+
* - `toJson` calls another `toJson` function and provides the state of the pair,
|
|
62
|
+
* it generates arguments to be passed to the other `toJson` function including an encoded public key of the account
|
|
63
|
+
* that it generates using the secret key from memory (if it has been made available in memory)
|
|
64
|
+
* and the optionally provided passphrase argument. It passes a third boolean argument to `toJson`
|
|
65
|
+
* indicating whether the public key has been encoded or not (if a passphrase argument was provided then it is encoded).
|
|
66
|
+
* The `toJson` function that it calls returns a JSON object with properties including the `address`
|
|
67
|
+
* and `meta` that are assigned with the values stored in the corresponding state variables of the account pair,
|
|
68
|
+
* an `encoded` property that is assigned with the encoded public key in hex format, and an `encoding`
|
|
69
|
+
* property that indicates whether the public key value of the `encoded` property is encoded or not.
|
|
70
|
+
*/
|
|
71
|
+
function createPair({ toSS58, type }, { publicKey, secretKey }, meta = {}, encoded = null, encTypes) {
|
|
72
|
+
const decodePkcs8 = (passphrase, userEncoded) => {
|
|
73
|
+
const decoded = (0, decode_js_1.decodePair)(passphrase, userEncoded || encoded, encTypes);
|
|
74
|
+
if (decoded.secretKey.length === 64) {
|
|
75
|
+
publicKey = decoded.publicKey;
|
|
76
|
+
secretKey = decoded.secretKey;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const pair = TYPE_FROM_SEED[type](decoded.secretKey);
|
|
80
|
+
publicKey = pair.publicKey;
|
|
81
|
+
secretKey = pair.secretKey;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const recode = (passphrase) => {
|
|
85
|
+
isLocked(secretKey) && encoded && decodePkcs8(passphrase, encoded);
|
|
86
|
+
encoded = (0, encode_js_1.encodePair)({ publicKey, secretKey }, passphrase); // re-encode, latest version
|
|
87
|
+
encTypes = undefined; // swap to defaults, latest version follows
|
|
88
|
+
return encoded;
|
|
89
|
+
};
|
|
90
|
+
const encodeAddress = () => {
|
|
91
|
+
const raw = TYPE_ADDRESS[type](publicKey);
|
|
92
|
+
return type === 'ethereum'
|
|
93
|
+
? (0, util_crypto_1.ethereumEncode)(raw)
|
|
94
|
+
: toSS58(raw);
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
get address() {
|
|
98
|
+
return encodeAddress();
|
|
99
|
+
},
|
|
100
|
+
get addressRaw() {
|
|
101
|
+
const raw = TYPE_ADDRESS[type](publicKey);
|
|
102
|
+
return type === 'ethereum'
|
|
103
|
+
? raw.slice(-20)
|
|
104
|
+
: raw;
|
|
105
|
+
},
|
|
106
|
+
get isLocked() {
|
|
107
|
+
return isLocked(secretKey);
|
|
108
|
+
},
|
|
109
|
+
get meta() {
|
|
110
|
+
return meta;
|
|
111
|
+
},
|
|
112
|
+
get publicKey() {
|
|
113
|
+
return publicKey;
|
|
114
|
+
},
|
|
115
|
+
get type() {
|
|
116
|
+
return type;
|
|
117
|
+
},
|
|
118
|
+
// eslint-disable-next-line sort-keys
|
|
119
|
+
decodePkcs8,
|
|
120
|
+
derive: (suri, meta) => {
|
|
121
|
+
if (type === 'ethereum') {
|
|
122
|
+
throw new Error('Unable to derive on this keypair');
|
|
123
|
+
}
|
|
124
|
+
else if (isLocked(secretKey)) {
|
|
125
|
+
throw new Error('Cannot derive on a locked keypair');
|
|
126
|
+
}
|
|
127
|
+
const { path } = (0, util_crypto_1.keyExtractPath)(suri);
|
|
128
|
+
const derived = (0, util_crypto_1.keyFromPath)({ publicKey, secretKey }, path, type);
|
|
129
|
+
return createPair({ toSS58, type }, derived, meta, null);
|
|
130
|
+
},
|
|
131
|
+
encodePkcs8: (passphrase) => {
|
|
132
|
+
return recode(passphrase);
|
|
133
|
+
},
|
|
134
|
+
lock: () => {
|
|
135
|
+
secretKey = new Uint8Array();
|
|
136
|
+
},
|
|
137
|
+
setMeta: (additional) => {
|
|
138
|
+
meta = (0, util_1.objectSpread)({}, meta, additional);
|
|
139
|
+
},
|
|
140
|
+
sign: (message, options = {}) => {
|
|
141
|
+
if (isLocked(secretKey)) {
|
|
142
|
+
throw new Error('Cannot sign with a locked key pair');
|
|
143
|
+
}
|
|
144
|
+
return (0, util_1.u8aConcat)(options.withType
|
|
145
|
+
? TYPE_PREFIX[type]
|
|
146
|
+
: SIG_TYPE_NONE, TYPE_SIGNATURE[type]((0, util_1.u8aToU8a)(message), { publicKey, secretKey }));
|
|
147
|
+
},
|
|
148
|
+
toJson: (passphrase) => {
|
|
149
|
+
// NOTE: For ecdsa and ethereum, the publicKey cannot be extracted from the address. For these
|
|
150
|
+
// pass the hex-encoded publicKey through to the address portion of the JSON (before decoding)
|
|
151
|
+
// unless the publicKey is already an address
|
|
152
|
+
const address = ['ecdsa', 'ethereum'].includes(type)
|
|
153
|
+
? publicKey.length === 20
|
|
154
|
+
? (0, util_1.u8aToHex)(publicKey)
|
|
155
|
+
: (0, util_1.u8aToHex)((0, util_crypto_1.secp256k1Compress)(publicKey))
|
|
156
|
+
: encodeAddress();
|
|
157
|
+
return (0, toJson_js_1.pairToJson)(type, { address, meta }, recode(passphrase), !!passphrase);
|
|
158
|
+
},
|
|
159
|
+
unlock: (passphrase) => {
|
|
160
|
+
return decodePkcs8(passphrase);
|
|
161
|
+
},
|
|
162
|
+
verify: (message, signature, signerPublic) => {
|
|
163
|
+
return (0, util_crypto_1.signatureVerify)(message, signature, TYPE_ADDRESS[type]((0, util_1.u8aToU8a)(signerPublic))).isValid;
|
|
164
|
+
},
|
|
165
|
+
vrfSign: (message, context, extra) => {
|
|
166
|
+
if (isLocked(secretKey)) {
|
|
167
|
+
throw new Error('Cannot sign with a locked key pair');
|
|
168
|
+
}
|
|
169
|
+
if (type === 'sr25519') {
|
|
170
|
+
return (0, util_crypto_1.sr25519VrfSign)(message, { secretKey }, context, extra);
|
|
171
|
+
}
|
|
172
|
+
const proof = TYPE_SIGNATURE[type]((0, util_1.u8aToU8a)(message), { publicKey, secretKey });
|
|
173
|
+
return (0, util_1.u8aConcat)(vrfHash(proof, context, extra), proof);
|
|
174
|
+
},
|
|
175
|
+
vrfVerify: (message, vrfResult, signerPublic, context, extra) => {
|
|
176
|
+
if (type === 'sr25519') {
|
|
177
|
+
return (0, util_crypto_1.sr25519VrfVerify)(message, vrfResult, publicKey, context, extra);
|
|
178
|
+
}
|
|
179
|
+
const result = (0, util_crypto_1.signatureVerify)(message, (0, util_1.u8aConcat)(TYPE_PREFIX[type], vrfResult.subarray(32)), TYPE_ADDRESS[type]((0, util_1.u8aToU8a)(signerPublic)));
|
|
180
|
+
return result.isValid && (0, util_1.u8aEq)(vrfResult.subarray(0, 32), vrfHash(vrfResult.subarray(32), context, extra));
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nobody = nobody;
|
|
4
|
+
const publicKey = new Uint8Array(32);
|
|
5
|
+
const address = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM';
|
|
6
|
+
const meta = {
|
|
7
|
+
isTesting: true,
|
|
8
|
+
name: 'nobody'
|
|
9
|
+
};
|
|
10
|
+
const json = {
|
|
11
|
+
address,
|
|
12
|
+
encoded: '',
|
|
13
|
+
encoding: {
|
|
14
|
+
content: ['pkcs8', 'ed25519'],
|
|
15
|
+
type: 'none',
|
|
16
|
+
version: '0'
|
|
17
|
+
},
|
|
18
|
+
meta
|
|
19
|
+
};
|
|
20
|
+
const pair = {
|
|
21
|
+
address,
|
|
22
|
+
addressRaw: publicKey,
|
|
23
|
+
decodePkcs8: (_passphrase, _encoded) => undefined,
|
|
24
|
+
derive: (_suri, _meta) => pair,
|
|
25
|
+
encodePkcs8: (_passphrase) => new Uint8Array(0),
|
|
26
|
+
isLocked: true,
|
|
27
|
+
lock: () => {
|
|
28
|
+
// no locking, it is always locked
|
|
29
|
+
},
|
|
30
|
+
meta,
|
|
31
|
+
publicKey,
|
|
32
|
+
setMeta: (_meta) => undefined,
|
|
33
|
+
sign: (_message) => new Uint8Array(64),
|
|
34
|
+
toJson: (_passphrase) => json,
|
|
35
|
+
type: 'ed25519',
|
|
36
|
+
unlock: (_passphrase) => undefined,
|
|
37
|
+
verify: (_message, _signature) => false,
|
|
38
|
+
vrfSign: (_message, _context, _extra) => new Uint8Array(96),
|
|
39
|
+
vrfVerify: (_message, _vrfResult, _context, _extra) => false
|
|
40
|
+
};
|
|
41
|
+
function nobody() {
|
|
42
|
+
return pair;
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pairToJson = pairToJson;
|
|
4
|
+
const util_1 = require("@pezkuwi/util");
|
|
5
|
+
const util_crypto_1 = require("@pezkuwi/util-crypto");
|
|
6
|
+
function pairToJson(type, { address, meta }, encoded, isEncrypted) {
|
|
7
|
+
return (0, util_1.objectSpread)((0, util_crypto_1.jsonEncryptFormat)(encoded, ['pkcs8', type], isEncrypted), {
|
|
8
|
+
address,
|
|
9
|
+
meta
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pairs = void 0;
|
|
4
|
+
const util_1 = require("@pezkuwi/util");
|
|
5
|
+
const util_crypto_1 = require("@pezkuwi/util-crypto");
|
|
6
|
+
class Pairs {
|
|
7
|
+
#map = {};
|
|
8
|
+
add(pair) {
|
|
9
|
+
this.#map[(0, util_crypto_1.decodeAddress)(pair.address).toString()] = pair;
|
|
10
|
+
return pair;
|
|
11
|
+
}
|
|
12
|
+
all() {
|
|
13
|
+
return Object.values(this.#map);
|
|
14
|
+
}
|
|
15
|
+
get(address) {
|
|
16
|
+
const pair = this.#map[(0, util_crypto_1.decodeAddress)(address).toString()];
|
|
17
|
+
if (!pair) {
|
|
18
|
+
throw new Error(`Unable to retrieve keypair '${(0, util_1.isU8a)(address) || (0, util_1.isHex)(address)
|
|
19
|
+
? (0, util_1.u8aToHex)((0, util_1.u8aToU8a)(address))
|
|
20
|
+
: address}'`);
|
|
21
|
+
}
|
|
22
|
+
return pair;
|
|
23
|
+
}
|
|
24
|
+
remove(address) {
|
|
25
|
+
delete this.#map[(0, util_crypto_1.decodeAddress)(address).toString()];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Pairs = Pairs;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PAIRSETHEREUM = exports.PAIRSSR25519 = void 0;
|
|
4
|
+
exports.createTestKeyring = createTestKeyring;
|
|
5
|
+
const util_1 = require("@pezkuwi/util");
|
|
6
|
+
const index_js_1 = require("./pair/index.js");
|
|
7
|
+
const keyring_js_1 = require("./keyring.js");
|
|
8
|
+
exports.PAIRSSR25519 = [
|
|
9
|
+
{
|
|
10
|
+
p: '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d',
|
|
11
|
+
s: '0x98319d4ff8a9508c4bb0cf0b5a78d760a0b2082c02775e6e82370816fedfff48925a225d97aa00682d6a59b95b18780c10d7032336e88f3442b42361f4a66011', // nosemgrep
|
|
12
|
+
seed: 'Alice',
|
|
13
|
+
type: 'sr25519'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
p: '0xbe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f',
|
|
17
|
+
s: '0xe8da6c9d810e020f5e3c7f5af2dea314cbeaa0d72bc6421e92c0808a0c584a6046ab28e97c3ffc77fe12b5a4d37e8cd4afbfebbf2391ffc7cb07c0f38c023efd', // nosemgrep
|
|
18
|
+
seed: 'Alice//stash',
|
|
19
|
+
type: 'sr25519'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
p: '0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48',
|
|
23
|
+
s: '0x081ff694633e255136bdb456c20a5fc8fed21f8b964c11bb17ff534ce80ebd5941ae88f85d0c1bfc37be41c904e1dfc01de8c8067b0d6d5df25dd1ac0894a325', // nosemgrep
|
|
24
|
+
seed: 'Bob',
|
|
25
|
+
type: 'sr25519'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
p: '0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e',
|
|
29
|
+
s: '0xc006507cdfc267a21532394c49ca9b754ca71de21e15a1cdf807c7ceab6d0b6c3ed408d9d35311540dcd54931933e67cf1ea10d46f75408f82b789d9bd212fde', // nosemgrep
|
|
30
|
+
seed: 'Bob//stash',
|
|
31
|
+
type: 'sr25519'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
p: '0x90b5ab205c6974c9ea841be688864633dc9ca8a357843eeacf2314649965fe22',
|
|
35
|
+
s: '0xa8f2d83016052e5d6d77b2f6fd5d59418922a09024cda701b3c34369ec43a7668faf12ff39cd4e5d92bb773972f41a7a5279ebc2ed92264bed8f47d344f8f18c', // nosemgrep
|
|
36
|
+
seed: 'Charlie',
|
|
37
|
+
type: 'sr25519'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
p: '0x306721211d5404bd9da88e0204360a1a9ab8b87c66c1bc2fcdd37f3c2222cc20',
|
|
41
|
+
s: '0x20e05482ca4677e0edbc58ae9a3a59f6ed3b1a9484ba17e64d6fe8688b2b7b5d108c4487b9323b98b11fe36cb301b084e920f7b7895536809a6d62a451b25568', // nosemgrep
|
|
42
|
+
seed: 'Dave',
|
|
43
|
+
type: 'sr25519'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
p: '0xe659a7a1628cdd93febc04a4e0646ea20e9f5f0ce097d9a05290d4a9e054df4e',
|
|
47
|
+
s: '0x683576abfd5dc35273e4264c23095a1bf21c14517bece57c7f0cc5c0ed4ce06a3dbf386b7828f348abe15d76973a72009e6ef86a5c91db2990cb36bb657c6587', // nosemgrep
|
|
48
|
+
seed: 'Eve',
|
|
49
|
+
type: 'sr25519'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
p: '0x1cbd2d43530a44705ad088af313e18f80b53ef16b36177cd4b77b846f2a5f07c',
|
|
53
|
+
s: '0xb835c20f450079cf4f513900ae9faf8df06ad86c681884122c752a4b2bf74d4303e4f21bc6cc62bb4eeed5a9cce642c25e2d2ac1464093b50f6196d78e3a7426', // nosemgrep
|
|
54
|
+
seed: 'Ferdie',
|
|
55
|
+
type: 'sr25519'
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
exports.PAIRSETHEREUM = [
|
|
59
|
+
{
|
|
60
|
+
name: 'Alith',
|
|
61
|
+
p: '0x02509540919faacf9ab52146c9aa40db68172d83777250b28e4679176e49ccdd9f',
|
|
62
|
+
s: '0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133', // nosemgrep
|
|
63
|
+
type: 'ethereum'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'Baltathar',
|
|
67
|
+
p: '0x033bc19e36ff1673910575b6727a974a9abd80c9a875d41ab3e2648dbfb9e4b518',
|
|
68
|
+
s: '0x8075991ce870b93a8870eca0c0f91913d12f47948ca0fd25b49c6fa7cdbeee8b', // nosemgrep
|
|
69
|
+
type: 'ethereum'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'Charleth',
|
|
73
|
+
p: '0x0234637bdc0e89b5d46543bcbf8edff329d2702bc995e27e9af4b1ba009a3c2a5e',
|
|
74
|
+
s: '0x0b6e18cafb6ed99687ec547bd28139cafdd2bffe70e6b688025de6b445aa5c5b', // nosemgrep
|
|
75
|
+
type: 'ethereum'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Dorothy',
|
|
79
|
+
p: '0x02a00d60b2b408c2a14c5d70cdd2c205db8985ef737a7e55ad20ea32cc9e7c417c',
|
|
80
|
+
s: '0x39539ab1876910bbf3a223d84a29e28f1cb4e2e456503e7e91ed39b2e7223d68', // nosemgrep
|
|
81
|
+
type: 'ethereum'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'Ethan',
|
|
85
|
+
p: '0x025cdc005b752651cd3f728fb9192182acb3a9c89e19072cbd5b03f3ee1f1b3ffa',
|
|
86
|
+
s: '0x7dce9bc8babb68fec1409be38c8e1a52650206a7ed90ff956ae8a6d15eeaaef4', // nosemgrep
|
|
87
|
+
type: 'ethereum'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'Faith',
|
|
91
|
+
p: '0x037964b6c9d546da4646ada28a99e34acaa1d14e7aba861a9055f9bd200c8abf74',
|
|
92
|
+
s: '0xb9d2ea9a615f3165812e8d44de0d24da9bbd164b65c4f0573e1ce2c8dbd9c8df', // nosemgrep
|
|
93
|
+
type: 'ethereum'
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
function createMeta(name, seed) {
|
|
97
|
+
if (!name && !seed) {
|
|
98
|
+
throw new Error('Testing pair should have either a name or a seed');
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
isTesting: true,
|
|
102
|
+
name: name || seed?.replace('//', '_').toLowerCase()
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @name testKeyring
|
|
107
|
+
* @summary Create an instance of Keyring pre-populated with locked test accounts
|
|
108
|
+
* @description The test accounts (i.e. alice, bob, dave, eve, ferdie)
|
|
109
|
+
* are available on the dev chain and each test account is initialized with DOT funds.
|
|
110
|
+
*/
|
|
111
|
+
function createTestKeyring(options = {}, isDerived = true) {
|
|
112
|
+
const keyring = new keyring_js_1.Keyring(options);
|
|
113
|
+
const pairs = options.type === 'ethereum'
|
|
114
|
+
? exports.PAIRSETHEREUM
|
|
115
|
+
: exports.PAIRSSR25519;
|
|
116
|
+
for (const { name, p, s, seed, type } of pairs) {
|
|
117
|
+
const meta = createMeta(name, seed);
|
|
118
|
+
const pair = !isDerived && !name && seed
|
|
119
|
+
? keyring.addFromUri(seed, meta, options.type)
|
|
120
|
+
: keyring.addPair((0, index_js_1.createPair)({ toSS58: keyring.encodeAddress, type }, { publicKey: (0, util_1.hexToU8a)(p), secretKey: (0, util_1.hexToU8a)(s) }, meta));
|
|
121
|
+
pair.lock = () => {
|
|
122
|
+
// we don't have lock/unlock functionality here
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return keyring;
|
|
126
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTestPairs = createTestPairs;
|
|
4
|
+
const nobody_js_1 = require("./pair/nobody.js");
|
|
5
|
+
const testing_js_1 = require("./testing.js");
|
|
6
|
+
function createTestPairs(options, isDerived = true) {
|
|
7
|
+
const keyring = (0, testing_js_1.createTestKeyring)(options, isDerived);
|
|
8
|
+
const pairs = keyring.getPairs();
|
|
9
|
+
const map = { nobody: (0, nobody_js_1.nobody)() };
|
|
10
|
+
for (const p of pairs) {
|
|
11
|
+
if (p.meta.name) {
|
|
12
|
+
map[p.meta.name] = p;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return map;
|
|
16
|
+
}
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { EncryptedJsonEncoding, Keypair, KeypairType } from '@pezkuwi/util-crypto/types';
|
|
2
|
+
import type { KeyringInstance, KeyringOptions, KeyringPair, KeyringPair$Json, KeyringPair$Meta } from './types.js';
|
|
3
|
+
import { decodeAddress } from '@pezkuwi/util-crypto';
|
|
4
|
+
/**
|
|
5
|
+
* # @pezkuwi/keyring
|
|
6
|
+
*
|
|
7
|
+
* ## Overview
|
|
8
|
+
*
|
|
9
|
+
* @name Keyring
|
|
10
|
+
* @summary Keyring management of user accounts
|
|
11
|
+
* @description Allows generation of keyring pairs from a variety of input combinations, such as
|
|
12
|
+
* json object containing account address or public key, account metadata, and account encoded using
|
|
13
|
+
* `addFromJson`, or by providing those values as arguments separately to `addFromAddress`,
|
|
14
|
+
* or by providing the mnemonic (seed phrase) and account metadata as arguments to `addFromMnemonic`.
|
|
15
|
+
* Stores the keyring pairs in a keyring pair dictionary. Removal of the keyring pairs from the keyring pair
|
|
16
|
+
* dictionary is achieved using `removePair`. Retrieval of all the stored pairs via `getPairs` or perform
|
|
17
|
+
* lookup of a pair for a given account address or public key using `getPair`. JSON metadata associated with
|
|
18
|
+
* an account may be obtained using `toJson` accompanied by the account passphrase.
|
|
19
|
+
*/
|
|
20
|
+
export declare class Keyring implements KeyringInstance {
|
|
21
|
+
#private;
|
|
22
|
+
decodeAddress: typeof decodeAddress;
|
|
23
|
+
constructor(options?: KeyringOptions);
|
|
24
|
+
/**
|
|
25
|
+
* @description retrieve the pairs (alias for getPairs)
|
|
26
|
+
*/
|
|
27
|
+
get pairs(): KeyringPair[];
|
|
28
|
+
/**
|
|
29
|
+
* @description retrieve the publicKeys (alias for getPublicKeys)
|
|
30
|
+
*/
|
|
31
|
+
get publicKeys(): Uint8Array[];
|
|
32
|
+
/**
|
|
33
|
+
* @description Returns the type of the keyring, ed25519, sr25519 or ecdsa
|
|
34
|
+
*/
|
|
35
|
+
get type(): KeypairType;
|
|
36
|
+
/**
|
|
37
|
+
* @name addPair
|
|
38
|
+
* @summary Stores an account, given a keyring pair, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
39
|
+
*/
|
|
40
|
+
addPair(pair: KeyringPair): KeyringPair;
|
|
41
|
+
/**
|
|
42
|
+
* @name addFromAddress
|
|
43
|
+
* @summary Stores an account, given an account address, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
44
|
+
* @description Allows user to explicitly provide separate inputs including account address or public key, and optionally
|
|
45
|
+
* the associated account metadata, and the default encoded value as arguments (that may be obtained from the json file
|
|
46
|
+
* of an account backup), and then generates a keyring pair from them that it passes to
|
|
47
|
+
* `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
|
|
48
|
+
*/
|
|
49
|
+
addFromAddress(address: string | Uint8Array, meta?: KeyringPair$Meta, encoded?: Uint8Array | null, type?: KeypairType, ignoreChecksum?: boolean, encType?: EncryptedJsonEncoding[]): KeyringPair;
|
|
50
|
+
/**
|
|
51
|
+
* @name addFromJson
|
|
52
|
+
* @summary Stores an account, given JSON data, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
53
|
+
* @description Allows user to provide a json object argument that contains account information (that may be obtained from the json file
|
|
54
|
+
* of an account backup), and then generates a keyring pair from it that it passes to
|
|
55
|
+
* `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
|
|
56
|
+
*/
|
|
57
|
+
addFromJson(json: KeyringPair$Json, ignoreChecksum?: boolean): KeyringPair;
|
|
58
|
+
/**
|
|
59
|
+
* @name addFromMnemonic
|
|
60
|
+
* @summary Stores an account, given a mnemonic, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
61
|
+
* @description Allows user to provide a mnemonic (seed phrase that is provided when account is originally created)
|
|
62
|
+
* argument and a metadata argument that contains account information (that may be obtained from the json file
|
|
63
|
+
* of an account backup), and then generates a keyring pair from it that it passes to
|
|
64
|
+
* `addPair` to stores in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
|
|
65
|
+
*/
|
|
66
|
+
addFromMnemonic(mnemonic: string, meta?: KeyringPair$Meta, type?: KeypairType, wordlist?: string[]): KeyringPair;
|
|
67
|
+
/**
|
|
68
|
+
* @name addFromPair
|
|
69
|
+
* @summary Stores an account created from an explicit publicKey/secreteKey combination
|
|
70
|
+
*/
|
|
71
|
+
addFromPair(pair: Keypair, meta?: KeyringPair$Meta, type?: KeypairType): KeyringPair;
|
|
72
|
+
/**
|
|
73
|
+
* @name addFromSeed
|
|
74
|
+
* @summary Stores an account, given seed data, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
75
|
+
* @description Stores in a keyring pair dictionary the public key of the pair as a key and the pair as the associated value.
|
|
76
|
+
* Allows user to provide the account seed as an argument, and then generates a keyring pair from it that it passes to
|
|
77
|
+
* `addPair` to store in a keyring pair dictionary the public key of the generated pair as a key and the pair as the associated value.
|
|
78
|
+
*/
|
|
79
|
+
addFromSeed(seed: Uint8Array, meta?: KeyringPair$Meta, type?: KeypairType): KeyringPair;
|
|
80
|
+
/**
|
|
81
|
+
* @name addFromUri
|
|
82
|
+
* @summary Creates an account via an suri
|
|
83
|
+
* @description Extracts the phrase, path and password from a SURI format for specifying secret keys `<secret>/<soft-key>//<hard-key>///<password>` (the `///password` may be omitted, and `/<soft-key>` and `//<hard-key>` maybe repeated and mixed). The secret can be a hex string, mnemonic phrase or a string (to be padded)
|
|
84
|
+
*/
|
|
85
|
+
addFromUri(suri: string, meta?: KeyringPair$Meta, type?: KeypairType, wordlist?: string[]): KeyringPair;
|
|
86
|
+
/**
|
|
87
|
+
* @name createFromJson
|
|
88
|
+
* @description Creates a pair from a JSON keyfile
|
|
89
|
+
*/
|
|
90
|
+
createFromJson({ address, encoded, encoding: { content, type, version }, meta }: KeyringPair$Json, ignoreChecksum?: boolean): KeyringPair;
|
|
91
|
+
/**
|
|
92
|
+
* @name createFromPair
|
|
93
|
+
* @summary Creates a pair from an explicit publicKey/secreteKey combination
|
|
94
|
+
*/
|
|
95
|
+
createFromPair(pair: Keypair, meta?: KeyringPair$Meta, type?: KeypairType): KeyringPair;
|
|
96
|
+
/**
|
|
97
|
+
* @name createFromUri
|
|
98
|
+
* @summary Creates a Keypair from an suri
|
|
99
|
+
* @description This creates a pair from the suri, but does not add it to the keyring
|
|
100
|
+
*/
|
|
101
|
+
createFromUri(_suri: string, meta?: KeyringPair$Meta, type?: KeypairType, wordlist?: string[]): KeyringPair;
|
|
102
|
+
/**
|
|
103
|
+
* @name encodeAddress
|
|
104
|
+
* @description Encodes the input into an ss58 representation
|
|
105
|
+
*/
|
|
106
|
+
encodeAddress: (address: Uint8Array | string, ss58Format?: number) => string;
|
|
107
|
+
/**
|
|
108
|
+
* @name getPair
|
|
109
|
+
* @summary Retrieves an account keyring pair from the Keyring Pair Dictionary, given an account address
|
|
110
|
+
* @description Returns a keyring pair value from the keyring pair dictionary by performing
|
|
111
|
+
* a key lookup using the provided account address or public key (after decoding it).
|
|
112
|
+
*/
|
|
113
|
+
getPair(address: string | Uint8Array): KeyringPair;
|
|
114
|
+
/**
|
|
115
|
+
* @name getPairs
|
|
116
|
+
* @summary Retrieves all account keyring pairs from the Keyring Pair Dictionary
|
|
117
|
+
* @description Returns an array list of all the keyring pair values that are stored in the keyring pair dictionary.
|
|
118
|
+
*/
|
|
119
|
+
getPairs(): KeyringPair[];
|
|
120
|
+
/**
|
|
121
|
+
* @name getPublicKeys
|
|
122
|
+
* @summary Retrieves Public Keys of all Keyring Pairs stored in the Keyring Pair Dictionary
|
|
123
|
+
* @description Returns an array list of all the public keys associated with each of the keyring pair values that are stored in the keyring pair dictionary.
|
|
124
|
+
*/
|
|
125
|
+
getPublicKeys(): Uint8Array[];
|
|
126
|
+
/**
|
|
127
|
+
* @name removePair
|
|
128
|
+
* @description Deletes the provided input address or public key from the stored Keyring Pair Dictionary.
|
|
129
|
+
*/
|
|
130
|
+
removePair(address: string | Uint8Array): void;
|
|
131
|
+
/**
|
|
132
|
+
* @name setSS58Format;
|
|
133
|
+
* @description Sets the ss58 format for the keyring
|
|
134
|
+
*/
|
|
135
|
+
setSS58Format(ss58: number): void;
|
|
136
|
+
/**
|
|
137
|
+
* @name toJson
|
|
138
|
+
* @summary Returns a JSON object associated with the input argument that contains metadata assocated with an account
|
|
139
|
+
* @description Returns a JSON object containing the metadata associated with an account
|
|
140
|
+
* when valid address or public key and when the account passphrase is provided if the account secret
|
|
141
|
+
* is not already unlocked and available in memory. Note that in [Polkadot-JS Apps](https://github.com/polkadot-js/apps) the user
|
|
142
|
+
* may backup their account to a JSON file that contains this information.
|
|
143
|
+
*/
|
|
144
|
+
toJson(address: string | Uint8Array, passphrase?: string): KeyringPair$Json;
|
|
145
|
+
}
|