@ocap/mcrypto 1.27.16 → 1.28.1

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.
Files changed (66) hide show
  1. package/esm/crypter/aes-legacy.d.ts +8 -6
  2. package/esm/crypter/aes-legacy.js +27 -24
  3. package/esm/crypter/aes.d.ts +9 -7
  4. package/esm/crypter/aes.js +27 -25
  5. package/esm/crypter/rsa-browserify.d.ts +7 -6
  6. package/esm/crypter/rsa-browserify.js +34 -31
  7. package/esm/crypter/rsa.d.ts +11 -9
  8. package/esm/crypter/rsa.js +31 -28
  9. package/esm/encode.d.ts +12 -8
  10. package/esm/encode.js +13 -18
  11. package/esm/hasher/keccak.d.ts +8 -5
  12. package/esm/hasher/keccak.js +37 -36
  13. package/esm/hasher/sha2.d.ts +8 -5
  14. package/esm/hasher/sha2.js +42 -40
  15. package/esm/hasher/sha3.d.ts +8 -5
  16. package/esm/hasher/sha3.js +37 -36
  17. package/esm/index.d.ts +148 -143
  18. package/esm/index.js +172 -209
  19. package/esm/protocols/crypter.d.ts +3 -1
  20. package/esm/protocols/crypter.js +7 -4
  21. package/esm/protocols/hasher.d.ts +3 -1
  22. package/esm/protocols/hasher.js +7 -4
  23. package/esm/protocols/signer.d.ts +3 -1
  24. package/esm/protocols/signer.js +7 -4
  25. package/esm/signer/ed25519.d.ts +49 -46
  26. package/esm/signer/ed25519.js +80 -80
  27. package/esm/signer/ethereum.d.ts +11 -8
  28. package/esm/signer/ethereum.js +34 -34
  29. package/esm/signer/passkey.d.ts +21 -18
  30. package/esm/signer/passkey.js +49 -58
  31. package/esm/signer/secp256k1.d.ts +35 -32
  32. package/esm/signer/secp256k1.js +80 -93
  33. package/lib/_virtual/rolldown_runtime.js +29 -0
  34. package/lib/crypter/aes-legacy.d.ts +8 -6
  35. package/lib/crypter/aes-legacy.js +35 -52
  36. package/lib/crypter/aes.d.ts +9 -7
  37. package/lib/crypter/aes.js +29 -29
  38. package/lib/crypter/rsa-browserify.d.ts +7 -6
  39. package/lib/crypter/rsa-browserify.js +36 -33
  40. package/lib/crypter/rsa.d.ts +11 -9
  41. package/lib/crypter/rsa.js +33 -32
  42. package/lib/encode.d.ts +12 -8
  43. package/lib/encode.js +14 -21
  44. package/lib/hasher/keccak.d.ts +8 -5
  45. package/lib/hasher/keccak.js +40 -41
  46. package/lib/hasher/sha2.d.ts +8 -5
  47. package/lib/hasher/sha2.js +43 -42
  48. package/lib/hasher/sha3.d.ts +8 -5
  49. package/lib/hasher/sha3.js +40 -41
  50. package/lib/index.d.ts +148 -143
  51. package/lib/index.js +177 -216
  52. package/lib/protocols/crypter.d.ts +3 -1
  53. package/lib/protocols/crypter.js +10 -9
  54. package/lib/protocols/hasher.d.ts +3 -1
  55. package/lib/protocols/hasher.js +10 -9
  56. package/lib/protocols/signer.d.ts +3 -1
  57. package/lib/protocols/signer.js +10 -9
  58. package/lib/signer/ed25519.d.ts +49 -46
  59. package/lib/signer/ed25519.js +85 -86
  60. package/lib/signer/ethereum.d.ts +11 -8
  61. package/lib/signer/ethereum.js +38 -39
  62. package/lib/signer/passkey.d.ts +21 -18
  63. package/lib/signer/passkey.js +51 -63
  64. package/lib/signer/secp256k1.d.ts +35 -32
  65. package/lib/signer/secp256k1.js +85 -99
  66. package/package.json +21 -10
