@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
@@ -1,82 +1,82 @@
1
- /* eslint-disable @typescript-eslint/no-useless-constructor */
2
- import tweetnacl from 'tweetnacl';
3
- import randomBytes from 'randombytes';
4
- import { toUint8Array } from '@ocap/util';
5
- import BaseSigner from '../protocols/signer';
6
- import { encode } from '../encode';
1
+ import { encode } from "../encode.js";
2
+ import signer_default from "../protocols/signer.js";
3
+ import { toUint8Array } from "@ocap/util";
4
+ import randomBytes from "randombytes";
5
+ import tweetnacl from "tweetnacl";
6
+
7
+ //#region src/signer/ed25519.ts
7
8
  const ed25519 = tweetnacl.sign;
8
9
  /**
9
- * Signer implementation for ed25519, based on `tweetnacl`
10
- *
11
- * @class Ed25519Signer
12
- */
13
- class Ed25519Signer extends BaseSigner {
14
- constructor() {
15
- super();
16
- }
17
- /**
18
- * @public
19
- * @typedefKeyPairType
20
- * @prop {string} publicKey - publicKey in hex format
21
- * @prop {string} secretKey - secretKey in hex format
22
- * @memberof Ed25519Signer
23
- */
24
- /**
25
- * Generate random secret/public key pair
26
- *
27
- * @param {Buffer|Uint8Array} [userSeed=undefined]
28
- * @param {string} [encoding='hex']
29
- * @returns {KeyPairType}
30
- * @memberof Ed25519Signer
31
- */
32
- genKeyPair(encoding = 'hex', userSeed) {
33
- const seed = userSeed ? toUint8Array(userSeed) : new Uint8Array(randomBytes(32));
34
- if (seed.byteLength !== 32) {
35
- throw new Error('Invalid seed to generate key pair');
36
- }
37
- const keyPair = ed25519.keyPair.fromSeed(seed);
38
- keyPair.publicKey = encode(keyPair.publicKey, encoding);
39
- keyPair.secretKey = encode(keyPair.secretKey, encoding);
40
- return keyPair;
41
- }
42
- /**
43
- * Get publicKey from secretKey
44
- *
45
- * @param {hex|buffer|base58|Uint8Array} sk - can be either a hex encoded string or a buffer
46
- * @returns {string} hex encoded publicKey
47
- */
48
- getPublicKey(sk, encoding = 'hex') {
49
- const skBytes = toUint8Array(sk);
50
- const pk = ed25519.keyPair.fromSecretKey(skBytes).publicKey;
51
- return encode(pk, encoding);
52
- }
53
- /**
54
- * Sign a message and get the signature hex
55
- *
56
- * @param {hex|base58|buffer|Uint8Array} message
57
- * @param {hex|base58|buffer|Uint8Array} sk
58
- * @returns {string} hex encoded signature
59
- */
60
- sign(message, sk, encoding = 'hex') {
61
- const skBytes = toUint8Array(sk);
62
- const messageBytes = toUint8Array(message);
63
- const signature = ed25519.detached(messageBytes, skBytes);
64
- return encode(signature, encoding);
65
- }
66
- /**
67
- * Verify if a signature is valid
68
- *
69
- * @param {string|buffer} message
70
- * @param {string|buffer} signature
71
- * @param {string|buffer} pk
72
- * @returns {bool}
73
- */
74
- verify(message, signature, pk) {
75
- const pkBytes = toUint8Array(pk);
76
- const messageBytes = toUint8Array(message);
77
- const signatureBytes = toUint8Array(signature);
78
- return ed25519.detached.verify(messageBytes, signatureBytes, pkBytes);
79
- }
80
- }
81
- export default new Ed25519Signer();
82
- export { Ed25519Signer };
10
+ * Signer implementation for ed25519, based on `tweetnacl`
11
+ *
12
+ * @class Ed25519Signer
13
+ */
14
+ var Ed25519Signer = class extends signer_default {
15
+ constructor() {
16
+ super();
17
+ }
18
+ /**
19
+ * @public
20
+ * @typedefKeyPairType
21
+ * @prop {string} publicKey - publicKey in hex format
22
+ * @prop {string} secretKey - secretKey in hex format
23
+ * @memberof Ed25519Signer
24
+ */
25
+ /**
26
+ * Generate random secret/public key pair
27
+ *
28
+ * @param {Buffer|Uint8Array} [userSeed=undefined]
29
+ * @param {string} [encoding='hex']
30
+ * @returns {KeyPairType}
31
+ * @memberof Ed25519Signer
32
+ */
33
+ genKeyPair(encoding = "hex", userSeed) {
34
+ const seed = userSeed ? toUint8Array(userSeed) : new Uint8Array(randomBytes(32));
35
+ if (seed.byteLength !== 32) throw new Error("Invalid seed to generate key pair");
36
+ const keyPair = ed25519.keyPair.fromSeed(seed);
37
+ keyPair.publicKey = encode(keyPair.publicKey, encoding);
38
+ keyPair.secretKey = encode(keyPair.secretKey, encoding);
39
+ return keyPair;
40
+ }
41
+ /**
42
+ * Get publicKey from secretKey
43
+ *
44
+ * @param {hex|buffer|base58|Uint8Array} sk - can be either a hex encoded string or a buffer
45
+ * @returns {string} hex encoded publicKey
46
+ */
47
+ getPublicKey(sk, encoding = "hex") {
48
+ const skBytes = toUint8Array(sk);
49
+ const pk = ed25519.keyPair.fromSecretKey(skBytes).publicKey;
50
+ return encode(pk, encoding);
51
+ }
52
+ /**
53
+ * Sign a message and get the signature hex
54
+ *
55
+ * @param {hex|base58|buffer|Uint8Array} message
56
+ * @param {hex|base58|buffer|Uint8Array} sk
57
+ * @returns {string} hex encoded signature
58
+ */
59
+ sign(message, sk, encoding = "hex") {
60
+ const skBytes = toUint8Array(sk);
61
+ const messageBytes = toUint8Array(message);
62
+ return encode(ed25519.detached(messageBytes, skBytes), encoding);
63
+ }
64
+ /**
65
+ * Verify if a signature is valid
66
+ *
67
+ * @param {string|buffer} message
68
+ * @param {string|buffer} signature
69
+ * @param {string|buffer} pk
70
+ * @returns {bool}
71
+ */
72
+ verify(message, signature, pk) {
73
+ const pkBytes = toUint8Array(pk);
74
+ const messageBytes = toUint8Array(message);
75
+ const signatureBytes = toUint8Array(signature);
76
+ return ed25519.detached.verify(messageBytes, signatureBytes, pkBytes);
77
+ }
78
+ };
79
+ var ed25519_default = new Ed25519Signer();
80
+
81
+ //#endregion
82
+ export { Ed25519Signer, ed25519_default as default };
@@ -1,16 +1,19 @@
1
- import { Secp256k1Signer } from './secp256k1';
1
+ import { Secp256k1Signer } from "./secp256k1.js";
2
+
3
+ //#region src/signer/ethereum.d.ts
4
+
2
5
  /**
3
6
  * Signer implementation for secp256k1, based on `elliptic`, and ethereum compatible
4
7
  *
5
8
  * @class EthereumSigner
6
9
  */
