@silencelaboratories/walletprovider-sdk 1.5.0 → 1.7.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/README.md CHANGED
@@ -2,14 +2,23 @@
2
2
 
3
3
  The client library for Silent Network Wallet Provider Service.
4
4
 
5
+ ## Table of contents
6
+
7
+
5
8
  - [Installing](#installing)
6
9
  - [Quick start](#quick-start)
7
10
  - [Documentation](#documentation)
8
- - [Features](#features)
9
- - [Overview](#overview)
11
+ - [SDK Usage](#sdk-usage)
10
12
  - [Authentication](#authentication)
11
- - [Keygen](#keygen)
12
- - [Signing](#signing)
13
+ - [Network Without Authentication](#network-without-authentication)
14
+ - [Keygen](#keygen)
15
+ - [Signgen](#signgen)
16
+ - [Network with Authentication](#network-with-authentication)
17
+ - [Keygen](#keygen-1)
18
+ - [Authenticate with EOA wallet](#authenticate-with-eoa-wallet)
19
+ - [Authenticate with Passkey](#authenticate-with-passkey)
20
+ - [Signing](#signing)
21
+ - [Key refresh](#key-refresh)
13
22
  - [Development](#development)
14
23
  - [Build the library](#build-the-library)
15
24
  - [End to end tests](#end-to-end-tests)
@@ -23,81 +32,112 @@ npm i @silencelaboratories/walletprovider-sdk
23
32
  ```
24
33
 
25
34
  # Quick start
26
-
27
- Check the [demo](./demo/README.md) for a quick start guide.
35
+ We provide simple demo-page what showcases the features of this SDK.
36
+ Check the [demo](https://github.com/silence-laboratories/walletprovider-sdk/tree/main/demo/) for a quick start guide.
28
37
 
29
38
  # Documentation
30
39
 
31
- For description of classes, interfaces, types, please refer to [documentation](./docs/walletprovider-sdk.md).
40
+ For description of classes, interfaces, types, please refer to [documentation](https://github.com/silence-laboratories/walletprovider-sdk/tree/main/docs/index.html).
32
41
 
33
- # Features
42
+ # SDK Usage
43
+ ## Authentication
44
+ Requests to the network can be authenticated by the User, using Externally Owned Account (EOA), by Passkeys, some of the requests, by session keys (also known as ephemeral keys).
34
45
 
35
- - Authentication
36
- - Keygen
37
- - Signing
46
+ - [Wallet-based](./docs/classes/EOAAuth.html) authenticate users using their digital wallet.
47
+ - [Passkey](./docs/classes/PasskeyAuth.html) has 2 steps: **register** and **login**. The user registers a passkey with the network, then authenticates request in with the Passkey.
48
+ - [Ephemeral keys](./docs/classes/EphAuth.html) Used to issue requests to the network and not prompt the user for the acceptance, contains expiry, and can be (self-)revoked.
38
49
 
39
- ## Overview
50
+ The authentication can be required, or not, depending on the version of Silent Network backend.
40
51
 
41
- The library provides API to authenticate, generate keys, and sign messages against the Silent Network. Before sending request for a distributed key or signature, users need to be authenticated to the Silent Network.
52
+ In *no-authentication* case It's backend responsibility to authenticate the User, and then forward the request to the Silent Network nodes.
42
53
 
43
- Once authenticated, users register an ephemeral signing key pair and associate it with their identity. The ephemeral signing keys can later be used to authorize signing requests for duration of the session without the need for repeated user interaction, providing a seamless and secure authentication mechanism.
54
+ For more information, please read [Types of architectures](https://docs.silent.sg/silent-network/architecture) in our high-level documentation.
44
55
 
45
- ## Authentication
56
+ > This SDK supports both versions of Silent Network, *no-authentication*, and where User authentication is required.
46
57
 
47
- Users authenticate to Silent Network using 2 methods [Wallet-based](./docs/walletprovider-sdk.eoaauth.md) or [Passkey](./docs/walletprovider-sdk.passkeyauth.md).
58
+ ## Network Without Authentication
59
+ The request goes to the backend, without any sort of User authentication.
48
60
 
49
- - [Wallet-based](./docs/walletprovider-sdk.eoaauth.md) authenticate users using their digital wallet, it runs at the same time users start doing **keygen**.
61
+ ### Initialize the Client object
62
+ Create the [NoAuthWalletProviderServiceClient](./docs/classes/NoAuthWalletProviderServiceClient.html), using [ClientConfig](./docs/types/ClientConfig.html). The `wpClient` will connect to the Wallet Provider Backend Service (WPBE).
50
63
 
51
- - [Passkey](./docs/walletprovider-sdk.passkeyauth.md) has 2 steps: **register** and **login**. The user registers a passkey with the network, then logs in with the passkey while starting the **keygen** process.
64
+ ```typescript
65
+ const config = {
66
+ walletProviderUrl: "https://silent-network-no-auth.sandbox.silencelaboratories.com/wpbe1",
67
+ apiVersion: 'v2',
68
+ } as ClientConfig;
52
69
 
70
+ const wpClient = new NoAuthWalletProviderServiceClient(clientConfig);
71
+ const sdk = new NetworkSigner(wpClient);
72
+ ```
53
73
 
54
- The [ephemeral public claim](./docs/walletprovider-sdk.eoaauth.ephclaim.md) will be associated with both [EOAAuth](./docs/walletprovider-sdk.eoaauth.md) and [PasskeyAuth](./docs/walletprovider-sdk.passkeyauth.md) objects.
74
+ Following snippet will create client to `wpbe1` on our `silent-network-no-auth` sandbox, and will use `v2` endpoints.
55
75
 
56
- - Users will use [EphAuth](./docs/walletprovider-sdk.ephauth.md) to do non-interactive authenticate **during signing**.
57
- - The library supports 2 signing algorithms for ephemeral signing keys: `secp256k1, ed25519`
76
+ Then pass the `wpClient` to the [NetworkSigner](./docs/classes/NetworkSigner.html). And use `NetworkSigner` for interacting with the WPBE.
58
77
 
59
- ## Keygen
78
+ ### Keygen
79
+ During keygen provide number of parties `n`, the threshold `t` and [types of the keys](./docs/types/MPCSignAlgorithm.html) you want to generate.
60
80
 
61
- The full working example is in the [demo](https://github.com/silence-laboratories/walletprovider-sdk/blob/main/demo/src/routes/%2Bpage.svelte).
62
- The core object to use is the [NetworkSigner](./docs/walletprovider-sdk.networksigner.md). It allows to generate keys and do signatures.
81
+ [Example usage](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/e2e-tests/client/src/actions/noAuth/keygen.ts#L75)
63
82
 
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**.
83
+ ```typescript
84
+ const response = await sdk.generateKey(
85
+ config.threshold,
86
+ config.parties,
87
+ keySignAlgs,
88
+ );
89
+ ```
65
90
 
66
- ### Authenticate with EOA wallet
67
- We provide EOA authentication via [EOAAuth](./docs/walletprovider-sdk.eoaauth.md) module. Let's create the `NetworkSigner` with associated `EOAAuth` object.
91
+ ### Signgen
92
+ The message to be signed can be of [different types](./docs/types/SignRequestType.html).
93
+ The example usage of different types is [shown here](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/e2e-tests/client/src/test/signature_verification.ts#L48).
68
94
 
69
- ```ts
70
- const algSign = 'secp256k1'; // Signing algorithms of ephemeral key
71
- // Generate ephemeral secret key esk
72
- const sk = generateEphPrivateKey(algSign);
73
- // Derive public part epk from esk
74
- const ephPK = getEphPublicKey(sk, algSign);
75
- // Arbitrary ID to identify the ephemeral key
76
- const ephId = uuidv4();
77
- // Create ephemeral key claim instance based on the ephemeral key
78
- const ephClaim = new EphKeyClaim(
79
- ephId,
80
- ephPK,
81
- algSign,
82
- // Lifetime of one hour
83
- 60 * 60,
84
- );
95
+ [Example usage](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/e2e-tests/client/src/actions/noAuth/signgen.ts#L58-L74)
85
96
 
86
- // Create EOA authenticator, signature will include epk
87
- const eoaAuth = new EOAAuth(
88
- accountsFromBrowserWallet[0],
89
- new BrowserWallet(),
90
- ephClaim
91
- );
97
+ ```typescript
98
+ let sample_message = ...;
92
99
 
93
- // Create a client that connects to the backend service
94
- const wpClient = await createWalletProviderService(clusterConfig);
100
+ const response = await sdk.signMessage(
101
+ config.threshold,
102
+ config.keyId,
103
+ config.signAlg,
104
+ sample_message,
105
+ );
106
+ ```
107
+
108
+ ## Network with Authentication
109
+ ### Initialize the Client object
110
+ Create the [WalletProviderServiceClient](./docs/classes/WalletProviderServiceClient.html), using [ClientConfig](./docs/types/ClientConfig.html). The `wpClient` will connect to the Wallet Provider Backend Service (WPBE).
111
+
112
+ ```typescript
113
+ const config = {
114
+ walletProviderUrl: "https://silent-network-auth.sandbox.silencelaboratories.com/wpbe1",
115
+ apiVersion: 'v1',
116
+ } as ClientConfig;
117
+
118
+ const wpClient = new WalletProviderServiceClient(clientConfig);
119
+ ```
120
+ Following snippet will create client to our `wpbe1` on our `silent-network-auth` sandbox, and will use `v1` endpoints.
121
+
122
+
123
+ ### Keygen
124
+ #### Authenticate with EOA wallet
125
+ The full working example is in the [demo](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/demo/src/routes/%2Bpage.svelte#L295-L316).
126
+
127
+ Apart from `wpClient` that connects to the Backend part of the SDK, you are going to need **authenticator module**.
128
+
129
+ We provide EOA authentication via [EOAAuth](./docs/classes/EOAAuth.html) module. Let's create the `NetworkSigner` with associated `EOAAuth` object.
130
+
131
+ ```ts
132
+ // Authenticate using EOA
133
+ const eoaAuth = new EOAAuth(accountsFromBrowserWallet[0], new BrowserWallet());
134
+
135
+ // Create a new signer instance
136
+ const sdk = new NetworkSigner(wpClient, eoaAuth);
95
137
 
96
- // Create a new signer instance
97
- const sdk = new NetworkSigner(wpClient, eoaAuth);
98
138
  ```
99
139
 
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_.
140
+ Now you can generate a key, using the [generateKey](./docs/classes/NetworkSigner.html#generatekey) method. The method accepts optional permissions. No permissions means _allow all operations_.
101
141
 
102
142
  ```ts
103
143
  const permissions = {
@@ -117,25 +157,35 @@ const permissions = {
117
157
 
118
158
  let signAlgs = ['secp256k1', 'ed25519'];
119
159
 
120
- // Generate a new key
121
- let resp: KeygenResponse[] = await sdk.generateKey(threshold, partiesNumber, signAlgs, JSON.stringify(permissions));
160
+ // Generate new eph key, will be later used in sign requests
161
+ const selectedEphSignAlg = 'secp256k1'; // Signing algorithm of ephemeral key
162
+ const sk = generateEphPrivateKey(selectedEphSignAlg);
163
+ const ephPK = getEphPublicKey(sk, selectedEphSignAlg);
164
+ const ephId = uuidv4();
165
+
166
+ const ephClaim = new EphKeyClaim(ephId, ephPK, selectedEphSignAlg, expireAt(60 * 60));
167
+
168
+ // Generate keys for secp256k1, ed25519, and include ephemeral key, permissions in the request
169
+ let resp: KeygenResponse[] = await sdk.generateKey(+threshold, +partiesNumber, signAlgs, ephClaim, permissions);
122
170
  ```
123
171
 
124
172
  Calling this method will cause to the Digital Wallet window to pop up, requesting the User to sign the request.
125
173
 
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.
174
+ The returned response [KeygenResponse](./docs/interfaces/KeygenResponse.html) 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.
127
175
 
128
176
  The ephemeral `sk` key can be later used in subsequent signgen requests for authenticating.
129
177
 
130
- ### Authenticate with Passkey
131
- First, we need to register user passkey to the network. We provide Passkey register via [PasskeyRegister](./docs/walletprovider-sdk.passkeyregister.md) module.
178
+ #### Authenticate with Passkey
179
+ First, we need to register user passkey to the network.
180
+
181
+ [Example usage](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/demo/src/routes/+page.svelte#L513)
182
+
132
183
  ```ts
133
- const wpClient = await createWalletProviderService(clusterConfig);
134
184
  const rpConfig: RelyingPartyConfig = {
135
- rpId: 'localhost',
136
- rpName: 'http://localhost:5173',
185
+ rpId: clusterConfig.rpConfig.rpId,
186
+ rpName: clusterConfig.rpConfig.rpName,
137
187
  };
138
- const userId = uuidv4();
188
+ userId = newUser();
139
189
  const passkeyUser = {
140
190
  id: userId,
141
191
  displayName: 'Alice',
@@ -146,68 +196,52 @@ const passkeyAuth = new PasskeyRegister(rpConfig, passkeyUser);
146
196
  // Create a new signer instance
147
197
  const sdk = new NetworkSigner(wpClient, passkeyAuth);
148
198
 
149
- // Register a new passkey
199
+ // Generate a new key
150
200
  let resp: RegisterPasskeyResponse = await sdk.registerPasskey();
151
201
  ```
152
202
 
153
- We provide Passkey login authentication via [PasskeyAuth](./docs/walletprovider-sdk.passkeyauth.md) module. Let's create the `NetworkSigner` with associated `PasskeyAuth` object.
203
+ We provide Passkey login authentication via [PasskeyAuth](./docs/classes/PasskeyAuth.html) module. Let's create the `NetworkSigner` with associated `PasskeyAuth` object.
154
204
 
205
+ [Example usage](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/demo/src/routes/+page.svelte#L441)
155
206
  ```ts
156
- const algSign = 'secp256k1'; // Signing algorithms of ephemeral key
157
- // Generate ephemeral secret key esk
158
- const sk = generateEphPrivateKey(algSign);
159
- // Derive public part epk from esk
160
- const ephPK = getEphPublicKey(sk, algSign);
161
- // Arbitrary ID to identify the ephemeral key
162
- const ephId = uuidv4();
163
- // Create ephemeral key claim instance based on the ephemeral key
164
- const ephClaim = new EphKeyClaim(
165
- ephId,
166
- ephPK,
167
- // Lifetime of one hour
168
- 60 * 60,
169
- );
170
- // Create a client that connects to the backend service
171
- const wpClient = await createWalletProviderService(clusterConfig);
172
- // Here we configure the relying party for local development
173
- const rpConfig: RelyingPartyConfig = {
174
- rpId: 'localhost',
175
- rpName: 'http://localhost:5173',
176
- };
177
-
178
- // Get passkey credential id from your storage
179
207
  const credentialId = getPasskeyCredentialId();
180
- // Create Passkey authenticator, signature will include epk
208
+ if (!credentialId) {
209
+ throw new Error('Must register passkey first');
210
+ }
181
211
  const passkeyAuth = new PasskeyAuth(
182
212
  rpConfig,
183
- // We will do passkey auth/login with the provided credentialId
184
213
  credentialId,
185
- ephClaim,
186
214
  );
187
215
 
188
216
  // Create a new signer instance
189
217
  const sdk = new NetworkSigner(wpClient, passkeyAuth);
218
+
219
+ // Generate a new key
220
+ const sk = generateEphPrivateKey(selectedEphSignAlg);
221
+ const ephPK = getEphPublicKey(sk, selectedEphSignAlg);
222
+ const ephId = uuidv4();
223
+
224
+ const ephClaim = new EphKeyClaim(ephId, ephPK, selectedEphSignAlg, expireAt(60 * 60));
225
+ let resp: KeygenResponse[] = await sdk.generateKey(+threshold, +partiesNumber, signAlgs, ephClaim, permissions);
190
226
  ```
191
227
 
192
- Now you can generate a key like in the EOA example by calling the [generateKey](./docs/walletprovider-sdk.networksigner.generatekey.md) method.
228
+ Now you can generate a key like in the EOA example by calling the [generateKey](./docs/classes/NetworkSigner.html#generatekey) method.
193
229
 
194
- Calling this method will prompt the device to request [Passkey User Verification](https://web.dev/articles/webauthn-user-verification). Once user verification is done, the [KeygenResponse](./docs/walletprovider-sdk.keygenresponse.md) is returned.
230
+ Calling this method will prompt the device to request [Passkey User Verification](https://web.dev/articles/webauthn-user-verification). Once user verification is done, the [KeygenResponse](./docs/interfaces/KeygenResponse.html) is returned.
195
231
 
196
232
  The `sk` key can be later used in subsequent signgen requests.
197
233
 
198
- ## Signing
234
+ ### Signing
235
+ The full signing example is [here](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/demo/src/routes/+page.svelte#L374).
199
236
 
200
- The full signing example is [here](https://github.com/silence-laboratories/walletprovider-sdk/blob/main/demo/src/routes/%2Bpage.svelte).
201
-
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).
237
+ The workflow is similar to the keygen process. The core objects to use are the [NetworkSigner](./docs/classes/NetworkSigner.html), [WalletProviderServiceClient](./docs/classes/WalletProviderServiceClient.html), and the [ephemeral authenticator module](./docs/classes/EphAuth.html).
203
238
  ```ts
204
239
  const authModule = new EphAuth(selectedEphId, ephSK, selectedEphSignAlg);
205
240
  // Create a new signer instance
206
241
  const sdk = new NetworkSigner(wpClient, authModule);
207
242
  ```
208
243
 
209
-
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.
244
+ Use the [SignRequestBuilder](./docs/classes/SignRequestBuilder.html) builder to generate the sign message payload. Then call the [signMessage](./docs/classes/NetworkSigner.html#signmessage) method to run the signing process.
211
245
 
212
246
  ```ts
213
247
  const signMessage = new SignRequestBuilder()
@@ -242,53 +276,34 @@ const signMessage = new SignRequestBuilder()
242
276
  let resp = await sdk.signMessage( threshold, selectedKeyId, signMessage);
243
277
  ```
244
278
 
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
279
+ The [SignResponse](./docs/interfaces/SignResponse.html) contains the signature `sign`, the recovery ID `recid` and the transaction ID `transactionId`.
248
280
 
249
- The full key refresh example is [here](https://github.com/silence-laboratories/walletprovider-sdk/blob/main/demo/src/routes/%2Bpage.svelte).
281
+ ### Key refresh
250
282
 
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.
283
+ The full key refresh example is [here](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/demo/src/routes/+page.svelte#L351).
252
284
 
285
+ The workflow is similar to the keygen process.
253
286
 
254
287
  ```ts
255
288
  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
289
 
271
- // Create EOA authenticator, signature will include epk
290
+ // Create EOA authenticator
272
291
  const eoaAuth = new EOAAuth(
273
292
  accountsFromBrowserWallet[0],
274
293
  new BrowserWallet(),
275
- ephClaim
276
294
  );
277
295
 
278
- // Create a client that connects to the backend service
279
- const wpClient = await createWalletProviderService(clusterConfig);
280
-
281
296
  // Create a new signer instance
282
297
  const sdk = new NetworkSigner(wpClient, eoaAuth);
283
298
  ```
284
299
 
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.
300
+ Now you can refresh the key (before doing this, make sure you've already generated the key), using the [refreshKey](./docs/classes/NetworkSigner.html#refreshkey) method.
286
301
 
287
302
  ```ts
288
303
  // Refresh the key
289
- let resp: KeyRefreshResponse = await sdk.refreshKey(threshold, keyId, mpcKeySignAlg);
304
+ let resp: KeyRefreshResponse = await sdk.refreshKey(+threshold, selectedKeyId, mpcKeySignAlg);
290
305
  ```
291
- The returned response [KeyRefreshResponse](./docs/walletprovider-sdk.keyrefreshresponse.md) contains `keyId`, `publicKey` and `signAlg` of the refreshed MPC key.
306
+ The returned response [KeyRefreshResponse](./docs/types/KeyRefreshResponse.html) contains `keyId`, `publicKey` and `signAlg` of the refreshed MPC key.
292
307
 
293
308
 
294
309
  # Development
@@ -1,5 +1,5 @@
1
- import { AddEphKeyRequest, RegisterPasskeyRequest } from './../client/networkRequest';
2
- import { KeygenSetupOpts } from '../setupMessage';
1
+ import { AddEphKeyRequest, KeyRefreshRequest, RegisterPasskeyRequest } from './../client/networkRequest';
2
+ import { KeygenSetupOpts, SignSetupOpts, FinishPresignOpts } from '../setupMessage';
3
3
  import { EoaAuthPayload, IBrowserWallet } from './EOAauthentication';
4
4
  import { PasskeyUser, RelyingPartyConfig } from './passkeyAuthentication';
5
5
  import { EphemeralAuthPayload, EphKeySignAlgorithm } from './ephemeralAuthentication';
@@ -28,7 +28,7 @@ export interface AuthModule {
28
28
  }): Promise<UserAuthentication>;
29
29
  }
30
30
  export type AuthPayload = EoaAuthPayload | PasskeyLoginPayload | EphemeralAuthPayload | RegisterPasskeyRequest;
31
- type PasskeyLoginPayload = KeygenSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest;
31
+ type PasskeyLoginPayload = KeygenSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest | SignSetupOpts | FinishPresignOpts | KeyRefreshRequest;
32
32
  /** The `EOAAuth` implementing Externally Owned Account authentication.
33
33
  * @public
34
34
  */
@@ -21,6 +21,6 @@ export declare function passkeyRegister({ user, challenge, rpConfig, }: {
21
21
  }): Promise<UserAuthentication>;
22
22
  export declare function passkeyLogin({ challenge, allowCredentialId, rpConfig, }: {
23
23
  challenge: string;
24
- allowCredentialId: string | null;
24
+ allowCredentialId: string;
25
25
  rpConfig: RelyingPartyConfig;
26
26
  }): Promise<UserAuthentication>;
@@ -1,7 +1,7 @@
1
1
  import { AuthModule, UserAuthentication } from '../auth/authentication';
2
2
  import { ApiVersion, RequestPayloadV1, RequestPayloadV2, Slug } from '../client/walletProviderServiceClientInterface';
3
3
  import { FinishPresignOpts, KeygenSetupOpts, SignSetupOpts } from '../setupMessage';
4
- import { AddEphKeyRequest, KeyRefreshRequest, QuorumChangeRequest, RegisterPasskeyRequest, RevokeEphKeyRequest } from '../client/networkRequest';
4
+ import { AddEphKeyRequest, KeyRefreshRequest, RegisterPasskeyRequest, RevokeEphKeyRequest } from '../client/networkRequest';
5
5
  /**
6
6
  * Builder class for constructing user signatures in all kind of client requests to the network.
7
7
  * It uses the API of `AuthModule` concrete types together with the `challenge` to generate the user signatures.
@@ -23,7 +23,6 @@ export declare class UserSignatures {
23
23
  setRevokeEphKeyUserSigs(payload: RevokeEphKeyRequest, challenge?: string): Promise<void>;
24
24
  setRegisterPasskeyUserSigs(payload: RegisterPasskeyRequest, challenge?: string): Promise<void>;
25
25
  setKeyRefreshUserSigs(payload: KeyRefreshRequest, challenge?: string): Promise<void>;
26
- setQcUserSigs(payload: QuorumChangeRequest, challenge?: string): Promise<void>;
27
26
  setFinishPresignUserSigs(payload: FinishPresignOpts, challenge?: string): Promise<void>;
28
27
  build(slug: Slug, payload: RequestPayloadV1 | RequestPayloadV2, challenge?: string): Promise<Record<string, UserAuthentication>>;
29
28
  }
@@ -34,32 +34,6 @@ export declare class RegisterPasskeyRequest {
34
34
  readonly options: string;
35
35
  constructor(options: string);
36
36
  }
37
- export declare class QuorumChangeRequest implements EoaAuthPayload {
38
- /** Threshold that will be changed */
39
- readonly new_t: number;
40
- /** Number of nodes that will be changed */
41
- readonly new_n: number;
42
- /** QC key ID */
43
- readonly key_id: string;
44
- /** QC key signature algorithm */
45
- readonly sign_alg: string;
46
- constructor({ newT, newN, keyId, signAlg }: {
47
- newT: number;
48
- newN: number;
49
- keyId: string;
50
- signAlg: string;
51
- });
52
- get eoaRequestSchema(): {
53
- Request: {
54
- name: string;
55
- type: string;
56
- }[];
57
- QuorumChangeRequest: {
58
- name: string;
59
- type: string;
60
- }[];
61
- };
62
- }
63
37
  export declare class KeyRefreshRequest implements EoaAuthPayload {
64
38
  /** Threshold of refresh key */
65
39
  readonly t: number;
@@ -8,13 +8,14 @@ export interface KeygenResponse {
8
8
  */
9
9
  keyId: string;
10
10
  /**
11
- * Public key encoded with SEC1 format.
12
11
  *
13
- * If point is uncompressed it's in a form of 0x04 || X || Y
12
+ * For ECDSA: Public key encoded with SEC1 format.
14
13
  *
14
+ * If point is uncompressed it's in a form of 0x04 || X || Y
15
15
  * If point is compressed it's in a form Y || X,
16
- *
17
16
  * where Y is set to 0x02 if Y-coord is even, or 0x03 if Y-coord is odd
17
+ *
18
+ * For EdDSA: RFC 8032 32-byte compressed Edwards.
18
19
  */
19
20
  publicKey: string;
20
21
  /**
@@ -34,11 +35,13 @@ export type KeyRefreshResponse = KeygenResponse;
34
35
  export interface SignResponse {
35
36
  transactionId: string;
36
37
  /**
37
- * Hexstring of length 128 bytes, in a form: r || s
38
+ * For ECDSA: Hexstring of length 128 bytes, in a form: r || s. The r and s are 64 bytes long.
39
+ * For EdDSA: RFC 8032 64-byte signature.
38
40
  */
39
41
  sign: string;
40
42
  /**
41
- * Recovery id, either 0, or 1
43
+ * For ECDSA: Recovery id, either 0, or 1
44
+ * For EdDSA: unused
42
45
  */
43
46
  recid: number;
44
47
  }
@@ -77,42 +80,3 @@ export interface RegisterPasskeyResponse {
77
80
  */
78
81
  passkeyCredentialId: string;
79
82
  }
80
- /**
81
- * Response from the network for quorum change request.
82
- * @public
83
- */
84
- export interface QuorumChangeResponse extends KeygenResponse {
85
- /**
86
- * Number of nodes of the previous version of the refreshed key.
87
- */
88
- oldN: number;
89
- }
90
- /**
91
- *
92
- * @param keysharePlaintext Public data of keyshare in plaintext format
93
- * @returns Keygen responses {@link KeygenResponse}
94
- */
95
- export declare const parseKeysharePublicData: (keysharePlaintext: string) => KeygenResponse;
96
- /**
97
- *
98
- * @param keygenResult MPC keygen result in plaintext format
99
- * @param totalKey Amount of keys to generate
100
- * @returns List of keygen responses {@link KeygenResponse}
101
- * @public
102
- */
103
- export declare const parseKeygenResult: (keygenResult: string, totalKey: number) => KeygenResponse[];
104
- /**
105
- *
106
- * @param signResult MPC sign result in plaintext format
107
- * @param signAlg MPC sign algorithm
108
- * @returns List of signgen responses {@link SignResponse}
109
- * @public
110
- */
111
- export declare const parseSigngenResult: (signResult: string, signAlg: string) => SignResponse[];
112
- /**
113
- *
114
- * @param keygenResult MPC keygen result in plaintext format
115
- * @returns List of keygen responses {@link KeygenResponse}
116
- * @public
117
- */
118
- export declare const parseEphKeyOperationResult: (operationsResult: string) => AddEphKeyResponse[];
@@ -1,7 +1,7 @@
1
1
  import { AuthModule, UserAuthentication } from '../auth/authentication';
2
2
  import { KeygenResponse, SignResponse, AddEphKeyResponse, RegisterPasskeyResponse, RevokeEphKeyResponse, KeyRefreshResponse } from './networkResponse';
3
3
  import { KeygenSetupOpts, SignSetupOpts, InitPresignOpts, FinishPresignOpts } from '../setupMessage';
4
- import { AddEphKeyRequest, KeyRefreshRequest, QuorumChangeRequest, RegisterPasskeyRequest, RevokeEphKeyRequest } from './networkRequest';
4
+ import { AddEphKeyRequest, KeyRefreshRequest, RegisterPasskeyRequest, RevokeEphKeyRequest } from './networkRequest';
5
5
  /**
6
6
  * The config used to create Wallet Provider Service backend client.
7
7
  * Please refer to {@link https://shipyard.rs/silencelaboratories/crates/wallet-provider-service | example backend service}
@@ -56,7 +56,7 @@ export interface IWalletProviderServiceClient {
56
56
  }): Promise<RegisterPasskeyResponse>;
57
57
  }
58
58
  export type Slug = 'signgen' | 'keygen' | 'keyRefresh' | 'quorumChange' | 'addEphemeralKey' | 'revokeEphemeralKey' | 'registerPasskey' | 'initPresign' | 'finishPresign';
59
- export type RequestPayloadV1 = KeygenSetupOpts[] | KeyRefreshRequest | QuorumChangeRequest | SignSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest | RegisterPasskeyRequest | FinishPresignOpts;
59
+ export type RequestPayloadV1 = KeygenSetupOpts[] | KeyRefreshRequest | SignSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest | RegisterPasskeyRequest | FinishPresignOpts;
60
60
  export type RequestPayloadV2 = KeygenSetupOpts[] | SignSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest | InitPresignOpts | FinishPresignOpts;
61
61
  export interface WpRequest {
62
62
  payload: RequestPayloadV1 | RequestPayloadV2;