@vlayer/sdk 0.1.0-nightly-20241028-591419e → 0.1.0-nightly-202410292-42360cf

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. package/dist/api/email/dnsResolver.d.ts +1 -0
  2. package/dist/api/email/dnsResolver.js +6 -0
  3. package/dist/api/email/dnsResolver.test.d.ts +1 -0
  4. package/dist/api/email/dnsResolver.test.js +12 -0
  5. package/dist/api/email/parseEmail.d.ts +10 -0
  6. package/dist/api/email/parseEmail.js +38 -0
  7. package/dist/api/email/parseEmail.test.d.ts +1 -0
  8. package/dist/api/email/parseEmail.test.js +91 -0
  9. package/dist/api/email/preverify.d.ts +4 -0
  10. package/dist/api/email/preverify.js +18 -0
  11. package/dist/api/email/preverify.test.d.ts +1 -0
  12. package/dist/api/email/preverify.test.js +25 -0
  13. package/dist/api/helpers.d.ts +38 -0
  14. package/dist/api/helpers.js +72 -0
  15. package/dist/api/lib/client.d.ts +6 -0
  16. package/dist/api/lib/client.js +45 -0
  17. package/dist/api/lib/types/ethereum.d.ts +14 -0
  18. package/dist/api/lib/types/ethereum.js +12 -0
  19. package/dist/api/lib/types/index.js +3 -0
  20. package/dist/api/lib/types/viem.d.ts +8 -0
  21. package/dist/api/lib/types/viem.js +1 -0
  22. package/dist/api/lib/types/vlayer.d.ts +47 -0
  23. package/dist/api/lib/types/vlayer.js +1 -0
  24. package/dist/api/lib/types/webProofProvider.d.ts +29 -0
  25. package/dist/api/lib/types/webProofProvider.js +1 -0
  26. package/dist/api/prover.d.ts +2 -0
  27. package/dist/api/prover.js +15 -0
  28. package/dist/api/v_call.d.ts +2 -0
  29. package/dist/api/v_call.js +30 -0
  30. package/dist/api/webProof/createWebProof.d.ts +2 -0
  31. package/dist/api/webProof/createWebProof.js +7 -0
  32. package/dist/api/webProof/index.js +3 -0
  33. package/dist/api/webProof/providers/extension.d.ts +2 -0
  34. package/dist/api/webProof/providers/extension.js +32 -0
  35. package/dist/api/webProof/providers/index.js +1 -0
  36. package/dist/api/webProof/steps/expectUrl.d.ts +2 -0
  37. package/dist/api/webProof/steps/expectUrl.js +8 -0
  38. package/dist/api/webProof/steps/index.d.ts +9 -0
  39. package/dist/api/webProof/steps/index.js +9 -0
  40. package/dist/api/webProof/steps/notarize.d.ts +2 -0
  41. package/dist/api/webProof/steps/notarize.js +9 -0
  42. package/dist/api/webProof/steps/startPage.d.ts +2 -0
  43. package/dist/api/webProof/steps/startPage.js +8 -0
  44. package/dist/index.d.ts +7 -0
  45. package/dist/index.js +7 -0
  46. package/dist/testHelpers/readFile.d.ts +1 -0
  47. package/dist/testHelpers/readFile.js +2 -0
  48. package/dist/web-proof-commons/index.d.ts +3 -0
  49. package/dist/web-proof-commons/index.js +3 -0
  50. package/dist/web-proof-commons/types/message.d.ts +56 -0
  51. package/dist/web-proof-commons/types/message.js +5 -0
  52. package/dist/web-proof-commons/types/webProof.d.ts +86 -0
  53. package/dist/web-proof-commons/types/webProof.js +10 -0
  54. package/dist/web-proof-commons/utils.d.ts +7 -0
  55. package/dist/web-proof-commons/utils.js +5 -0
  56. package/package.json +16 -7
  57. package/.changeset/config.json +0 -11
  58. package/CHANGELOG.md +0 -7
  59. package/eslint.config.ts +0 -22
  60. package/src/api/email/dnsResolver.test.ts +0 -18
  61. package/src/api/email/dnsResolver.ts +0 -7
  62. package/src/api/email/parseEmail.test.ts +0 -133
  63. package/src/api/email/parseEmail.ts +0 -49
  64. package/src/api/email/preverify.test.ts +0 -37
  65. package/src/api/email/preverify.ts +0 -19
  66. package/src/api/email/testdata/test_email.txt +0 -21
  67. package/src/api/email/testdata/test_email_multiple_dkims.txt +0 -28
  68. package/src/api/email/testdata/test_email_unknown_domain.txt +0 -21
  69. package/src/api/helpers.ts +0 -173
  70. package/src/api/lib/client.ts +0 -76
  71. package/src/api/lib/types/ethereum.ts +0 -43
  72. package/src/api/lib/types/viem.ts +0 -28
  73. package/src/api/lib/types/vlayer.ts +0 -60
  74. package/src/api/lib/types/webProofProvider.ts +0 -44
  75. package/src/api/prover.ts +0 -34
  76. package/src/api/v_call.ts +0 -45
  77. package/src/api/webProof/createWebProof.ts +0 -9
  78. package/src/api/webProof/providers/extension.ts +0 -72
  79. package/src/api/webProof/steps/expectUrl.ts +0 -12
  80. package/src/api/webProof/steps/index.ts +0 -11
  81. package/src/api/webProof/steps/notarize.ts +0 -17
  82. package/src/api/webProof/steps/startPage.ts +0 -12
  83. package/src/index.ts +0 -9
  84. package/src/testHelpers/readFile.ts +0 -3
  85. package/src/web-proof-commons/index.ts +0 -3
  86. package/src/web-proof-commons/types/message.ts +0 -73
  87. package/src/web-proof-commons/types/webProof.ts +0 -111
  88. package/src/web-proof-commons/utils.ts +0 -12
  89. package/tsconfig.json +0 -24
  90. package/vite.config.ts +0 -7
  91. /package/{src/api/lib/types/index.ts → dist/api/lib/types/index.d.ts} +0 -0
  92. /package/{src/api/webProof/index.ts → dist/api/webProof/index.d.ts} +0 -0
  93. /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,3 +0,0 @@
1
- import fs from "fs";
2
-
3
- export const readFile = (path: string) => fs.readFileSync(path).toString();
@@ -1,3 +0,0 @@
1
- export * from "./types/message.ts";
2
- export * from "./types/webProof.ts";
3
- export * from "./utils";
@@ -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
@@ -1,7 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import react from "@vitejs/plugin-react";
3
- import tsconfigPaths from "vite-tsconfig-paths";
4
-
5
- export default defineConfig({
6
- plugins: [tsconfigPaths(), react()],
7
- });