@silencelaboratories/walletprovider-sdk 1.3.0 → 1.4.0
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/LICENSE +103 -0
- package/README.md +89 -32
- package/dist/{EOAauthentication.d.ts → auth/EOAauthentication.d.ts} +13 -10
- package/dist/{authentication.d.ts → auth/authentication.d.ts} +56 -38
- package/dist/auth/ephemeralAuthentication.d.ts +58 -0
- package/dist/{passkeyAuthentication.d.ts → auth/passkeyAuthentication.d.ts} +2 -2
- package/dist/builder/signRequest.d.ts +28 -0
- package/dist/builder/userAuth.d.ts +28 -0
- package/dist/client/ethUtil.d.ts +8 -0
- package/dist/client/httpClient.d.ts +23 -0
- package/dist/client/networkRequest.d.ts +82 -0
- package/dist/client/networkResponse.d.ts +118 -0
- package/dist/{networkSigner.d.ts → client/networkSigner.d.ts} +35 -72
- package/dist/client/walletProviderServiceClient.d.ts +46 -0
- package/dist/client/walletProviderServiceClientInterface.d.ts +64 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +35 -13
- package/dist/index.esm.js +1 -1
- package/dist/setupMessage.d.ts +25 -32
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/encoder.d.ts +7 -0
- package/dist/utils/validator.d.ts +7 -0
- package/dist/viemSigner.d.ts +13 -4
- package/package.json +6 -3
- package/dist/encoding.d.ts +0 -4
- package/dist/ephemeralAuthentication.d.ts +0 -44
- package/dist/validator.d.ts +0 -6
- package/dist/walletProviderServiceClient.d.ts +0 -43
- package/dist/walletProviderServiceClientInterface.d.ts +0 -59
package/LICENSE
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
SILENCE LABORATORIES’ NON-COMMERCIAL USE LICENSE AGREEMENT (SLL)
|
|
2
|
+
|
|
3
|
+
This is an agreement (License) between You and Silence Laboratories Pte. Ltd., a company incorporated under the laws of Singapore having the registration number UEN 201938700D (Silence Laboratories). By using or accessing this repository(ies)/software made available by Silence Laboratories (each, a Software) in any manner, you agree to the terms of this License.
|
|
4
|
+
|
|
5
|
+
You acknowledge and accept that Silence Laboratories and its licensors, as applicable, own all legal right, title and interest in and to the work, software, application, source code, object code, documentation and any other documents in the Software. Further, you acknowledge and agree that Silence Laboratories and its licensors, as applicable, own all registered and unregistered intellectual property rights subsisting in the Software anywhere in the world, whether in source code form or any other form.
|
|
6
|
+
|
|
7
|
+
The limited rights granted below in relation to the Software are the only rights granted under this License. No additional rights are granted by Silence Laboratories under this License.
|
|
8
|
+
|
|
9
|
+
This License is applicable to all copies of the original and any modified versions of the Software, and derivative works of the Software. This License is applicable to all past and future versions of the Software, unless decided otherwise by Silence Laboratories in its sole discretion.
|
|
10
|
+
|
|
11
|
+
1. Grant of License
|
|
12
|
+
|
|
13
|
+
1.1. You are granted a perpetual, limited, revocable, worldwide, royalty-free, non-exclusive, non-transferable, non-sublicensable License to use, reproduce, make available, distribute, publish, copy, modify, merge, combine with another program or create derivative works of the Software in source code or any other form (Resulting Program(s)) solely for Non-Commercial Use (as defined below), and as long as you:
|
|
14
|
+
|
|
15
|
+
a. do not use, reproduce, make available, distribute, publish, copy, modify, merge and combine the Software or Resulting Program (a) in any manner that infringes, misappropriates, or otherwise violates any third-party rights, or (b) in any manner that violates any applicable law.
|
|
16
|
+
|
|
17
|
+
b. give any other recipients or users of the Software or the Resulting Program a copy of this License;
|
|
18
|
+
|
|
19
|
+
c. prominently publish or give notice with each copy of the Resulting Program that,
|
|
20
|
+
|
|
21
|
+
i. the Software is used in the Resulting Program,
|
|
22
|
+
|
|
23
|
+
ii. (if applicable) you changed or modified the files and any other documents in the Software (including stating the changes or modifications made), and give the relevant date; and
|
|
24
|
+
|
|
25
|
+
iii. Silence Laboratories is the owner of the copyright and all other intellectual property rights in the Software by: (A) including the following copyright notice: “\[This repository/software] is licensed under the Silence Laboratories License Agreement, Copyright © Silence Laboratories Pte. Ltd. All Rights Reserved.”, (B), this list of conditions, and (C) the disclaimer below (NOTICE) as a text file; and
|
|
26
|
+
|
|
27
|
+
d. require the Resulting Program and any reproduction, distribution, publication, copy, modification, merger therewith, combination with another program or derivative works thereof to the same NOTICE requirement and Non-Commercial Use restrictions set out below; and
|
|
28
|
+
|
|
29
|
+
e. make the source code form of the Resulting Program publicly available or make it available upon request (subject to the terms of this License, third party rights, and applicable law); and
|
|
30
|
+
|
|
31
|
+
f. retain, in the source form of any Resulting Program that you distribute, all copyright, patent, trademark, and attribution notices from the source form of the Software, excluding those notices that do not pertain to any part of the Resulting Program; and
|
|
32
|
+
|
|
33
|
+
g. If the Software includes a NOTICE text file as part of its distribution, then any Resulting Program that you distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Resulting Program, in at least one of the following places: within a NOTICE text file distributed as part of the Resulting Program; within the source form or documentation, if provided along with the Resulting Program; or, within a display generated by the Resulting Program, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add your own attribution notices within Resulting Programs that you distribute, alongside as an addendum to the NOTICE text from the Software, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
34
|
+
|
|
35
|
+
1.2. You may add your own copyright statement to your modifications and provide additional or different license terms and conditions for use, reproduction, or distribution of your modifications, or for any such Resulting Program as a whole, provided your use, reproduction, or distribution of the Software otherwise complies with the conditions stated in this License.
|
|
36
|
+
|
|
37
|
+
2) Violation of terms of License
|
|
38
|
+
|
|
39
|
+
2.1. If your use of the Software or the Resulting Program does not comply with the conditions set out in this License or has any intended or unintended commercial application anywhere in the world and at any given point of time, you shall obtain a Commercial Use License from Silence Laboratories, or you must refrain from using the Software immediately. To obtain a copy of the Commercial Use License, reach out to info@silencelaboratories.com.
|
|
40
|
+
|
|
41
|
+
2.2 Upon Silence Laboratories coming to know of your potential violation of any of the terms of this License, you will be notified in writing (Silence Laboratories Notice) to purchase a Commercial Use License within 30 days of receiving the Silence Laboratories Notice or refrain from using the Software immediately.
|
|
42
|
+
|
|
43
|
+
2.3. Any continued use of the Software in violation of this License will automatically result in termination of your rights under this License for the current and any future or past versions of the Software.
|
|
44
|
+
|
|
45
|
+
3. Intellectual Property
|
|
46
|
+
|
|
47
|
+
3.1. This License does not grant you any right to use the name, trade marks, service marks, trade names, logos or any other intellectual property of Silence Laboratories for endorsing, promoting the Resulting Program or other works derived using the Software without obtaining specific written permission from Silence Laboratories (except as required for reasonable and customary use in attributing the usage of the Software to Silence Laboratories as expressly required under this License).
|
|
48
|
+
|
|
49
|
+
3.2. You must cause any Resulting Program to carry prominent notices stating that you have made changes to or modified the Software independently and without any involvement from Silence Laboratories in developing the Resulting Program.
|
|
50
|
+
|
|
51
|
+
4. Third Party Material
|
|
52
|
+
|
|
53
|
+
The Software may contain third-party software or other components (including free and open source software) as may be made available by Silence Laboratories on its website https://silencelaboratories.com (OS Components), which are subject to the license terms of the respective third-party licensors. Your dealings or correspondence with third parties and your use of or interaction with any OS Components are solely between you and the third party. Silence Laboratories does not control or endorse, and makes no representations or warranties regarding, any OS Components, and your access to and use of such OS Components are at your own risk. You may modify or replace these OS Components; provided that you comply with the terms of this License, any applicable licensing terms governing use of the OS Components, and applicable laws. Silence Laboratories is not obligated to provide any updates, maintenance, warranty, technical or other support, or services for the resultant modified Software.
|
|
54
|
+
|
|
55
|
+
5. Limitation of Liability
|
|
56
|
+
|
|
57
|
+
TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT WILL SILENCE LABORATORIES BE LIABLE TO YOU (A) UNDER ANY THEORY OF LIABILITY, WHETHER BASED IN CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY, WARRANTY, OR OTHERWISE UNDER THIS LICENSE, OR (B) FOR ANY INDIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, PUNITIVE OR SPECIAL DAMAGES OR LOST PROFITS, EVEN IF SILENCE LABORATORIES HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THE PROGRAM, THEIR CONSTITUENT COMPONENTS, THE RESULTING PROGRAM AND ANY OUTPUT (COLLECTIVELY, PROGRAM MATERIALS) ARE NOT DESIGNED OR INTENDED FOR USE IN ANY APPLICATION OR SITUATION WHERE FAILURE OR FAULT OF THE PROGRAM MATERIALS COULD REASONABLY BE ANTICIPATED TO LEAD TO SERIOUS INJURY OF ANY PERSON OR PROPERTY, INCLUDING POTENTIAL LOSS OF PROPERTY AND VIRTUAL ASSETS (INCLUDING CRYPTOCURRENCIES, NON-FUNGIBLE TOKENS, ETC.), LOSS OF ACCESS TO A VIRTUAL ASSET WALLET, VIOLATION OF AN INDIVIDUAL’S PRIVACY RIGHTS (EACH, A HIGH-RISK USE). IF YOU ELECT TO USE ANY OF THE PROGRAM MATERIALS FOR A HIGH-RISK USE, YOU DO SO AT YOUR OWN RISK. YOU AGREE TO DESIGN AND IMPLEMENT APPROPRIATE DECISION-MAKING AND RISK-MITIGATION PROCEDURES AND POLICIES IN CONNECTION WITH A HIGH-RISK USE SUCH THAT EVEN IF THERE IS A FAILURE OR FAULT IN ANY OF THE PROGRAM MATERIALS, THE SAFETY OF PERSONS OR PROPERTY AFFECTED BY THE ACTIVITY STAYS AT A LEVEL THAT IS REASONABLE, APPROPRIATE, AND LAWFUL FOR THE FIELD OF THE HIGH-RISK USE.
|
|
58
|
+
|
|
59
|
+
6. Indemnity
|
|
60
|
+
|
|
61
|
+
You will indemnify, defend and hold harmless Silence Laboratories and its affiliates, and each of its respective shareholders, directors, officers, employees, agents, successors, and assigns (collectively, the Silence Laboratories Parties) from and against any losses, liabilities, damages, fines, penalties, and expenses (including reasonable attorneys’ fees) incurred by any Silence Laboratories Party in connection with any claim, demand, allegation, lawsuit, proceeding, or investigation (collectively, Claims) arising out of or related to: (a) your access to or use of the Program Products (as well as any results or data generated from such access or use), including any High-Risk Use (defined below); (b) your violation of this License; or (c) your violation, misappropriation or infringement of any rights of another (including intellectual property or other proprietary rights and privacy rights). You will promptly notify the Silence Laboratories Parties of any such Claims, and cooperate with Silence Laboratories Parties in defending such Claims. You will also grant the Silence Laboratories Parties sole control of the defense or settlement, at Silence Laboratories’ sole option, of any Claims. This indemnity is in addition to, and not in lieu of, any other indemnities or remedies set forth in a written agreement between you and Silence Laboratories or the other Silence Laboratories Parties.
|
|
62
|
+
|
|
63
|
+
7. Contributions
|
|
64
|
+
|
|
65
|
+
7.1. "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Silence Laboratories for inclusion in, or documentation of, any of the products owned or managed by Silence Laboratories (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Silence Laboratories or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems
|
|
66
|
+
|
|
67
|
+
7.2. Subject to the terms and conditions of this Agreement, You hereby grant to Silence Laboratories and to recipients of software products distributed by Silence Laboratories a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
|
|
68
|
+
|
|
69
|
+
7.3. Subject to the terms and conditions of this Agreement,You hereby grant to Silence Laboratories and to recipients of software distributed by Silence Laboratories a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted.
|
|
70
|
+
|
|
71
|
+
7.4. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that Your Contribution, or the Work to which You have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
|
|
72
|
+
|
|
73
|
+
7.6. You represent that You are legally entitled to grant the above license. If Your employer(s) has rights to intellectual property that You create that includes Your Contributions, You represent that You have received permission to make Contributions on behalf of that employer, that Your employer has waived such rights for Your Contributions to Silence Laboratories, or that Your employer has executed a separate Corporate CLA with Silence Laboratories.
|
|
74
|
+
|
|
75
|
+
7.6. You represent that each of Your Contributions is Your original creation. You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which You are personally aware and which are associated with any part of Your Contributions.
|
|
76
|
+
|
|
77
|
+
7.7. You agree to notify Silence Laboratories of any facts or circumstances of which You become aware that would make these representations inaccurate in any respect.
|
|
78
|
+
|
|
79
|
+
8. Governing Law
|
|
80
|
+
|
|
81
|
+
This License will be governed by and shall be construed in accordance with the laws of Singapore without regard to any choice or conflict of laws rules. All or any disputes arising out of or touching upon or in relation to this License including the interpretation and validity of the terms thereof and the respective rights and obligations of the parties shall be settled through arbitration. The arbitration proceedings shall be held in Singapore by a sole arbitrator who shall be appointed by Silence Laboratories and whose decision shall be final and binding upon all the parties. Subject to the arbitration clause, the courts in Singapore alone shall have jurisdiction. The language of the arbitration proceedings shall be in English. You and Silence Laboratories agree that any cause of action arising in relation to the License must be commenced within three (3) months after the cause of action accrues or you become aware of the facts giving rise to the cause of action, whichever is later. Otherwise, such cause of action shall be permanently barred. Each party to any arbitration will cover its own fees and costs associated with the arbitration proceedings. The award of the arbitrator will be final and binding, and any judgement on the award rendered by the arbitrator may be entered in any court of competent jurisdiction. The parties to the arbitration shall not appeal any arbitration decision to any court.
|
|
82
|
+
|
|
83
|
+
9. Modifications
|
|
84
|
+
|
|
85
|
+
Silence Laboratories may modify the terms of this License at any time, at its sole discretion. Such modified terms of this License will come into effect immediately upon their publication, unless decided otherwise by Silence Laboratories (Effective Date). By continuing to use or access the Software after the Effective Date, you agree to the modified terms of this License. It is your responsibility to check this License regularly for any modifications.
|
|
86
|
+
|
|
87
|
+
10. Definition
|
|
88
|
+
|
|
89
|
+
Non-Commercial Use means your use of the Software as described below, as determined by Silence Laboratories in its sole discretion, for:
|
|
90
|
+
|
|
91
|
+
a. personal use for research, experiments, personal study, educational purposes, private entertainment, personal projects or amateur pursuits;
|
|
92
|
+
|
|
93
|
+
b. use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization or government institution,
|
|
94
|
+
|
|
95
|
+
in each case, i.e., (1) and (2), without anticipated commercial application. For the sake of clarity, modifying and/or creating a substitute for the Software, or any other use of the Software, for commercial gain, including by way of (a) using the Software for internal business purposes, or (b) resale or distribution for commercial purposes, shall not constitute Non-Commercial Use.
|
|
96
|
+
|
|
97
|
+
DISCLAIMER
|
|
98
|
+
|
|
99
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS PROGRAM, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
100
|
+
|
|
101
|
+
We have last modified this License on 28-01-2025.
|
|
102
|
+
|
|
103
|
+
If you have any questions, comments or interest in pursuing any other commercial use cases, please reach out to us at info@silencelaboratories.com.
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ The [ephemeral public claim](./docs/walletprovider-sdk.eoaauth.ephclaim.md) will
|
|
|
58
58
|
|
|
59
59
|
## Keygen
|
|
60
60
|
|
|
61
|
-
The full working example is in the [demo](https://github.com/silence-laboratories/walletprovider-sdk/blob/main/demo/src/routes/%2Bpage.svelte
|
|
61
|
+
The full working example is in the [demo](https://github.com/silence-laboratories/walletprovider-sdk/blob/main/demo/src/routes/%2Bpage.svelte).
|
|
62
62
|
The core object to use is the [NetworkSigner](./docs/walletprovider-sdk.networksigner.md). It allows to generate keys and do signatures.
|
|
63
63
|
|
|
64
64
|
In order to create your keys, you need two other components. The [WalletProviderServiceClient](./docs/walletprovider-sdk.walletproviderserviceclient.md) that connects to the Backend part of the SDK, and the **authenticator module**.
|
|
@@ -94,7 +94,7 @@ const eoaAuth = new EOAAuth(
|
|
|
94
94
|
const wpClient = await createWalletProviderService(clusterConfig);
|
|
95
95
|
|
|
96
96
|
// Create a new signer instance
|
|
97
|
-
const sdk = new NetworkSigner(wpClient,
|
|
97
|
+
const sdk = new NetworkSigner(wpClient, eoaAuth);
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
Now you can generate a key, using the [generateKey](./docs/walletprovider-sdk.networksigner.generatekey.md) method. The method accepts optional permissions. No permissions means _allow all operations_.
|
|
@@ -115,13 +115,15 @@ const permissions = {
|
|
|
115
115
|
],
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
+
let signAlgs = ['secp256k1', 'ed25519'];
|
|
119
|
+
|
|
118
120
|
// Generate a new key
|
|
119
|
-
let resp: KeygenResponse = await sdk.generateKey(JSON.stringify(permissions));
|
|
121
|
+
let resp: KeygenResponse[] = await sdk.generateKey(threshold, partiesNumber, signAlgs, JSON.stringify(permissions));
|
|
120
122
|
```
|
|
121
123
|
|
|
122
124
|
Calling this method will cause to the Digital Wallet window to pop up, requesting the User to sign the request.
|
|
123
125
|
|
|
124
|
-
The returned [KeygenResponse](./docs/walletprovider-sdk.keygenresponse.md) contains `keyId` and `
|
|
126
|
+
The returned response [KeygenResponse[]](./docs/walletprovider-sdk.keygenresponse.md) is a list of DKG results, each contains `keyId`, `publicKey` and `signAlg`. The `publicKey` is the public part of the key generated by Silent Network. The `signAlg` is the sign algorithm of the MPC key. Use the `keyId` in subsequent calls to sign.
|
|
125
127
|
|
|
126
128
|
The ephemeral `sk` key can be later used in subsequent signgen requests for authenticating.
|
|
127
129
|
|
|
@@ -142,7 +144,7 @@ const passkeyUser = {
|
|
|
142
144
|
|
|
143
145
|
const passkeyAuth = new PasskeyRegister(rpConfig, passkeyUser);
|
|
144
146
|
// Create a new signer instance
|
|
145
|
-
const sdk = new NetworkSigner(wpClient,
|
|
147
|
+
const sdk = new NetworkSigner(wpClient, passkeyAuth);
|
|
146
148
|
|
|
147
149
|
// Register a new passkey
|
|
148
150
|
let resp: RegisterPasskeyResponse = await sdk.registerPasskey();
|
|
@@ -184,7 +186,7 @@ const passkeyAuth = new PasskeyAuth(
|
|
|
184
186
|
);
|
|
185
187
|
|
|
186
188
|
// Create a new signer instance
|
|
187
|
-
const sdk = new NetworkSigner(wpClient,
|
|
189
|
+
const sdk = new NetworkSigner(wpClient, passkeyAuth);
|
|
188
190
|
```
|
|
189
191
|
|
|
190
192
|
Now you can generate a key like in the EOA example by calling the [generateKey](./docs/walletprovider-sdk.networksigner.generatekey.md) method.
|
|
@@ -195,44 +197,99 @@ The `sk` key can be later used in subsequent signgen requests.
|
|
|
195
197
|
|
|
196
198
|
## Signing
|
|
197
199
|
|
|
198
|
-
The full signing example is [here](https://github.com/silence-laboratories/walletprovider-sdk/blob/main/demo/src/routes/%2Bpage.svelte
|
|
200
|
+
The full signing example is [here](https://github.com/silence-laboratories/walletprovider-sdk/blob/main/demo/src/routes/%2Bpage.svelte).
|
|
199
201
|
|
|
200
202
|
The workflow is similar to the keygen process. The core objects to use are the [NetworkSigner](./docs/walletprovider-sdk.networksigner.md), WalletProviderServiceClient, and the [ephemeral authenticator module](./docs/walletprovider-sdk.ephauth.md).
|
|
201
203
|
```ts
|
|
202
204
|
const authModule = new EphAuth(selectedEphId, ephSK, selectedEphSignAlg);
|
|
203
205
|
// Create a new signer instance
|
|
204
|
-
const sdk = new NetworkSigner(wpClient,
|
|
206
|
+
const sdk = new NetworkSigner(wpClient, authModule);
|
|
205
207
|
```
|
|
206
208
|
|
|
207
209
|
|
|
208
|
-
Use the [
|
|
210
|
+
Use the [SignRequestBuilder](./docs/walletprovider-sdk.signrequestbuilder.md) builder to generate the sign message payload. Then call the [signMessage](./docs/walletprovider-sdk.networksigner.signmessage.md) method to run the signing process.
|
|
209
211
|
|
|
210
212
|
```ts
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
213
|
+
const signMessage = new SignRequestBuilder()
|
|
214
|
+
.setRequest(
|
|
215
|
+
uuidv4(),
|
|
216
|
+
JSON.stringify({
|
|
217
|
+
userOperation: {
|
|
218
|
+
sender: '0x8d4cb2540d993fe34c646299f1ab4af3012ff34c',
|
|
219
|
+
nonce: '0x7',
|
|
220
|
+
initCode: '0x',
|
|
221
|
+
callData: '0000...',
|
|
222
|
+
callGasLimit: '0x18473',
|
|
223
|
+
verificationGasLimit: '0x18473',
|
|
224
|
+
preVerificationGas: '66768',
|
|
225
|
+
maxFeePerGas: '',
|
|
226
|
+
maxPriorityFeePerGas: '',
|
|
227
|
+
paymasterAndData: '0x',
|
|
228
|
+
},
|
|
229
|
+
entryPointVersion: 'v0.6.0',
|
|
230
|
+
entryPointAddress: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
|
|
231
|
+
chainId: 80002,
|
|
232
|
+
}),
|
|
233
|
+
'accountAbstractionTx',
|
|
234
|
+
)
|
|
235
|
+
.setRequest(
|
|
236
|
+
uuidv4(),
|
|
237
|
+
'4549502d313931206d657373616765',
|
|
238
|
+
'rawBytes',
|
|
239
|
+
)
|
|
240
|
+
.build();
|
|
241
|
+
|
|
242
|
+
let resp = await sdk.signMessage( threshold, selectedKeyId, signMessage);
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The [SignResponse](./docs/walletprovider-sdk.signresponse.md) contains the signature `sign`, the recovery ID `recid` and the transaction ID `transactionId`.
|
|
246
|
+
|
|
247
|
+
## Key refresh
|
|
248
|
+
|
|
249
|
+
The full key refresh example is [here](https://github.com/silence-laboratories/walletprovider-sdk/blob/main/demo/src/routes/%2Bpage.svelte).
|
|
250
|
+
|
|
251
|
+
The workflow is similar to the keygen process. The core objects to use are the [NetworkSigner](./docs/walletprovider-sdk.networksigner.md), WalletProviderServiceClient, and the [EOAAuth](./docs/walletprovider-sdk.eoaauth.md) module.
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
const algSign = 'secp256k1'; // Signing algorithms of ephemeral key
|
|
256
|
+
// Generate ephemeral secret key esk
|
|
257
|
+
const sk = generateEphPrivateKey(algSign);
|
|
258
|
+
// Derive public part epk from esk
|
|
259
|
+
const ephPK = getEphPublicKey(sk, algSign);
|
|
260
|
+
// Arbitrary ID to identify the ephemeral key
|
|
261
|
+
const ephId = uuidv4();
|
|
262
|
+
// Create ephemeral key claim instance based on the ephemeral key
|
|
263
|
+
const ephClaim = new EphKeyClaim(
|
|
264
|
+
ephId,
|
|
265
|
+
ephPK,
|
|
266
|
+
algSign,
|
|
267
|
+
// Lifetime of one hour
|
|
268
|
+
60 * 60,
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
// Create EOA authenticator, signature will include epk
|
|
272
|
+
const eoaAuth = new EOAAuth(
|
|
273
|
+
accountsFromBrowserWallet[0],
|
|
274
|
+
new BrowserWallet(),
|
|
275
|
+
ephClaim
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
// Create a client that connects to the backend service
|
|
279
|
+
const wpClient = await createWalletProviderService(clusterConfig);
|
|
280
|
+
|
|
281
|
+
// Create a new signer instance
|
|
282
|
+
const sdk = new NetworkSigner(wpClient, eoaAuth);
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Now you can refresh the key (before doing this, make sure you've already generated the key), using the [refreshKey](./docs/walletprovider-sdk.networksigner.refreshkey.md) method.
|
|
286
|
+
|
|
287
|
+
```ts
|
|
288
|
+
// Refresh the key
|
|
289
|
+
let resp: KeyRefreshResponse = await sdk.refreshKey(threshold, keyId, mpcKeySignAlg);
|
|
233
290
|
```
|
|
291
|
+
The returned response [KeyRefreshResponse](./docs/walletprovider-sdk.keyrefreshresponse.md) contains `keyId`, `publicKey` and `signAlg` of the refreshed MPC key.
|
|
234
292
|
|
|
235
|
-
The [SignResponse](./docs/walletprovider-sdk.signresponse.md) contains the signature `sign` and the recovery ID `recid`.
|
|
236
293
|
|
|
237
294
|
# Development
|
|
238
295
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** Externally Owned Account (EOA) atuhentication. Uses secret key stored on a wallet to sign requests.
|
|
2
2
|
* The requests are presented to the user in a readable form by using TypedData (EIP712).
|
|
3
3
|
*/
|
|
4
|
-
import { MetadataSetupOpts, KeygenSetupOpts } from './setupMessage';
|
|
5
4
|
import { type UserAuthentication } from './authentication';
|
|
6
5
|
import { type TypedDataDomain } from 'viem';
|
|
7
6
|
import { EphKeyClaim } from './ephemeralAuthentication';
|
|
@@ -10,7 +9,7 @@ export type FieldDefinition = {
|
|
|
10
9
|
type: string;
|
|
11
10
|
};
|
|
12
11
|
/** EIP-712 Typed data struct definition.
|
|
13
|
-
* @
|
|
12
|
+
* @public
|
|
14
13
|
* */
|
|
15
14
|
export type TypedData<T> = {
|
|
16
15
|
/** contains the schema definition of the types that are in `msg` */
|
|
@@ -25,7 +24,7 @@ export type TypedData<T> = {
|
|
|
25
24
|
/**
|
|
26
25
|
* Interface to implement communication between this library, and a Browser Wallet. In order to
|
|
27
26
|
* request the signature from the User.
|
|
28
|
-
* @
|
|
27
|
+
* @public
|
|
29
28
|
*/
|
|
30
29
|
export interface IBrowserWallet {
|
|
31
30
|
/** Sign data using the secret key stored on Browser Wallet
|
|
@@ -45,23 +44,27 @@ export interface IBrowserWallet {
|
|
|
45
44
|
*/
|
|
46
45
|
signTypedData<T>(from: string, request: TypedData<T>): Promise<unknown>;
|
|
47
46
|
}
|
|
48
|
-
type RequestToSign<T> = {
|
|
49
|
-
setup: T;
|
|
50
|
-
challenge: string;
|
|
51
|
-
};
|
|
52
47
|
export declare const EIP712SilentShardAuthenticationDomain: {
|
|
53
48
|
name: string;
|
|
54
49
|
version: string;
|
|
55
50
|
};
|
|
56
|
-
|
|
51
|
+
type RequestToSign<T> = {
|
|
52
|
+
setup: T;
|
|
53
|
+
challenge: string;
|
|
54
|
+
eph_claim: string;
|
|
55
|
+
};
|
|
56
|
+
export interface EoaAuthPayload {
|
|
57
|
+
get eoaRequestSchema(): any;
|
|
58
|
+
}
|
|
59
|
+
export declare function createTypedRequest(request: EoaAuthPayload, final_challenge: string, eph_claim: string): TypedData<RequestToSign<EoaAuthPayload>>;
|
|
57
60
|
/** Present the request to the User using wallet UI, and ask for sign.
|
|
58
61
|
* The signature is the authorization for keygen operation
|
|
59
62
|
*/
|
|
60
63
|
export declare function authenticateUsingEOA({ setup, eoa, challenge, browserWallet, ephClaim, }: {
|
|
61
|
-
setup:
|
|
64
|
+
setup: EoaAuthPayload;
|
|
62
65
|
eoa: string;
|
|
63
66
|
challenge: string;
|
|
64
67
|
browserWallet: IBrowserWallet;
|
|
65
|
-
ephClaim: EphKeyClaim;
|
|
68
|
+
ephClaim: EphKeyClaim | undefined;
|
|
66
69
|
}): Promise<UserAuthentication>;
|
|
67
70
|
export {};
|
|
@@ -1,60 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AddEphKeyRequest, RegisterPasskeyRequest } from './../client/networkRequest';
|
|
2
|
+
import { KeygenSetupOpts } from '../setupMessage';
|
|
3
|
+
import { EoaAuthPayload, IBrowserWallet } from './EOAauthentication';
|
|
3
4
|
import { PasskeyUser, RelyingPartyConfig } from './passkeyAuthentication';
|
|
4
|
-
import { EphKeyClaim,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { EphemeralAuthPayload, EphKeyClaim, EphKeySignAlgorithm } from './ephemeralAuthentication';
|
|
6
|
+
import { RevokeEphKeyRequest } from '../client/networkRequest';
|
|
7
|
+
/** Contains essential information about how to authenticate the user request.
|
|
8
|
+
* @public
|
|
7
9
|
*/
|
|
8
10
|
export type UserCredentials = {
|
|
9
11
|
id: string;
|
|
10
12
|
method: 'eoa' | 'ephemeral' | 'passkey';
|
|
11
13
|
credentials: string;
|
|
12
14
|
};
|
|
15
|
+
/** User signature container.
|
|
16
|
+
* It contains the signature of the request and the user credentials (authentication method, id and additional credential information).
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
13
19
|
export type UserAuthentication = {
|
|
14
20
|
credentials: UserCredentials;
|
|
15
21
|
signature: string;
|
|
16
22
|
};
|
|
17
23
|
export interface AuthModule {
|
|
18
|
-
authenticate({
|
|
19
|
-
|
|
24
|
+
authenticate({ payload, challenge }: {
|
|
25
|
+
payload: AuthPayload;
|
|
20
26
|
challenge: string;
|
|
21
27
|
}): Promise<UserAuthentication>;
|
|
22
28
|
}
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
}
|
|
29
|
+
export type AuthPayload = EoaAuthPayload | PasskeyLoginPayload | EphemeralAuthPayload | RegisterPasskeyRequest;
|
|
30
|
+
type PasskeyLoginPayload = KeygenSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest;
|
|
26
31
|
/** The `EOAAuth` implementing Externally Owned Account authentication.
|
|
27
|
-
* @
|
|
32
|
+
* @public
|
|
28
33
|
*/
|
|
29
|
-
export declare class EOAAuth
|
|
34
|
+
export declare class EOAAuth {
|
|
30
35
|
/** An interface to the wallet, like MetaMask, that is used to sign the requests */
|
|
31
36
|
private browserWallet;
|
|
32
37
|
/** the ETH address that is used to do EOA authentication */
|
|
33
38
|
private eoa;
|
|
34
|
-
/** Ephemeral key claim */
|
|
35
|
-
ephClaim
|
|
39
|
+
/** Ephemeral key claim populated for single or batched keys*/
|
|
40
|
+
private ephClaim;
|
|
36
41
|
/**
|
|
37
42
|
*
|
|
38
43
|
* @param eoa - Ethereum address
|
|
39
44
|
* @param browserWallet - Interface to the wallet provider, like MetaMask, that is used to sign the requests
|
|
40
|
-
* @param
|
|
45
|
+
* @param ephClaimOptions - Either EphKeyClaim or Map of SignatureAlgorithms and their appropriate EphKeyClaims
|
|
41
46
|
*/
|
|
42
|
-
constructor(eoa: string, browserWallet: IBrowserWallet, ephClaim
|
|
47
|
+
constructor(eoa: string, browserWallet: IBrowserWallet, ephClaim?: EphKeyClaim);
|
|
43
48
|
private validateInputs;
|
|
44
49
|
/**
|
|
45
50
|
* Prepares a message to present on the Browser Wallet window and requests to sign it.
|
|
46
|
-
* @param
|
|
47
|
-
* @param challenge - the challenge received from the backend
|
|
48
|
-
*
|
|
51
|
+
* @param payload - request payload to be sent to the backend
|
|
52
|
+
* @param challenge - the challenge received from the backend in v1 or generated by client in v2
|
|
49
53
|
* @public
|
|
50
54
|
*/
|
|
51
|
-
authenticate({
|
|
52
|
-
|
|
55
|
+
authenticate({ payload, challenge, }: {
|
|
56
|
+
payload: EoaAuthPayload;
|
|
53
57
|
challenge: string;
|
|
54
58
|
}): Promise<UserAuthentication>;
|
|
55
59
|
}
|
|
56
60
|
/** The `EphAuth` module is only used for signing requests to the network.
|
|
57
|
-
* @
|
|
61
|
+
* @public
|
|
58
62
|
* An Ephmeral key used to locally sign the signature requests to network.
|
|
59
63
|
* This eph key is registered during keygen. The key is used to sign the requests without
|
|
60
64
|
* asking the user to sign the request each time.
|
|
@@ -70,43 +74,50 @@ export declare class EphAuth implements AuthModule {
|
|
|
70
74
|
* @param ephSK - Ephemeral secret key
|
|
71
75
|
* @param signAlg - Signature algorithm
|
|
72
76
|
*/
|
|
73
|
-
constructor(ephId: string, ephSK: Uint8Array, signAlg:
|
|
77
|
+
constructor(ephId: string, ephSK: Uint8Array, signAlg: EphKeySignAlgorithm);
|
|
74
78
|
/**
|
|
75
|
-
* Prepares a message
|
|
76
|
-
* @param
|
|
77
|
-
* @param challenge - the challenge received from the backend
|
|
79
|
+
* Prepares a message for Ephemeral secret key to sign.
|
|
80
|
+
* @param payload - request payload to be sent to the backend
|
|
81
|
+
* @param challenge - the challenge received from the backend in v1 or generated by client in v2
|
|
78
82
|
*
|
|
79
83
|
* @public
|
|
80
84
|
*/
|
|
81
|
-
authenticate({
|
|
82
|
-
|
|
85
|
+
authenticate({ payload, challenge, }: {
|
|
86
|
+
payload: EphemeralAuthPayload;
|
|
83
87
|
challenge: string;
|
|
84
88
|
}): Promise<UserAuthentication>;
|
|
85
89
|
}
|
|
86
90
|
/** The `AuthModule` implementing Passkey authentication.
|
|
87
|
-
* @
|
|
91
|
+
* @public
|
|
88
92
|
*/
|
|
89
|
-
export declare class PasskeyAuth
|
|
93
|
+
export declare class PasskeyAuth {
|
|
90
94
|
/** Replying party object. Read more: https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredentialCreationOptions#rp */
|
|
91
95
|
private rpConfig;
|
|
92
96
|
/** ID of the acceptable credential by user. App proves that user has passkey credential by passing the value of this field */
|
|
93
97
|
private allowCredentialId;
|
|
94
|
-
/** Ephemeral key claim */
|
|
95
|
-
ephClaim
|
|
98
|
+
/** Ephemeral key claim populated for non batched requests*/
|
|
99
|
+
private ephClaim;
|
|
96
100
|
/**
|
|
97
101
|
*
|
|
98
102
|
* @param rpConfig - Passkey relying party configuration. Read more: https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredentialCreationOptions#rp
|
|
99
103
|
* @param allowCredentialId - ID of the acceptable credential by user. App proves that user has passkey credential by passing the value of this field
|
|
100
|
-
* @param
|
|
104
|
+
* @param ephClaimOptions - Either EphKeyClaim or Map of SignatureAlgorithms and their appropriate EphKeyClaims
|
|
101
105
|
*/
|
|
102
106
|
constructor(rpConfig: RelyingPartyConfig, allowCredentialId: string, ephClaim: EphKeyClaim);
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Prepares a message for Passkey login flow and prompts user device's authenticator to sign it.
|
|
109
|
+
* @param payload - request payload to be sent to the backend
|
|
110
|
+
* @param challenge - the challenge received from the backend in v1 or generated by client in v2
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
authenticate({ payload, // TODO: Passkey login doesnt require payload, we should clean up this
|
|
114
|
+
challenge, }: {
|
|
115
|
+
payload: PasskeyLoginPayload;
|
|
105
116
|
challenge: string;
|
|
106
117
|
}): Promise<UserAuthentication>;
|
|
107
118
|
}
|
|
108
119
|
/** The `AuthModule` implementing Passkey register.
|
|
109
|
-
* @
|
|
120
|
+
* @public
|
|
110
121
|
*/
|
|
111
122
|
export declare class PasskeyRegister implements AuthModule {
|
|
112
123
|
/** Replying party object. Read more: https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredentialCreationOptions#rp */
|
|
@@ -119,8 +130,15 @@ export declare class PasskeyRegister implements AuthModule {
|
|
|
119
130
|
* @param user - Passkey user information, only requires while registering. Read more: https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredentialCreationOptions#user
|
|
120
131
|
*/
|
|
121
132
|
constructor(rpConfig: RelyingPartyConfig, user: PasskeyUser);
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Prepares a message for Passkey register flow and prompts user device's authenticator to sign it.
|
|
135
|
+
* @param payload - request payload to be sent to the backend
|
|
136
|
+
* @param challenge - the challenge received from the backend in v1 or generated by client in v2
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
authenticate({ payload, challenge, }: {
|
|
140
|
+
payload: RegisterPasskeyRequest;
|
|
124
141
|
challenge: string;
|
|
125
142
|
}): Promise<UserAuthentication>;
|
|
126
143
|
}
|
|
144
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { UserAuthentication } from './authentication';
|
|
2
|
+
import { SignSetupOpts } from '../setupMessage';
|
|
3
|
+
import { RevokeEphKeyRequest } from '../client/networkRequest';
|
|
4
|
+
/**
|
|
5
|
+
* Supported signature algorithms for ephemeral signing.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type EphKeySignAlgorithm = 'ed25519' | 'secp256k1';
|
|
9
|
+
export type EphemeralAuthPayload = SignSetupOpts | RevokeEphKeyRequest;
|
|
10
|
+
/** The `EphKeyClaim` object represents the public claim of the ephemeral key.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare class EphKeyClaim {
|
|
14
|
+
ephId: string;
|
|
15
|
+
ephPK: string;
|
|
16
|
+
signAlg: EphKeySignAlgorithm;
|
|
17
|
+
expiry: number;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param ephId - Ephemeral key ID
|
|
21
|
+
* @param ephPK - Ephemeral public key
|
|
22
|
+
* @param signAlg - Signature algorithm.
|
|
23
|
+
* @param expiryInSecs - Expiry date of the ephemeral key in seconds. Default is 1 hour.
|
|
24
|
+
*/
|
|
25
|
+
constructor(ephId: string, ephPK: Uint8Array, signAlg: EphKeySignAlgorithm, expiryInSecs?: number);
|
|
26
|
+
private validateInputs;
|
|
27
|
+
toJSON(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Helper method to generate ephemeral keypair and its claim. This uses the generated public key as the ephemeral key ID.
|
|
30
|
+
*
|
|
31
|
+
* @param algSign - Signature algorithm
|
|
32
|
+
* @param expiryInSecs - Expiry date of the ephemeral key in seconds. Default is 1 hour
|
|
33
|
+
* @returns keypair of ephemeral key and its claim
|
|
34
|
+
*/
|
|
35
|
+
static generateKeys(algSign: EphKeySignAlgorithm, expiryInSecs?: number): {
|
|
36
|
+
privKey: Uint8Array;
|
|
37
|
+
pubKey: Uint8Array;
|
|
38
|
+
ephClaim: EphKeyClaim;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Locally sign the signature requests to network without asking the user, the ephSK is registered during keygen.
|
|
42
|
+
* The signature is the authorization for signgen operation
|
|
43
|
+
*/
|
|
44
|
+
export declare function authenticateUsingEphKey({ setup, challenge, ephSK, ephClaim, }: {
|
|
45
|
+
setup: EphemeralAuthPayload;
|
|
46
|
+
challenge: string;
|
|
47
|
+
ephSK: Uint8Array;
|
|
48
|
+
ephClaim: EphKeyClaim;
|
|
49
|
+
}): Promise<UserAuthentication>;
|
|
50
|
+
export declare function genHexSignature(msg: Uint8Array, ephSK: Uint8Array, signAlg: EphKeySignAlgorithm): Promise<string>;
|
|
51
|
+
/** Generate Ephemeral `privateKey`
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
export declare function generateEphPrivateKey(algSign: EphKeySignAlgorithm): Uint8Array;
|
|
55
|
+
/** Derive Ephemeral `publicKey` from `privateKey` returned from `generateEphPrivateKey`
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export declare function getEphPublicKey(ephSK: Uint8Array, algSign: EphKeySignAlgorithm): Uint8Array;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UserAuthentication } from './authentication';
|
|
2
2
|
import { EphKeyClaim } from './ephemeralAuthentication';
|
|
3
3
|
/** Information about the user currently registering. Read more: https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-user
|
|
4
|
-
* @
|
|
4
|
+
* @public
|
|
5
5
|
* */
|
|
6
6
|
export type PasskeyUser = {
|
|
7
7
|
id: string;
|
|
@@ -9,7 +9,7 @@ export type PasskeyUser = {
|
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
11
11
|
/** The RP responsible for registering and authenticating the user. Read more: https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-rp
|
|
12
|
-
* @
|
|
12
|
+
* @public
|
|
13
13
|
* */
|
|
14
14
|
export type RelyingPartyConfig = {
|
|
15
15
|
rpName: string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type of signing transaction.
|
|
3
|
+
* For `eddsa` it is REQUIRED to encode the message in hex.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type SignRequestType = 'accountAbstractionTx' | 'EIP712' | 'EIP191' | 'rawBytes' | 'eddsa';
|
|
7
|
+
/**
|
|
8
|
+
* Builder class for constructing request payload for DSG.
|
|
9
|
+
* The returned value from `build()` is the value of `message` field of SignSetupOpts.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class SignRequestBuilder {
|
|
13
|
+
private signRequest;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the transaction ID, message, and request type for the sign request.
|
|
16
|
+
* Ensures that each transaction ID is only set once.
|
|
17
|
+
* @param transactionId - The transaction ID.
|
|
18
|
+
* @param message - The message to be signed.
|
|
19
|
+
* @param requestType - The type of the sign request.
|
|
20
|
+
* @returns The builder instance.
|
|
21
|
+
*/
|
|
22
|
+
setRequest(transactionId: string, message: string, requestType: SignRequestType): SignRequestBuilder;
|
|
23
|
+
/**
|
|
24
|
+
* Builds and returns the Map<string, Transaction> as a JSON.
|
|
25
|
+
* @returns The canonicalized JSON of Map<string, Transaction>.
|
|
26
|
+
*/
|
|
27
|
+
build(): string;
|
|
28
|
+
}
|