@silencelaboratories/walletprovider-sdk 1.6.0 → 4.0.0-hackaton

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
@@ -55,24 +55,32 @@ For more information, please read [Types of architectures](https://docs.silent.s
55
55
 
56
56
  > This SDK supports both versions of Silent Network, *no-authentication*, and where User authentication is required.
57
57
 
58
+ ## Network Without Authentication
59
+ The request goes to the backend, without any sort of User authentication.
58
60
 
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).
59
63
 
60
- The core object to use is the [NetworkSigner](./docs/classes/NetworkSigner.html). It allows to send requests to the Silent Network.
64
+ ```typescript
65
+ const config = {
66
+ walletProviderUrl: "https://silent-network-no-auth.sandbox.silencelaboratories.com/wpbe1",
67
+ apiVersion: 'v2',
68
+ } as ClientConfig;
61
69
 
62
- ## Network Without Authentication
63
- The request goes to the backend, without any sort of User authentication.
70
+ const wpClient = new NoAuthWalletProviderServiceClient(clientConfig);
71
+ const sdk = new NetworkSigner(wpClient);
72
+ ```
73
+
74
+ Following snippet will create client to `wpbe1` on our `silent-network-no-auth` sandbox, and will use `v2` endpoints.
75
+
76
+ Then pass the `wpClient` to the [NetworkSigner](./docs/classes/NetworkSigner.html). And use `NetworkSigner` for interacting with the WPBE.
64
77
 
65
- Use the [NoAuthWalletProviderServiceClient](./docs/classes/NoAuthWalletProviderServiceClient.html) with the `Network Signer`.
66
78
  ### Keygen
67
79
  During keygen provide number of parties `n`, the threshold `t` and [types of the keys](./docs/types/MPCSignAlgorithm.html) you want to generate.
68
80
 