7
10
  declare class EthereumSigner extends Secp256k1Signer {
8
- pkHasFormatPrefix: boolean;
9
- constructor();
10
- ethHash(data: string): string;
11
- ethSign(data: string, privateKey: string): string;
12
- ethRecover(data: string, signature: string): string;
11
+ pkHasFormatPrefix: boolean;
12
+ constructor();
13
+ ethHash(data: string): string;
14
+ ethSign(data: string, privateKey: string): string;
15
+ ethRecover(data: string, signature: string): string;
13
16
  }
14
17
  declare const _default: EthereumSigner;
15
- export default _default;
16
- export { EthereumSigner };
18
+ //#endregion
19
+ export { EthereumSigner, _default as default };
@@ -1,35 +1,35 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- // @ts-ignore
3
- import Account from 'eth-lib/lib/account';
4
- // @ts-ignore
5
- import Hash from 'eth-lib/lib/hash';
6
- import { isHexStrict, utf8ToHex, hexToBytes } from '@ocap/util';
7
- import { Secp256k1Signer } from './secp256k1';
1
+ import { Secp256k1Signer } from "./secp256k1.js";
2
+ import { hexToBytes, isHexStrict, utf8ToHex } from "@ocap/util";
3
+ import Account from "eth-lib/lib/account.js";
4
+ import Hash from "eth-lib/lib/hash.js";
5
+
6
+ //#region src/signer/ethereum.ts
8
7
  /**
9
- * Signer implementation for secp256k1, based on `elliptic`, and ethereum compatible
10
- *
11
- * @class EthereumSigner
12
- */
13
- class EthereumSigner extends Secp256k1Signer {
14
- constructor() {
15
- super();
16
- this.pkHasFormatPrefix = false;
17
- }
18
- ethHash(data) {
19
- const messageHex = isHexStrict(data) ? data : utf8ToHex(data);
20
- const messageBytes = hexToBytes(messageHex);
21
- const messageBuffer = Buffer.from(messageBytes);
22
- const preamble = `\x19Ethereum Signed Message:\n${messageBytes.length}`;
23
- const preambleBuffer = Buffer.from(preamble);
24
- const ethMessage = Buffer.concat([preambleBuffer, messageBuffer]);
25
- return Hash.keccak256s(ethMessage);
26
- }
27
- ethSign(data, privateKey) {
28
- return Account.sign(data, privateKey);
29
- }
30
- ethRecover(data, signature) {
31
- return Account.recover(data, signature);
32
- }
33
- }
34
- export default new EthereumSigner();
35
- export { EthereumSigner };
8
+ * Signer implementation for secp256k1, based on `elliptic`, and ethereum compatible
9
+ *
10
+ * @class EthereumSigner
11
+ */
12
+ var EthereumSigner = class extends Secp256k1Signer {
13
+ constructor() {
14
+ super();
15
+ this.pkHasFormatPrefix = false;
16
+ }
17
+ ethHash(data) {
18
+ const messageBytes = hexToBytes(isHexStrict(data) ? data : utf8ToHex(data));
19
+ const messageBuffer = Buffer.from(messageBytes);
20
+ const preamble = `\x19Ethereum Signed Message:\n${messageBytes.length}`;
21
+ const preambleBuffer = Buffer.from(preamble);
22
+ const ethMessage = Buffer.concat([preambleBuffer, messageBuffer]);
23
+ return Hash.keccak256s(ethMessage);
24
+ }
25
+ ethSign(data, privateKey) {
26
+ return Account.sign(data, privateKey);
27
+ }
28
+ ethRecover(data, signature) {
29
+ return Account.recover(data, signature);
30
+ }
31
+ };
32
+ var ethereum_default = new EthereumSigner();
33
+
34
+ //#endregion
35
+ export { EthereumSigner, ethereum_default as default };
@@ -1,5 +1,8 @@
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/passkey.d.ts
5
+
3
6
  /**
4
7
  * Signer implementation for passkey, based on `@simplewebauthn/server`
5
8
  * Since passkey supports only verification, we do not need to implement the sign method
@@ -7,21 +10,21 @@ import BaseSigner from '../protocols/signer';
7
10
  *
8
11
  * @class PasskeySigner
9
12
  */
