@silencelaboratories/walletprovider-sdk 1.7.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
@@ -137,36 +137,77 @@ We provide EOA authentication via [EOAAuth](./docs/classes/EOAAuth.html) module.
137
137
 
138
138
  ```
139
139
 
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_.
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_.
141
141
 
142
142
  ```ts
143
- const permissions = {
144
- permissions: [
145
- {
146
- type: 'erc20',
147
- method: 'approve',
148
- to: '0x1234567890123456789012345678901234567890',
149
- args: {
150
- spender: '0x1234567890123456789012345678901234567890',
151
- value: 10000,
152
- eq: '<',
153
- },
154
- },
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
+ }),
155
196
  ],
156
- };
197
+ });
157
198
 
158
199
  let signAlgs = ['secp256k1', 'ed25519'];
159
200
 
160
201
  // Generate new eph key, will be later used in sign requests
161
- const selectedEphSignAlg = 'secp256k1'; // Signing algorithm of ephemeral key
202
+ const selectedEphSignAlg = 'secp256k1'; // Signing algorithm of Ephemeral Key
162
203
  const sk = generateEphPrivateKey(selectedEphSignAlg);
163
204
  const ephPK = getEphPublicKey(sk, selectedEphSignAlg);
164
205
  const ephId = uuidv4();
165
206
 
166
207
  const ephClaim = new EphKeyClaim(ephId, ephPK, selectedEphSignAlg, expireAt(60 * 60));
167
208
 
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);
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);
170
211
  ```
171
212
 
172
213
  Calling this method will cause to the Digital Wallet window to pop up, requesting the User to sign the request.
@@ -222,7 +263,7 @@ const ephPK = getEphPublicKey(sk, selectedEphSignAlg);
222
263
  const ephId = uuidv4();
223
264
 
224
265
  const ephClaim = new EphKeyClaim(ephId, ephPK, selectedEphSignAlg, expireAt(60 * 60));
225
- let resp: KeygenResponse[] = await sdk.generateKey(+threshold, +partiesNumber, signAlgs, ephClaim, permissions);
266
+ let resp: KeygenResponse[] = await sdk.generateKey(+threshold, +partiesNumber, signAlgs, ephClaim);
226
267
  ```
227
268
 
228
269
  Now you can generate a key like in the EOA example by calling the [generateKey](./docs/classes/NetworkSigner.html#generatekey) method.
@@ -244,27 +285,28 @@ const sdk = new NetworkSigner(wpClient, authModule);
244
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.
245
286
 
246
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
+ };
247
305
  const signMessage = new SignRequestBuilder()
248
306
  .setRequest(
249
307
  uuidv4(),
250
- JSON.stringify({
251
- userOperation: {
252
- sender: '0x8d4cb2540d993fe34c646299f1ab4af3012ff34c',
253
- nonce: '0x7',
254
- initCode: '0x',
255
- callData: '0000...',
256
- callGasLimit: '0x18473',
257
- verificationGasLimit: '0x18473',
258
- preVerificationGas: '66768',
259
- maxFeePerGas: '',
260
- maxPriorityFeePerGas: '',
261
- paymasterAndData: '0x',
262
- },
263
- entryPointVersion: 'v0.6.0',
264
- entryPointAddress: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
265
- chainId: 80002,
266
- }),
267
- 'accountAbstractionTx',
308
+ JSON.stringify(eip1559Tx),
309
+ 'EIP1559',
268
310
  )
269
311
  .setRequest(
270
312
  uuidv4(),
@@ -273,7 +315,7 @@ const signMessage = new SignRequestBuilder()
273
315
  )
274
316
  .build();
275
317
 
276
- let resp = await sdk.signMessage( threshold, selectedKeyId, signMessage);
318
+ let resp = await sdk.signMessage(threshold, selectedKeyId, 'secp256k1', signMessage);
277
319
  ```
278
320
 
279
321
  The [SignResponse](./docs/interfaces/SignResponse.html) contains the signature `sign`, the recovery ID `recid` and the transaction ID `transactionId`.
@@ -285,7 +327,7 @@ The full key refresh example is [here](https://github.com/silence-laboratories/w
285
327
  The workflow is similar to the keygen process.
286
328
 
287
329
  ```ts
288
- const algSign = 'secp256k1'; // Signing algorithms of ephemeral key
330
+ const algSign = 'secp256k1'; // Signing algorithms of Ephemeral Key
289
331
 
290
332
  // Create EOA authenticator
