@vlayer/sdk 0.1.0-nightly-20241004-7d30f05e → 0.1.0-nightly-20241007-c9fd44e

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,3 +6,8 @@ export const enum ExtensionMessage {
6
6
  ProofDone,
7
7
  ProofError,
8
8
  }
9
+
10
+ export type WebProverSessionConfig = {
11
+ notaryUrl: string;
12
+ wsProxyUrl: string;
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-20241004-7d30f05e",
5
+ "version": "0.1.0-nightly-20241007-c9fd44e",
6
6
  "types": "src/index.ts",
7
7
  "scripts": {
8
8
  "build": "npm run gen:types",
@@ -28,17 +28,17 @@ declare const chrome: {
28
28
  };
29
29
  };
30
30
 
31
+ // this id is fixed in the extension by the key in manifest.json
32
+ const EXTENSION_ID = "ghigbilfcgeibjkkajaekabeldkmijcd";
33
+
31
34
  export const createExtensionWebProofProvider = ({
32
35
  notaryUrl = "https://notary.pse.dev/v0.1.0-alpha.5/",
33
36
  wsProxyUrl = "wss://notary.pse.dev/proxy",
34
37
  }: WebProofProviderSetup): WebProofProvider => {
35
38
  return {
36
39
  getWebProof: async function (webProofSetup: WebProofSetupInput) {
37
- // TODO: we can't assume that developer is using vite
38
- // VITE_EXTENSION_ID value should be injected by the build system
39
-
40
40
  return new Promise<WebProof>((resolve, reject) => {
41
- chrome.runtime.sendMessage(import.meta.env.VITE_EXTENSION_ID, {
41
+ chrome.runtime.sendMessage(EXTENSION_ID, {
42
42
  action: ExtensionAction.RequestWebProof,
43
43
  payload: {
44
44
  notaryUrl,
@@ -47,7 +47,6 @@ export const createExtensionWebProofProvider = ({
47
47
  steps: webProofSetup.steps,
48
48
  },
49
49
  });
50
- const EXTENSION_ID = import.meta.env.VITE_EXTENSION_ID as string;
51
50
  const port = chrome.runtime.connect(EXTENSION_ID);
52
51
  // TODO: validate message in runtime
53
52
  port.onMessage.addListener(