@silencelaboratories/walletprovider-sdk 0.3.0 → 1.3.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.
@@ -1,3 +1,6 @@
1
+ import { SignAlgorithm } from './ephemeralAuthentication';
1
2
  export declare const throwIfInvalidString: (key: string, value: string) => void;
2
- export declare const throwIfInvalidEphKey: (ephKey: Uint8Array) => void;
3
+ export declare const throwIfInvalidEphPK: (ephKey: Uint8Array, signAlg: SignAlgorithm) => void;
4
+ export declare const throwIfInvalidEphSK: (ephKey: Uint8Array, signAlg: SignAlgorithm) => void;
5
+ export declare const throwIfInvalidSignAlg: (signAlg: SignAlgorithm) => void;
3
6
  export declare const throwIf: (condition: boolean, message: string) => void;
@@ -1,6 +1,7 @@
1
- import { AuthModule } from './authentication';
2
- import { type KeygenSetupOpts, type KeygenResponse, type SignSetupOpts, type SignResponse, AddEphemeralKeyOpts, AddEphemeralKeyResponse } from './networkSigner';
3
- import { type ClientConfig, IWalletProviderServiceClient } from './walletProviderServiceClientInterface';
1
+ import { AuthModule, DkgAuthModule } from './authentication';
2
+ import { type KeygenResponse, type SignResponse, type OperationStatusResponse, type RegisterPasskeyResponse } from './networkSigner';
3
+ import { MetadataSetupOpts, KeygenSetupOpts, SignSetupOpts } from './setupMessage';
4
+ import { ApiVersion, type ClientConfig, IWalletProviderServiceClient, QueryPath } from './walletProviderServiceClientInterface';
4
5
  /**
5
6
  * The Websocket client to the Wallet Provider backend service.
6
7
  * All requests are relayed by this entity to the MPC network.
@@ -9,24 +10,34 @@ import { type ClientConfig, IWalletProviderServiceClient } from './walletProvide
9
10
  export declare class WalletProviderServiceClient implements IWalletProviderServiceClient {
10
11
  walletProviderId: string;
11
12
  walletProviderUrl: string;
12
- passkeyCredentialId?: string;
13
+ apiVersion: ApiVersion;
13
14
  /**
14
15
  * Create new client that connects to the backend service
15
16
  * @param config - config containing information about backend service
16
17
  */
17
18
  constructor(config: ClientConfig);
19
+ getVersion(): ApiVersion;
18
20
  getWalletId(): string;
19
21
  startKeygen({ setup, authModule, }: {
20
22
  setup: KeygenSetupOpts;
21
- authModule: AuthModule;
23
+ authModule: DkgAuthModule;
22
24
  }): Promise<KeygenResponse>;
23
25
  startSigngen({ setup, authModule }: {
24
26
  setup: SignSetupOpts;
25
27
  authModule: AuthModule;
26
28
  }): Promise<SignResponse>;
27
29
  addEphemeralKey({ setup, authModule, }: {
28
- setup: AddEphemeralKeyOpts;
30
+ setup: MetadataSetupOpts;
31
+ authModule: DkgAuthModule;
32
+ }): Promise<OperationStatusResponse>;
33
+ revokeEphemeralKey({ setup, authModule, }: {
34
+ setup: MetadataSetupOpts;
35
+ authModule: AuthModule;
36
+ }): Promise<OperationStatusResponse>;
37
+ registerPasskey({ setup, authModule, }: {
38
+ setup: MetadataSetupOpts;
29
39
  authModule: AuthModule;
30
- }): Promise<AddEphemeralKeyResponse>;
31
- connect(setupOpts: KeygenSetupOpts | SignSetupOpts | AddEphemeralKeyOpts, authModule: AuthModule): Promise<string>;
40
+ }): Promise<RegisterPasskeyResponse>;
41
+ connect(path: QueryPath, setupOpts: KeygenSetupOpts | SignSetupOpts | MetadataSetupOpts, authModule: AuthModule): Promise<string>;
42
+ connectV2(path: QueryPath, setupOpts: KeygenSetupOpts | SignSetupOpts | MetadataSetupOpts, authModule: AuthModule): Promise<string>;
32
43
  }
@@ -1,5 +1,6 @@
1
1
  import { AuthModule, UserAuthentication } from './authentication';
2
- import { AddEphemeralKeyOpts, KeygenResponse, KeygenSetupOpts, SignResponse, SignSetupOpts, AddEphemeralKeyResponse } from './networkSigner';
2
+ import { KeygenResponse, SignResponse, OperationStatusResponse, RegisterPasskeyResponse } from './networkSigner';
3
+ import { MetadataSetupOpts, KeygenSetupOpts, SignSetupOpts } from './setupMessage';
3
4
  /**
4
5
  * The config used to create Wallet Provider Service backend client.
5
6
  * Please refer to {@link https://shipyard.rs/silencelaboratories/crates/wallet-provider-service | example backend service}
@@ -7,6 +8,10 @@ import { AddEphemeralKeyOpts, KeygenResponse, KeygenSetupOpts, SignResponse, Sig
7
8
  * @alpha
8
9
  */
