@worldcoin/idkit 2.4.2 → 4.0.0-dev.fe98789
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/README.md +42 -59
- package/dist/index.cjs +1764 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +57 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +1724 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -100
- package/LICENSE +0 -7
- package/build/chunk-PWFTYFSZ.js +0 -373
- package/build/config-SH5TbLYj.d.cts +0 -57
- package/build/config-SH5TbLYj.d.ts +0 -57
- package/build/index.cjs +0 -2697
- package/build/index.d.cts +0 -57
- package/build/index.d.ts +0 -57
- package/build/index.js +0 -2285
- package/build/internal.cjs +0 -413
- package/build/internal.d.cts +0 -68
- package/build/internal.d.ts +0 -68
- package/build/internal.js +0 -20
- package/src/index.ts +0 -28
package/README.md
CHANGED
|
@@ -1,68 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @worldcoin/idkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React SDK for World ID built on top of `@worldcoin/idkit-core`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Highlights
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- Headless hooks for custom UI
|
|
8
|
+
- Built-in controlled widgets with shadow DOM isolation
|
|
9
|
+
- Separate request and session APIs
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## Installation
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
```bash
|
|
14
|
+
npm install @worldcoin/idkit
|
|
15
|
+
```
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# be sure to run this in the root folder of the repo
|
|
17
|
-
yarn install
|
|
18
|
-
```
|
|
19
|
-
- Run tests
|
|
20
|
-
```bash
|
|
21
|
-
# runs in the /idkit folder
|
|
22
|
-
cd idkit/
|
|
23
|
-
yarn test
|
|
24
|
-
```
|
|
25
|
-
- Run local test project
|
|
26
|
-
```bash
|
|
27
|
-
# runs in the /idkit folder
|
|
28
|
-
yarn dev
|
|
29
|
-
```
|
|
30
|
-
- Open browser at `http://localhost:3000`
|
|
31
|
-
- To build the production bundle you can simply run.
|
|
32
|
-
```bash
|
|
33
|
-
# runs in the /idkit folder
|
|
34
|
-
yarn build
|
|
35
|
-
```
|
|
17
|
+
## Basic usage
|
|
36
18
|
|
|
37
|
-
## Usage
|
|
38
|
-
|
|
39
|
-
### Set Language Explicitly
|
|
40
19
|
```tsx
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Supported Languages
|
|
20
|
+
import { useIDKitRequest, orbLegacy } from "@worldcoin/idkit";
|
|
21
|
+
|
|
22
|
+
function Example() {
|
|
23
|
+
const flow = useIDKitRequest({
|
|
24
|
+
app_id: "app_xxxxx",
|
|
25
|
+
action: "my-action",
|
|
26
|
+
rp_context,
|
|
27
|
+
allow_legacy_proofs: false,
|
|
28
|
+
preset: orbLegacy({ signal: "user-123" }),
|
|
29
|
+
});
|
|
30
|
+
const isBusy =
|
|
31
|
+
flow.isAwaitingUserConnection || flow.isAwaitingUserConfirmation;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<button onClick={flow.open} disabled={isBusy}>
|
|
35
|
+
Verify
|
|
36
|
+
</button>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
64
40
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
```tsx
|
|
42
|
+
import type { IDKitRequestHookConfig } from "@worldcoin/idkit";
|
|
43
|
+
|
|
44
|
+
const config: IDKitRequestHookConfig = {
|
|
45
|
+
app_id: "app_xxxxx",
|
|
46
|
+
action: "my-action",
|
|
47
|
+
rp_context,
|
|
48
|
+
allow_legacy_proofs: false,
|
|
49
|
+
preset: { type: "OrbLegacy" },
|
|
50
|
+
};
|
|
51
|
+
```
|