10
- declare class PasskeySigner extends BaseSigner {
11
- constructor();
12
- genKeyPair(encoding?: EncodingType, userSeed?: BytesType): KeyPairType;
13
- getPublicKey(sk: BytesType, encoding?: EncodingType): BytesType;
14
- sign(message: BytesType, sk: BytesType, encoding?: EncodingType): BytesType;
15
- /**
16
- * Verify if a signature is valid
17
- *
18
- * @param {string|buffer} challenge - the challenge sent to passkey, should be txHash when signing a transaction
19
- * @param {string|buffer} signature - signature from passkey
20
- * @param {string|buffer} pk - credentialPublicKey from passkey, must be parsed with `parseAuthenticatorData`
21
- * @returns {bool}
22
- */
23
- verify(challenge: BytesType, signature: BytesType, pk: BytesType, extra: string): Promise<boolean>;
13
+ declare class PasskeySigner extends _default$1 {
14
+ constructor();
15
+ genKeyPair(encoding?: EncodingType, userSeed?: BytesType): KeyPairType;
16
+ getPublicKey(sk: BytesType, encoding?: EncodingType): BytesType;
17
+ sign(message: BytesType, sk: BytesType, encoding?: EncodingType): BytesType;
18
+ /**
19
+ * Verify if a signature is valid
20
+ *
21
+ * @param {string|buffer} challenge - the challenge sent to passkey, should be txHash when signing a transaction
22
+ * @param {string|buffer} signature - signature from passkey
23
+ * @param {string|buffer} pk - credentialPublicKey from passkey, must be parsed with `parseAuthenticatorData`
24
+ * @returns {bool}
25
+ */
26
+ verify(challenge: BytesType, signature: BytesType, pk: BytesType, extra: string): Promise<boolean>;
24
27
  }
25
28
  declare const _default: PasskeySigner;
26
- export default _default;
27
- export { PasskeySigner };
29
+ //#endregion
30
+ export { PasskeySigner, _default as default };
@@ -1,59 +1,50 @@
1
- /* eslint-disable @typescript-eslint/no-useless-constructor */
2
- import { toBuffer, fromBase64, toBase64 } from '@ocap/util';
3
- import { decodeClientDataJSON, isoBase64URL, isoUint8Array, toHash, verifySignature, } from '@simplewebauthn/server/helpers';
4
- import BaseSigner from '../protocols/signer';
1
+ import signer_default from "../protocols/signer.js";
2
+ import { fromBase64, toBase64, toBuffer } from "@ocap/util";
3
+ import { decodeClientDataJSON, isoBase64URL, isoUint8Array, toHash, verifySignature } from "@simplewebauthn/server/helpers";
4
+
5
+ //#region src/signer/passkey.ts
5
6
  /**
6
- * Signer implementation for passkey, based on `@simplewebauthn/server`
7
- * Since passkey supports only verification, we do not need to implement the sign method
8
- * And passkeys can used multiple algorithms, we do not need to implement the algorithm selection
9
- *
10
- * @class PasskeySigner
11
- */
12
- class PasskeySigner extends BaseSigner {
13
- constructor() {
14
- super();
15
- }
16
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
- genKeyPair(encoding = 'hex', userSeed) {
18
- throw new Error('Not supported');
19
- }
20
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
21
- getPublicKey(sk, encoding = 'hex') {
22
- throw new Error('Not supported');
23
- }
24
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
- sign(message, sk, encoding = 'hex') {
26
- throw new Error('Not supported');
27
- }
28
- /**
29
- * Verify if a signature is valid
30
- *
31
- * @param {string|buffer} challenge - the challenge sent to passkey, should be txHash when signing a transaction
32
- * @param {string|buffer} signature - signature from passkey
33
- * @param {string|buffer} pk - credentialPublicKey from passkey, must be parsed with `parseAuthenticatorData`
34
- * @returns {bool}
35
- */
36
- async verify(challenge, signature, pk, extra) {
37
- const parsed = JSON.parse(extra);
38
- if (!parsed.authenticatorData || !parsed.clientDataJSON) {
39
- throw new Error('extra.authenticatorData or extra.clientDataJSON is required for passkey signature verification');
40
- }
41
- const authDataBuffer = toBuffer(fromBase64(parsed.authenticatorData));
42
- const clientDataHash = await toHash(isoBase64URL.toBuffer(parsed.clientDataJSON));
43
- const clientData = decodeClientDataJSON(parsed.clientDataJSON);
44
- if (clientData.challenge !== toBase64(challenge)) {
45
- throw new Error('challenge mismatch for passkey signature');
46
- }
47
- // FIXME: @wangshijun add more check here
48
- // if (clientData.type !== 'ocap.tx.sign') {
49
- // throw new Error('Invalid client data type');
50
- // }
51
- return verifySignature({
52
- signature: isoBase64URL.toBuffer(typeof signature === 'string' ? signature : toBase64(signature)),
53
- data: isoUint8Array.concat([authDataBuffer, clientDataHash]),
54
- credentialPublicKey: pk,
55
- });
56
- }
57
- }
58
- export default new PasskeySigner();
59
- export { PasskeySigner };
7
+ * Signer implementation for passkey, based on `@simplewebauthn/server`
8
+ * Since passkey supports only verification, we do not need to implement the sign method
9
+ * And passkeys can used multiple algorithms, we do not need to implement the algorithm selection
10
+ *
11
+ * @class PasskeySigner
12
+ */
13
+ var PasskeySigner = class extends signer_default {
14
+ constructor() {
15
+ super();
16
+ }
17
+ genKeyPair(encoding = "hex", userSeed) {
18
+ throw new Error("Not supported");
19
+ }
20
+ getPublicKey(sk, encoding = "hex") {
21
+ throw new Error("Not supported");
22
+ }
23
+ sign(message, sk, encoding = "hex") {
24
+ throw new Error("Not supported");
25
+ }
26
+ /**
27
+ * Verify if a signature is valid
28
+ *
29
+ * @param {string|buffer} challenge - the challenge sent to passkey, should be txHash when signing a transaction
30
+ * @param {string|buffer} signature - signature from passkey
31
+ * @param {string|buffer} pk - credentialPublicKey from passkey, must be parsed with `parseAuthenticatorData`
32
+ * @returns {bool}
33
+ */
34
+ async verify(challenge, signature, pk, extra) {
35
+ const parsed = JSON.parse(extra);
36
+ if (!parsed.authenticatorData || !parsed.clientDataJSON) throw new Error("extra.authenticatorData or extra.clientDataJSON is required for passkey signature verification");
37
+ const authDataBuffer = toBuffer(fromBase64(parsed.authenticatorData));
38
+ const clientDataHash = await toHash(isoBase64URL.toBuffer(parsed.clientDataJSON));
39
+ if (decodeClientDataJSON(parsed.clientDataJSON).challenge !== toBase64(challenge)) throw new Error("challenge mismatch for passkey signature");
40
+ return verifySignature({
41
+ signature: isoBase64URL.toBuffer(typeof signature === "string" ? signature : toBase64(signature)),
42
+ data: isoUint8Array.concat([authDataBuffer, clientDataHash]),
43
+ credentialPublicKey: pk
44
+ });
45
+ }
46
+ };
47
+ var passkey_default = new PasskeySigner();
48
+
49
+ //#endregion
50
+ export { PasskeySigner, passkey_default as default };
@@ -1,39 +1,42 @@
1
- import { BytesType, KeyPairType, EncodingType } from '@ocap/util';
2
- import Signer from '../protocols/signer';
1
+ import _default$1 from "../protocols/signer.js";
2
+ import { BytesType, EncodingType, KeyPairType } from "@ocap/util";
3
+
4
+ //#region src/signer/secp256k1.d.ts
5
+
3
6
  /**
4
7
  * Signer implementation for secp256k1, based on `elliptic`
5
8
  *
6
9
  * @class Secp256k1Signer
7
10
  */
8
- declare class Secp256k1Signer extends Signer {
9
- pkCompressed: boolean;
10
- pkHasFormatPrefix: boolean;
11
- constructor();
12
- isValidSK(sk: Uint8Array): boolean;
13
- /**
14
- * @public
15
- * @typedefKeyPairType
16
- * @prop {string} publicKey - publicKey in hex format
17
- * @prop {string} secretKey - secretKey in hex format
18
- * @memberof Secp256k1Signer
19
- */
20
- /**
21
- * Generate random secret/public key pair
22
- */
23
- genKeyPair(encoding?: EncodingType): KeyPairType;
24
- /**
25
- * Get publicKey from secretKey
26
- */
27
- getPublicKey(sk: BytesType, encoding?: EncodingType): BytesType;
28
- /**
29
- * Sign a message and get the signature hex
30
- */
31
- sign(message: BytesType, sk: BytesType, encoding?: EncodingType): BytesType;
32
- /**
33
- * Verify if a signature is valid
34
- */
35
- verify(message: BytesType, signature: BytesType, pk: BytesType): boolean;
11
+ declare class Secp256k1Signer extends _default$1 {
12
+ pkCompressed: boolean;
13
+ pkHasFormatPrefix: boolean;
14
+ constructor();
15
+ isValidSK(sk: Uint8Array): boolean;
16
+ /**
17
+ * @public
18
+ * @typedefKeyPairType
19
+ * @prop {string} publicKey - publicKey in hex format
20
+ * @prop {string} secretKey - secretKey in hex format
21
+ * @memberof Secp256k1Signer
22
+ */
23
+ /**
24
+ * Generate random secret/public key pair
25
+ */
26
+ genKeyPair(encoding?: EncodingType): KeyPairType;
27
+ /**
28
+ * Get publicKey from secretKey
29
+ */
30
+ getPublicKey(sk: BytesType, encoding?: EncodingType): BytesType;
31
+ /**
32
+ * Sign a message and get the signature hex
33
+ */
34
+ sign(message: BytesType, sk: BytesType, encoding?: EncodingType): BytesType;
35
+ /**
36
+ * Verify if a signature is valid
37
+ */
38
+ verify(message: BytesType, signature: BytesType, pk: BytesType): boolean;
36
39
  }
37
40
  declare const _default: Secp256k1Signer;
38
- export default _default;
39
- export { Secp256k1Signer };
41
+ //#endregion
42
+ export { Secp256k1Signer, _default as default };