@buildonspark/spark-sdk 0.1.45 → 0.1.47
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/CHANGELOG.md +22 -0
- package/dist/{chunk-I54FARY2.js → chunk-EAP3U3CW.js} +14 -14
- package/dist/chunk-GWFQ7EBA.js +3773 -0
- package/dist/{chunk-J2IE4Z7Y.js → chunk-NNX4OK44.js} +3487 -934
- package/dist/{RequestLightningSendInput-Du0z7Om7.d.cts → client-CvpTRpcw.d.cts} +422 -212
- package/dist/{RequestLightningSendInput-DEPd_fPO.d.ts → client-D7KgLN44.d.ts} +422 -212
- package/dist/graphql/objects/index.d.cts +5 -9
- package/dist/graphql/objects/index.d.ts +5 -9
- package/dist/graphql/objects/index.js +1 -1
- package/dist/index.cjs +20461 -23377
- package/dist/index.d.cts +15 -769
- package/dist/index.d.ts +15 -769
- package/dist/index.js +81 -71
- package/dist/index.node.cjs +21994 -25018
- package/dist/index.node.d.cts +312 -34
- package/dist/index.node.d.ts +312 -34
- package/dist/index.node.js +82 -176
- package/dist/native/index.cjs +22847 -25841
- package/dist/native/index.d.cts +974 -1138
- package/dist/native/index.d.ts +974 -1138
- package/dist/native/index.js +10604 -13592
- package/dist/proto/lrc20.d.cts +2 -2
- package/dist/proto/lrc20.d.ts +2 -2
- package/dist/proto/lrc20.js +3098 -46
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/{sdk-types-Cc4l4kb1.d.ts → sdk-types-BGCeea0G.d.ts} +1 -1
- package/dist/{sdk-types-B0SwjolI.d.cts → sdk-types-XUeQMLFP.d.cts} +1 -1
- package/dist/{spark-dM7EYXYQ.d.cts → spark-BbUrbvZz.d.cts} +1 -1
- package/dist/{spark-dM7EYXYQ.d.ts → spark-BbUrbvZz.d.ts} +1 -1
- package/dist/spark-wallet-BAFPpPtY.d.cts +923 -0
- package/dist/spark-wallet-CJkQW8pK.d.ts +923 -0
- package/dist/spark_bindings/native/index.d.cts +1 -1
- package/dist/spark_bindings/native/index.d.ts +1 -1
- package/dist/spark_bindings/wasm/index.d.cts +1 -1
- package/dist/spark_bindings/wasm/index.d.ts +1 -1
- package/dist/{services/index.cjs → tests/test-utils.cjs} +2512 -4380
- package/dist/tests/test-utils.d.cts +79 -0
- package/dist/tests/test-utils.d.ts +79 -0
- package/dist/tests/test-utils.js +85 -0
- package/dist/types/index.d.cts +5 -9
- package/dist/types/index.d.ts +5 -9
- package/dist/types/index.js +5 -5
- package/dist/{types-C-Rp0Oo7.d.cts → types-BADxR3bm.d.cts} +1 -1
- package/dist/{types-C-Rp0Oo7.d.ts → types-BADxR3bm.d.ts} +1 -1
- package/package.json +7 -35
- package/src/graphql/client.ts +59 -20
- package/src/index.node.ts +28 -2
- package/src/index.ts +31 -1
- package/src/native/index.ts +16 -2
- package/src/services/config.ts +4 -6
- package/src/services/connection.ts +131 -64
- package/src/services/lightning.ts +1 -2
- package/src/services/token-transactions.ts +7 -7
- package/src/services/transfer.ts +1 -1
- package/src/services/tree-creation.ts +1 -1
- package/src/services/wallet-config.ts +18 -10
- package/src/signer/signer.react-native.ts +2 -5
- package/src/signer/signer.ts +138 -64
- package/src/signer/types.ts +52 -0
- package/src/spark-wallet/spark-wallet.ts +79 -36
- package/src/spark-wallet/types.ts +4 -4
- package/src/tests/integration/coop-exit.test.ts +2 -1
- package/src/tests/integration/lightning.test.ts +2 -2
- package/src/tests/integration/swap.test.ts +1 -1
- package/src/tests/integration/transfer.test.ts +5 -5
- package/src/tests/integration/tree-creation.test.ts +1 -1
- package/src/tests/integration/wallet.test.ts +1 -0
- package/src/tests/isHermeticTest.ts +3 -24
- package/src/tests/{test-util.ts → test-utils.ts} +3 -7
- package/src/tests/wrapWithOtelSpan.test.ts +1 -1
- package/src/{address → utils}/address.ts +1 -1
- package/src/utils/crypto.ts +19 -9
- package/src/utils/index.ts +2 -0
- package/src/utils/network.ts +17 -0
- package/src/utils/secret-sharing.ts +1 -2
- package/src/utils/signing.ts +1 -1
- package/src/utils/token-transactions.ts +3 -3
- package/src/utils/unilateral-exit.ts +32 -0
- package/src/utils/xchain-address.ts +1 -1
- package/dist/BitcoinNetwork-TnABML0T.d.cts +0 -18
- package/dist/BitcoinNetwork-TnABML0T.d.ts +0 -18
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.cts +0 -10
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.ts +0 -10
- package/dist/address/index.cjs +0 -458
- package/dist/address/index.d.cts +0 -32
- package/dist/address/index.d.ts +0 -32
- package/dist/address/index.js +0 -17
- package/dist/chunk-5FUB65LX.js +0 -838
- package/dist/chunk-6264CGDM.js +0 -113
- package/dist/chunk-7V6N75CC.js +0 -24
- package/dist/chunk-C2S227QR.js +0 -2336
- package/dist/chunk-GSI4OLXZ.js +0 -117
- package/dist/chunk-GZ5IPPJ2.js +0 -170
- package/dist/chunk-HWJWKEIU.js +0 -75
- package/dist/chunk-KMUMFYFX.js +0 -137
- package/dist/chunk-L3EHBOUX.js +0 -0
- package/dist/chunk-NSJF5F5O.js +0 -325
- package/dist/chunk-NTFKFRQ2.js +0 -3146
- package/dist/chunk-PQN3C2MF.js +0 -1122
- package/dist/chunk-QNNSEJ4P.js +0 -232
- package/dist/chunk-R5PXJZQS.js +0 -277
- package/dist/chunk-VTUGIIWI.js +0 -0
- package/dist/chunk-YUPMXTCJ.js +0 -622
- package/dist/chunk-Z5HIAYFT.js +0 -84
- package/dist/index-B2AwKW5J.d.cts +0 -214
- package/dist/index-CJDi1HWc.d.ts +0 -214
- package/dist/network-BTJl-Sul.d.ts +0 -46
- package/dist/network-CqgsdUF2.d.cts +0 -46
- package/dist/services/config.cjs +0 -2354
- package/dist/services/config.d.cts +0 -42
- package/dist/services/config.d.ts +0 -42
- package/dist/services/config.js +0 -17
- package/dist/services/connection.cjs +0 -17691
- package/dist/services/connection.d.cts +0 -95
- package/dist/services/connection.d.ts +0 -95
- package/dist/services/connection.js +0 -11
- package/dist/services/index.d.cts +0 -21
- package/dist/services/index.d.ts +0 -21
- package/dist/services/index.js +0 -58
- package/dist/services/lrc-connection.cjs +0 -4713
- package/dist/services/lrc-connection.d.cts +0 -34
- package/dist/services/lrc-connection.d.ts +0 -34
- package/dist/services/lrc-connection.js +0 -11
- package/dist/services/token-transactions.cjs +0 -2877
- package/dist/services/token-transactions.d.cts +0 -75
- package/dist/services/token-transactions.d.ts +0 -75
- package/dist/services/token-transactions.js +0 -15
- package/dist/services/wallet-config.cjs +0 -340
- package/dist/services/wallet-config.d.cts +0 -56
- package/dist/services/wallet-config.d.ts +0 -56
- package/dist/services/wallet-config.js +0 -33
- package/dist/signer/signer.cjs +0 -2004
- package/dist/signer/signer.d.cts +0 -10
- package/dist/signer/signer.d.ts +0 -10
- package/dist/signer/signer.js +0 -24
- package/dist/signer-BocS_J6B.d.ts +0 -187
- package/dist/signer-DKS0AJkw.d.cts +0 -187
- package/dist/utils/index.cjs +0 -2947
- package/dist/utils/index.d.cts +0 -18
- package/dist/utils/index.d.ts +0 -18
- package/dist/utils/index.js +0 -157
- package/src/address/index.ts +0 -1
- package/src/services/lrc-connection.ts +0 -215
package/dist/signer/signer.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '@scure/bip32';
|
|
2
|
-
import '../spark-dM7EYXYQ.cjs';
|
|
3
|
-
import '../types-C-Rp0Oo7.cjs';
|
|
4
|
-
export { A as AggregateFrostParams, D as DefaultSparkSigner, k as SignFrostParams, h as SigningCommitment, i as SigningNonce, S as SparkSigner, l as SplitSecretWithProofsParams, j as TaprootOutputKeysGenerator, T as TaprootSparkSigner } from '../signer-DKS0AJkw.cjs';
|
|
5
|
-
export { PARITY, Receipt, TokenSigner, fromPrivateKey } from '@buildonspark/lrc20-sdk';
|
|
6
|
-
import '@scure/btc-signer';
|
|
7
|
-
import 'bitcoinjs-lib';
|
|
8
|
-
export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
|
|
9
|
-
import '@bufbuild/protobuf/wire';
|
|
10
|
-
import 'nice-grpc-common';
|
package/dist/signer/signer.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import '@scure/bip32';
|
|
2
|
-
import '../spark-dM7EYXYQ.js';
|
|
3
|
-
import '../types-C-Rp0Oo7.js';
|
|
4
|
-
export { A as AggregateFrostParams, D as DefaultSparkSigner, k as SignFrostParams, h as SigningCommitment, i as SigningNonce, S as SparkSigner, l as SplitSecretWithProofsParams, j as TaprootOutputKeysGenerator, T as TaprootSparkSigner } from '../signer-BocS_J6B.js';
|
|
5
|
-
export { PARITY, Receipt, TokenSigner, fromPrivateKey } from '@buildonspark/lrc20-sdk';
|
|
6
|
-
import '@scure/btc-signer';
|
|
7
|
-
import 'bitcoinjs-lib';
|
|
8
|
-
export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
|
|
9
|
-
import '@bufbuild/protobuf/wire';
|
|
10
|
-
import 'nice-grpc-common';
|
package/dist/signer/signer.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DefaultSparkSigner,
|
|
3
|
-
MultisigReceiptInput,
|
|
4
|
-
PARITY,
|
|
5
|
-
Receipt,
|
|
6
|
-
TaprootOutputKeysGenerator,
|
|
7
|
-
TaprootSparkSigner,
|
|
8
|
-
fromPrivateKey
|
|
9
|
-
} from "../chunk-YUPMXTCJ.js";
|
|
10
|
-
import "../chunk-NSJF5F5O.js";
|
|
11
|
-
import "../chunk-QNNSEJ4P.js";
|
|
12
|
-
import "../chunk-VTUGIIWI.js";
|
|
13
|
-
import "../chunk-7V6N75CC.js";
|
|
14
|
-
import "../chunk-GSI4OLXZ.js";
|
|
15
|
-
import "../chunk-MVRQ5US7.js";
|
|
16
|
-
export {
|
|
17
|
-
DefaultSparkSigner,
|
|
18
|
-
MultisigReceiptInput,
|
|
19
|
-
PARITY,
|
|
20
|
-
Receipt,
|
|
21
|
-
TaprootOutputKeysGenerator,
|
|
22
|
-
TaprootSparkSigner,
|
|
23
|
-
fromPrivateKey
|
|
24
|
-
};
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { HDKey } from '@scure/bip32';
|
|
2
|
-
import { d as TreeNode } from './spark-dM7EYXYQ.js';
|
|
3
|
-
import { I as ISigningCommitment } from './types-C-Rp0Oo7.js';
|
|
4
|
-
import { TokenSigner, Receipt } from '@buildonspark/lrc20-sdk';
|
|
5
|
-
import { Transaction } from '@scure/btc-signer';
|
|
6
|
-
import { Psbt } from 'bitcoinjs-lib';
|
|
7
|
-
import '@buildonspark/lrc20-sdk/lrc/types';
|
|
8
|
-
|
|
9
|
-
type Polynomial = {
|
|
10
|
-
fieldModulus: bigint;
|
|
11
|
-
coefficients: bigint[];
|
|
12
|
-
proofs: Uint8Array[];
|
|
13
|
-
};
|
|
14
|
-
type SecretShare = {
|
|
15
|
-
fieldModulus: bigint;
|
|
16
|
-
threshold: number;
|
|
17
|
-
index: bigint;
|
|
18
|
-
share: bigint;
|
|
19
|
-
};
|
|
20
|
-
type VerifiableSecretShare = SecretShare & {
|
|
21
|
-
proofs: Uint8Array[];
|
|
22
|
-
};
|
|
23
|
-
declare function getRandomBigInt(max: bigint): bigint;
|
|
24
|
-
declare function modInverse(a: bigint, m: bigint): bigint;
|
|
25
|
-
declare function evaluatePolynomial(polynomial: Polynomial, x: bigint): bigint;
|
|
26
|
-
declare function fieldDiv(numerator: bigint, denominator: bigint, fieldModulus: bigint): bigint;
|
|
27
|
-
declare function computerLagrangeCoefficients(index: bigint, points: SecretShare[]): bigint;
|
|
28
|
-
declare function generatePolynomialForSecretSharing(fieldModulus: bigint, secret: bigint, degree: number): Polynomial;
|
|
29
|
-
declare function splitSecret(fieldModulus: bigint, secret: bigint, threshold: number, numberOfShares: number): SecretShare[];
|
|
30
|
-
declare function splitSecretWithProofs(secret: bigint, fieldModulus: bigint, threshold: number, numberOfShares: number): VerifiableSecretShare[];
|
|
31
|
-
declare function recoverSecret(shares: VerifiableSecretShare[]): bigint;
|
|
32
|
-
declare function validateShare(share: VerifiableSecretShare): void;
|
|
33
|
-
declare function bigIntToPrivateKey(value: bigint): Uint8Array;
|
|
34
|
-
|
|
35
|
-
type SigningNonce = {
|
|
36
|
-
binding: Uint8Array;
|
|
37
|
-
hiding: Uint8Array;
|
|
38
|
-
};
|
|
39
|
-
type SigningCommitment = {
|
|
40
|
-
binding: Uint8Array;
|
|
41
|
-
hiding: Uint8Array;
|
|
42
|
-
};
|
|
43
|
-
type SignFrostParams = {
|
|
44
|
-
message: Uint8Array;
|
|
45
|
-
privateAsPubKey: Uint8Array;
|
|
46
|
-
publicKey: Uint8Array;
|
|
47
|
-
verifyingKey: Uint8Array;
|
|
48
|
-
selfCommitment: ISigningCommitment;
|
|
49
|
-
statechainCommitments?: {
|
|
50
|
-
[key: string]: ISigningCommitment;
|
|
51
|
-
} | undefined;
|
|
52
|
-
adaptorPubKey?: Uint8Array | undefined;
|
|
53
|
-
};
|
|
54
|
-
type AggregateFrostParams = Omit<SignFrostParams, "privateAsPubKey"> & {
|
|
55
|
-
selfSignature: Uint8Array;
|
|
56
|
-
statechainSignatures?: {
|
|
57
|
-
[key: string]: Uint8Array;
|
|
58
|
-
} | undefined;
|
|
59
|
-
statechainPublicKeys?: {
|
|
60
|
-
[key: string]: Uint8Array;
|
|
61
|
-
} | undefined;
|
|
62
|
-
};
|
|
63
|
-
type SplitSecretWithProofsParams = {
|
|
64
|
-
secret: Uint8Array;
|
|
65
|
-
curveOrder: bigint;
|
|
66
|
-
threshold: number;
|
|
67
|
-
numShares: number;
|
|
68
|
-
isSecretPubkey?: boolean;
|
|
69
|
-
};
|
|
70
|
-
type DerivedHDKey = {
|
|
71
|
-
hdKey: HDKey;
|
|
72
|
-
privateKey: Uint8Array;
|
|
73
|
-
publicKey: Uint8Array;
|
|
74
|
-
};
|
|
75
|
-
type KeyPair = {
|
|
76
|
-
privateKey: Uint8Array;
|
|
77
|
-
publicKey: Uint8Array;
|
|
78
|
-
};
|
|
79
|
-
interface SparkKeysGenerator {
|
|
80
|
-
deriveKeysFromSeed(seed: Uint8Array, accountNumber: number): Promise<{
|
|
81
|
-
masterPublicKey: Uint8Array;
|
|
82
|
-
identityKey: KeyPair;
|
|
83
|
-
signingHDKey: DerivedHDKey;
|
|
84
|
-
depositKey: KeyPair;
|
|
85
|
-
staticDepositHDKey: DerivedHDKey;
|
|
86
|
-
}>;
|
|
87
|
-
}
|
|
88
|
-
declare class TaprootOutputKeysGenerator implements SparkKeysGenerator {
|
|
89
|
-
private readonly useAddressIndex;
|
|
90
|
-
constructor(useAddressIndex?: boolean);
|
|
91
|
-
deriveKeysFromSeed(seed: Uint8Array, accountNumber: number): Promise<{
|
|
92
|
-
masterPublicKey: Uint8Array;
|
|
93
|
-
identityKey: KeyPair;
|
|
94
|
-
signingHDKey: DerivedHDKey;
|
|
95
|
-
depositKey: KeyPair;
|
|
96
|
-
staticDepositHDKey: DerivedHDKey;
|
|
97
|
-
}>;
|
|
98
|
-
}
|
|
99
|
-
interface SparkSigner extends TokenSigner {
|
|
100
|
-
getIdentityPublicKey(): Promise<Uint8Array>;
|
|
101
|
-
getDepositSigningKey(): Promise<Uint8Array>;
|
|
102
|
-
generateStaticDepositKey(idx: number): Promise<Uint8Array>;
|
|
103
|
-
getStaticDepositSigningKey(idx: number): Promise<Uint8Array>;
|
|
104
|
-
getStaticDepositSecretKey(idx: number): Promise<Uint8Array>;
|
|
105
|
-
generateMnemonic(): Promise<string>;
|
|
106
|
-
mnemonicToSeed(mnemonic: string): Promise<Uint8Array>;
|
|
107
|
-
createSparkWalletFromSeed(seed: Uint8Array | string, accountNumber?: number): Promise<string>;
|
|
108
|
-
restoreSigningKeysFromLeafs(leafs: TreeNode[]): Promise<void>;
|
|
109
|
-
getTrackedPublicKeys(): Promise<Uint8Array[]>;
|
|
110
|
-
generatePublicKey(hash?: Uint8Array): Promise<Uint8Array>;
|
|
111
|
-
removePublicKey(publicKey: Uint8Array): Promise<void>;
|
|
112
|
-
getSchnorrPublicKey(publicKey: Uint8Array): Promise<Uint8Array>;
|
|
113
|
-
signSchnorr(message: Uint8Array, publicKey: Uint8Array): Promise<Uint8Array>;
|
|
114
|
-
signSchnorrWithIdentityKey(message: Uint8Array): Promise<Uint8Array>;
|
|
115
|
-
subtractPrivateKeysGivenPublicKeys(first: Uint8Array, second: Uint8Array): Promise<Uint8Array>;
|
|
116
|
-
splitSecretWithProofs(params: SplitSecretWithProofsParams): Promise<VerifiableSecretShare[]>;
|
|
117
|
-
signFrost(params: SignFrostParams): Promise<Uint8Array>;
|
|
118
|
-
aggregateFrost(params: AggregateFrostParams): Promise<Uint8Array>;
|
|
119
|
-
signMessageWithPublicKey(message: Uint8Array, publicKey: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
120
|
-
signMessageWithIdentityKey(message: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
121
|
-
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
122
|
-
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
123
|
-
encryptLeafPrivateKeyEcies(receiverPublicKey: Uint8Array, publicKey: Uint8Array): Promise<Uint8Array>;
|
|
124
|
-
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
125
|
-
getRandomSigningCommitment(): Promise<SigningCommitment>;
|
|
126
|
-
hashRandomPrivateKey(): Promise<Uint8Array>;
|
|
127
|
-
generateAdaptorFromSignature(signature: Uint8Array): Promise<{
|
|
128
|
-
adaptorSignature: Uint8Array;
|
|
129
|
-
adaptorPublicKey: Uint8Array;
|
|
130
|
-
}>;
|
|
131
|
-
getDepositSigningKey(): Promise<Uint8Array>;
|
|
132
|
-
getMasterPublicKey(): Promise<Uint8Array>;
|
|
133
|
-
}
|
|
134
|
-
declare class DefaultSparkSigner implements SparkSigner {
|
|
135
|
-
private masterPublicKey;
|
|
136
|
-
private identityKey;
|
|
137
|
-
private signingKey;
|
|
138
|
-
private depositKey;
|
|
139
|
-
private staticDepositKey;
|
|
140
|
-
private staticDepositKeyMap;
|
|
141
|
-
protected publicKeyToPrivateKeyMap: Map<string, string>;
|
|
142
|
-
protected commitmentToNonceMap: Map<SigningCommitment, SigningNonce>;
|
|
143
|
-
private readonly keysGenerator;
|
|
144
|
-
constructor({ sparkKeysGenerator, }?: {
|
|
145
|
-
sparkKeysGenerator?: SparkKeysGenerator;
|
|
146
|
-
});
|
|
147
|
-
private deriveSigningKey;
|
|
148
|
-
restoreSigningKeysFromLeafs(leafs: TreeNode[]): Promise<void>;
|
|
149
|
-
getSchnorrPublicKey(publicKey: Uint8Array): Promise<Uint8Array>;
|
|
150
|
-
signSchnorr(message: Uint8Array, publicKey: Uint8Array): Promise<Uint8Array>;
|
|
151
|
-
signSchnorrWithIdentityKey(message: Uint8Array): Promise<Uint8Array>;
|
|
152
|
-
getIdentityPublicKey(): Promise<Uint8Array>;
|
|
153
|
-
getDepositSigningKey(): Promise<Uint8Array>;
|
|
154
|
-
generateStaticDepositKey(idx: number): Promise<Uint8Array>;
|
|
155
|
-
getStaticDepositSigningKey(idx: number): Promise<Uint8Array>;
|
|
156
|
-
getStaticDepositSecretKey(idx: number): Promise<Uint8Array>;
|
|
157
|
-
generateMnemonic(): Promise<string>;
|
|
158
|
-
mnemonicToSeed(mnemonic: string): Promise<Uint8Array>;
|
|
159
|
-
getTrackedPublicKeys(): Promise<Uint8Array[]>;
|
|
160
|
-
generatePublicKey(hash?: Uint8Array): Promise<Uint8Array>;
|
|
161
|
-
removePublicKey(publicKey: Uint8Array): Promise<void>;
|
|
162
|
-
subtractPrivateKeysGivenPublicKeys(first: Uint8Array, second: Uint8Array): Promise<Uint8Array>;
|
|
163
|
-
splitSecretWithProofs({ secret, curveOrder, threshold, numShares, isSecretPubkey, }: SplitSecretWithProofsParams): Promise<VerifiableSecretShare[]>;
|
|
164
|
-
signFrost({ message, privateAsPubKey, publicKey, verifyingKey, selfCommitment, statechainCommitments, adaptorPubKey, }: SignFrostParams): Promise<Uint8Array>;
|
|
165
|
-
aggregateFrost({ message, publicKey, verifyingKey, selfCommitment, statechainCommitments, adaptorPubKey, selfSignature, statechainSignatures, statechainPublicKeys, }: AggregateFrostParams): Promise<Uint8Array>;
|
|
166
|
-
createSparkWalletFromSeed(seed: Uint8Array | string, accountNumber?: number): Promise<string>;
|
|
167
|
-
signMessageWithPublicKey(message: Uint8Array, publicKey: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
168
|
-
signMessageWithIdentityKey(message: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
169
|
-
encryptLeafPrivateKeyEcies(receiverPublicKey: Uint8Array, publicKey: Uint8Array): Promise<Uint8Array>;
|
|
170
|
-
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
171
|
-
getRandomSigningCommitment(): Promise<SigningCommitment>;
|
|
172
|
-
hashRandomPrivateKey(): Promise<Uint8Array>;
|
|
173
|
-
generateAdaptorFromSignature(signature: Uint8Array): Promise<{
|
|
174
|
-
adaptorSignature: Uint8Array;
|
|
175
|
-
adaptorPublicKey: Uint8Array;
|
|
176
|
-
}>;
|
|
177
|
-
getMasterPublicKey(): Promise<Uint8Array>;
|
|
178
|
-
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
179
|
-
signPsbt(psbt: Psbt, input: number, sighashTypes?: number[], receipt?: Receipt): Promise<Psbt>;
|
|
180
|
-
private getReceiptPrivateKey;
|
|
181
|
-
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
182
|
-
}
|
|
183
|
-
declare class TaprootSparkSigner extends DefaultSparkSigner {
|
|
184
|
-
constructor();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export { type AggregateFrostParams as A, DefaultSparkSigner as D, type SparkSigner as S, TaprootSparkSigner as T, type VerifiableSecretShare as V, generatePolynomialForSecretSharing as a, splitSecretWithProofs as b, computerLagrangeCoefficients as c, bigIntToPrivateKey as d, evaluatePolynomial as e, fieldDiv as f, getRandomBigInt as g, type SigningCommitment as h, type SigningNonce as i, TaprootOutputKeysGenerator as j, type SignFrostParams as k, type SplitSecretWithProofsParams as l, modInverse as m, recoverSecret as r, splitSecret as s, validateShare as v };
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { HDKey } from '@scure/bip32';
|
|
2
|
-
import { d as TreeNode } from './spark-dM7EYXYQ.cjs';
|
|
3
|
-
import { I as ISigningCommitment } from './types-C-Rp0Oo7.cjs';
|
|
4
|
-
import { TokenSigner, Receipt } from '@buildonspark/lrc20-sdk';
|
|
5
|
-
import { Transaction } from '@scure/btc-signer';
|
|
6
|
-
import { Psbt } from 'bitcoinjs-lib';
|
|
7
|
-
import '@buildonspark/lrc20-sdk/lrc/types';
|
|
8
|
-
|
|
9
|
-
type Polynomial = {
|
|
10
|
-
fieldModulus: bigint;
|
|
11
|
-
coefficients: bigint[];
|
|
12
|
-
proofs: Uint8Array[];
|
|
13
|
-
};
|
|
14
|
-
type SecretShare = {
|
|
15
|
-
fieldModulus: bigint;
|
|
16
|
-
threshold: number;
|
|
17
|
-
index: bigint;
|
|
18
|
-
share: bigint;
|
|
19
|
-
};
|
|
20
|
-
type VerifiableSecretShare = SecretShare & {
|
|
21
|
-
proofs: Uint8Array[];
|
|
22
|
-
};
|
|
23
|
-
declare function getRandomBigInt(max: bigint): bigint;
|
|
24
|
-
declare function modInverse(a: bigint, m: bigint): bigint;
|
|
25
|
-
declare function evaluatePolynomial(polynomial: Polynomial, x: bigint): bigint;
|
|
26
|
-
declare function fieldDiv(numerator: bigint, denominator: bigint, fieldModulus: bigint): bigint;
|
|
27
|
-
declare function computerLagrangeCoefficients(index: bigint, points: SecretShare[]): bigint;
|
|
28
|
-
declare function generatePolynomialForSecretSharing(fieldModulus: bigint, secret: bigint, degree: number): Polynomial;
|
|
29
|
-
declare function splitSecret(fieldModulus: bigint, secret: bigint, threshold: number, numberOfShares: number): SecretShare[];
|
|
30
|
-
declare function splitSecretWithProofs(secret: bigint, fieldModulus: bigint, threshold: number, numberOfShares: number): VerifiableSecretShare[];
|
|
31
|
-
declare function recoverSecret(shares: VerifiableSecretShare[]): bigint;
|
|
32
|
-
declare function validateShare(share: VerifiableSecretShare): void;
|
|
33
|
-
declare function bigIntToPrivateKey(value: bigint): Uint8Array;
|
|
34
|
-
|
|
35
|
-
type SigningNonce = {
|
|
36
|
-
binding: Uint8Array;
|
|
37
|
-
hiding: Uint8Array;
|
|
38
|
-
};
|
|
39
|
-
type SigningCommitment = {
|
|
40
|
-
binding: Uint8Array;
|
|
41
|
-
hiding: Uint8Array;
|
|
42
|
-
};
|
|
43
|
-
type SignFrostParams = {
|
|
44
|
-
message: Uint8Array;
|
|
45
|
-
privateAsPubKey: Uint8Array;
|
|
46
|
-
publicKey: Uint8Array;
|
|
47
|
-
verifyingKey: Uint8Array;
|
|
48
|
-
selfCommitment: ISigningCommitment;
|
|
49
|
-
statechainCommitments?: {
|
|
50
|
-
[key: string]: ISigningCommitment;
|
|
51
|
-
} | undefined;
|
|
52
|
-
adaptorPubKey?: Uint8Array | undefined;
|
|
53
|
-
};
|
|
54
|
-
type AggregateFrostParams = Omit<SignFrostParams, "privateAsPubKey"> & {
|
|
55
|
-
selfSignature: Uint8Array;
|
|
56
|
-
statechainSignatures?: {
|
|
57
|
-
[key: string]: Uint8Array;
|
|
58
|
-
} | undefined;
|
|
59
|
-
statechainPublicKeys?: {
|
|
60
|
-
[key: string]: Uint8Array;
|
|
61
|
-
} | undefined;
|
|
62
|
-
};
|
|
63
|
-
type SplitSecretWithProofsParams = {
|
|
64
|
-
secret: Uint8Array;
|
|
65
|
-
curveOrder: bigint;
|
|
66
|
-
threshold: number;
|
|
67
|
-
numShares: number;
|
|
68
|
-
isSecretPubkey?: boolean;
|
|
69
|
-
};
|
|
70
|
-
type DerivedHDKey = {
|
|
71
|
-
hdKey: HDKey;
|
|
72
|
-
privateKey: Uint8Array;
|
|
73
|
-
publicKey: Uint8Array;
|
|
74
|
-
};
|
|
75
|
-
type KeyPair = {
|
|
76
|
-
privateKey: Uint8Array;
|
|
77
|
-
publicKey: Uint8Array;
|
|
78
|
-
};
|
|
79
|
-
interface SparkKeysGenerator {
|
|
80
|
-
deriveKeysFromSeed(seed: Uint8Array, accountNumber: number): Promise<{
|
|
81
|
-
masterPublicKey: Uint8Array;
|
|
82
|
-
identityKey: KeyPair;
|
|
83
|
-
signingHDKey: DerivedHDKey;
|
|
84
|
-
depositKey: KeyPair;
|
|
85
|
-
staticDepositHDKey: DerivedHDKey;
|
|
86
|
-
}>;
|
|
87
|
-
}
|
|
88
|
-
declare class TaprootOutputKeysGenerator implements SparkKeysGenerator {
|
|
89
|
-
private readonly useAddressIndex;
|
|
90
|
-
constructor(useAddressIndex?: boolean);
|
|
91
|
-
deriveKeysFromSeed(seed: Uint8Array, accountNumber: number): Promise<{
|
|
92
|
-
masterPublicKey: Uint8Array;
|
|
93
|
-
identityKey: KeyPair;
|
|
94
|
-
signingHDKey: DerivedHDKey;
|
|
95
|
-
depositKey: KeyPair;
|
|
96
|
-
staticDepositHDKey: DerivedHDKey;
|
|
97
|
-
}>;
|
|
98
|
-
}
|
|
99
|
-
interface SparkSigner extends TokenSigner {
|
|
100
|
-
getIdentityPublicKey(): Promise<Uint8Array>;
|
|
101
|
-
getDepositSigningKey(): Promise<Uint8Array>;
|
|
102
|
-
generateStaticDepositKey(idx: number): Promise<Uint8Array>;
|
|
103
|
-
getStaticDepositSigningKey(idx: number): Promise<Uint8Array>;
|
|
104
|
-
getStaticDepositSecretKey(idx: number): Promise<Uint8Array>;
|
|
105
|
-
generateMnemonic(): Promise<string>;
|
|
106
|
-
mnemonicToSeed(mnemonic: string): Promise<Uint8Array>;
|
|
107
|
-
createSparkWalletFromSeed(seed: Uint8Array | string, accountNumber?: number): Promise<string>;
|
|
108
|
-
restoreSigningKeysFromLeafs(leafs: TreeNode[]): Promise<void>;
|
|
109
|
-
getTrackedPublicKeys(): Promise<Uint8Array[]>;
|
|
110
|
-
generatePublicKey(hash?: Uint8Array): Promise<Uint8Array>;
|
|
111
|
-
removePublicKey(publicKey: Uint8Array): Promise<void>;
|
|
112
|
-
getSchnorrPublicKey(publicKey: Uint8Array): Promise<Uint8Array>;
|
|
113
|
-
signSchnorr(message: Uint8Array, publicKey: Uint8Array): Promise<Uint8Array>;
|
|
114
|
-
signSchnorrWithIdentityKey(message: Uint8Array): Promise<Uint8Array>;
|
|
115
|
-
subtractPrivateKeysGivenPublicKeys(first: Uint8Array, second: Uint8Array): Promise<Uint8Array>;
|
|
116
|
-
splitSecretWithProofs(params: SplitSecretWithProofsParams): Promise<VerifiableSecretShare[]>;
|
|
117
|
-
signFrost(params: SignFrostParams): Promise<Uint8Array>;
|
|
118
|
-
aggregateFrost(params: AggregateFrostParams): Promise<Uint8Array>;
|
|
119
|
-
signMessageWithPublicKey(message: Uint8Array, publicKey: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
120
|
-
signMessageWithIdentityKey(message: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
121
|
-
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
122
|
-
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
123
|
-
encryptLeafPrivateKeyEcies(receiverPublicKey: Uint8Array, publicKey: Uint8Array): Promise<Uint8Array>;
|
|
124
|
-
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
125
|
-
getRandomSigningCommitment(): Promise<SigningCommitment>;
|
|
126
|
-
hashRandomPrivateKey(): Promise<Uint8Array>;
|
|
127
|
-
generateAdaptorFromSignature(signature: Uint8Array): Promise<{
|
|
128
|
-
adaptorSignature: Uint8Array;
|
|
129
|
-
adaptorPublicKey: Uint8Array;
|
|
130
|
-
}>;
|
|
131
|
-
getDepositSigningKey(): Promise<Uint8Array>;
|
|
132
|
-
getMasterPublicKey(): Promise<Uint8Array>;
|
|
133
|
-
}
|
|
134
|
-
declare class DefaultSparkSigner implements SparkSigner {
|
|
135
|
-
private masterPublicKey;
|
|
136
|
-
private identityKey;
|
|
137
|
-
private signingKey;
|
|
138
|
-
private depositKey;
|
|
139
|
-
private staticDepositKey;
|
|
140
|
-
private staticDepositKeyMap;
|
|
141
|
-
protected publicKeyToPrivateKeyMap: Map<string, string>;
|
|
142
|
-
protected commitmentToNonceMap: Map<SigningCommitment, SigningNonce>;
|
|
143
|
-
private readonly keysGenerator;
|
|
144
|
-
constructor({ sparkKeysGenerator, }?: {
|
|
145
|
-
sparkKeysGenerator?: SparkKeysGenerator;
|
|
146
|
-
});
|
|
147
|
-
private deriveSigningKey;
|
|
148
|
-
restoreSigningKeysFromLeafs(leafs: TreeNode[]): Promise<void>;
|
|
149
|
-
getSchnorrPublicKey(publicKey: Uint8Array): Promise<Uint8Array>;
|
|
150
|
-
signSchnorr(message: Uint8Array, publicKey: Uint8Array): Promise<Uint8Array>;
|
|
151
|
-
signSchnorrWithIdentityKey(message: Uint8Array): Promise<Uint8Array>;
|
|
152
|
-
getIdentityPublicKey(): Promise<Uint8Array>;
|
|
153
|
-
getDepositSigningKey(): Promise<Uint8Array>;
|
|
154
|
-
generateStaticDepositKey(idx: number): Promise<Uint8Array>;
|
|
155
|
-
getStaticDepositSigningKey(idx: number): Promise<Uint8Array>;
|
|
156
|
-
getStaticDepositSecretKey(idx: number): Promise<Uint8Array>;
|
|
157
|
-
generateMnemonic(): Promise<string>;
|
|
158
|
-
mnemonicToSeed(mnemonic: string): Promise<Uint8Array>;
|
|
159
|
-
getTrackedPublicKeys(): Promise<Uint8Array[]>;
|
|
160
|
-
generatePublicKey(hash?: Uint8Array): Promise<Uint8Array>;
|
|
161
|
-
removePublicKey(publicKey: Uint8Array): Promise<void>;
|
|
162
|
-
subtractPrivateKeysGivenPublicKeys(first: Uint8Array, second: Uint8Array): Promise<Uint8Array>;
|
|
163
|
-
splitSecretWithProofs({ secret, curveOrder, threshold, numShares, isSecretPubkey, }: SplitSecretWithProofsParams): Promise<VerifiableSecretShare[]>;
|
|
164
|
-
signFrost({ message, privateAsPubKey, publicKey, verifyingKey, selfCommitment, statechainCommitments, adaptorPubKey, }: SignFrostParams): Promise<Uint8Array>;
|
|
165
|
-
aggregateFrost({ message, publicKey, verifyingKey, selfCommitment, statechainCommitments, adaptorPubKey, selfSignature, statechainSignatures, statechainPublicKeys, }: AggregateFrostParams): Promise<Uint8Array>;
|
|
166
|
-
createSparkWalletFromSeed(seed: Uint8Array | string, accountNumber?: number): Promise<string>;
|
|
167
|
-
signMessageWithPublicKey(message: Uint8Array, publicKey: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
168
|
-
signMessageWithIdentityKey(message: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
169
|
-
encryptLeafPrivateKeyEcies(receiverPublicKey: Uint8Array, publicKey: Uint8Array): Promise<Uint8Array>;
|
|
170
|
-
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
171
|
-
getRandomSigningCommitment(): Promise<SigningCommitment>;
|
|
172
|
-
hashRandomPrivateKey(): Promise<Uint8Array>;
|
|
173
|
-
generateAdaptorFromSignature(signature: Uint8Array): Promise<{
|
|
174
|
-
adaptorSignature: Uint8Array;
|
|
175
|
-
adaptorPublicKey: Uint8Array;
|
|
176
|
-
}>;
|
|
177
|
-
getMasterPublicKey(): Promise<Uint8Array>;
|
|
178
|
-
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
179
|
-
signPsbt(psbt: Psbt, input: number, sighashTypes?: number[], receipt?: Receipt): Promise<Psbt>;
|
|
180
|
-
private getReceiptPrivateKey;
|
|
181
|
-
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
182
|
-
}
|
|
183
|
-
declare class TaprootSparkSigner extends DefaultSparkSigner {
|
|
184
|
-
constructor();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export { type AggregateFrostParams as A, DefaultSparkSigner as D, type SparkSigner as S, TaprootSparkSigner as T, type VerifiableSecretShare as V, generatePolynomialForSecretSharing as a, splitSecretWithProofs as b, computerLagrangeCoefficients as c, bigIntToPrivateKey as d, evaluatePolynomial as e, fieldDiv as f, getRandomBigInt as g, type SigningCommitment as h, type SigningNonce as i, TaprootOutputKeysGenerator as j, type SignFrostParams as k, type SplitSecretWithProofsParams as l, modInverse as m, recoverSecret as r, splitSecret as s, validateShare as v };
|