291
333
  const eoaAuth = new EOAAuth(
@@ -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,4 +1,4 @@
1
- import { AddEphKeyRequest, KeyRefreshRequest, RegisterPasskeyRequest } from './../client/networkRequest';
1
+ import { AddEphKeyRequest, DeletePolicyRequest, KeyRefreshRequest, RegisterPasskeyRequest, UpdatePolicyRequest } from './../client/networkRequest';
2
2
  import { KeygenSetupOpts, SignSetupOpts, FinishPresignOpts } from '../setupMessage';
3
3
  import { EoaAuthPayload, IBrowserWallet } from './EOAauthentication';
4
4
  import { PasskeyUser, RelyingPartyConfig } from './passkeyAuthentication';
@@ -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 | SignSetupOpts | FinishPresignOpts | KeyRefreshRequest;
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 {};
@@ -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, 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,11 +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
- setFinishPresignUserSigs(payload: FinishPresignOpts, challenge?: string): Promise<void>;
27
- 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>>;
28
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;
@@ -57,3 +58,40 @@ export declare class KeyRefreshRequest implements EoaAuthPayload {
57
58
  }[];
58
59
  };
59
60
  }
61
+ export declare class UpdatePolicyRequest implements EoaAuthPayload {
62
+ /** Policy associated key ID */
63
+ readonly key_id: string;
64
+ /** New policy */
65
+ readonly policy: string;
66
+ constructor({ keyId, policy }: {
67
+ keyId: string;
68
+ policy: Policy;
69
+ });
70
+ get eoaRequestSchema(): {
71
+ Request: {
72
+ name: string;
73
+ type: string;
74
+ }[];
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: {
93
+ name: string;
94
+ type: string;
95
+ }[];
96
+ };
97
+ }
@@ -45,30 +45,27 @@ export interface SignResponse {
45
45
  */
46
46
  recid: number;
47
47
  }
48
+ interface SimpleResponse {
49
+ /**
50
+ * Status of the request.
51
+ */
52
+ status: string;
53
+ }
48
54
  /**
49
55
  * Response from the SDK for adding ephemeral key request. Receive plaintext response from network.
50
56
  * @public
51
57
  */
52
- export interface AddEphKeyResponse {
58
+ export interface AddEphKeyResponse extends SimpleResponse {
53
59
  /**
54
60
  * Unique ID of produced key used in subsequent API calls.
55
61
  */
56
62
  keyId: string;
57
- /**
58
- * Status of the request.
59
- */
60
- status: string;
61
63
  }
62
64
  /**
63
65
  * Response from the network for revoking ephemeral key request.
64
66
  * @public
65
67
  */
66
- export interface RevokeEphKeyResponse {
67
- /**
68
- * Status of the request.
69
- */
70
- status: string;
71
- }
68
+ export type RevokeEphKeyResponse = SimpleResponse;
72
69
  /**
73
70
  * Response from the network for registering passkey request.
74
71
  * @public
@@ -80,3 +77,14 @@ export interface RegisterPasskeyResponse {
80
77
  */
81
78
  passkeyCredentialId: string;
82
79
  }
80
+ /**
81
+ * Response from the network for updating passkey policy request.
82
+ * @public
83
+ */
84
+ export type UpdatePolicyResponse = SimpleResponse;
85
+ /**
86
+ * Response from the network for deleting passkey policy request.
87
+ * @public
88
+ */
89
+ export type DeletePolicyResponse = SimpleResponse;
90
+ export {};
@@ -1,7 +1,8 @@
1
1
  import { AuthModule } from '../auth/authentication';
2
2
  import { INoAuthWpServiceClient, type IWalletProviderServiceClient } from './walletProviderServiceClientInterface';
3
- import { KeygenResponse, AddEphKeyResponse, RegisterPasskeyResponse, SignResponse, RevokeEphKeyResponse, KeyRefreshResponse } from './networkResponse';
3
+ import { KeygenResponse, AddEphKeyResponse, RegisterPasskeyResponse, SignResponse, RevokeEphKeyResponse, KeyRefreshResponse, UpdatePolicyResponse, DeletePolicyResponse } from './networkResponse';
4
4
  import { EphKeyClaim } from '../auth/ephemeralAuthentication';
5
+ import { Policy } from '../policy';
5
6
  /**
6
7
  * Supported signature algorithms for MPC signing.
7
8
  * @public
@@ -32,12 +33,12 @@ export declare class NetworkSigner {
32
33
  * @param totalNodes - Number of nodes that participate in keygen operation. Also known as `n`.
33
34
  * @param signAlgs - signature algorithms for which MPC keys will be generated.
34
35
  * @param eph_claim - optional eph key added to the generated key
35
- * @param permissions - optional permissions that will be stored in the key metadata.
36
- * The permissions are validated during sign requests.
36
+ * @param policy - optional policy that will be stored in the key metadata.
37
+ * The policy are validated during sign requests.
37
38
  * @returns {@link KeygenResponse} containing `keyId` and the `pubKey` public part of the key
38
39
  * @public
39
40
  */
