@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.
- package/esm/crypter/aes-legacy.d.ts +8 -6
- package/esm/crypter/aes-legacy.js +27 -24
- package/esm/crypter/aes.d.ts +9 -7
- package/esm/crypter/aes.js +27 -25
- package/esm/crypter/rsa-browserify.d.ts +7 -6
- package/esm/crypter/rsa-browserify.js +34 -31
- package/esm/crypter/rsa.d.ts +11 -9
- package/esm/crypter/rsa.js +31 -28
- package/esm/encode.d.ts +12 -8
- package/esm/encode.js +13 -18
- package/esm/hasher/keccak.d.ts +8 -5
- package/esm/hasher/keccak.js +37 -36
- package/esm/hasher/sha2.d.ts +8 -5
- package/esm/hasher/sha2.js +42 -40
- package/esm/hasher/sha3.d.ts +8 -5
- package/esm/hasher/sha3.js +37 -36
- package/esm/index.d.ts +148 -143
- package/esm/index.js +172 -209
- package/esm/protocols/crypter.d.ts +3 -1
- package/esm/protocols/crypter.js +7 -4
- package/esm/protocols/hasher.d.ts +3 -1
- package/esm/protocols/hasher.js +7 -4
- package/esm/protocols/signer.d.ts +3 -1
- package/esm/protocols/signer.js +7 -4
- package/esm/signer/ed25519.d.ts +49 -46
- package/esm/signer/ed25519.js +80 -80
- package/esm/signer/ethereum.d.ts +11 -8
- package/esm/signer/ethereum.js +34 -34
- package/esm/signer/passkey.d.ts +21 -18
- package/esm/signer/passkey.js +49 -58
- package/esm/signer/secp256k1.d.ts +35 -32
- package/esm/signer/secp256k1.js +80 -93
- package/lib/_virtual/rolldown_runtime.js +29 -0
- package/lib/crypter/aes-legacy.d.ts +8 -6
- package/lib/crypter/aes-legacy.js +35 -52
- package/lib/crypter/aes.d.ts +9 -7
- package/lib/crypter/aes.js +29 -29
- package/lib/crypter/rsa-browserify.d.ts +7 -6
- package/lib/crypter/rsa-browserify.js +36 -33
- package/lib/crypter/rsa.d.ts +11 -9
- package/lib/crypter/rsa.js +33 -32
- package/lib/encode.d.ts +12 -8
- package/lib/encode.js +14 -21
- package/lib/hasher/keccak.d.ts +8 -5
- package/lib/hasher/keccak.js +40 -41
- package/lib/hasher/sha2.d.ts +8 -5
- package/lib/hasher/sha2.js +43 -42
- package/lib/hasher/sha3.d.ts +8 -5
- package/lib/hasher/sha3.js +40 -41
- package/lib/index.d.ts +148 -143
- package/lib/index.js +177 -216
- package/lib/protocols/crypter.d.ts +3 -1
- package/lib/protocols/crypter.js +10 -9
- package/lib/protocols/hasher.d.ts +3 -1
- package/lib/protocols/hasher.js +10 -9
- package/lib/protocols/signer.d.ts +3 -1
- package/lib/protocols/signer.js +10 -9
- package/lib/signer/ed25519.d.ts +49 -46
- package/lib/signer/ed25519.js +85 -86
- package/lib/signer/ethereum.d.ts +11 -8
- package/lib/signer/ethereum.js +38 -39
- package/lib/signer/passkey.d.ts +21 -18
- package/lib/signer/passkey.js +51 -63
- package/lib/signer/secp256k1.d.ts +35 -32
- package/lib/signer/secp256k1.js +85 -99
- package/package.json +21 -10
package/esm/signer/ed25519.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
export default
|
|
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 };
|
package/esm/signer/ethereum.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { Secp256k1Signer } from
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
16
|
-
export { EthereumSigner };
|
|
18
|
+
//#endregion
|
|
19
|
+
export { EthereumSigner, _default as default };
|
package/esm/signer/ethereum.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import Account from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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 };
|
package/esm/signer/passkey.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
27
|
-
export { PasskeySigner };
|
|
29
|
+
//#endregion
|
|
30
|
+
export { PasskeySigner, _default as default };
|
package/esm/signer/passkey.js
CHANGED
|
@@ -1,59 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { decodeClientDataJSON, isoBase64URL, isoUint8Array, toHash, verifySignature
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
2
|
-
import
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
39
|
-
export { Secp256k1Signer };
|
|
41
|
+
//#endregion
|
|
42
|
+
export { Secp256k1Signer, _default as default };
|