@vlayer/sdk 0.1.0-nightly-20241008-77ed5a3 → 0.1.0-nightly-20241008-a3822d1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ export * from "./lib";
@@ -0,0 +1 @@
1
+ export * from "./message";
@@ -0,0 +1,20 @@
1
+ export const enum ExtensionAction {
2
+ RequestWebProof,
3
+ }
4
+
5
+ export const enum ExtensionMessageType {
6
+ ProofDone,
7
+ ProofError,
8
+ RedirectBack,
9
+ }
10
+
11
+ export type ExtensionMessage =
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ | { type: ExtensionMessageType.ProofDone; proof: any } // Change to WebProof
14
+ | { type: ExtensionMessageType.ProofError; error: string }
15
+ | { type: ExtensionMessageType.RedirectBack };
16
+
17
+ export type WebProverSessionConfig = {
18
+ notaryUrl: string;
19
+ wsProxyUrl: string;
20
+ };
@@ -4,6 +4,10 @@
4
4
  "version": "1.0.0",
5
5
  "module": "index.ts",
6
6
  "type": "module",
7
+ "scripts": {
8
+ "lint": "eslint lib",
9
+ "lint:fix": "eslint --fix lib"
10
+ },
7
11
  "devDependencies": {
8
12
  "@types/bun": "latest"
9
13
  },
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vlayer/sdk",
3
3
  "type": "module",
4
4
  "module": "src/index.ts",
5
- "version": "0.1.0-nightly-20241008-77ed5a3",
5
+ "version": "0.1.0-nightly-20241008-a3822d1",
6
6
  "types": "src/index.ts",
7
7
  "scripts": {
8
8
  "build": "npm run gen:types",
@@ -7,7 +7,8 @@ import {
7
7
  import {
8
8
  ExtensionAction,
9
9
  ExtensionMessage,
10
- } from "@vlayer/web-proof-commons/constants/message";
10
+ ExtensionMessageType,
11
+ } from "@vlayer/web-proof-commons";
11
12
 
12
13
  import { WebProof } from "../../lib/types/webProof";
13
14
 
@@ -49,26 +50,14 @@ export const createExtensionWebProofProvider = ({
49
50
  });
50
51
  const port = chrome.runtime.connect(EXTENSION_ID);
51
52
  // TODO: validate message in runtime
52
- port.onMessage.addListener(
53
- (
54
- message:
55
- | {
56
- type: ExtensionMessage.ProofDone;
57
- proof: WebProof;
58
- }
59
- | {
60
- type: ExtensionMessage.ProofError;
61
- error: { message: string };
62
- },
63
- ) => {
64
- if (message.type === ExtensionMessage.ProofDone) {
65
- resolve(message.proof);
66
- }
67
- if (message.type === ExtensionMessage.ProofError) {
68
- reject(message.error);
69
- }
70
- },
71
- );
53
+ port.onMessage.addListener((message: ExtensionMessage) => {
54
+ if (message.type === ExtensionMessageType.ProofDone) {
55
+ resolve(message.proof);
56
+ }
57
+ if (message.type === ExtensionMessageType.ProofError) {
58
+ reject(message.error);
59
+ }
60
+ });
72
61
  });
73
62
  },
74
63
  };
@@ -1,13 +0,0 @@
1
- export const enum ExtensionAction {
2
- RequestWebProof,
3
- }
4
-
5
- export const enum ExtensionMessage {
6
- ProofDone,
7
- ProofError,
8
- }
9
-
10
- export type WebProverSessionConfig = {
11
- notaryUrl: string;
12
- wsProxyUrl: string;
13
- };