@zkid/bridge-spec 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={INIT:"init",START:"start",CHECK_DATA_SOURCE:"checkDataSource",CHECK_DATA_SOURCE_RES:"checkDataSourceRes",CLOSE_DATA_SOURCE:"closeDataSource",VISITED_PAGE_PATHS:"visitedPagePaths",FAVICON_URL_CHANGED:"faviconUrlChanged",INIT_ATT:"initAttestation",START_ATT:"startAttestation",GET_ATT_RESULT:"getAttestationResult",GET_ATT_RESULT_TIMEOUT:"getAttestationResultTimeout",INIT_ATT_RES:"initAttestationRes",GET_ATT_RES:"getAttestationRes",START_ATT_RES:"startAttestationRes",OFFSCREEN_RECEIVE_GET_ATT:"offscreenReceiveGetAttestation",OFFSCREEN_GET_ATT:"getAttestation",OFFSCREEN_GET_ATT_RESULT:"getAttestationResult",START_OFFLINE:"startOffline"},T={EXTENSION:"hashKeyExtension",DEVHUB:"devhub",SDK:"sdk",EXT_BACKGROUND:"background",EXT_CONTENT:"content",EXT_POPUP:"popup",EXT_SIDEPANEL:"sidepanel",EXT_OFFSCREEN:"offscreen",EXT_OFFSCREEN_ALGORITHM:"offscreenAlgorithm",EXT_OFFSCREEN_REPORT:"offscreenReport"};exports.BRIDGE_METHODS=t;exports.BRIDGE_TARGET=T;
@@ -0,0 +1,4 @@
1
+ export { BRIDGE_METHODS } from './methods';
2
+ export type { BridgeMethod } from './methods';
3
+ export { BRIDGE_TARGET } from './target';
4
+ export type { BridgeTarget } from './target';
@@ -0,0 +1,40 @@
1
+ const t = {
2
+ INIT: "init",
3
+ START: "start",
4
+ CHECK_DATA_SOURCE: "checkDataSource",
5
+ CHECK_DATA_SOURCE_RES: "checkDataSourceRes",
6
+ CLOSE_DATA_SOURCE: "closeDataSource",
7
+ VISITED_PAGE_PATHS: "visitedPagePaths",
8
+ FAVICON_URL_CHANGED: "faviconUrlChanged",
9
+ // attestation - outbound (SDK -> Extension)
10
+ INIT_ATT: "initAttestation",
11
+ START_ATT: "startAttestation",
12
+ GET_ATT_RESULT: "getAttestationResult",
13
+ GET_ATT_RESULT_TIMEOUT: "getAttestationResultTimeout",
14
+ // attestation - inbound (Extension -> SDK)
15
+ INIT_ATT_RES: "initAttestationRes",
16
+ GET_ATT_RES: "getAttestationRes",
17
+ START_ATT_RES: "startAttestationRes",
18
+ // offscreen
19
+ OFFSCREEN_RECEIVE_GET_ATT: "offscreenReceiveGetAttestation",
20
+ OFFSCREEN_GET_ATT: "getAttestation",
21
+ OFFSCREEN_GET_ATT_RESULT: "getAttestationResult",
22
+ START_OFFLINE: "startOffline"
23
+ }, T = {
24
+ EXTENSION: "hashKeyExtension",
25
+ DEVHUB: "devhub",
26
+ // devhub
27
+ SDK: "sdk",
28
+ // network sdk or zktls sdk
29
+ EXT_BACKGROUND: "background",
30
+ EXT_CONTENT: "content",
31
+ EXT_POPUP: "popup",
32
+ EXT_SIDEPANEL: "sidepanel",
33
+ EXT_OFFSCREEN: "offscreen",
34
+ EXT_OFFSCREEN_ALGORITHM: "offscreenAlgorithm",
35
+ EXT_OFFSCREEN_REPORT: "offscreenReport"
36
+ };
37
+ export {
38
+ t as BRIDGE_METHODS,
39
+ T as BRIDGE_TARGET
40
+ };
@@ -0,0 +1,21 @@
1
+ export declare const BRIDGE_METHODS: {
2
+ readonly INIT: "init";
3
+ readonly START: "start";
4
+ readonly CHECK_DATA_SOURCE: "checkDataSource";
5
+ readonly CHECK_DATA_SOURCE_RES: "checkDataSourceRes";
6
+ readonly CLOSE_DATA_SOURCE: "closeDataSource";
7
+ readonly VISITED_PAGE_PATHS: "visitedPagePaths";
8
+ readonly FAVICON_URL_CHANGED: "faviconUrlChanged";
9
+ readonly INIT_ATT: "initAttestation";
10
+ readonly START_ATT: "startAttestation";
11
+ readonly GET_ATT_RESULT: "getAttestationResult";
12
+ readonly GET_ATT_RESULT_TIMEOUT: "getAttestationResultTimeout";
13
+ readonly INIT_ATT_RES: "initAttestationRes";
14
+ readonly GET_ATT_RES: "getAttestationRes";
15
+ readonly START_ATT_RES: "startAttestationRes";
16
+ readonly OFFSCREEN_RECEIVE_GET_ATT: "offscreenReceiveGetAttestation";
17
+ readonly OFFSCREEN_GET_ATT: "getAttestation";
18
+ readonly OFFSCREEN_GET_ATT_RESULT: "getAttestationResult";
19
+ readonly START_OFFLINE: "startOffline";
20
+ };
21
+ export type BridgeMethod = (typeof BRIDGE_METHODS)[keyof typeof BRIDGE_METHODS];
@@ -0,0 +1,13 @@
1
+ export declare const BRIDGE_TARGET: {
2
+ readonly EXTENSION: "hashKeyExtension";
3
+ readonly DEVHUB: "devhub";
4
+ readonly SDK: "sdk";
5
+ readonly EXT_BACKGROUND: "background";
6
+ readonly EXT_CONTENT: "content";
7
+ readonly EXT_POPUP: "popup";
8
+ readonly EXT_SIDEPANEL: "sidepanel";
9
+ readonly EXT_OFFSCREEN: "offscreen";
10
+ readonly EXT_OFFSCREEN_ALGORITHM: "offscreenAlgorithm";
11
+ readonly EXT_OFFSCREEN_REPORT: "offscreenReport";
12
+ };
13
+ export type BridgeTarget = (typeof BRIDGE_TARGET)[keyof typeof BRIDGE_TARGET];
@@ -0,0 +1,6 @@
1
+ export interface Counter {
2
+ readonly value: number;
3
+ increment(step?: number): number;
4
+ reset(nextValue?: number): number;
5
+ }
6
+ export declare function createCounter(initialValue?: number): Counter;
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(t=0){let e=t;return{get value(){return e},increment(r=1){return e+=r,e},reset(r=0){return e=r,e}}}exports.createCounter=n;
@@ -0,0 +1,2 @@
1
+ export { createCounter } from './counter';
2
+ export type { Counter } from './counter';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ function n(t = 0) {
2
+ let e = t;
3
+ return {
4
+ get value() {
5
+ return e;
6
+ },
7
+ increment(r = 1) {
8
+ return e += r, e;
9
+ },
10
+ reset(r = 0) {
11
+ return e = r, e;
12
+ }
13
+ };
14
+ }
15
+ export {
16
+ n as createCounter
17
+ };
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@zkid/bridge-spec",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ },
14
+ "./constants": {
15
+ "types": "./dist/constants/index.d.ts",
16
+ "import": "./dist/constants/index.js",
17
+ "require": "./dist/constants/index.cjs"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "dev": "vite build --watch",
25
+ "build": "rm -rf dist && vite build && bun run build:types",
26
+ "build:types": "tsc -p tsconfig.build.json",
27
+ "typecheck": "tsc --noEmit",
28
+ "publish:dry": "bun run build && npm publish --access public --dry-run",
29
+ "publish:npm": "bun run build && npm publish --access public"
30
+ },
31
+ "devDependencies": {
32
+ "typescript": "~5.9.3",
33
+ "vite": "^7.3.1"
34
+ }
35
+ }