package/esm/index.js CHANGED
@@ -1,220 +1,183 @@
1
- import randomBytes from 'randombytes';
2
- import { encode } from './encode';
3
- import keccak from './hasher/keccak';
4
- import sha2 from './hasher/sha2';
5
- import sha3 from './hasher/sha3';
6
- import ed25519 from './signer/ed25519';
7
- import ethereum from './signer/ethereum';
8
- import secp256k1 from './signer/secp256k1';
9
- import passkey from './signer/passkey';
1
+ import { encode } from "./encode.js";
2
+ import keccak_default from "./hasher/keccak.js";
3
+ import sha2_default from "./hasher/sha2.js";
4
+ import sha3_default from "./hasher/sha3.js";
5
+ import ed25519_default from "./signer/ed25519.js";
6
+ import secp256k1_default from "./signer/secp256k1.js";
7
+ import ethereum_default from "./signer/ethereum.js";
8
+ import passkey_default from "./signer/passkey.js";
9
+ import randomBytes from "randombytes";
10
+
11
+ //#region src/index.ts
10
12
  /**
11
- * Contains all supported signers, eg: `Ed25519` and `Secp256k1`
12
- *
13
- * @readonly
14
- * @type {object}
15
- * @name Signer
16
- * @static
17
- * @example
18
- * const { Signer } = require('@ocap/mcrypto');
19
- * const message = 'some message to sign';
20
- *
21
- * // Use Signer directly
22
- * const keyPair = Signer.Ed25519.genKeyPair();
23
- * const signature = Signer.Ed25519.sign(message, keyPair.secretKey);
24
- * const result = Signer.Ed25519.verify(message, signature, keyPair.publicKey);
25
- * assert.ok(result);
26
- */
27
- export const Signer = {
28
- Ed25519: ed25519,
29
- Secp256k1: secp256k1,
30
- Ethereum: ethereum,
31
- Passkey: passkey,
13
+ * Contains all supported signers, eg: `Ed25519` and `Secp256k1`
14
+ *
15
+ * @readonly
16
+ * @type {object}
17
+ * @name Signer
18
+ * @static
19
+ * @example
20
+ * const { Signer } = require('@ocap/mcrypto');
21
+ * const message = 'some message to sign';
22
+ *
23
+ * // Use Signer directly
24
+ * const keyPair = Signer.Ed25519.genKeyPair();
25
+ * const signature = Signer.Ed25519.sign(message, keyPair.secretKey);
26
+ * const result = Signer.Ed25519.verify(message, signature, keyPair.publicKey);
27
+ * assert.ok(result);
28
+ */
29
+ const Signer = {
30
+ Ed25519: ed25519_default,
31
+ Secp256k1: secp256k1_default,
32
+ Ethereum: ethereum_default,
33
+ Passkey: passkey_default
32
34
  };
33
35
  /**
34
- * Contains all supported hasher, eg: `SHA2`,`SHA3` and `Keccak`, each of them supports `hash224`, `hash256`, `hash384`, `hash512`
35
- *
36
- * @readonly
37
- * @type {object}
38
- * @name Hasher
39
- * @static
40
- * @example
41
- * const { Hasher } = require('@ocap/mcrypto');
42
- *
43
- * const message = 'message to hash';
44
- * const hash = Hasher.SHA2.hash256(message);
45
- */
46
- export const Hasher = {
47
- SHA2: sha2,
48
- SHA3: sha3,
49
- Keccak: keccak,
36
+ * Contains all supported hasher, eg: `SHA2`,`SHA3` and `Keccak`, each of them supports `hash224`, `hash256`, `hash384`, `hash512`
37
+ *
38
+ * @readonly
39
+ * @type {object}
40
+ * @name Hasher
41
+ * @static
42
+ * @example
43
+ * const { Hasher } = require('@ocap/mcrypto');
44
+ *
45
+ * const message = 'message to hash';
46
+ * const hash = Hasher.SHA2.hash256(message);
47
+ */
48
+ const Hasher = {
49
+ SHA2: sha2_default,
50
+ SHA3: sha3_default,
51
+ Keccak: keccak_default
50
52
  };
51
53
  /**
52
- * Contains type constants that represent can be used to compose different crypto method, each crypto method consist one of:
53
- * FIXME: enum definition of forge-abi and abt-did-elixir are not exactly the same
54
- *
55
- * @readonly
56
- * @type {object}
57
- * @name types
58
- * @static
59
- * @example
60
- * const { types } = require('@ocap/mcrypto');
61
- *
62
- * // types.RoleType.ROLE_ACCOUNT
63
- * // types.KeyType.ED25519
64
- * // types.HashType.SHA3
65
- * // types.EncodingType.BASE58
66
- */
67
- export const types = {
68
- /**
69
- * Key-pair derivation algorithms
70
- *
71
- * @readonly
72
- * @enum {number}
73
- * @name types.KeyType
74
- * @memberof types
75
- * @static
76
- */
77
- KeyType: {
78
- ED25519: 0,
79
- SECP256K1: 1,
80
- ETHEREUM: 2,
81
- PASSKEY: 3,
82
- },
83
- /**
84
- * Hashing algorithms
85
- *
86
- * @readonly
87
- * @enum {number}
88
- * @name types.HashType
89
- * @memberof types
90
- * @static
91
- */
92
- HashType: {
93
- KECCAK: 0,
94
- SHA3: 1,
95
- KECCAK_384: 2,
96
- SHA3_384: 3,
97
- KECCAK_512: 4,
98
- SHA3_512: 5,
99
- SHA2: 6,
100
- },
101
- /**
102
- * DID wallet role type
103
- *
104
- * @readonly
105
- * @enum {number}
106
- * @name types.RoleType
107
- * @memberof types
108
- * @static
109
- */
110
- RoleType: {
111
- ROLE_ACCOUNT: 0,
112
- ROLE_NODE: 1,
113
- ROLE_DEVICE: 2,
114
- ROLE_APPLICATION: 3,
115
- ROLE_SMART_CONTRACT: 4,
116
- ROLE_BOT: 5,
117
- ROLE_ASSET: 6,
118
- ROLE_STAKE: 7,
119
- ROLE_VALIDATOR: 8,
120
- ROLE_GROUP: 9,
121
- ROLE_TX: 10,
122
- ROLE_TETHER: 11,
123
- ROLE_SWAP: 12,
124
- ROLE_DELEGATION: 13,
125
- ROLE_VC: 14,
126
- ROLE_BLOCKLET: 15,
127
- ROLE_STORE: 16,
128
- ROLE_TOKEN: 17,
129
- ROLE_FACTORY: 18,
130
- ROLE_ROLLUP: 19,
131
- ROLE_STORAGE: 20,
132
- ROLE_PROFILE: 21,
133
- ROLE_PASSKEY: 22,
134
- ROLE_TOKEN_FACTORY: 23,
135
- ROLE_ANY: 63,
136
- },
137
- /**
138
- * Address encoding algorithm, defaults to `base58btc`
139
- *
140
- * @readonly
141
- * @enum {number}
142
- * @name types.RoleType
143
- * @memberof types
144
- * @static
145
- */
146
- EncodingType: {
147
- BASE16: 0,
148
- BASE58: 1,
149
- },
54
+ * Contains type constants that represent can be used to compose different crypto method, each crypto method consist one of:
55
+ * FIXME: enum definition of forge-abi and abt-did-elixir are not exactly the same
56
+ *
57
+ * @readonly
58
+ * @type {object}
59
+ * @name types
60
+ * @static
61
+ * @example
62
+ * const { types } = require('@ocap/mcrypto');
63
+ *
64
+ * // types.RoleType.ROLE_ACCOUNT
65
+ * // types.KeyType.ED25519
66
+ * // types.HashType.SHA3
67
+ * // types.EncodingType.BASE58
68
+ */
69
+ const types = {
70
+ KeyType: {
71
+ ED25519: 0,
72
+ SECP256K1: 1,
73
+ ETHEREUM: 2,
74
+ PASSKEY: 3
75
+ },
76
+ HashType: {
77
+ KECCAK: 0,
78
+ SHA3: 1,
79
+ KECCAK_384: 2,
80
+ SHA3_384: 3,
81
+ KECCAK_512: 4,
82
+ SHA3_512: 5,
83
+ SHA2: 6
84
+ },
85
+ RoleType: {
86
+ ROLE_ACCOUNT: 0,
87
+ ROLE_NODE: 1,
88
+ ROLE_DEVICE: 2,
89
+ ROLE_APPLICATION: 3,
90
+ ROLE_SMART_CONTRACT: 4,
91
+ ROLE_BOT: 5,
92
+ ROLE_ASSET: 6,
93
+ ROLE_STAKE: 7,
94
+ ROLE_VALIDATOR: 8,
95
+ ROLE_GROUP: 9,
96
+ ROLE_TX: 10,
97
+ ROLE_TETHER: 11,
98
+ ROLE_SWAP: 12,
99
+ ROLE_DELEGATION: 13,
100
+ ROLE_VC: 14,
101
+ ROLE_BLOCKLET: 15,
102
+ ROLE_STORE: 16,
103
+ ROLE_TOKEN: 17,
104
+ ROLE_FACTORY: 18,
105
+ ROLE_ROLLUP: 19,
106
+ ROLE_STORAGE: 20,
107
+ ROLE_PROFILE: 21,
108
+ ROLE_PASSKEY: 22,
109
+ ROLE_TOKEN_FACTORY: 23,
110
+ ROLE_ANY: 63
111
+ },
112
+ EncodingType: {
113
+ BASE16: 0,
114
+ BASE58: 1
115
+ }
150
116
  };
151
117
  /**
152
- * Get signer instance
153
- *
154
- * @function
155
- * @param {number} type - algorithm used to derive key pair, possible values are
156
- * - types.KeyType.ED25519
157
- * - types.KeyType.SECP256k1
158
- * - types.KeyType.ETHEREUM
159
- * @returns {object} signer instance
160
- * @example
161
- * const { getSigner, types } = require('@ocap/mcrypto');
162
- * const message = 'some message to sign';
163
- *
164
- * const signer = getSigner(types.KeyType.ED25519);
165
- * const keyPair1 = signer.genKeyPair();
166
- * const signature1 = signer.sign(message, keyPair1.secretKey);
167
- * const result1 = signer.verify(message, signature1, keyPair1.publicKey);
168
- * assert.ok(result1);
169
- */
170
- export function getSigner(type) {
171
- if (typeof Signers[type] === 'undefined') {
172
- throw new Error(`Unsupported signer type: ${type}`);
173
- }
174
- // @ts-ignore
175
- return Signers[type];
118
+ * Get signer instance
119
+ *
120
+ * @function
121
+ * @param {number} type - algorithm used to derive key pair, possible values are
122
+ * - types.KeyType.ED25519
123
+ * - types.KeyType.SECP256k1
124
+ * - types.KeyType.ETHEREUM
125
+ * @returns {object} signer instance
126
+ * @example
127
+ * const { getSigner, types } = require('@ocap/mcrypto');
128
+ * const message = 'some message to sign';
129
+ *
130
+ * const signer = getSigner(types.KeyType.ED25519);
131
+ * const keyPair1 = signer.genKeyPair();
132
+ * const signature1 = signer.sign(message, keyPair1.secretKey);
133
+ * const result1 = signer.verify(message, signature1, keyPair1.publicKey);
134
+ * assert.ok(result1);
135
+ */
136
+ function getSigner(type) {
137
+ const Signers = Object.freeze({
138
+ [types.KeyType.ED25519]: Signer.Ed25519,
139
+ [types.KeyType.SECP256K1]: Signer.Secp256k1,
140
+ [types.KeyType.ETHEREUM]: Signer.Ethereum,
141
+ [types.KeyType.PASSKEY]: Signer.Passkey
142
+ });
143
+ if (typeof Signers[type] === "undefined") throw new Error(`Unsupported signer type: ${type}`);
144
+ return Signers[type];
176
145
  }
177
146
  /**
178
- * Get hasher instance
179
- *
180
- * @function
181
- * @param {number} type - algorithm used to hash data, possible values
182
- * - types.HashType.KECCAK
183
- * - types.HashType.KECCAK_384
184
- * - types.HashType.KECCAK_512
185
- * - types.HashType.SHA3
186
- * - types.HashType.SHA3_384
187
- * - types.HashType.SHA3_512
188
- * @returns {object} hasher instance
189
- * @example
190
- * const { getHasher, types } = require('@ocap/mcrypto');
191
- *
192
- * const hashFn = getHasher(types.HashType.SHA3);
193
- * const hash2 = hashFn(message);
194
- */
195
- export function getHasher(type) {
196
- if (typeof Hashers[type] === 'undefined') {
197
- throw new Error(`Unsupported hash type: ${type}`);
198
- }
199
- // @ts-ignore
200
- return Hashers[type];
147
+ * Get hasher instance
148
+ *
149
+ * @function
150
+ * @param {number} type - algorithm used to hash data, possible values
151
+ * - types.HashType.KECCAK
152
+ * - types.HashType.KECCAK_384
153
+ * - types.HashType.KECCAK_512
154
+ * - types.HashType.SHA3
155
+ * - types.HashType.SHA3_384
156
+ * - types.HashType.SHA3_512
157
+ * @returns {object} hasher instance
158
+ * @example
159
+ * const { getHasher, types } = require('@ocap/mcrypto');
160
+ *
161
+ * const hashFn = getHasher(types.HashType.SHA3);
162
+ * const hash2 = hashFn(message);
163
+ */
164
+ function getHasher(type) {
165
+ const Hashers = Object.freeze({
166
+ [types.HashType.KECCAK]: Hasher.Keccak.hash256,
167
+ [types.HashType.KECCAK_384]: Hasher.Keccak.hash384,
168
+ [types.HashType.KECCAK_512]: Hasher.Keccak.hash512,
169
+ [types.HashType.SHA3]: Hasher.SHA3.hash256,
170
+ [types.HashType.SHA3_384]: Hasher.SHA3.hash384,
171
+ [types.HashType.SHA3_512]: Hasher.SHA3.hash512,
172
+ [types.HashType.SHA2]: Hasher.SHA2.hash256
173
+ });
174
+ if (typeof Hashers[type] === "undefined") throw new Error(`Unsupported hash type: ${type}`);
175
+ return Hashers[type];
201
176
  }
202
- export function getRandomBytes(length = 32, encoding = 'hex') {
203
- return encode(randomBytes(length), encoding);
177
+ function getRandomBytes(length = 32, encoding = "hex") {
178
+ return encode(randomBytes(length), encoding);
204
179
  }
205
- export const Signers = Object.freeze({
206
- [types.KeyType.ED25519]: Signer.Ed25519,
207
- [types.KeyType.SECP256K1]: Signer.Secp256k1,
208
- [types.KeyType.ETHEREUM]: Signer.Ethereum,
209
- [types.KeyType.PASSKEY]: Signer.Passkey,
210
- });
211
- export const Hashers = Object.freeze({
212
- [types.HashType.KECCAK]: Hasher.Keccak.hash256,
213
- [types.HashType.KECCAK_384]: Hasher.Keccak.hash384,
214
- [types.HashType.KECCAK_512]: Hasher.Keccak.hash512,
215
- [types.HashType.SHA3]: Hasher.SHA3.hash256,
216
- [types.HashType.SHA3_384]: Hasher.SHA3.hash384,
217
- [types.HashType.SHA3_512]: Hasher.SHA3.hash512,
218
- [types.HashType.SHA2]: Hasher.SHA2.hash256,
219
- });
220
- export const toTxHash = (buf) => Hasher.SHA2.hash256(buf, 1, 'hex').replace(/^0x/, '').toUpperCase();
180
+ const toTxHash = (buf) => Hasher.SHA2.hash256(buf, 1, "hex").replace(/^0x/, "").toUpperCase();
181
+
182
+ //#endregion
183
+ export { Hasher, Signer, getHasher, getRandomBytes, getSigner, toTxHash, types };
@@ -1,2 +1,4 @@
1
+ //#region src/protocols/crypter.d.ts
1
2
  declare const _default: any;
2
- export default _default;
3
+ //#endregion
4
+ export { _default as default };
@@ -1,4 +1,7 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- // @ts-ignore
3
- import Interface from 'interface';
4
- export default Interface.create('encrypt', 'decrypt');
1
+ import Interface from "interface";
2
+
3
+ //#region src/protocols/crypter.ts
4
+ var crypter_default = Interface.create("encrypt", "decrypt");
5
+
6
+ //#endregion
7
+ export { crypter_default as default };
@@ -1,2 +1,4 @@
1
+ //#region src/protocols/hasher.d.ts
1
2
  declare const _default: any;
2
- export default _default;
3
+ //#endregion
4
+ export { _default as default };
@@ -1,4 +1,7 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- // @ts-ignore
3
- import Interface from 'interface';
4
- export default Interface.create('sha224', 'sha256', 'sha384', 'sha512');
1
+ import Interface from "interface";
2
+
3
+ //#region src/protocols/hasher.ts
4
+ var hasher_default = Interface.create("sha224", "sha256", "sha384", "sha512");
5
+
6
+ //#endregion
7
+ export { hasher_default as default };
@@ -1,2 +1,4 @@
1
+ //#region src/protocols/signer.d.ts
1
2
  declare const _default: any;
2
- export default _default;
3
+ //#endregion
4
+ export { _default as default };
@@ -1,4 +1,7 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- // @ts-ignore
3
- import Interface from 'interface';
4
- export default Interface.create('genKeyPair', 'getPublicKey', 'sign', 'verify');
1
+ import Interface from "interface";
2
+
3
+ //#region src/protocols/signer.ts
4
+ var signer_default = Interface.create("genKeyPair", "getPublicKey", "sign", "verify");
5
+
6
+ //#endregion
7
+ export { signer_default as default };
@@ -1,53 +1,56 @@
1
- import { BytesType, EncodingType, KeyPairType } from '@ocap/util';
2
- import BaseSigner from '../protocols/signer';
1
+ import _default$1 from "../protocols/signer.js";
2
+ import { BytesType, EncodingType, KeyPairType } from "@ocap/util";
3
+
4
+ //#region src/signer/ed25519.d.ts
5
+
3
6
  /**
4
7
  * Signer implementation for ed25519, based on `tweetnacl`
5
8
  *
6
9
  * @class Ed25519Signer
7
10
  */
8
- declare class Ed25519Signer extends BaseSigner {
9
- constructor();
10
- /**
11
- * @public
12
- * @typedefKeyPairType
13
- * @prop {string} publicKey - publicKey in hex format
14
- * @prop {string} secretKey - secretKey in hex format
15
- * @memberof Ed25519Signer
16
- */
17
- /**
18
- * Generate random secret/public key pair
19
- *
20
- * @param {Buffer|Uint8Array} [userSeed=undefined]
21
- * @param {string} [encoding='hex']
22
- * @returns {KeyPairType}
23
- * @memberof Ed25519Signer
24
- */
25
- genKeyPair(encoding?: EncodingType, userSeed?: BytesType): KeyPairType;
26
- /**
27
- * Get publicKey from secretKey
28
- *
29
- * @param {hex|buffer|base58|Uint8Array} sk - can be either a hex encoded string or a buffer
30
- * @returns {string} hex encoded publicKey
31
- */
32
- getPublicKey(sk: BytesType, encoding?: EncodingType): BytesType;
33
- /**
34
- * Sign a message and get the signature hex
35
- *
36
- * @param {hex|base58|buffer|Uint8Array} message
37
- * @param {hex|base58|buffer|Uint8Array} sk
38
- * @returns {string} hex encoded signature
39
- */
40
- sign(message: BytesType, sk: BytesType, encoding?: EncodingType): BytesType;
41
- /**
42
- * Verify if a signature is valid
43
- *
44
- * @param {string|buffer} message
45
- * @param {string|buffer} signature
46
- * @param {string|buffer} pk
47
- * @returns {bool}
48
- */
49
- verify(message: BytesType, signature: BytesType, pk: BytesType): boolean;
11
+ declare class Ed25519Signer extends _default$1 {
12
+ constructor();
13
+ /**
14
+ * @public
15
+ * @typedefKeyPairType
16
+ * @prop {string} publicKey - publicKey in hex format
17
+ * @prop {string} secretKey - secretKey in hex format
18
+ * @memberof Ed25519Signer
19
+ */
20
+ /**
21
+ * Generate random secret/public key pair
22
+ *
23
+ * @param {Buffer|Uint8Array} [userSeed=undefined]
24
+ * @param {string} [encoding='hex']
25
+ * @returns {KeyPairType}
26
+ * @memberof Ed25519Signer
27
+ */
28
+ genKeyPair(encoding?: EncodingType, userSeed?: BytesType): KeyPairType;
29
+ /**
30
+ * Get publicKey from secretKey
31
+ *
32
+ * @param {hex|buffer|base58|Uint8Array} sk - can be either a hex encoded string or a buffer
33
+ * @returns {string} hex encoded publicKey
34
+ */
35
+ getPublicKey(sk: BytesType, encoding?: EncodingType): BytesType;
36
+ /**
37
+ * Sign a message and get the signature hex
38
+ *
39
+ * @param {hex|base58|buffer|Uint8Array} message
40
+ * @param {hex|base58|buffer|Uint8Array} sk
41
+ * @returns {string} hex encoded signature
42
+ */
43
+ sign(message: BytesType, sk: BytesType, encoding?: EncodingType): BytesType;
44
+ /**
45
+ * Verify if a signature is valid
46
+ *
47
+ * @param {string|buffer} message
48
+ * @param {string|buffer} signature
49
+ * @param {string|buffer} pk
50
+ * @returns {bool}
51
+ */
52
+ verify(message: BytesType, signature: BytesType, pk: BytesType): boolean;
50
53
  }
51
54
  declare const _default: Ed25519Signer;
52
- export default _default;
53
- export { Ed25519Signer };
55
+ //#endregion
56
+ export { Ed25519Signer, _default as default };