40
- generateKey(threshold: number, totalNodes: number, signAlgs: string[], ephClaim?: EphKeyClaim, permissions?: string): Promise<KeygenResponse[]>;
41
+ generateKey(threshold: number, totalNodes: number, signAlgs: string[], ephClaim?: EphKeyClaim, policy?: Policy): Promise<KeygenResponse[]>;
41
42
  /** Generate a signature by the distributed key of Silent Network.
42
43
  * Uses `authModule` to authenticate the sign request by the User.
43
44
  * The network chooses `t` nodes to execute the protocol.
@@ -81,4 +82,19 @@ export declare class NetworkSigner {
81
82
  * @public
82
83
  */
83
84
  registerPasskey(options?: string): Promise<RegisterPasskeyResponse>;
85
+ /** Update user's key policy on the network. This will try to update to all the available nodes on the network.
86
+ * Uses `authModule` to authenticate the request by the User.
87
+ * @param keyId - the key id returned from `keygen`
88
+ * @param policy - the key policy to be updated
89
+ * @returns {@link UpdatePolicyResponse}
90
+ * @public
91
+ */
92
+ updatePolicy(keyId: string, policy: Policy): Promise<UpdatePolicyResponse>;
93
+ /** Delete user's key policy on the network. This will try to delete to all the available nodes on the network.
94
+ * Uses `authModule` to authenticate the request by the User.
95
+ * @param keyId - the key id returned from `keygen`
96
+ * @returns {@link DeletePolicyResponse}
97
+ * @public
98
+ */
99
+ deletePolicy(keyId: string): Promise<DeletePolicyResponse>;
84
100
  }
@@ -1,8 +1,8 @@
1
1
  import { AuthModule } from '../auth/authentication';
2
- import { type KeygenResponse, type SignResponse, type AddEphKeyResponse, type RegisterPasskeyResponse, RevokeEphKeyResponse, KeyRefreshResponse } from './networkResponse';
2
+ import { type KeygenResponse, type SignResponse, type AddEphKeyResponse, type RegisterPasskeyResponse, RevokeEphKeyResponse, KeyRefreshResponse, UpdatePolicyResponse, DeletePolicyResponse } from './networkResponse';
3
3
  import { KeygenSetupOpts, SignSetupOpts } from '../setupMessage';
4
4
  import { ApiVersion, type ClientConfig, IWalletProviderServiceClient, Slug, RequestPayloadV1, RequestPayloadV2, INoAuthWpServiceClient, NoAuthSlug, NoAuthRequestPayload } from './walletProviderServiceClientInterface';
5
- import { AddEphKeyRequest, KeyRefreshRequest, RegisterPasskeyRequest, RevokeEphKeyRequest } from './networkRequest';
5
+ import { AddEphKeyRequest, DeletePolicyRequest, KeyRefreshRequest, RegisterPasskeyRequest, RevokeEphKeyRequest, UpdatePolicyRequest } from './networkRequest';
6
6
  declare enum ProtocolState {
7
7
  initiated = 0,
8
8
  waitingForSign = 1,
@@ -47,6 +47,14 @@ export declare class WalletProviderServiceClient implements IWalletProviderServi
47
47
  payload: RegisterPasskeyRequest;
48
48
  authModule: AuthModule;
49
49
  }): Promise<RegisterPasskeyResponse>;
50
+ updatePolicy({ payload, authModule, }: {
51
+ payload: UpdatePolicyRequest;
52
+ authModule: AuthModule;
53
+ }): Promise<UpdatePolicyResponse>;
54
+ deletePolicy({ payload, authModule, }: {
55
+ payload: DeletePolicyRequest;
56
+ authModule: AuthModule;
57
+ }): Promise<DeletePolicyResponse>;
50
58
  connect(slug: Slug, payload: RequestPayloadV1, authModule: AuthModule): Promise<string>;
51
59
  connectV2(slug: Slug, payload: RequestPayloadV2, authModule: AuthModule): Promise<string>;