9
10
  export type ClientConfig = {
11
+ /**
12
+ * The version of the API used to connect to the service
13
+ */
14
+ apiVersion: ApiVersion;
10
15
  /**
11
16
  * The id of the Wallet Provider Service
12
17
  * @alpha
@@ -18,12 +23,18 @@ export type ClientConfig = {
18
23
  */
19
24
  walletProviderUrl: string;
20
25
  };
26
+ /**
27
+ * The API version of the Wallet Provider Service
28
+ * @public
29
+ */
30
+ export type ApiVersion = 'v1' | 'v2';
21
31
  export type Signer = (challenge: string) => Promise<UserAuthentication>;
22
32
  /** Interface for client of Wallet Provider Service
23
33
  * @alpha
24
34
  */
25
35
  export interface IWalletProviderServiceClient {
26
36
  getWalletId(): string;
37
+ getVersion(): ApiVersion;
27
38
  startKeygen({ setup, authModule }: {
28
39
  setup: KeygenSetupOpts;
29
40
  authModule: AuthModule;
@@ -33,11 +44,16 @@ export interface IWalletProviderServiceClient {
33
44
  authModule: AuthModule;
34
45
  }): Promise<SignResponse>;
35
46
  addEphemeralKey({ setup, authModule, }: {
36
- setup: AddEphemeralKeyOpts;
47
+ setup: MetadataSetupOpts;
37
48
  authModule: AuthModule;
38
- }): Promise<AddEphemeralKeyResponse>;
39
- }
40
- export type QueryPath = 'signgen' | 'keygen' | 'addEphemeralKey';
41
- export interface GetQueryPath {
42
- get queryPath(): QueryPath;
49
+ }): Promise<OperationStatusResponse>;
50
+ revokeEphemeralKey({ setup, authModule, }: {
51
+ setup: MetadataSetupOpts;
52
+ authModule: AuthModule;
53
+ }): Promise<OperationStatusResponse>;
54
+ registerPasskey({ setup, authModule, }: {
55
+ setup: MetadataSetupOpts;
56
+ authModule: AuthModule;
57
+ }): Promise<RegisterPasskeyResponse>;
43
58
  }
59
+ export type QueryPath = 'signgen' | 'keygen' | 'addEphemeralKey' | 'revokeEphemeralKey' | 'registerPasskey';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silencelaboratories/walletprovider-sdk",
3
- "version": "0.3.0",
3
+ "version": "1.3.0",
4
4
  "author": "Silence Laboratories",
5
5
  "description": "Frontend SDK for Wallet Providers",
6
6
  "main": "./dist/index.cjs.js",
@@ -21,6 +21,7 @@
21
21
  "formatcheck": "prettier --check --cache .",
22
22
  "lint": "eslint --cache ./src/**/*.ts",
23
23
  "typecheck": "tsc -p . --noEmit",
24
+ "test": "vitest",
24
25
  "build": "node build.js && npm run build:declaration",
25
26
  "build:declaration": "tsc -p . --emitDeclarationOnly",
26
27
  "clean": "rimraf dist",
@@ -28,24 +29,25 @@
28
29
  "docs": "npm run build:declaration && api-extractor run --local --verbose && api-documenter markdown -i ./temp -o ./docs"
29
30
  },
30
31
  "devDependencies": {
31
- "@eslint/js": "^9.3.0",
32
+ "@eslint/js": "9.14.0",
32
33
  "@microsoft/api-documenter": "^7.25.2",
33
34
  "@microsoft/api-extractor": "^7.46.2",
34
35
  "@types/eslint-plugin-security": "^3.0.0",
35
36
  "esbuild": "0.24.0",
36
37
  "esbuild-node-externals": "^1.15.0",
37
- "eslint": "^8.x",
38
+ "eslint": "9.14.0",
38
39
  "eslint-plugin-security": "^3.0.1",
39
40
  "globals": "^15.3.0",
40
41
  "npm-dts": "^1.3.13",
41
- "prettier": "^3.2.5",
42
+ "prettier": "3.3.3",
42
43
  "rimraf": "^6.0.1",
43
44
  "typescript": "5.6.3",
44
- "typescript-eslint": "^7.11.0"
45
+ "typescript-eslint": "8.13.0",
46
+ "vitest": "^2.1.5"
45
47
  },
46
48
  "dependencies": {
47
49
  "@noble/curves": "^1.6.0",
48
50
  "js-base64": "^3.7.7",
49
- "viem": "2.21.32"
51
+ "viem": "2.21.54"
50
52
  }
51
53
  }