@vlayer/sdk 0.1.0-nightly-20241028-74b5b0d → 0.1.0-nightly-202410292-42360cf
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/api/email/dnsResolver.d.ts +1 -0
- package/dist/api/email/dnsResolver.js +6 -0
- package/dist/api/email/dnsResolver.test.d.ts +1 -0
- package/dist/api/email/dnsResolver.test.js +12 -0
- package/dist/api/email/parseEmail.d.ts +10 -0
- package/dist/api/email/parseEmail.js +38 -0
- package/dist/api/email/parseEmail.test.d.ts +1 -0
- package/dist/api/email/parseEmail.test.js +91 -0
- package/dist/api/email/preverify.d.ts +4 -0
- package/dist/api/email/preverify.js +18 -0
- package/dist/api/email/preverify.test.d.ts +1 -0
- package/dist/api/email/preverify.test.js +25 -0
- package/dist/api/helpers.d.ts +38 -0
- package/dist/api/helpers.js +72 -0
- package/dist/api/lib/client.d.ts +6 -0
- package/dist/api/lib/client.js +45 -0
- package/dist/api/lib/types/ethereum.d.ts +14 -0
- package/dist/api/lib/types/ethereum.js +12 -0
- package/dist/api/lib/types/index.js +3 -0
- package/dist/api/lib/types/viem.d.ts +8 -0
- package/dist/api/lib/types/viem.js +1 -0
- package/dist/api/lib/types/vlayer.d.ts +47 -0
- package/dist/api/lib/types/vlayer.js +1 -0
- package/dist/api/lib/types/webProofProvider.d.ts +29 -0
- package/dist/api/lib/types/webProofProvider.js +1 -0
- package/dist/api/prover.d.ts +2 -0
- package/dist/api/prover.js +15 -0
- package/dist/api/v_call.d.ts +2 -0
- package/dist/api/v_call.js +30 -0
- package/dist/api/webProof/createWebProof.d.ts +2 -0
- package/dist/api/webProof/createWebProof.js +7 -0
- package/dist/api/webProof/index.js +3 -0
- package/dist/api/webProof/providers/extension.d.ts +2 -0
- package/dist/api/webProof/providers/extension.js +32 -0
- package/dist/api/webProof/providers/index.js +1 -0
- package/dist/api/webProof/steps/expectUrl.d.ts +2 -0
- package/dist/api/webProof/steps/expectUrl.js +8 -0
- package/dist/api/webProof/steps/index.d.ts +9 -0
- package/dist/api/webProof/steps/index.js +9 -0
- package/dist/api/webProof/steps/notarize.d.ts +2 -0
- package/dist/api/webProof/steps/notarize.js +9 -0
- package/dist/api/webProof/steps/startPage.d.ts +2 -0
- package/dist/api/webProof/steps/startPage.js +8 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/testHelpers/readFile.d.ts +1 -0
- package/dist/testHelpers/readFile.js +2 -0
- package/dist/web-proof-commons/index.d.ts +3 -0
- package/dist/web-proof-commons/index.js +3 -0
- package/dist/web-proof-commons/types/message.d.ts +56 -0
- package/dist/web-proof-commons/types/message.js +5 -0
- package/dist/web-proof-commons/types/webProof.d.ts +86 -0
- package/dist/web-proof-commons/types/webProof.js +10 -0
- package/dist/web-proof-commons/utils.d.ts +7 -0
- package/dist/web-proof-commons/utils.js +5 -0
- package/package.json +16 -7
- package/.changeset/config.json +0 -11
- package/CHANGELOG.md +0 -7
- package/eslint.config.ts +0 -22
- package/src/api/email/dnsResolver.test.ts +0 -18
- package/src/api/email/dnsResolver.ts +0 -7
- package/src/api/email/parseEmail.test.ts +0 -133
- package/src/api/email/parseEmail.ts +0 -49
- package/src/api/email/preverify.test.ts +0 -37
- package/src/api/email/preverify.ts +0 -19
- package/src/api/email/testdata/test_email.txt +0 -21
- package/src/api/email/testdata/test_email_multiple_dkims.txt +0 -28
- package/src/api/email/testdata/test_email_unknown_domain.txt +0 -21
- package/src/api/helpers.ts +0 -173
- package/src/api/lib/client.ts +0 -76
- package/src/api/lib/types/ethereum.ts +0 -43
- package/src/api/lib/types/viem.ts +0 -28
- package/src/api/lib/types/vlayer.ts +0 -60
- package/src/api/lib/types/webProofProvider.ts +0 -44
- package/src/api/prover.ts +0 -34
- package/src/api/v_call.ts +0 -45
- package/src/api/webProof/createWebProof.ts +0 -9
- package/src/api/webProof/providers/extension.ts +0 -72
- package/src/api/webProof/steps/expectUrl.ts +0 -12
- package/src/api/webProof/steps/index.ts +0 -11
- package/src/api/webProof/steps/notarize.ts +0 -17
- package/src/api/webProof/steps/startPage.ts +0 -12
- package/src/index.ts +0 -9
- package/src/testHelpers/readFile.ts +0 -3
- package/src/web-proof-commons/index.ts +0 -3
- package/src/web-proof-commons/types/message.ts +0 -73
- package/src/web-proof-commons/types/webProof.ts +0 -111
- package/src/web-proof-commons/utils.ts +0 -12
- package/tsconfig.json +0 -24
- package/vite.config.ts +0 -7
- /package/{src/api/lib/types/index.ts → dist/api/lib/types/index.d.ts} +0 -0
- /package/{src/api/webProof/index.ts → dist/api/webProof/index.d.ts} +0 -0
- /package/{src/api/webProof/providers/index.ts → dist/api/webProof/providers/index.d.ts} +0 -0
package/src/index.ts
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
export * as testHelpers from "./api/helpers";
|
2
|
-
export { preverifyEmail } from "./api/email/preverify.ts";
|
3
|
-
export { createVlayerClient } from "./api/lib/client.ts";
|
4
|
-
|
5
|
-
export * from "./api/webProof";
|
6
|
-
export * from "./api/lib/types";
|
7
|
-
|
8
|
-
export * from "./web-proof-commons/types/webProof.ts";
|
9
|
-
export * from "./web-proof-commons/utils.ts";
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import type { Branded } from "../utils.ts";
|
2
|
-
import type { WebProof } from "./webProof.ts";
|
3
|
-
|
4
|
-
export const EXTENSION_STEP = {
|
5
|
-
expectUrl: "expectUrl",
|
6
|
-
startPage: "startPage",
|
7
|
-
notarize: "notarize",
|
8
|
-
} as const;
|
9
|
-
|
10
|
-
export type ExtensionStep =
|
11
|
-
(typeof EXTENSION_STEP)[keyof typeof EXTENSION_STEP];
|
12
|
-
|
13
|
-
export const enum ExtensionAction {
|
14
|
-
RequestWebProof,
|
15
|
-
}
|
16
|
-
|
17
|
-
export type MessageToExtension = {
|
18
|
-
action: ExtensionAction;
|
19
|
-
payload: WebProverSessionConfig;
|
20
|
-
};
|
21
|
-
|
22
|
-
export const enum ExtensionMessageType {
|
23
|
-
ProofDone = "ProofDone",
|
24
|
-
ProofError = "ProofError",
|
25
|
-
RedirectBack = "RedirectBack",
|
26
|
-
TabOpened = "TabOpened",
|
27
|
-
}
|
28
|
-
|
29
|
-
export type ExtensionMessage =
|
30
|
-
| { type: ExtensionMessageType.ProofDone; proof: WebProof }
|
31
|
-
| { type: ExtensionMessageType.ProofError; error: string }
|
32
|
-
| { type: ExtensionMessageType.RedirectBack }
|
33
|
-
| { type: ExtensionMessageType.TabOpened; tabId: number };
|
34
|
-
|
35
|
-
export type WebProverSessionConfig = {
|
36
|
-
notaryUrl: string;
|
37
|
-
wsProxyUrl: string;
|
38
|
-
logoUrl: string;
|
39
|
-
steps: WebProofStep[];
|
40
|
-
};
|
41
|
-
|
42
|
-
export type WebProofStep =
|
43
|
-
| WebProofStepNotarize
|
44
|
-
| WebProofStepExpectUrl
|
45
|
-
| WebProofStepStartPage;
|
46
|
-
|
47
|
-
export type WebProofStepNotarize = Branded<
|
48
|
-
{
|
49
|
-
url: string;
|
50
|
-
method: string;
|
51
|
-
label: string;
|
52
|
-
step: typeof EXTENSION_STEP.notarize;
|
53
|
-
},
|
54
|
-
"notarize"
|
55
|
-
>;
|
56
|
-
|
57
|
-
export type WebProofStepExpectUrl = Branded<
|
58
|
-
{
|
59
|
-
url: string;
|
60
|
-
label: string;
|
61
|
-
step: typeof EXTENSION_STEP.expectUrl;
|
62
|
-
},
|
63
|
-
"expectUrl"
|
64
|
-
>;
|
65
|
-
|
66
|
-
export type WebProofStepStartPage = Branded<
|
67
|
-
{
|
68
|
-
url: string;
|
69
|
-
label: string;
|
70
|
-
step: typeof EXTENSION_STEP.startPage;
|
71
|
-
},
|
72
|
-
"startPage"
|
73
|
-
>;
|
@@ -1,111 +0,0 @@
|
|
1
|
-
// NOTE : this is copied from tlsn-js 5.4
|
2
|
-
// for some reason newest versions doesn't export this type (clarification is in progress)
|
3
|
-
// probably it should be reexported from tlsn-js
|
4
|
-
|
5
|
-
export interface WebProof {
|
6
|
-
session: Session;
|
7
|
-
substrings: Substrings;
|
8
|
-
notaryUrl: string;
|
9
|
-
}
|
10
|
-
|
11
|
-
export interface Session {
|
12
|
-
header: Header;
|
13
|
-
signature: Signature;
|
14
|
-
session_info: SessionInfo;
|
15
|
-
}
|
16
|
-
|
17
|
-
export interface SessionInfo {
|
18
|
-
server_name: ServerName;
|
19
|
-
handshake_decommitment: HandshakeDecommitment;
|
20
|
-
}
|
21
|
-
|
22
|
-
export interface HandshakeDecommitment {
|
23
|
-
nonce: number[];
|
24
|
-
data: Data;
|
25
|
-
}
|
26
|
-
|
27
|
-
export interface Data {
|
28
|
-
server_cert_details: ServerCERTDetails;
|
29
|
-
server_kx_details: ServerKxDetails;
|
30
|
-
client_random: number[];
|
31
|
-
server_random: number[];
|
32
|
-
}
|
33
|
-
|
34
|
-
export interface ServerCERTDetails {
|
35
|
-
cert_chain: Array<number[]>;
|
36
|
-
ocsp_response: number[];
|
37
|
-
scts: null;
|
38
|
-
}
|
39
|
-
|
40
|
-
export interface ServerKxDetails {
|
41
|
-
kx_params: number[];
|
42
|
-
kx_sig: KxSig;
|
43
|
-
}
|
44
|
-
|
45
|
-
export interface KxSig {
|
46
|
-
scheme: string;
|
47
|
-
sig: number[];
|
48
|
-
}
|
49
|
-
|
50
|
-
export interface Header {
|
51
|
-
encoder_seed: number[];
|
52
|
-
merkle_root: number[];
|
53
|
-
sent_len: number;
|
54
|
-
recv_len: number;
|
55
|
-
handshake_summary: HandshakeSummary;
|
56
|
-
}
|
57
|
-
|
58
|
-
export interface HandshakeSummary {
|
59
|
-
time: number;
|
60
|
-
server_public_key: ServerPublicKey;
|
61
|
-
handshake_commitment: number[];
|
62
|
-
}
|
63
|
-
|
64
|
-
export interface ServerPublicKey {
|
65
|
-
group: string;
|
66
|
-
key: number[];
|
67
|
-
}
|
68
|
-
|
69
|
-
export interface ServerName {
|
70
|
-
Dns: string;
|
71
|
-
}
|
72
|
-
|
73
|
-
export interface Signature {
|
74
|
-
P256: string;
|
75
|
-
}
|
76
|
-
|
77
|
-
export interface Substrings {
|
78
|
-
openings: { [key: string]: Opening[] };
|
79
|
-
inclusion_proof: InclusionProof;
|
80
|
-
}
|
81
|
-
|
82
|
-
export interface InclusionProof {
|
83
|
-
proof: unknown[];
|
84
|
-
total_leaves: number;
|
85
|
-
}
|
86
|
-
|
87
|
-
export interface Opening {
|
88
|
-
kind?: string;
|
89
|
-
ranges?: Range[];
|
90
|
-
direction?: string;
|
91
|
-
Blake3?: Blake3;
|
92
|
-
}
|
93
|
-
|
94
|
-
export interface Blake3 {
|
95
|
-
data: number[];
|
96
|
-
nonce: number[];
|
97
|
-
}
|
98
|
-
|
99
|
-
export interface Range {
|
100
|
-
start: number;
|
101
|
-
end: number;
|
102
|
-
}
|
103
|
-
export const assertWebProof = function (candidate: {
|
104
|
-
notaryUrl?: string;
|
105
|
-
}): asserts candidate is WebProof {
|
106
|
-
//for now only thing we check is notary url
|
107
|
-
//TODO: implement later once we known the conteact with tlsn-js
|
108
|
-
if (!candidate.notaryUrl) {
|
109
|
-
throw new Error("Missing required parameter");
|
110
|
-
}
|
111
|
-
};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
declare const __brand: unique symbol;
|
2
|
-
type Brand<B> = { [__brand]: B };
|
3
|
-
export type Branded<T, B> = T & Brand<B>;
|
4
|
-
|
5
|
-
export function isDefined<T>(
|
6
|
-
value: T | undefined,
|
7
|
-
message: string = "Value is undefined",
|
8
|
-
): asserts value is T {
|
9
|
-
if (value === undefined) {
|
10
|
-
throw new Error(message);
|
11
|
-
}
|
12
|
-
}
|
package/tsconfig.json
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"extends": "../tsconfig.base.json",
|
3
|
-
"compilerOptions": {
|
4
|
-
"lib": [
|
5
|
-
"ESNext"
|
6
|
-
],
|
7
|
-
"moduleResolution": "bundler",
|
8
|
-
"moduleDetection": "force",
|
9
|
-
"allowImportingTsExtensions": true,
|
10
|
-
"downlevelIteration": true,
|
11
|
-
"jsx": "preserve",
|
12
|
-
"allowSyntheticDefaultImports": true,
|
13
|
-
"forceConsistentCasingInFileNames": true,
|
14
|
-
"allowJs": true,
|
15
|
-
"types": [
|
16
|
-
"bun" // add Bun global
|
17
|
-
],
|
18
|
-
"baseUrl": "./",
|
19
|
-
"paths": {
|
20
|
-
"types/*": ["./src/api/lib/types/*"],
|
21
|
-
"testHelpers/*": ["./src/testHelpers/*"],
|
22
|
-
},
|
23
|
-
}
|
24
|
-
}
|
package/vite.config.ts
DELETED
File without changes
|
File without changes
|
File without changes
|