@pezkuwi/keyring 14.0.12 → 14.0.14
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-pezkuwi-keyring.js +1 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/pair/defaults.d.ts +2 -2
- package/package.json +11 -11
- package/packageInfo.js +1 -1
- package/pair/defaults.d.ts +2 -2
- package/build/LICENSE +0 -201
- package/build/README.md +0 -17
- package/build/bundle-pezkuwi-keyring.js +0 -553
- package/build/bundle.d.ts +0 -7
- package/build/bundle.js +0 -7
- package/build/cjs/bundle.d.ts +0 -7
- package/build/cjs/bundle.js +0 -19
- package/build/cjs/defaults.d.ts +0 -2
- package/build/cjs/defaults.js +0 -5
- package/build/cjs/index.d.ts +0 -4
- package/build/cjs/index.js +0 -7
- package/build/cjs/keyring.d.ts +0 -145
- package/build/cjs/keyring.js +0 -261
- package/build/cjs/package.json +0 -3
- package/build/cjs/packageDetect.d.ts +0 -1
- package/build/cjs/packageDetect.js +0 -7
- package/build/cjs/packageInfo.d.ts +0 -6
- package/build/cjs/packageInfo.js +0 -4
- package/build/cjs/pair/decode.d.ts +0 -12
- package/build/cjs/pair/decode.js +0 -45
- package/build/cjs/pair/defaults.d.ts +0 -12
- package/build/cjs/pair/defaults.js +0 -15
- package/build/cjs/pair/encode.d.ts +0 -5
- package/build/cjs/pair/encode.js +0 -22
- package/build/cjs/pair/index.d.ts +0 -40
- package/build/cjs/pair/index.js +0 -183
- package/build/cjs/pair/nobody.d.ts +0 -2
- package/build/cjs/pair/nobody.js +0 -43
- package/build/cjs/pair/toJson.d.ts +0 -8
- package/build/cjs/pair/toJson.js +0 -11
- package/build/cjs/pair/types.d.ts +0 -5
- package/build/cjs/pair/types.js +0 -2
- package/build/cjs/pairs.d.ts +0 -8
- package/build/cjs/pairs.js +0 -28
- package/build/cjs/testing.d.ts +0 -20
- package/build/cjs/testing.js +0 -126
- package/build/cjs/testingPairs.d.ts +0 -25
- package/build/cjs/testingPairs.js +0 -16
- package/build/cjs/types.d.ts +0 -111
- package/build/cjs/types.js +0 -2
- package/build/defaults.d.ts +0 -2
- package/build/defaults.js +0 -2
- package/build/index.d.ts +0 -4
- package/build/index.js +0 -4
- package/build/keyring.d.ts +0 -145
- package/build/keyring.js +0 -257
- package/build/package.json +0 -294
- package/build/packageDetect.d.ts +0 -1
- package/build/packageDetect.js +0 -5
- package/build/packageInfo.d.ts +0 -6
- package/build/packageInfo.js +0 -1
- package/build/pair/decode.d.ts +0 -12
- package/build/pair/decode.js +0 -42
- package/build/pair/defaults.d.ts +0 -12
- package/build/pair/defaults.js +0 -12
- package/build/pair/encode.d.ts +0 -5
- package/build/pair/encode.js +0 -19
- package/build/pair/index.d.ts +0 -40
- package/build/pair/index.js +0 -180
- package/build/pair/nobody.d.ts +0 -2
- package/build/pair/nobody.js +0 -40
- package/build/pair/toJson.d.ts +0 -8
- package/build/pair/toJson.js +0 -8
- package/build/pair/types.d.ts +0 -5
- package/build/pair/types.js +0 -1
- package/build/pairs.d.ts +0 -8
- package/build/pairs.js +0 -24
- package/build/testing.d.ts +0 -20
- package/build/testing.js +0 -122
- package/build/testingPairs.d.ts +0 -25
- package/build/testingPairs.js +0 -13
- package/build/types.d.ts +0 -111
- package/build/types.js +0 -1
- package/build-deno/README.md +0 -17
- package/build-deno/bundle.ts +0 -10
- package/build-deno/defaults.ts +0 -4
- package/build-deno/index.ts +0 -8
- package/build-deno/keyring.ts +0 -305
- package/build-deno/mod.ts +0 -2
- package/build-deno/packageDetect.ts +0 -9
- package/build-deno/packageInfo.ts +0 -3
- package/build-deno/pair/decode.ts +0 -54
- package/build-deno/pair/defaults.ts +0 -18
- package/build-deno/pair/encode.ts +0 -28
- package/build-deno/pair/index.ts +0 -218
- package/build-deno/pair/nobody.ts +0 -58
- package/build-deno/pair/toJson.ts +0 -18
- package/build-deno/pair/types.ts +0 -6
- package/build-deno/pairs.ts +0 -39
- package/build-deno/testing.ts +0 -150
- package/build-deno/testingPairs.ts +0 -54
- package/build-deno/types.ts +0 -129
- package/build-tsc/bundle.d.ts +0 -7
- package/build-tsc/defaults.d.ts +0 -2
- package/build-tsc/index.d.ts +0 -4
- package/build-tsc/keyring.d.ts +0 -145
- package/build-tsc/packageDetect.d.ts +0 -1
- package/build-tsc/packageInfo.d.ts +0 -6
- package/build-tsc/pair/decode.d.ts +0 -12
- package/build-tsc/pair/defaults.d.ts +0 -12
- package/build-tsc/pair/encode.d.ts +0 -5
- package/build-tsc/pair/index.d.ts +0 -40
- package/build-tsc/pair/nobody.d.ts +0 -2
- package/build-tsc/pair/toJson.d.ts +0 -8
- package/build-tsc/pair/types.d.ts +0 -5
- package/build-tsc/pairs.d.ts +0 -8
- package/build-tsc/testing.d.ts +0 -20
- package/build-tsc/testingPairs.d.ts +0 -25
- package/build-tsc/types.d.ts +0 -111
- package/build-tsc-cjs/bundle.js +0 -19
- package/build-tsc-cjs/defaults.js +0 -5
- package/build-tsc-cjs/index.js +0 -7
- package/build-tsc-cjs/keyring.js +0 -261
- package/build-tsc-cjs/packageDetect.js +0 -7
- package/build-tsc-cjs/packageInfo.js +0 -4
- package/build-tsc-cjs/pair/decode.js +0 -45
- package/build-tsc-cjs/pair/defaults.js +0 -15
- package/build-tsc-cjs/pair/encode.js +0 -22
- package/build-tsc-cjs/pair/index.js +0 -183
- package/build-tsc-cjs/pair/nobody.js +0 -43
- package/build-tsc-cjs/pair/toJson.js +0 -11
- package/build-tsc-cjs/pair/types.js +0 -2
- package/build-tsc-cjs/pairs.js +0 -28
- package/build-tsc-cjs/testing.js +0 -126
- package/build-tsc-cjs/testingPairs.js +0 -16
- package/build-tsc-cjs/types.js +0 -2
- package/build-tsc-esm/bundle.js +0 -7
- package/build-tsc-esm/defaults.js +0 -2
- package/build-tsc-esm/index.js +0 -4
- package/build-tsc-esm/keyring.js +0 -257
- package/build-tsc-esm/packageDetect.js +0 -5
- package/build-tsc-esm/packageInfo.js +0 -1
- package/build-tsc-esm/pair/decode.js +0 -42
- package/build-tsc-esm/pair/defaults.js +0 -12
- package/build-tsc-esm/pair/encode.js +0 -19
- package/build-tsc-esm/pair/index.js +0 -180
- package/build-tsc-esm/pair/nobody.js +0 -40
- package/build-tsc-esm/pair/toJson.js +0 -8
- package/build-tsc-esm/pair/types.js +0 -1
- package/build-tsc-esm/pairs.js +0 -24
- package/build-tsc-esm/testing.js +0 -122
- package/build-tsc-esm/testingPairs.js +0 -13
- package/build-tsc-esm/types.js +0 -1
- package/src/bundle.ts +0 -16
- package/src/defaults.ts +0 -8
- package/src/index.spec.ts +0 -609
- package/src/index.ts +0 -10
- package/src/keyring.ts +0 -307
- package/src/mod.ts +0 -4
- package/src/packageDetect.ts +0 -13
- package/src/packageInfo.ts +0 -6
- package/src/pair/decode.spec.ts +0 -26
- package/src/pair/decode.ts +0 -56
- package/src/pair/defaults.ts +0 -20
- package/src/pair/encode.spec.ts +0 -28
- package/src/pair/encode.ts +0 -30
- package/src/pair/index.spec.ts +0 -189
- package/src/pair/index.ts +0 -220
- package/src/pair/nobody.ts +0 -62
- package/src/pair/toJson.spec.ts +0 -42
- package/src/pair/toJson.ts +0 -20
- package/src/pair/types.ts +0 -8
- package/src/pair/vrf.spec.ts +0 -47
- package/src/pairs.ts +0 -41
- package/src/suri.spec.ts +0 -109
- package/src/testing.ts +0 -156
- package/src/testingPairs.spec.ts +0 -79
- package/src/testingPairs.ts +0 -56
- package/src/types.ts +0 -131
- package/tsconfig.build.json +0 -16
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.spec.json +0 -18
- package/tsconfig.spec.tsbuildinfo +0 -1
package/build/cjs/keyring.d.ts
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
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
|
-
}
|
package/build/cjs/keyring.js
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Keyring = void 0;
|
|
4
|
-
const util_1 = require("@pezkuwi/util");
|
|
5
|
-
const util_crypto_1 = require("@pezkuwi/util-crypto");
|
|
6
|
-
const index_js_1 = require("./pair/index.js");
|
|
7
|
-
const defaults_js_1 = require("./defaults.js");
|
|
8
|
-
const pairs_js_1 = require("./pairs.js");
|
|
9
|
-
const PairFromSeed = {
|
|
10
|
-
ecdsa: (seed) => (0, util_crypto_1.secp256k1PairFromSeed)(seed),
|
|
11
|
-
ed25519: (seed) => (0, util_crypto_1.ed25519PairFromSeed)(seed),
|
|
12
|
-
ethereum: (seed) => (0, util_crypto_1.secp256k1PairFromSeed)(seed),
|
|
13
|
-
sr25519: (seed) => (0, util_crypto_1.sr25519PairFromSeed)(seed)
|
|
14
|
-
};
|
|
15
|
-
function pairToPublic({ publicKey }) {
|
|
16
|
-
return publicKey;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* # @pezkuwi/keyring
|
|
20
|
-
*
|
|
21
|
-
* ## Overview
|
|
22
|
-
*
|
|
23
|
-
* @name Keyring
|
|
24
|
-
* @summary Keyring management of user accounts
|
|
25
|
-
* @description Allows generation of keyring pairs from a variety of input combinations, such as
|
|
26
|
-
* json object containing account address or public key, account metadata, and account encoded using
|
|
27
|
-
* `addFromJson`, or by providing those values as arguments separately to `addFromAddress`,
|
|
28
|
-
* or by providing the mnemonic (seed phrase) and account metadata as arguments to `addFromMnemonic`.
|
|
29
|
-
* Stores the keyring pairs in a keyring pair dictionary. Removal of the keyring pairs from the keyring pair
|
|
30
|
-
* dictionary is achieved using `removePair`. Retrieval of all the stored pairs via `getPairs` or perform
|
|
31
|
-
* lookup of a pair for a given account address or public key using `getPair`. JSON metadata associated with
|
|
32
|
-
* an account may be obtained using `toJson` accompanied by the account passphrase.
|
|
33
|
-
*/
|
|
34
|
-
class Keyring {
|
|
35
|
-
#pairs;
|
|
36
|
-
#type;
|
|
37
|
-
#ss58;
|
|
38
|
-
decodeAddress = util_crypto_1.decodeAddress;
|
|
39
|
-
constructor(options = {}) {
|
|
40
|
-
options.type = options.type || 'ed25519';
|
|
41
|
-
if (!['ecdsa', 'ethereum', 'ed25519', 'sr25519'].includes(options.type || 'undefined')) {
|
|
42
|
-
throw new Error(`Expected a keyring type of either 'ed25519', 'sr25519', 'ethereum' or 'ecdsa', found '${options.type || 'unknown'}`);
|
|
43
|
-
}
|
|
44
|
-
this.#pairs = new pairs_js_1.Pairs();
|
|
45
|
-
this.#ss58 = options.ss58Format;
|
|
46
|
-
this.#type = options.type;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @description retrieve the pairs (alias for getPairs)
|
|
50
|
-
*/
|
|
51
|
-
get pairs() {
|
|
52
|
-
return this.getPairs();
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @description retrieve the publicKeys (alias for getPublicKeys)
|
|
56
|
-
*/
|
|
57
|
-
get publicKeys() {
|
|
58
|
-
return this.getPublicKeys();
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @description Returns the type of the keyring, ed25519, sr25519 or ecdsa
|
|
62
|
-
*/
|
|
63
|
-
get type() {
|
|
64
|
-
return this.#type;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @name addPair
|
|
68
|
-
* @summary Stores an account, given a keyring pair, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
69
|
-
*/
|
|
70
|
-
addPair(pair) {
|
|
71
|
-
return this.#pairs.add(pair);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* @name addFromAddress
|
|
75
|
-
* @summary Stores an account, given an account address, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
76
|
-
* @description Allows user to explicitly provide separate inputs including account address or public key, and optionally
|
|
77
|
-
* the associated account metadata, and the default encoded value as arguments (that may be obtained from the json file
|
|
78
|
-
* of an account backup), and then generates a keyring pair from them that it passes to
|
|
79
|
-
* `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.
|
|
80
|
-
*/
|
|
81
|
-
addFromAddress(address, meta = {}, encoded = null, type = this.type, ignoreChecksum, encType) {
|
|
82
|
-
const publicKey = this.decodeAddress(address, ignoreChecksum);
|
|
83
|
-
return this.addPair((0, index_js_1.createPair)({ toSS58: this.encodeAddress, type }, { publicKey, secretKey: new Uint8Array() }, meta, encoded, encType));
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @name addFromJson
|
|
87
|
-
* @summary Stores an account, given JSON data, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
88
|
-
* @description Allows user to provide a json object argument that contains account information (that may be obtained from the json file
|
|
89
|
-
* of an account backup), and then generates a keyring pair from it that it passes to
|
|
90
|
-
* `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.
|
|
91
|
-
*/
|
|
92
|
-
addFromJson(json, ignoreChecksum) {
|
|
93
|
-
return this.addPair(this.createFromJson(json, ignoreChecksum));
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* @name addFromMnemonic
|
|
97
|
-
* @summary Stores an account, given a mnemonic, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
98
|
-
* @description Allows user to provide a mnemonic (seed phrase that is provided when account is originally created)
|
|
99
|
-
* argument and a metadata argument that contains account information (that may be obtained from the json file
|
|
100
|
-
* of an account backup), and then generates a keyring pair from it that it passes to
|
|
101
|
-
* `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.
|
|
102
|
-
*/
|
|
103
|
-
addFromMnemonic(mnemonic, meta = {}, type = this.type, wordlist) {
|
|
104
|
-
return this.addFromUri(mnemonic, meta, type, wordlist);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* @name addFromPair
|
|
108
|
-
* @summary Stores an account created from an explicit publicKey/secreteKey combination
|
|
109
|
-
*/
|
|
110
|
-
addFromPair(pair, meta = {}, type = this.type) {
|
|
111
|
-
return this.addPair(this.createFromPair(pair, meta, type));
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @name addFromSeed
|
|
115
|
-
* @summary Stores an account, given seed data, as a Key/Value (public key, pair) in Keyring Pair Dictionary
|
|
116
|
-
* @description Stores in a keyring pair dictionary the public key of the pair as a key and the pair as the associated value.
|
|
117
|
-
* Allows user to provide the account seed as an argument, and then generates a keyring pair from it that it passes to
|
|
118
|
-
* `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.
|
|
119
|
-
*/
|
|
120
|
-
addFromSeed(seed, meta = {}, type = this.type) {
|
|
121
|
-
return this.addPair((0, index_js_1.createPair)({ toSS58: this.encodeAddress, type }, PairFromSeed[type](seed), meta, null));
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* @name addFromUri
|
|
125
|
-
* @summary Creates an account via an suri
|
|
126
|
-
* @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)
|
|
127
|
-
*/
|
|
128
|
-
addFromUri(suri, meta = {}, type = this.type, wordlist) {
|
|
129
|
-
return this.addPair(this.createFromUri(suri, meta, type, wordlist));
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* @name createFromJson
|
|
133
|
-
* @description Creates a pair from a JSON keyfile
|
|
134
|
-
*/
|
|
135
|
-
createFromJson({ address, encoded, encoding: { content, type, version }, meta }, ignoreChecksum) {
|
|
136
|
-
if (version === '3' && content[0] !== 'pkcs8') {
|
|
137
|
-
throw new Error(`Unable to decode non-pkcs8 type, [${content.join(',')}] found}`);
|
|
138
|
-
}
|
|
139
|
-
const cryptoType = version === '0' || !Array.isArray(content)
|
|
140
|
-
? this.type
|
|
141
|
-
: content[1];
|
|
142
|
-
const encType = !Array.isArray(type)
|
|
143
|
-
? [type]
|
|
144
|
-
: type;
|
|
145
|
-
if (!['ed25519', 'sr25519', 'ecdsa', 'ethereum'].includes(cryptoType)) {
|
|
146
|
-
throw new Error(`Unknown crypto type ${cryptoType}`);
|
|
147
|
-
}
|
|
148
|
-
// Here the address and publicKey are 32 bytes and isomorphic. This is why the address field needs to be the public key for ethereum type pairs
|
|
149
|
-
const publicKey = (0, util_1.isHex)(address)
|
|
150
|
-
? (0, util_1.hexToU8a)(address)
|
|
151
|
-
: this.decodeAddress(address, ignoreChecksum);
|
|
152
|
-
const decoded = (0, util_1.isHex)(encoded)
|
|
153
|
-
? (0, util_1.hexToU8a)(encoded)
|
|
154
|
-
: (0, util_crypto_1.base64Decode)(encoded);
|
|
155
|
-
return (0, index_js_1.createPair)({ toSS58: this.encodeAddress, type: cryptoType }, { publicKey, secretKey: new Uint8Array() }, meta, decoded, encType);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* @name createFromPair
|
|
159
|
-
* @summary Creates a pair from an explicit publicKey/secreteKey combination
|
|
160
|
-
*/
|
|
161
|
-
createFromPair(pair, meta = {}, type = this.type) {
|
|
162
|
-
return (0, index_js_1.createPair)({ toSS58: this.encodeAddress, type }, pair, meta, null);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* @name createFromUri
|
|
166
|
-
* @summary Creates a Keypair from an suri
|
|
167
|
-
* @description This creates a pair from the suri, but does not add it to the keyring
|
|
168
|
-
*/
|
|
169
|
-
createFromUri(_suri, meta = {}, type = this.type, wordlist) {
|
|
170
|
-
// here we only aut-add the dev phrase if we have a hard-derived path
|
|
171
|
-
const suri = _suri.startsWith('//')
|
|
172
|
-
? `${defaults_js_1.DEV_PHRASE}${_suri}`
|
|
173
|
-
: _suri;
|
|
174
|
-
const { derivePath, password, path, phrase } = (0, util_crypto_1.keyExtractSuri)(suri);
|
|
175
|
-
let seed;
|
|
176
|
-
const isPhraseHex = (0, util_1.isHex)(phrase, 256);
|
|
177
|
-
if (isPhraseHex) {
|
|
178
|
-
seed = (0, util_1.hexToU8a)(phrase);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
const parts = phrase.split(' ');
|
|
182
|
-
if ([12, 15, 18, 21, 24].includes(parts.length)) {
|
|
183
|
-
seed = type === 'ethereum'
|
|
184
|
-
? (0, util_crypto_1.mnemonicToLegacySeed)(phrase, '', false, 64)
|
|
185
|
-
: (0, util_crypto_1.mnemonicToMiniSecret)(phrase, password, wordlist);
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
if (phrase.length > 32) {
|
|
189
|
-
throw new Error('specified phrase is not a valid mnemonic and is invalid as a raw seed at > 32 bytes');
|
|
190
|
-
}
|
|
191
|
-
seed = (0, util_1.stringToU8a)(phrase.padEnd(32));
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
const derived = type === 'ethereum'
|
|
195
|
-
? isPhraseHex
|
|
196
|
-
? PairFromSeed[type](seed) // for eth, if the private key is provided as suri, it must be derived only once
|
|
197
|
-
: (0, util_crypto_1.hdEthereum)(seed, derivePath.substring(1))
|
|
198
|
-
: (0, util_crypto_1.keyFromPath)(PairFromSeed[type](seed), path, type);
|
|
199
|
-
return (0, index_js_1.createPair)({ toSS58: this.encodeAddress, type }, derived, meta, null);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* @name encodeAddress
|
|
203
|
-
* @description Encodes the input into an ss58 representation
|
|
204
|
-
*/
|
|
205
|
-
encodeAddress = (address, ss58Format) => {
|
|
206
|
-
return this.type === 'ethereum'
|
|
207
|
-
? (0, util_crypto_1.ethereumEncode)(address)
|
|
208
|
-
: (0, util_crypto_1.encodeAddress)(address, ss58Format ?? this.#ss58);
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* @name getPair
|
|
212
|
-
* @summary Retrieves an account keyring pair from the Keyring Pair Dictionary, given an account address
|
|
213
|
-
* @description Returns a keyring pair value from the keyring pair dictionary by performing
|
|
214
|
-
* a key lookup using the provided account address or public key (after decoding it).
|
|
215
|
-
*/
|
|
216
|
-
getPair(address) {
|
|
217
|
-
return this.#pairs.get(address);
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* @name getPairs
|
|
221
|
-
* @summary Retrieves all account keyring pairs from the Keyring Pair Dictionary
|
|
222
|
-
* @description Returns an array list of all the keyring pair values that are stored in the keyring pair dictionary.
|
|
223
|
-
*/
|
|
224
|
-
getPairs() {
|
|
225
|
-
return this.#pairs.all();
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* @name getPublicKeys
|
|
229
|
-
* @summary Retrieves Public Keys of all Keyring Pairs stored in the Keyring Pair Dictionary
|
|
230
|
-
* @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.
|
|
231
|
-
*/
|
|
232
|
-
getPublicKeys() {
|
|
233
|
-
return this.#pairs.all().map(pairToPublic);
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* @name removePair
|
|
237
|
-
* @description Deletes the provided input address or public key from the stored Keyring Pair Dictionary.
|
|
238
|
-
*/
|
|
239
|
-
removePair(address) {
|
|
240
|
-
this.#pairs.remove(address);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* @name setSS58Format;
|
|
244
|
-
* @description Sets the ss58 format for the keyring
|
|
245
|
-
*/
|
|
246
|
-
setSS58Format(ss58) {
|
|
247
|
-
this.#ss58 = ss58;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* @name toJson
|
|
251
|
-
* @summary Returns a JSON object associated with the input argument that contains metadata assocated with an account
|
|
252
|
-
* @description Returns a JSON object containing the metadata associated with an account
|
|
253
|
-
* when valid address or public key and when the account passphrase is provided if the account secret
|
|
254
|
-
* is not already unlocked and available in memory. Note that in [Polkadot-JS Apps](https://github.com/polkadot-js/apps) the user
|
|
255
|
-
* may backup their account to a JSON file that contains this information.
|
|
256
|
-
*/
|
|
257
|
-
toJson(address, passphrase) {
|
|
258
|
-
return this.#pairs.get(address).toJson(passphrase);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
exports.Keyring = Keyring;
|
package/build/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require("@pezkuwi/util");
|
|
4
|
-
const packageInfo_1 = require("@pezkuwi/util/cjs/packageInfo");
|
|
5
|
-
const packageInfo_2 = require("@pezkuwi/util-crypto/cjs/packageInfo");
|
|
6
|
-
const packageInfo_js_1 = require("./packageInfo.js");
|
|
7
|
-
(0, util_1.detectPackage)(packageInfo_js_1.packageInfo, null, [packageInfo_2.packageInfo, packageInfo_1.packageInfo]);
|
package/build/cjs/packageInfo.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { EncryptedJsonEncoding } from '@pezkuwi/util-crypto/types';
|
|
2
|
-
/**
|
|
3
|
-
* Decode a pair, taking into account the generation-specific formats and headers
|
|
4
|
-
*
|
|
5
|
-
* For divisor/headers, don't rely on the magic being static. These will
|
|
6
|
-
* change between generations, aka with the long-awaited 4th generation
|
|
7
|
-
* of the format. The external decode interface is the only way to use and decode these.
|
|
8
|
-
**/
|
|
9
|
-
export declare function decodePair(passphrase?: string, encrypted?: Uint8Array | null, _encType?: EncryptedJsonEncoding | EncryptedJsonEncoding[]): {
|
|
10
|
-
publicKey: Uint8Array;
|
|
11
|
-
secretKey: Uint8Array;
|
|
12
|
-
};
|
package/build/cjs/pair/decode.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodePair = decodePair;
|
|
4
|
-
const util_1 = require("@pezkuwi/util");
|
|
5
|
-
const util_crypto_1 = require("@pezkuwi/util-crypto");
|
|
6
|
-
const defaults_js_1 = require("./defaults.js");
|
|
7
|
-
const SEED_OFFSET = defaults_js_1.PAIR_HDR.length;
|
|
8
|
-
/**
|
|
9
|
-
* Decode a pair, taking into account the generation-specific formats and headers
|
|
10
|
-
*
|
|
11
|
-
* For divisor/headers, don't rely on the magic being static. These will
|
|
12
|
-
* change between generations, aka with the long-awaited 4th generation
|
|
13
|
-
* of the format. The external decode interface is the only way to use and decode these.
|
|
14
|
-
**/
|
|
15
|
-
function decodePair(passphrase, encrypted, _encType) {
|
|
16
|
-
const encType = Array.isArray(_encType) || _encType === undefined
|
|
17
|
-
? _encType
|
|
18
|
-
: [_encType];
|
|
19
|
-
const decrypted = (0, util_crypto_1.jsonDecryptData)(encrypted, passphrase, encType);
|
|
20
|
-
const header = decrypted.subarray(0, defaults_js_1.PAIR_HDR.length);
|
|
21
|
-
// check the start header (generations 1-3)
|
|
22
|
-
if (!(0, util_1.u8aEq)(header, defaults_js_1.PAIR_HDR)) {
|
|
23
|
-
throw new Error('Invalid encoding header found in body');
|
|
24
|
-
}
|
|
25
|
-
// setup for generation 3 format
|
|
26
|
-
let secretKey = decrypted.subarray(SEED_OFFSET, SEED_OFFSET + defaults_js_1.SEC_LENGTH);
|
|
27
|
-
let divOffset = SEED_OFFSET + defaults_js_1.SEC_LENGTH;
|
|
28
|
-
let divider = decrypted.subarray(divOffset, divOffset + defaults_js_1.PAIR_DIV.length);
|
|
29
|
-
// old-style (generation 1 & 2), we have the seed here
|
|
30
|
-
if (!(0, util_1.u8aEq)(divider, defaults_js_1.PAIR_DIV)) {
|
|
31
|
-
divOffset = SEED_OFFSET + defaults_js_1.SEED_LENGTH;
|
|
32
|
-
secretKey = decrypted.subarray(SEED_OFFSET, divOffset);
|
|
33
|
-
divider = decrypted.subarray(divOffset, divOffset + defaults_js_1.PAIR_DIV.length);
|
|
34
|
-
// check the divisior at this point (already checked for generation 3)
|
|
35
|
-
if (!(0, util_1.u8aEq)(divider, defaults_js_1.PAIR_DIV)) {
|
|
36
|
-
throw new Error('Invalid encoding divider found in body');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const pubOffset = divOffset + defaults_js_1.PAIR_DIV.length;
|
|
40
|
-
const publicKey = decrypted.subarray(pubOffset, pubOffset + defaults_js_1.PUB_LENGTH);
|
|
41
|
-
return {
|
|
42
|
-
publicKey,
|
|
43
|
-
secretKey
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** public/secret section divider (generation 1-3, will change in 4, don't rely on value) */
|
|
2
|
-
export declare const PAIR_DIV: Uint8Array<ArrayBuffer>;
|
|
3
|
-
/** public/secret start block (generation 1-3, will change in 4, don't rely on value) */
|
|
4
|
-
export declare const PAIR_HDR: Uint8Array<ArrayBuffer>;
|
|
5
|
-
/** length of a public key */
|
|
6
|
-
export declare const PUB_LENGTH = 32;
|
|
7
|
-
/** length of a salt */
|
|
8
|
-
export declare const SALT_LENGTH = 32;
|
|
9
|
-
/** length of a secret key */
|
|
10
|
-
export declare const SEC_LENGTH = 64;
|
|
11
|
-
/** length of a user-input seed */
|
|
12
|
-
export declare const SEED_LENGTH = 32;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SEED_LENGTH = exports.SEC_LENGTH = exports.SALT_LENGTH = exports.PUB_LENGTH = exports.PAIR_HDR = exports.PAIR_DIV = void 0;
|
|
4
|
-
/** public/secret section divider (generation 1-3, will change in 4, don't rely on value) */
|
|
5
|
-
exports.PAIR_DIV = new Uint8Array([161, 35, 3, 33, 0]);
|
|
6
|
-
/** public/secret start block (generation 1-3, will change in 4, don't rely on value) */
|
|
7
|
-
exports.PAIR_HDR = new Uint8Array([48, 83, 2, 1, 1, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32]);
|
|
8
|
-
/** length of a public key */
|
|
9
|
-
exports.PUB_LENGTH = 32;
|
|
10
|
-
/** length of a salt */
|
|
11
|
-
exports.SALT_LENGTH = 32;
|
|
12
|
-
/** length of a secret key */
|
|
13
|
-
exports.SEC_LENGTH = 64;
|
|
14
|
-
/** length of a user-input seed */
|
|
15
|
-
exports.SEED_LENGTH = 32;
|
package/build/cjs/pair/encode.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodePair = encodePair;
|
|
4
|
-
const util_1 = require("@pezkuwi/util");
|
|
5
|
-
const util_crypto_1 = require("@pezkuwi/util-crypto");
|
|
6
|
-
const defaults_js_1 = require("./defaults.js");
|
|
7
|
-
/**
|
|
8
|
-
* Encode a pair with the latest generation format (generation 3)
|
|
9
|
-
**/
|
|
10
|
-
function encodePair({ publicKey, secretKey }, passphrase) {
|
|
11
|
-
if (!secretKey) {
|
|
12
|
-
throw new Error('Expected a valid secretKey to be passed to encode');
|
|
13
|
-
}
|
|
14
|
-
const encoded = (0, util_1.u8aConcat)(defaults_js_1.PAIR_HDR, secretKey, defaults_js_1.PAIR_DIV, publicKey);
|
|
15
|
-
if (!passphrase) {
|
|
16
|
-
return encoded;
|
|
17
|
-
}
|
|
18
|
-
// this is only for generation 3 (previous generations are only handled in decoding)
|
|
19
|
-
const { params, password, salt } = (0, util_crypto_1.scryptEncode)(passphrase);
|
|
20
|
-
const { encrypted, nonce } = (0, util_crypto_1.naclEncrypt)(encoded, password.subarray(0, 32));
|
|
21
|
-
return (0, util_1.u8aConcat)((0, util_crypto_1.scryptToU8a)(salt, params), nonce, encrypted);
|
|
22
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { EncryptedJsonEncoding, KeypairType } from '@pezkuwi/util-crypto/types';
|
|
2
|
-
import type { KeyringPair, KeyringPair$Meta } from '../types.js';
|
|
3
|
-
import type { PairInfo } from './types.js';
|
|
4
|
-
interface Setup {
|
|
5
|
-
toSS58: (publicKey: Uint8Array) => string;
|
|
6
|
-
type: KeypairType;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @name createPair
|
|
10
|
-
* @summary Creates a keyring pair object
|
|
11
|
-
* @description Creates a keyring pair object with provided account public key, metadata, and encoded arguments.
|
|
12
|
-
* The keyring pair stores the account state including the encoded address and associated metadata.
|
|
13
|
-
*
|
|
14
|
-
* It has properties whose values are functions that may be called to perform account actions:
|
|
15
|
-
*
|
|
16
|
-
* - `address` function retrieves the address associated with the account.
|
|
17
|
-
* - `decodedPkcs8` function is called with the account passphrase and account encoded public key.
|
|
18
|
-
* It decodes the encoded public key using the passphrase provided to obtain the decoded account public key
|
|
19
|
-
* and associated secret key that are then available in memory, and changes the account address stored in the
|
|
20
|
-
* state of the pair to correspond to the address of the decoded public key.
|
|
21
|
-
* - `encodePkcs8` function when provided with the correct passphrase associated with the account pair
|
|
22
|
-
* and when the secret key is in memory (when the account pair is not locked) it returns an encoded
|
|
23
|
-
* public key of the account.
|
|
24
|
-
* - `meta` is the metadata that is stored in the state of the pair, either when it was originally
|
|
25
|
-
* created or set via `setMeta`.
|
|
26
|
-
* - `publicKey` returns the public key stored in memory for the pair.
|
|
27
|
-
* - `sign` may be used to return a signature by signing a provided message with the secret
|
|
28
|
-
* key (if it is in memory) using Nacl.
|
|
29
|
-
* - `toJson` calls another `toJson` function and provides the state of the pair,
|
|
30
|
-
* it generates arguments to be passed to the other `toJson` function including an encoded public key of the account
|
|
31
|
-
* that it generates using the secret key from memory (if it has been made available in memory)
|
|
32
|
-
* and the optionally provided passphrase argument. It passes a third boolean argument to `toJson`
|
|
33
|
-
* indicating whether the public key has been encoded or not (if a passphrase argument was provided then it is encoded).
|
|
34
|
-
* The `toJson` function that it calls returns a JSON object with properties including the `address`
|
|
35
|
-
* and `meta` that are assigned with the values stored in the corresponding state variables of the account pair,
|
|
36
|
-
* an `encoded` property that is assigned with the encoded public key in hex format, and an `encoding`
|
|
37
|
-
* property that indicates whether the public key value of the `encoded` property is encoded or not.
|
|
38
|
-
*/
|
|
39
|
-
export declare function createPair({ toSS58, type }: Setup, { publicKey, secretKey }: PairInfo, meta?: KeyringPair$Meta, encoded?: Uint8Array | null, encTypes?: EncryptedJsonEncoding[]): KeyringPair;
|
|
40
|
-
export {};
|