@worldcoin/idkit 0.0.1 → 0.1.0

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.
@@ -1,8 +1,15 @@
1
1
  import type { CallbackFn } from '.';
2
+ export type StringOrAdvanced = Array<[string, unknown]> | string;
3
+ export declare enum ConfigSource {
4
+ HOOK = "hook",
5
+ PROPS = "props",
6
+ MANUAL = "manual"
7
+ }
2
8
  export type Config = {
3
- actionId: string;
9
+ signal: StringOrAdvanced;
10
+ actionId: StringOrAdvanced;
4
11
  autoClose?: boolean;
5
- onSuccess?: CallbackFn;
12
+ onVerification?: CallbackFn;
6
13
  enableTelemetry?: boolean;
7
14
  copy?: {
8
15
  title?: string;
@@ -11,6 +18,11 @@ export type Config = {
11
18
  success?: string;
12
19
  };
13
20
  };
21
+ export type WidgetProps = Config & {
22
+ children?: ({ open }: {
23
+ open: () => void;
24
+ }) => JSX.Element;
25
+ };
14
26
  export declare const DEFAULT_COPY: {
15
27
  title: string;
16
28
  heading: string;
@@ -2,9 +2,11 @@ export declare enum IDKITStage {
2
2
  ENTER_PHONE = "ENTER_PHONE",
3
3
  ENTER_CODE = "ENTER_CODE",
4
4
  WORLD_ID = "WORLD_ID",
5
+ PRIVACY = "PRIVACY",
5
6
  SUCCESS = "SUCCESS",
6
7
  ERROR = "ERROR",
7
- ABOUT = "ABOUT"
8
+ ABOUT = "ABOUT",
9
+ HOST_APP_VERIFICATION = "HOST_APP_VERIFICATION"
8
10
  }
9
11
  export interface OrbSignalProof {
10
12
  merkle_root: string;
@@ -23,8 +25,28 @@ export interface ISuccessResult {
23
25
  proof_payload: OrbSignalProof | PhoneSignalProof;
24
26
  nullifier_hash: string;
25
27
  }
26
- export type CallbackFn = (result: ISuccessResult) => void;
27
- export declare enum ErrorState {
28
+ export type CallbackFn = (result: ISuccessResult) => Promise<void> | void;
29
+ export interface IErrorState {
30
+ code: ErrorCodes;
31
+ message?: string;
32
+ }
33
+ export declare enum ErrorCodes {
28
34
  GENERIC_ERROR = "GENERIC_ERROR",
29
- INVALID_CODE = "INVALID_CODE"
35
+ PHONE_OTP_REQUEST_ERROR = "PHONE_OTP_REQUEST_ERROR",
36
+ INVALID_CODE = "INVALID_CODE",
37
+ REJECTED_BY_HOST_APP = "REJECTED_BY_HOST_APP"
38
+ }
39
+ export interface ExpectedErrorResponse {
40
+ message: string;
41
+ stack: string;
42
+ }
43
+ export declare enum PhoneVerificationChannel {
44
+ SMS = "sms",
45
+ Call = "call"
46
+ }
47
+ export declare enum PhoneRequestErrorCodes {
48
+ MAX_ATTEMPTS = "max_attempts",
49
+ TIMEOUT = "timeout",
50
+ UNSUPPORTED_COUNTRY = "unsupported_country",
51
+ SERVER_ERROR = "server_error"
30
52
  }
@@ -0,0 +1,21 @@
1
+ export declare enum OrbErrorCodes {
2
+ ConnectionFailed = "connection_failed",
3
+ VerificationRejected = "verification_rejected",
4
+ AlreadySigned = "already_signed",
5
+ InvalidActionID = "invalid_action_id",
6
+ InvalidSignal = "invalid_signal",
7
+ UnexpectedResponse = "unexpected_response",
8
+ GenericError = "generic_error"
9
+ }
10
+ export declare enum VerificationState {
11
+ LoadingWidget = "loading_widget",
12
+ AwaitingConnection = "awaiting_connection",
13
+ AwaitingVerification = "awaiting_verification",
14
+ Confirmed = "confirmed",
15
+ Failed = "failed"
16
+ }
17
+ export type OrbResponse = {
18
+ proof: string;
19
+ merkle_root: string;
20
+ nullifier_hash: string;
21
+ };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The identity SDK. Add sybil resistance to your apps through the World ID protocol.",
4
4
  "type": "module",
5
5
  "types": "./build/index.d.ts",
6
- "version": "0.0.1",
6
+ "version": "0.1.0",
7
7
  "private": false,
8
8
  "main": "./build/index.cjs",
9
9
  "module": "./build/index.js",
@@ -17,11 +17,11 @@
17
17
  "web3",
18
18
  "proof-of-personhood",
19
19
  "sybil resistance"
20
- ],
21
- "author": "",
22
- "license": "MIT",
23
- "homepage": "https://github.com/worldcoin/idkit-js",
24
- "repository": "github:worldcoin/idkit-js",
20
+ ],
21
+ "author": "",
22
+ "license": "MIT",
23
+ "homepage": "https://github.com/worldcoin/idkit-js",
24
+ "repository": "github:worldcoin/idkit-js",
25
25
  "scripts": {
26
26
  "build": "npm-run-all clean build:*",
27
27
  "build:css": "npx tailwindcss -i ./src/styles/styles.css -o ./build/index.css --minify",
@@ -37,13 +37,16 @@
37
37
  "format:check": "prettier --check ./",
38
38
  "lint": "eslint --ext .tsx,.ts,.js,.jsx ./",
39
39
  "lint:fix": "eslint --ext .tsx,.ts,.js,.jsx ./ --fix",
40
- "typecheck": "tsc"
40
+ "typecheck": "tsc",
41
+ "prerelease": "standard-version"
41
42
  },
42
43
  "peerDependencies": {
43
44
  "react": ">18.0.0",
44
45
  "react-dom": ">18.0.0"
45
46
  },
46
47
  "dependencies": {
48
+ "@ethersproject/bytes": "^5.7.0",
49
+ "@ethersproject/solidity": "^5.7.0",
47
50
  "@fontsource/rubik": "^4.5.11",
48
51
  "@headlessui/react": "^1.7.4",
49
52
  "@heroicons/react": "^2.0.13",
@@ -52,9 +55,13 @@
52
55
  "@radix-ui/react-select": "^1.1.2",
53
56
  "@radix-ui/react-toast": "^1.1.2",
54
57
  "@tailwindcss/forms": "^0.5.3",
58
+ "@walletconnect/client": "^1.8.0",
55
59
  "country-telephone-data": "^0.6.3",
56
60
  "framer-motion": "^7.6.7",
61
+ "js-sha3": "^0.8.0",
57
62
  "phone": "^3.1.30",
63
+ "posthog-js-lite": "2.0.0-alpha5",
64
+ "qr-code-styling-new": "^1.6.1",
58
65
  "react-countdown": "^2.3.4",
59
66
  "react-country-flag": "^3.0.2",
60
67
  "react-frame-component": "^5.2.3",
@@ -62,7 +69,6 @@
62
69
  "zustand": "^4.1.4"
63
70
  },
64
71
  "devDependencies": {
65
- "typescript": "4.9.3",
66
72
  "@babel/core": "^7.20.2",
67
73
  "@babel/plugin-syntax-typescript": "^7.20.0",
68
74
  "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
@@ -96,7 +102,21 @@
96
102
  "react": "18.2.0",
97
103
  "react-dom": "18.2.0",
98
104
  "rimraf": "^3.0.2",
105
+ "standard-version": "^9.5.0",
99
106
  "tailwindcss": "^3.2.4",
100
- "tsc-alias": "^1.7.1"
107
+ "tsc-alias": "^1.7.1",
108
+ "typescript": "4.9.3"
109
+ },
110
+ "browserslist": {
111
+ "production": [
112
+ ">0.2%",
113
+ "not dead",
114
+ "not op_mini all"
115
+ ],
116
+ "development": [
117
+ "last 1 chrome version",
118
+ "last 1 firefox version",
119
+ "last 1 safari version"
120
+ ]
101
121
  }
102
122
  }