@worldcoin/idkit 0.5.1 → 1.0.0-alpha.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.
- package/LICENSE +7 -0
- package/build/chunk-EXZRURG3.js +246 -0
- package/build/config-cd2f02fe.d.ts +36 -0
- package/build/index.d.ts +31 -0
- package/build/index.js +2094 -3
- package/build/internal.d.ts +55 -0
- package/build/internal.js +12 -0
- package/build/verified-O6D4JQCX.webp +0 -0
- package/package.json +34 -79
- package/src/index.ts +11 -0
- package/build/idkit-js.js +0 -155
- package/build/index.cjs +0 -3
- package/build/index.cjs.map +0 -7
- package/build/index.css +0 -2
- package/build/index.js.map +0 -7
- package/build/jest.config.d.ts +0 -21
- package/build/jest.setup.d.ts +0 -1
- package/build/src/components/AboutWorldID.d.ts +0 -6
- package/build/src/components/Button.d.ts +0 -3
- package/build/src/components/Frame.d.ts +0 -4
- package/build/src/components/IDKitWidget/BaseWidget.d.ts +0 -4
- package/build/src/components/IDKitWidget/States/ErrorState.d.ts +0 -3
- package/build/src/components/IDKitWidget/States/HostAppVerificationState.d.ts +0 -7
- package/build/src/components/IDKitWidget/States/PrivacyState.d.ts +0 -3
- package/build/src/components/IDKitWidget/States/SuccessState.d.ts +0 -3
- package/build/src/components/IDKitWidget/States/WorldID/QRState.d.ts +0 -11
- package/build/src/components/IDKitWidget/States/WorldIDState.d.ts +0 -3
- package/build/src/components/IDKitWidget/experimental/components/CountryCodeSelect.d.ts +0 -7
- package/build/src/components/IDKitWidget/experimental/states/EnterPhoneState.d.ts +0 -3
- package/build/src/components/IDKitWidget/experimental/states/SelectMethodState.d.ts +0 -3
- package/build/src/components/IDKitWidget/experimental/states/VerifyCodeState.d.ts +0 -3
- package/build/src/components/IDKitWidget/index.d.ts +0 -3
- package/build/src/components/Icons/ArrowLongLeftIcon.d.ts +0 -3
- package/build/src/components/Icons/CheckIcon.d.ts +0 -3
- package/build/src/components/Icons/ChevronDownIcon.d.ts +0 -3
- package/build/src/components/Icons/DevicePhoneMobileIcon.d.ts +0 -3
- package/build/src/components/Icons/HumanIcon.d.ts +0 -3
- package/build/src/components/Icons/InfoIcon.d.ts +0 -3
- package/build/src/components/Icons/LoadingIcon.d.ts +0 -5
- package/build/src/components/Icons/LockIcon.d.ts +0 -3
- package/build/src/components/Icons/QuestionMarkIcon.d.ts +0 -5
- package/build/src/components/Icons/WorldIDWordmark.d.ts +0 -3
- package/build/src/components/Icons/WorldcoinIcon.d.ts +0 -3
- package/build/src/components/Icons/XMarkIcon.d.ts +0 -3
- package/build/src/components/PhoneInput.d.ts +0 -6
- package/build/src/components/QRCode.d.ts +0 -7
- package/build/src/components/ResendButton.d.ts +0 -3
- package/build/src/components/SMSCodeInput.d.ts +0 -6
- package/build/src/components/SignInButton.d.ts +0 -7
- package/build/src/components/SignInWithWorldID.d.ts +0 -11
- package/build/src/components/WorldIDIcon.d.ts +0 -7
- package/build/src/hooks/useIDKit.d.ts +0 -7
- package/build/src/hooks/useMedia.d.ts +0 -2
- package/build/src/index.d.ts +0 -34
- package/build/src/lang/index.d.ts +0 -9
- package/build/src/lib/consts.d.ts +0 -1
- package/build/src/lib/hashing.d.ts +0 -20
- package/build/src/lib/qr.d.ts +0 -4
- package/build/src/lib/telemetry.d.ts +0 -6
- package/build/src/lib/utils.d.ts +0 -2
- package/build/src/services/phone.d.ts +0 -21
- package/build/src/services/walletconnect.d.ts +0 -15
- package/build/src/store/idkit.d.ts +0 -41
- package/build/src/types/app.d.ts +0 -22
- package/build/src/types/config.d.ts +0 -48
- package/build/src/types/index.d.ts +0 -63
- package/build/src/vanilla.d.ts +0 -12
- package/build/stitches.config.d.ts +0 -45
- package/build/tests/lib/hashing.test.d.ts +0 -1
- package/build/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import * as zustand_traditional from 'zustand/traditional';
|
|
3
|
+
import * as zustand from 'zustand';
|
|
4
|
+
import { I as IDKITStage, C as Config, b as ConfigSource, c as CallbackFn } from './config-cd2f02fe.js';
|
|
5
|
+
import { IDKitConfig, ISuccessResult, IErrorState } from '@worldcoin/idkit-core';
|
|
6
|
+
|
|
7
|
+
type CleanWord<T> = T extends `${string}${' ' | ',' | '!' | '?' | '.' | '`'}${string}` ? never : T extends '' ? never : T;
|
|
8
|
+
type ExtractPlaceholders<S extends string> = S extends `${string}:${infer Placeholder}` ? Placeholder extends `${infer Word}${' ' | ',' | '!' | '?' | '.' | '`'}${infer Rest}` ? CleanWord<Word> | ExtractPlaceholders<Rest> : never : never;
|
|
9
|
+
type NoPlaceholder<S extends string> = S extends `${string}:${string}` ? never : S;
|
|
10
|
+
type PlaceholderValues<S extends string> = {
|
|
11
|
+
[K in ExtractPlaceholders<S>]: string;
|
|
12
|
+
};
|
|
13
|
+
declare function __<S extends `${string}:${string}`>(str: S, params: PlaceholderValues<S>): string;
|
|
14
|
+
declare function __<S extends string>(str: NoPlaceholder<S>): string;
|
|
15
|
+
|
|
16
|
+
type Props = {
|
|
17
|
+
data: string;
|
|
18
|
+
size?: number;
|
|
19
|
+
};
|
|
20
|
+
declare const _default: react.MemoExoticComponent<({ data, size }: Props) => JSX.Element>;
|
|
21
|
+
|
|
22
|
+
type IDKitStore = {
|
|
23
|
+
app_id: IDKitConfig['app_id'];
|
|
24
|
+
action: IDKitConfig['action'];
|
|
25
|
+
signal: IDKitConfig['signal'];
|
|
26
|
+
bridge_url?: IDKitConfig['bridge_url'];
|
|
27
|
+
action_description?: IDKitConfig['action_description'];
|
|
28
|
+
credential_types?: IDKitConfig['credential_types'];
|
|
29
|
+
open: boolean;
|
|
30
|
+
stage: IDKITStage;
|
|
31
|
+
autoClose: boolean;
|
|
32
|
+
processing: boolean;
|
|
33
|
+
theme: Config['theme'];
|
|
34
|
+
result: ISuccessResult | null;
|
|
35
|
+
errorState: IErrorState | null;
|
|
36
|
+
errorCallbacks: Record<ConfigSource, CallbackFn<IErrorState> | undefined> | Record<string, never>;
|
|
37
|
+
verifyCallbacks: Record<ConfigSource, CallbackFn<ISuccessResult> | undefined> | Record<string, never>;
|
|
38
|
+
successCallbacks: Record<ConfigSource, CallbackFn<ISuccessResult> | undefined> | Record<string, never>;
|
|
39
|
+
computed: {
|
|
40
|
+
canGoBack: (stage: IDKITStage) => boolean;
|
|
41
|
+
};
|
|
42
|
+
retryFlow: () => void;
|
|
43
|
+
setStage: (stage: IDKITStage) => void;
|
|
44
|
+
onOpenChange: (open: boolean) => void;
|
|
45
|
+
setProcessing: (processing: boolean) => void;
|
|
46
|
+
handleVerify: (result: ISuccessResult) => void;
|
|
47
|
+
setErrorState: (state: IErrorState | null) => void;
|
|
48
|
+
setOptions: (options: Config, source: ConfigSource) => void;
|
|
49
|
+
addErrorCallback: (cb: CallbackFn<IErrorState>, source: ConfigSource) => void;
|
|
50
|
+
addSuccessCallback: (cb: CallbackFn<ISuccessResult>, source: ConfigSource) => void;
|
|
51
|
+
addVerificationCallback: (cb: CallbackFn<ISuccessResult>, source: ConfigSource) => void;
|
|
52
|
+
};
|
|
53
|
+
declare const useIDKitStore: zustand_traditional.UseBoundStoreWithEqualityFn<zustand.StoreApi<IDKitStore>>;
|
|
54
|
+
|
|
55
|
+
export { ConfigSource, _default as QRCode, __, useIDKitStore };
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worldcoin/idkit",
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
|
+
"homepage": "https://docs.worldcoin.org/id/idkit",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"private": false,
|
|
3
7
|
"description": "The identity SDK. Privacy-preserving identity and proof of personhood with World ID.",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/worldcoin/idkit-js",
|
|
11
|
+
"directory": "packages/react"
|
|
12
|
+
},
|
|
4
13
|
"type": "module",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./build/index.js",
|
|
17
|
+
"types": "./build/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./internal": {
|
|
20
|
+
"import": "./build/internal.js",
|
|
21
|
+
"types": "./build/internal.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"main": "src/index.ts",
|
|
25
|
+
"types": "src/index.ts",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=12.4"
|
|
28
|
+
},
|
|
10
29
|
"files": [
|
|
11
|
-
"build
|
|
12
|
-
"
|
|
30
|
+
"build",
|
|
31
|
+
"README.md"
|
|
13
32
|
],
|
|
14
33
|
"keywords": [
|
|
15
34
|
"identity",
|
|
@@ -18,10 +37,6 @@
|
|
|
18
37
|
"proof-of-personhood",
|
|
19
38
|
"sybil resistance"
|
|
20
39
|
],
|
|
21
|
-
"author": "",
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"homepage": "https://github.com/worldcoin/idkit-js",
|
|
24
|
-
"repository": "github:worldcoin/idkit-js",
|
|
25
40
|
"peerDependencies": {
|
|
26
41
|
"react": ">18.0.0",
|
|
27
42
|
"react-dom": ">18.0.0"
|
|
@@ -31,32 +46,18 @@
|
|
|
31
46
|
"@headlessui/react": "^1.7.4",
|
|
32
47
|
"@radix-ui/react-dialog": "^1.0.3",
|
|
33
48
|
"@radix-ui/react-toast": "^1.1.3",
|
|
34
|
-
"@stitches/react": "^1.2.8",
|
|
35
49
|
"@tailwindcss/forms": "^0.5.3",
|
|
36
|
-
"@walletconnect/sign-client": "^2.2.0",
|
|
37
|
-
"@walletconnect/types": "^2.2.0",
|
|
38
|
-
"@walletconnect/utils": "^2.2.1",
|
|
39
50
|
"copy-to-clipboard": "^3.3.3",
|
|
40
|
-
"country-telephone-data": "^0.6.3",
|
|
41
51
|
"framer-motion": "^7.6.7",
|
|
42
|
-
"phone": "^3.1.37",
|
|
43
52
|
"posthog-js-lite": "2.4.0",
|
|
44
|
-
"qr-code-styling-new": "^1.6.1",
|
|
45
53
|
"qrcode": "^1.5.1",
|
|
46
|
-
"react-countdown": "^2.3.4",
|
|
47
|
-
"react-country-flag": "^3.1.0",
|
|
48
|
-
"react-frame-component": "^5.2.3",
|
|
49
54
|
"react-shadow": "^19.0.3",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
55
|
+
"zustand": "^4.3.3",
|
|
56
|
+
"@worldcoin/idkit-core": "1.0.0-alpha.0"
|
|
52
57
|
},
|
|
53
58
|
"devDependencies": {
|
|
54
|
-
"@babel/core": "^7.20.2",
|
|
55
|
-
"@babel/plugin-syntax-typescript": "^7.20.0",
|
|
56
|
-
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
|
|
57
59
|
"@testing-library/jest-dom": "^5.16.5",
|
|
58
60
|
"@testing-library/react": "^14.0.0",
|
|
59
|
-
"@types/country-telephone-data": "^0.6.1",
|
|
60
61
|
"@types/jest": "^29.5.0",
|
|
61
62
|
"@types/node": "18.11.9",
|
|
62
63
|
"@types/qrcode": "^1.5.0",
|
|
@@ -65,15 +66,6 @@
|
|
|
65
66
|
"@typescript-eslint/eslint-plugin": "5.20.0",
|
|
66
67
|
"@typescript-eslint/parser": "5.20.0",
|
|
67
68
|
"autoprefixer": "^10.4.13",
|
|
68
|
-
"babel-plugin-macros": "^3.1.0",
|
|
69
|
-
"babel-plugin-twin": "^1.1.0",
|
|
70
|
-
"construct-style-sheets-polyfill": "^3.1.0",
|
|
71
|
-
"esbuild": "0.14.43",
|
|
72
|
-
"esbuild-jest": "0.5.0",
|
|
73
|
-
"esbuild-node-externals": "1.4.1",
|
|
74
|
-
"esbuild-plugin-alias": "0.2.1",
|
|
75
|
-
"esbuild-style-plugin": "^1.6.0",
|
|
76
|
-
"esbuild-visualizer": "^0.4.0",
|
|
77
69
|
"eslint": "8.29.0",
|
|
78
70
|
"eslint-config-prettier": "^8.5.0",
|
|
79
71
|
"eslint-plugin-compat": "^4.1.1",
|
|
@@ -85,56 +77,19 @@
|
|
|
85
77
|
"eslint-plugin-tailwindcss": "^3.7.1",
|
|
86
78
|
"jest": "^29.5.0",
|
|
87
79
|
"jest-environment-jsdom": "^29.5.0",
|
|
88
|
-
"
|
|
89
|
-
"npm-run-all": "^4.1.5",
|
|
90
|
-
"postcss": "^8.4.19",
|
|
80
|
+
"postcss": "^8.4.31",
|
|
91
81
|
"prettier": "^2.7.1",
|
|
92
82
|
"prettier-plugin-sort-imports-desc": "^1.0.0",
|
|
93
83
|
"react": "18.2.0",
|
|
94
84
|
"react-dom": "18.2.0",
|
|
95
|
-
"rimraf": "^3.0.2",
|
|
96
85
|
"tailwindcss": "^3.2.4",
|
|
97
|
-
"
|
|
98
|
-
"twin.macro": "^3.1.0",
|
|
86
|
+
"tsup": "^7.2.0",
|
|
99
87
|
"typescript": "4.9.3"
|
|
100
88
|
},
|
|
101
|
-
"browserslist": {
|
|
102
|
-
"production": [
|
|
103
|
-
">0.2%",
|
|
104
|
-
"not dead",
|
|
105
|
-
"not op_mini all"
|
|
106
|
-
],
|
|
107
|
-
"development": [
|
|
108
|
-
"last 1 chrome version",
|
|
109
|
-
"last 1 firefox version",
|
|
110
|
-
"last 1 safari version"
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
"babelMacros": {
|
|
114
|
-
"twin": {
|
|
115
|
-
"preset": "stitches",
|
|
116
|
-
"stitchesConfig": "stitches.config.ts"
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
89
|
"scripts": {
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"build
|
|
123
|
-
"build:
|
|
124
|
-
"build:esm": "node esbuild/production.js -p esm",
|
|
125
|
-
"build:cjs": "node esbuild/production.js -p cjs",
|
|
126
|
-
"build:iife": "node esbuild/production.js -p iife",
|
|
127
|
-
"clean": "rimraf build/",
|
|
128
|
-
"dev": "npm-run-all clean dev:styles --parallel dev:*",
|
|
129
|
-
"dev:bundle": "node esbuild/development.js",
|
|
130
|
-
"dev:styles": "npx tailwindcss -i ./src/styles/styles.css -o ./build/index.css",
|
|
131
|
-
"dev:styles-watch": "npx tailwindcss -i ./src/styles/styles.css -o ./build/index.css --watch",
|
|
132
|
-
"format": "prettier -w ./",
|
|
133
|
-
"format:check": "prettier --check ./",
|
|
134
|
-
"lint": "eslint --ext .tsx,.ts,.js,.jsx ./",
|
|
135
|
-
"lint:fix": "eslint --ext .tsx,.ts,.js,.jsx ./ --fix",
|
|
136
|
-
"test": "jest",
|
|
137
|
-
"typecheck": "tsc",
|
|
138
|
-
"prepublish": "npm run build"
|
|
90
|
+
"dev": "tsup --watch",
|
|
91
|
+
"lint": "eslint src --ext .ts",
|
|
92
|
+
"build": "npm run build:css && tsup",
|
|
93
|
+
"build:css": "npx tailwindcss -i ./src/styles/styles.css -o ./build/index.css --minify"
|
|
139
94
|
}
|
|
140
95
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import useIDKit from './hooks/useIDKit'
|
|
2
|
+
import SignInButton from './components/SignInButton'
|
|
3
|
+
import { CredentialType } from '@worldcoin/idkit-core'
|
|
4
|
+
import IDKitWidget from '@/components/IDKitWidget/index'
|
|
5
|
+
import type { WidgetProps, Config } from '@/types/config'
|
|
6
|
+
import type { ISuccessResult } from '@worldcoin/idkit-core'
|
|
7
|
+
import { solidityEncode } from '@worldcoin/idkit-core/hashing'
|
|
8
|
+
import SignInWithWorldID from './components/SignInWithWorldID'
|
|
9
|
+
|
|
10
|
+
export { IDKitWidget, useIDKit, solidityEncode, SignInWithWorldID, CredentialType, SignInButton }
|
|
11
|
+
export type { ISuccessResult, Config, WidgetProps }
|