69
- [Example usage](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/e2e-tests/client/src/actions/noAuth/keygen.ts#L35-L37)
81
+ [Example usage](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/e2e-tests/client/src/actions/noAuth/keygen.ts#L75)
70
82
 
71
83
  ```typescript
72
- const wpClient = new NoAuthWalletProviderServiceClient(selectedWpProvider);
73
-
74
- const sdk = new NetworkSigner(wpClient);
75
-
76
84
  const response = await sdk.generateKey(
77
85
  config.threshold,
78
86
  config.parties,
@@ -87,10 +95,6 @@ The example usage of different types is [shown here](https://github.com/silence-
87
95
  [Example usage](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/e2e-tests/client/src/actions/noAuth/signgen.ts#L58-L74)
88
96
 
89
97
  ```typescript
90
- const wpClient = new NoAuthWalletProviderServiceClient(selectedWpProvider);
91
-
92
- const sdk = new NetworkSigner(wpClient);
93
-
94
98
  let sample_message = ...;
95
99
 
96
100
  const response = await sdk.signMessage(
@@ -102,62 +106,113 @@ The example usage of different types is [shown here](https://github.com/silence-
102
106
  ```
103
107
 
104
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
+
105
123
  ### Keygen
106
124
  #### Authenticate with EOA wallet
107
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).
108
126
 
109
- In order to create your keys, you need two other components. The [WalletProviderServiceClient](./docs/classes/WalletProviderServiceClient.html) that connects to the Backend part of the SDK, and the **authenticator module**.
127
+ Apart from `wpClient` that connects to the Backend part of the SDK, you are going to need **authenticator module**.
110
128
 
111
129
  We provide EOA authentication via [EOAAuth](./docs/classes/EOAAuth.html) module. Let's create the `NetworkSigner` with associated `EOAAuth` object.
112
130
 
113
131
  ```ts
114
- // Create Client to the network
115
- const wpClient = createWalletProviderService(clusterConfig);
116
-
117
132
  // Authenticate using EOA
118
133
  const eoaAuth = new EOAAuth(accountsFromBrowserWallet[0], new BrowserWallet());
119
134
 
120
135
  // Create a new signer instance
121
136
  const sdk = new NetworkSigner(wpClient, eoaAuth);
122
137
 
123
-
124
- // Generate new eph key
125
- const selectedEphSignAlg = 'secp256k1'; // Signing algorithm of ephemeral key
126
- const sk = generateEphPrivateKey(selectedEphSignAlg);
127
- const ephPK = getEphPublicKey(sk, selectedEphSignAlg);
128
- const ephId = uuidv4();
129
-
130
- const ephClaim = new EphKeyClaim(ephId, ephPK, selectedEphSignAlg, expireAt(60 * 60));
131
-
132
138
  ```
133
139
 
134
- 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_.
140
+ Now you can generate a key, using the [generateKey](./docs/classes/NetworkSigner.html#generatekey) method. The method accepts optional Policy. No Policy means _allow all operations_.
135
141
 
136
142
  ```ts
137
- const permissions = {
138
- permissions: [
139
- {
140
- type: 'erc20',
141
- method: 'approve',
142
- to: '0x1234567890123456789012345678901234567890',
143
- args: {
144
- spender: '0x1234567890123456789012345678901234567890',
145
- value: 10000,
146
- eq: '<',
147
- },
148
- },
143
+ const POLICY_ERC20_TRANSFER = new Policy({
144
+ version: '1.0',
145
+ description: 'Simple ERC20 transfer policy',
146
+ rules: [
147
+ new Rule({
148
+ description: 'ERC20 transferFrom: sender/recipient match and value < 10000',
149
+ chain_type: ChainType.Ethereum,
150
+ conditions: [
151
+ {
152
+ logic: Logic.And,
153
+ abi: {
154
+ name: 'transfer',
155
+ type: 'function',
156
+ inputs: [
157
+ {
158
+ name: 'to',
159
+ type: 'address',
160
+ },
161
+ {
162
+ name: 'amount',
163
+ type: 'uint256',
164
+ },
165
+ ],
166
+ outputs: [
167
+ {
168
+ name: '',
169
+ type: 'bool',
170
+ },
171
+ ],
172
+ },
173
+ group: [
174
+ {
175
+ transaction_type: TransactionType.Erc20,
176
+ transaction_attr: TransactionAttribute.Receiver,
177
+ operator: Operator.Eq,
178
+ value: '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238',
179
+ },
180
+ {
181
+ transaction_type: TransactionType.Erc20,
182
+ transaction_attr: "to",
183
+ operator: Operator.Eq,
184
+ value: '0x1758f42af7026fbbb559dc60ece0de3ef81f665e',
185
+ },
186
+ {
187
+ transaction_type: TransactionType.Erc20,
188
+ transaction_attr: "amount",
189
+ operator: Operator.Lt,
190
+ value: 10000,
191
+ },
192
+ ],
193
+ },
194
+ ],
195
+ }),
149
196
  ],
150
- };
197
+ });
151
198
 
152
199
  let signAlgs = ['secp256k1', 'ed25519'];
153
200
 
154
- // Generate keys for secp256k1, ed25519, and include ephemeral key, permissions in the request
155
- let resp: KeygenResponse[] = await sdk.generateKey(+threshold, +partiesNumber, signAlgs, ephClaim, permissions);
201
+ // Generate new eph key, will be later used in sign requests
202
+ const selectedEphSignAlg = 'secp256k1'; // Signing algorithm of Ephemeral Key
203
+ const sk = generateEphPrivateKey(selectedEphSignAlg);
204
+ const ephPK = getEphPublicKey(sk, selectedEphSignAlg);
205
+ const ephId = uuidv4();
206
+
207
+ const ephClaim = new EphKeyClaim(ephId, ephPK, selectedEphSignAlg, expireAt(60 * 60));
208
+
209
+ // Generate keys for secp256k1, ed25519, and include Ephemeral Key, Policy in the request
210
+ let resp: KeygenResponse[] = await sdk.generateKey(+threshold, +partiesNumber, signAlgs, ephClaim, POLICY_ERC20_TRANSFER);
156
211
  ```
157
212
 
158
213
  Calling this method will cause to the Digital Wallet window to pop up, requesting the User to sign the request.
159
214
 
160
- 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.
215
+ 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.
161
216
 
162
217
  The ephemeral `sk` key can be later used in subsequent signgen requests for authenticating.
163
218
 
@@ -167,7 +222,6 @@ First, we need to register user passkey to the network.
167
222
  [Example usage](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/demo/src/routes/+page.svelte#L513)
168
223
 
169
224
  ```ts
170
- const wpClient = createWalletProviderService(clusterConfig);
171
225
  const rpConfig: RelyingPartyConfig = {
172
226
  rpId: clusterConfig.rpConfig.rpId,
173
227
  rpName: clusterConfig.rpConfig.rpName,
@@ -191,9 +245,6 @@ We provide Passkey login authentication via [PasskeyAuth](./docs/classes/Passkey
191
245
 
192
246
  [Example usage](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/demo/src/routes/+page.svelte#L441)
193
247
  ```ts
194
- // Create a new signer instance
195
- const sdk = new NetworkSigner(wpClient, passkeyAuth);
196
-
197
248
  const credentialId = getPasskeyCredentialId();
198
249
  if (!credentialId) {
199
250
  throw new Error('Must register passkey first');
@@ -212,8 +263,7 @@ const ephPK = getEphPublicKey(sk, selectedEphSignAlg);
212
263
  const ephId = uuidv4();
213
264
 
214
265
  const ephClaim = new EphKeyClaim(ephId, ephPK, selectedEphSignAlg, expireAt(60 * 60));
215
- let resp: KeygenResponse[] = await sdk.generateKey(+threshold, +partiesNumber, signAlgs, ephClaim, permissions);
216
-
266
+ let resp: KeygenResponse[] = await sdk.generateKey(+threshold, +partiesNumber, signAlgs, ephClaim);
217
267
  ```
218
268
 
219
269
  Now you can generate a key like in the EOA example by calling the [generateKey](./docs/classes/NetworkSigner.html#generatekey) method.
@@ -225,7 +275,7 @@ The `sk` key can be later used in subsequent signgen requests.
225
275
  ### Signing
226
276
  The full signing example is [here](https://github.com/silence-laboratories/walletprovider-sdk/blob/564cca4bb59658a6e477a59e8ea554a67c26b161/demo/src/routes/+page.svelte#L374).
227
277
 
228
- The workflow is similar to the keygen process. The core objects to use are the [NetworkSigner](./docs/classes/NetworkSigner.html), WalletProviderServiceClient, and the [ephemeral authenticator module](./docs/classes/EphAuth.html).
278
+ 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).
229
279
  ```ts
230
280
  const authModule = new EphAuth(selectedEphId, ephSK, selectedEphSignAlg);
231
281
  // Create a new signer instance
@@ -235,27 +285,28 @@ const sdk = new NetworkSigner(wpClient, authModule);
235
285
  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.
236
286
 
237
287
  ```ts
288
+ const data = encodeFunctionData({
289
+ abi: ERC_20_ABI,
290
+ functionName: 'transfer',
291
+ args: ['0x1758f42af7026fbbb559dc60ece0de3ef81f665e', 1000n],
292
+ });
293
+
294
+ const eip1559Tx: UnsignedTransactionRequest = {
295
+ from: ethAddress,
296
+ to: '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238', // USDC Contract
297
+ value: '0x0',
298
+ data,
299
+ chainId: 80002,
300
+ nonce: 0,
301
+ gas: '0x18473',
302
+ maxFeePerGas: '0x18473',
303
+ maxPriorityFeePerGas: '0x1000',
304
+ };
238
305
  const signMessage = new SignRequestBuilder()
239
306
  .setRequest(
240
307
  uuidv4(),
241
- JSON.stringify({
242
- userOperation: {
243
- sender: '0x8d4cb2540d993fe34c646299f1ab4af3012ff34c',
244
- nonce: '0x7',
245
- initCode: '0x',
246
- callData: '0000...',
247
- callGasLimit: '0x18473',
248
- verificationGasLimit: '0x18473',
249
- preVerificationGas: '66768',
250
- maxFeePerGas: '',
251
- maxPriorityFeePerGas: '',
252
- paymasterAndData: '0x',
253
- },
254
- entryPointVersion: 'v0.6.0',
255
- entryPointAddress: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
256
- chainId: 80002,
257
- }),
258
- 'accountAbstractionTx',
308
+ JSON.stringify(eip1559Tx),
309
+ 'EIP1559',
259
310
  )
260
311
  .setRequest(
261
312
  uuidv4(),
@@ -264,7 +315,7 @@ const signMessage = new SignRequestBuilder()
264
315
  )
265
316
  .build();
266
317
 
267
- let resp = await sdk.signMessage( threshold, selectedKeyId, signMessage);
318
+ let resp = await sdk.signMessage(threshold, selectedKeyId, 'secp256k1', signMessage);
268
319
  ```
269
320
 
270
321
  The [SignResponse](./docs/interfaces/SignResponse.html) contains the signature `sign`, the recovery ID `recid` and the transaction ID `transactionId`.
@@ -276,7 +327,7 @@ The full key refresh example is [here](https://github.com/silence-laboratories/w
276
327
  The workflow is similar to the keygen process.
277
328
 
278
329
  ```ts
279
- const algSign = 'secp256k1'; // Signing algorithms of ephemeral key
330
+ const algSign = 'secp256k1'; // Signing algorithms of Ephemeral Key
280
331
 
281
332
  // Create EOA authenticator
282
333
  const eoaAuth = new EOAAuth(
@@ -284,9 +335,6 @@ const eoaAuth = new EOAAuth(
284
335
  new BrowserWallet(),
285
336
  );
286
337
 
287
- // Create a client that connects to the backend service
288
- const wpClient = await createWalletProviderService(clusterConfig);
289
-
290
338
  // Create a new signer instance
291
339
  const sdk = new NetworkSigner(wpClient, eoaAuth);
292
340
  ```
@@ -1,7 +1,7 @@
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 { type UserAuthentication } from './authentication';
4
+ import { UserAuthentication } from './authentication';
5
5
  import { type TypedDataDomain } from 'viem';
6
6
  export type FieldDefinition = {
7
7
  name: string;
@@ -1,5 +1,5 @@
1
- import { AddEphKeyRequest, RegisterPasskeyRequest } from './../client/networkRequest';
2
- import { KeygenSetupOpts } from '../setupMessage';
1
+ import { AddEphKeyRequest, DeletePolicyRequest, KeyRefreshRequest, RegisterPasskeyRequest, UpdatePolicyRequest } 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';
@@ -11,24 +11,25 @@ export type AuthMethod = 'eoa' | 'ephemeral' | 'passkey';
11
11
  export type UserCredentials = {
12
12
  id: string;
13
13
  method: AuthMethod;
14
- credentials: string;
15
14
  };
16
15
  /** User signature container.
17
16
  * It contains the signature of the request and the user credentials (authentication method, id and additional credential information).
18
17
  * @public
19
18
  */
20
- export type UserAuthentication = {
19
+ export declare class UserAuthentication {
21
20
  credentials: UserCredentials;
22
21
  signature: string;
23
- };
22
+ constructor(credentials: UserCredentials, signature: string);
23
+ }
24
+ export interface AuthModuleParams<T extends AuthPayload = AuthPayload> {
25
+ payload: T;
26
+ challenge: string;
27
+ }
24
28
  export interface AuthModule {
25
- authenticate({ payload, challenge }: {
26
- payload: AuthPayload;
27
- challenge: string;
28
- }): Promise<UserAuthentication>;
29
+ authenticate(params: AuthModuleParams): Promise<UserAuthentication>;
29
30
  }
30
31
  export type AuthPayload = EoaAuthPayload | PasskeyLoginPayload | EphemeralAuthPayload | RegisterPasskeyRequest;
31
- type PasskeyLoginPayload = KeygenSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest;
32
+ type PasskeyLoginPayload = KeygenSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest | UpdatePolicyRequest | DeletePolicyRequest | SignSetupOpts | FinishPresignOpts | KeyRefreshRequest;
32
33
  /** The `EOAAuth` implementing Externally Owned Account authentication.
33
34
  * @public
34
35
  */
@@ -50,10 +51,7 @@ export declare class EOAAuth {
50
51
  * @param challenge - the challenge received from the backend in v1 or generated by client in v2
51
52
  * @public
52
53
  */
53
- authenticate({ payload, challenge, }: {
54
- payload: EoaAuthPayload;
55
- challenge: string;
56
- }): Promise<UserAuthentication>;
54
+ authenticate({ payload, challenge }: AuthModuleParams<EoaAuthPayload>): Promise<UserAuthentication>;
57
55
  }
58
56
  /** The `EphAuth` module is only used for signing requests to the network.
59
57
  * @public
@@ -80,15 +78,12 @@ export declare class EphAuth implements AuthModule {
80
78
  *
81
79
  * @public
82
80
  */
83
- authenticate({ payload, challenge, }: {
84
- payload: EphemeralAuthPayload;
85
- challenge: string;
86
- }): Promise<UserAuthentication>;
81
+ authenticate({ payload, challenge }: AuthModuleParams<EphemeralAuthPayload>): Promise<UserAuthentication>;
87
82
  }
88
83
  /** The `AuthModule` implementing Passkey authentication.
89
84
  * @public
90
85
  */
91
- export declare class PasskeyAuth {
86
+ export declare class PasskeyAuth implements AuthModule {
92
87
  /** Replying party object. Read more: https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredentialCreationOptions#rp */
93
88
  private rpConfig;
94
89
  /** ID of the acceptable credential by user. App proves that user has passkey credential by passing the value of this field */
@@ -106,10 +101,7 @@ export declare class PasskeyAuth {
106
101
  * @public
107
102
  */
108
103
  authenticate({ payload, // TODO: Passkey login doesnt require payload, we should clean up this
109
- challenge, }: {
110
- payload: PasskeyLoginPayload;
111
- challenge: string;
112
- }): Promise<UserAuthentication>;
104
+ challenge, }: AuthModuleParams<PasskeyLoginPayload>): Promise<UserAuthentication>;
113
105
  }
114
106
  /** The `AuthModule` implementing Passkey register.
115
107
  * @public
@@ -131,9 +123,6 @@ export declare class PasskeyRegister implements AuthModule {
131
123
  * @param challenge - the challenge received from the backend in v1 or generated by client in v2
132
124
  * @public
133
125
  */
134
- authenticate({ payload, challenge, }: {
135
- payload: RegisterPasskeyRequest;
136
- challenge: string;
137
- }): Promise<UserAuthentication>;
126
+ authenticate({ payload, challenge }: AuthModuleParams<RegisterPasskeyRequest>): Promise<UserAuthentication>;
138
127
  }
139
128
  export {};
@@ -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,9 +1,9 @@
1
1
  /**
2
2
  * Type of signing transaction.
3
- * For `eddsa` it is REQUIRED to encode the message in hex.
3
+ * For `rawBytes` | `solanaTransaction` it is REQUIRED to encode the message in hex.
4
4
  * @public
5
5
  */
6
- export type SignRequestType = 'accountAbstractionTx' | 'EIP712' | 'EIP191' | 'rawBytes' | 'eddsa';
6
+ export type SignRequestType = 'EIP1559' | 'EIP712' | 'EIP191' | 'rawBytes' | 'solanaTransaction';
7
7
  /**
8
8
  * Builder class for constructing request payload for DSG.
9
9
  * The returned value from `build()` is the value of `message` field of SignSetupOpts.
@@ -1,7 +1,10 @@
1
- import { AuthModule, UserAuthentication } from '../auth/authentication';
1
+ import { AuthModule, AuthModuleParams, 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, DeletePolicyRequest, KeyRefreshRequest, RegisterPasskeyRequest, RevokeEphKeyRequest, UpdatePolicyRequest } from '../client/networkRequest';
5
+ export type UserSignaturesOptionalParams = {
6
+ challenge?: string | undefined;
7
+ };
5
8
  /**
6
9
  * Builder class for constructing user signatures in all kind of client requests to the network.
7
10
  * It uses the API of `AuthModule` concrete types together with the `challenge` to generate the user signatures.
@@ -18,12 +21,13 @@ export declare class UserSignatures {
18
21
  setKeygenUserSigs(payload: KeygenSetupOpts[], challenges?: {
19
22
  [key: string]: string;
20
23
  }): Promise<void>;
21
- setSigngenUserSigs(payload: SignSetupOpts, challenge?: string): Promise<void>;
22
- setAddEphKeyUserSigs(payload: AddEphKeyRequest, challenge?: string): Promise<void>;
23
- setRevokeEphKeyUserSigs(payload: RevokeEphKeyRequest, challenge?: string): Promise<void>;
24
- setRegisterPasskeyUserSigs(payload: RegisterPasskeyRequest, challenge?: string): Promise<void>;
25
- setKeyRefreshUserSigs(payload: KeyRefreshRequest, challenge?: string): Promise<void>;
26
- setQcUserSigs(payload: QuorumChangeRequest, challenge?: string): Promise<void>;
27
- setFinishPresignUserSigs(payload: FinishPresignOpts, challenge?: string): Promise<void>;
28
- build(slug: Slug, payload: RequestPayloadV1 | RequestPayloadV2, challenge?: string): Promise<Record<string, UserAuthentication>>;
24
+ setSigngenUserSigs(authParams: AuthModuleParams<SignSetupOpts>): Promise<void>;
25
+ setAddEphKeyUserSigs(authParams: AuthModuleParams<AddEphKeyRequest>): Promise<void>;
26
+ setRevokeEphKeyUserSigs(authParams: AuthModuleParams<RevokeEphKeyRequest>): Promise<void>;
27
+ setRegisterPasskeyUserSigs(authParams: AuthModuleParams<RegisterPasskeyRequest>): Promise<void>;
28
+ setKeyRefreshUserSigs(authParams: AuthModuleParams<KeyRefreshRequest>): Promise<void>;
29
+ setFinishPresignUserSigs(authParams: AuthModuleParams<FinishPresignOpts>): Promise<void>;
30
+ setUpdatePolicyUserSigs(authParams: AuthModuleParams<UpdatePolicyRequest>): Promise<void>;
31
+ setDeletePolicyUserSigs(authParams: AuthModuleParams<DeletePolicyRequest>): Promise<void>;
32
+ build(slug: Slug, payload: RequestPayloadV1 | RequestPayloadV2, options?: UserSignaturesOptionalParams): Promise<Record<string, UserAuthentication>>;
29
33
  }
@@ -1,5 +1,6 @@
1
1
  import { EoaAuthPayload } from '../auth/EOAauthentication';
2
2
  import { EphKeyClaim } from '../auth/ephemeralAuthentication';
3
+ import { Policy } from '../policy';
3
4
  export declare class RevokeEphKeyRequest implements EoaAuthPayload {
4
5
  readonly key_id: string;
5
6
  readonly eph_claim: string;
@@ -34,18 +35,15 @@ export declare class RegisterPasskeyRequest {
34
35
  readonly options: string;
35
36
  constructor(options: string);
36
37
  }
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 */
38
+ export declare class KeyRefreshRequest implements EoaAuthPayload {
39
+ /** Threshold of refresh key */
40
+ readonly t: number;
41
+ /** Refresh key ID */
43
42
  readonly key_id: string;
44
- /** QC key signature algorithm */
43
+ /** Refresh key signature algorithm */
45
44
  readonly sign_alg: string;
46
- constructor({ newT, newN, keyId, signAlg }: {
47
- newT: number;
48
- newN: number;
45
+ constructor({ t, keyId, signAlg }: {
46
+ t: number;
49
47
  keyId: string;
50
48
  signAlg: string;
51
49
  });
@@ -54,30 +52,44 @@ export declare class QuorumChangeRequest implements EoaAuthPayload {
54
52
  name: string;
55
53
  type: string;
56
54
  }[];
57
- QuorumChangeRequest: {
55
+ KeyRefreshRequest: {
58
56
  name: string;
59
57
  type: string;
60
58
  }[];
61
59
  };
62
60
  }
63
- export declare class KeyRefreshRequest implements EoaAuthPayload {
64
- /** Threshold of refresh key */
65
- readonly t: number;
66
- /** Refresh key ID */
61
+ export declare class UpdatePolicyRequest implements EoaAuthPayload {
62
+ /** Policy associated key ID */
67
63
  readonly key_id: string;
68
- /** Refresh key signature algorithm */
69
- readonly sign_alg: string;
70
- constructor({ t, keyId, signAlg }: {
71
- t: number;
64
+ /** New policy */
65
+ readonly policy: string;
66
+ constructor({ keyId, policy }: {
72
67
  keyId: string;
73
- signAlg: string;
68
+ policy: Policy;
74
69
  });
75
70
  get eoaRequestSchema(): {
76
71
  Request: {
77
72
  name: string;
78
73
  type: string;
79
74
  }[];
80
- KeyRefreshRequest: {
75
+ UpdatePolicyRequest: {
76
+ name: string;
77
+ type: string;
78
+ }[];
79
+ };
80
+ }
81
+ export declare class DeletePolicyRequest implements EoaAuthPayload {
82
+ /** Policy associated key ID */
83
+ readonly key_id: string;
84
+ constructor({ keyId }: {
85
+ keyId: string;
86
+ });
87
+ get eoaRequestSchema(): {
88
+ Request: {
89
+ name: string;
90
+ type: string;
91
+ }[];
92
+ DeletePolicyRequest: {
81
93
  name: string;
82
94
  type: string;
83
95
  }[];