@vlayer/sdk 0.1.0-nightly-20241003-23d0e97 → 0.1.0-nightly-20241004-ebf2976
Sign up to get free protection for your applications and to get access to all the features.
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-
|
5
|
+
"version": "0.1.0-nightly-20241004-ebf2976",
|
6
6
|
"types": "src/index.ts",
|
7
7
|
"scripts": {
|
8
8
|
"build": "npm run gen:types",
|
@@ -22,6 +22,9 @@
|
|
22
22
|
"dns-over-http-resolver": "^3.0.3",
|
23
23
|
"postal-mime": "^2.3.2",
|
24
24
|
"viem": "^2.21.0",
|
25
|
-
"
|
26
|
-
}
|
25
|
+
"@vlayer/web-proof-commons": "file:../../web-proof-commons"
|
26
|
+
},
|
27
|
+
"bundleDependencies": [
|
28
|
+
"@vlayer/web-proof-commons"
|
29
|
+
]
|
27
30
|
}
|
@@ -9,15 +9,6 @@ export const EXTENSION_STEP = {
|
|
9
9
|
notarize: "notarize",
|
10
10
|
} as const;
|
11
11
|
|
12
|
-
export const EXTENSION_ACTION = {
|
13
|
-
requestWebProof: "requestWebProof",
|
14
|
-
} as const;
|
15
|
-
|
16
|
-
export const EXTENSION_MESSAGE = {
|
17
|
-
proofDone: "proofDone",
|
18
|
-
proofError: "proofError",
|
19
|
-
} as const;
|
20
|
-
|
21
12
|
export type ExtensionStep =
|
22
13
|
(typeof EXTENSION_STEP)[keyof typeof EXTENSION_STEP];
|
23
14
|
|
@@ -1,11 +1,14 @@
|
|
1
1
|
import {
|
2
|
-
EXTENSION_ACTION,
|
3
|
-
EXTENSION_MESSAGE,
|
4
2
|
type WebProofProvider,
|
5
3
|
type WebProofProviderSetup,
|
6
4
|
type WebProofSetupInput,
|
7
5
|
} from "../../lib/types/webProofProvider";
|
8
6
|
|
7
|
+
import {
|
8
|
+
ExtensionAction,
|
9
|
+
ExtensionMessage,
|
10
|
+
} from "@vlayer/web-proof-commons/constants/message";
|
11
|
+
|
9
12
|
import { WebProof } from "../../lib/types/webProof";
|
10
13
|
|
11
14
|
// NOTE @types/chrome and webextension-polyfill work only in the extension context
|
@@ -36,7 +39,7 @@ export const createExtensionWebProofProvider = ({
|
|
36
39
|
|
37
40
|
return new Promise<WebProof>((resolve, reject) => {
|
38
41
|
chrome.runtime.sendMessage(import.meta.env.VITE_EXTENSION_ID, {
|
39
|
-
action:
|
42
|
+
action: ExtensionAction.RequestWebProof,
|
40
43
|
payload: {
|
41
44
|
notaryUrl,
|
42
45
|
wsProxyUrl,
|
@@ -51,18 +54,18 @@ export const createExtensionWebProofProvider = ({
|
|
51
54
|
(
|
52
55
|
message:
|
53
56
|
| {
|
54
|
-
type:
|
57
|
+
type: ExtensionMessage.ProofDone;
|
55
58
|
proof: WebProof;
|
56
59
|
}
|
57
60
|
| {
|
58
|
-
type:
|
61
|
+
type: ExtensionMessage.ProofError;
|
59
62
|
error: { message: string };
|
60
63
|
},
|
61
64
|
) => {
|
62
|
-
if (message.type ===
|
65
|
+
if (message.type === ExtensionMessage.ProofDone) {
|
63
66
|
resolve(message.proof);
|
64
67
|
}
|
65
|
-
if (message.type ===
|
68
|
+
if (message.type === ExtensionMessage.ProofError) {
|
66
69
|
reject(message.error);
|
67
70
|
}
|
68
71
|
},
|