52
60
  /**
@@ -85,6 +93,12 @@ export declare class NoAuthWalletProviderServiceClient implements INoAuthWpServi
85
93
  startKeyRefresh({ payload }: {
86
94
  payload: KeyRefreshRequest;
87
95
  }): Promise<KeyRefreshResponse>;
96
+ updatePolicy({ payload }: {
97
+ payload: UpdatePolicyRequest;
98
+ }): Promise<UpdatePolicyResponse>;
99
+ deletePolicy({ payload }: {
100
+ payload: DeletePolicyRequest;
101
+ }): Promise<DeletePolicyResponse>;
88
102
  connect(slug: NoAuthSlug, payload: NoAuthRequestPayload): Promise<string>;
89
103
  }
90
104
  export {};
@@ -1,7 +1,7 @@
1
1
  import { AuthModule, UserAuthentication } from '../auth/authentication';
2
- import { KeygenResponse, SignResponse, AddEphKeyResponse, RegisterPasskeyResponse, RevokeEphKeyResponse, KeyRefreshResponse } from './networkResponse';
2
+ import { KeygenResponse, SignResponse, AddEphKeyResponse, RegisterPasskeyResponse, RevokeEphKeyResponse, KeyRefreshResponse, UpdatePolicyResponse, DeletePolicyResponse } from './networkResponse';
3
3
  import { KeygenSetupOpts, SignSetupOpts, InitPresignOpts, FinishPresignOpts } from '../setupMessage';
4
- import { AddEphKeyRequest, KeyRefreshRequest, RegisterPasskeyRequest, RevokeEphKeyRequest } from './networkRequest';
4
+ import { AddEphKeyRequest, DeletePolicyRequest, KeyRefreshRequest, RegisterPasskeyRequest, RevokeEphKeyRequest, UpdatePolicyRequest } 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}
@@ -54,10 +54,18 @@ export interface IWalletProviderServiceClient {
54
54
  payload: RegisterPasskeyRequest;
55
55
  authModule: AuthModule;
56
56
  }): Promise<RegisterPasskeyResponse>;
57
+ updatePolicy({ payload, authModule, }: {
58
+ payload: UpdatePolicyRequest;
59
+ authModule: AuthModule;
60
+ }): Promise<UpdatePolicyResponse>;
61
+ deletePolicy({ payload, authModule, }: {
62
+ payload: DeletePolicyRequest;
63
+ authModule: AuthModule;
64
+ }): Promise<DeletePolicyResponse>;
57
65
  }
58
- export type Slug = 'signgen' | 'keygen' | 'keyRefresh' | 'quorumChange' | 'addEphemeralKey' | 'revokeEphemeralKey' | 'registerPasskey' | 'initPresign' | 'finishPresign';
59
- export type RequestPayloadV1 = KeygenSetupOpts[] | KeyRefreshRequest | SignSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest | RegisterPasskeyRequest | FinishPresignOpts;
60
- export type RequestPayloadV2 = KeygenSetupOpts[] | SignSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest | InitPresignOpts | FinishPresignOpts;
66
+ export type Slug = 'signgen' | 'keygen' | 'keyRefresh' | 'quorumChange' | 'addEphemeralKey' | 'revokeEphemeralKey' | 'registerPasskey' | 'initPresign' | 'finishPresign' | 'updatePolicy' | 'deletePolicy';
67
+ export type RequestPayloadV1 = KeygenSetupOpts[] | KeyRefreshRequest | SignSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest | RegisterPasskeyRequest | UpdatePolicyRequest | DeletePolicyRequest | FinishPresignOpts;
68
+ export type RequestPayloadV2 = KeygenSetupOpts[] | SignSetupOpts | AddEphKeyRequest | RevokeEphKeyRequest | InitPresignOpts | FinishPresignOpts | UpdatePolicyRequest | DeletePolicyRequest;
61
69
  export interface WpRequest {
62
70
  payload: RequestPayloadV1 | RequestPayloadV2;
63
71
  userSigs: Record<string, UserAuthentication> | undefined;
@@ -76,6 +84,12 @@ export interface INoAuthWpServiceClient {
76
84
  startKeyRefresh({ payload }: {
77
85
  payload: KeyRefreshRequest;
78
86
  }): Promise<KeyRefreshResponse>;
87
+ updatePolicy({ payload }: {
88
+ payload: UpdatePolicyRequest;
89
+ }): Promise<UpdatePolicyResponse>;
90
+ deletePolicy({ payload }: {
91
+ payload: DeletePolicyRequest;
92
+ }): Promise<DeletePolicyResponse>;
79
93
  }
80
- export type NoAuthSlug = 'signgen' | 'keygen' | 'keyRefresh';
81
- export type NoAuthRequestPayload = KeygenSetupOpts[] | SignSetupOpts | InitPresignOpts | FinishPresignOpts | KeyRefreshRequest;
94
+ export type NoAuthSlug = 'signgen' | 'keygen' | 'keyRefresh' | 'updatePolicy' | 'deletePolicy';
95
+ export type NoAuthRequestPayload = KeygenSetupOpts[] | SignSetupOpts | InitPresignOpts | FinishPresignOpts | KeyRefreshRequest | UpdatePolicyRequest | DeletePolicyRequest;