@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/build/index.d.cts DELETED
@@ -1,57 +0,0 @@
1
- import { C as Config, W as WidgetProps } from './config-SH5TbLYj.cjs';
2
- export { S as SupportedLanguage, a as getCurrentLanguage, g as getLocalizationConfig, b as getSupportedLanguages, s as setLocalizationConfig } from './config-SH5TbLYj.cjs';
3
- import * as react from 'react';
4
- export { solidityEncode } from '@worldcoin/idkit-core/hashing';
5
- export { IVerifyResponse, verifyCloudProof } from '@worldcoin/idkit-core/backend';
6
- import { IDKitConfig, VerificationState, ISuccessResult, AppErrorCodes } from '@worldcoin/idkit-core';
7
- export { IErrorState, ISuccessResult, VerificationLevel, VerificationState } from '@worldcoin/idkit-core';
8
-
9
- type HookConfig = Partial<Pick<Config, 'handleVerify' | 'onSuccess'>>;
10
- declare const useIDKit: ({ handleVerify, onSuccess }?: HookConfig) => {
11
- open: boolean;
12
- setOpen: (open: boolean) => void;
13
- };
14
-
15
- declare const _default: react.NamedExoticComponent<WidgetProps>;
16
-
17
- type UseSessionConfig = IDKitConfig;
18
- type UseSessionResult = {
19
- /** The current verification state */
20
- status: VerificationState;
21
- /** The QR code URI that users can scan to verify */
22
- sessionURI: string | null;
23
- /** The verification result if successful */
24
- result: ISuccessResult | null;
25
- /** Error code if verification failed */
26
- errorCode: AppErrorCodes | null;
27
- /** Function to reset the session and start over */
28
- reset: () => void;
29
- };
30
- /**
31
- * A beginner-friendly React hook for World ID verification sessions.
32
- *
33
- * This hook automatically:
34
- * - Creates a verification session
35
- * - Generates a QR code URI for scanning
36
- * - Polls for verification updates
37
- * - Stops polling when verification completes or fails
38
- *
39
- * @param config - The World ID configuration object
40
- * @returns Session state and controls
41
- *
42
- * @example
43
- * ```tsx
44
- * const { status, sessionURI, result, errorCode } = useSession({
45
- * app_id: 'app_staging_12345',
46
- * action: 'login',
47
- * signal: 'user_123'
48
- * })
49
- *
50
- * if (status === VerificationState.WaitingForConnection) {
51
- * return <QRCodeSVG value={sessionURI} />
52
- * }
53
- * ```
54
- */
55
- declare function useSession(config: UseSessionConfig): UseSessionResult;
56
-
57
- export { Config, _default as IDKitWidget, type UseSessionConfig, type UseSessionResult, WidgetProps, useIDKit, useSession };
package/build/index.d.ts DELETED
@@ -1,57 +0,0 @@
1
- import { C as Config, W as WidgetProps } from './config-SH5TbLYj.js';
2
- export { S as SupportedLanguage, a as getCurrentLanguage, g as getLocalizationConfig, b as getSupportedLanguages, s as setLocalizationConfig } from './config-SH5TbLYj.js';
3
- import * as react from 'react';
4
- export { solidityEncode } from '@worldcoin/idkit-core/hashing';
5
- export { IVerifyResponse, verifyCloudProof } from '@worldcoin/idkit-core/backend';
6
- import { IDKitConfig, VerificationState, ISuccessResult, AppErrorCodes } from '@worldcoin/idkit-core';
7
- export { IErrorState, ISuccessResult, VerificationLevel, VerificationState } from '@worldcoin/idkit-core';
8
-
9
- type HookConfig = Partial<Pick<Config, 'handleVerify' | 'onSuccess'>>;
10
- declare const useIDKit: ({ handleVerify, onSuccess }?: HookConfig) => {
11
- open: boolean;
12
- setOpen: (open: boolean) => void;
13
- };
14
-
15
- declare const _default: react.NamedExoticComponent<WidgetProps>;
16
-
17
- type UseSessionConfig = IDKitConfig;
18
- type UseSessionResult = {
19
- /** The current verification state */
20
- status: VerificationState;
21
- /** The QR code URI that users can scan to verify */
22
- sessionURI: string | null;
23
- /** The verification result if successful */
24
- result: ISuccessResult | null;
25
- /** Error code if verification failed */
26
- errorCode: AppErrorCodes | null;
27
- /** Function to reset the session and start over */
28
- reset: () => void;
29
- };
30
- /**
31
- * A beginner-friendly React hook for World ID verification sessions.
32
- *
33
- * This hook automatically:
34
- * - Creates a verification session
35
- * - Generates a QR code URI for scanning
36
- * - Polls for verification updates
37
- * - Stops polling when verification completes or fails
38
- *
39
- * @param config - The World ID configuration object
40
- * @returns Session state and controls
41
- *
42
- * @example
43
- * ```tsx
44
- * const { status, sessionURI, result, errorCode } = useSession({
45
- * app_id: 'app_staging_12345',
46
- * action: 'login',
47
- * signal: 'user_123'
48
- * })
49
- *
50
- * if (status === VerificationState.WaitingForConnection) {
51
- * return <QRCodeSVG value={sessionURI} />
52
- * }
53
- * ```
54
- */
55
- declare function useSession(config: UseSessionConfig): UseSessionResult;
56
-
57
- export { Config, _default as IDKitWidget, type UseSessionConfig, type UseSessionResult, WidgetProps, useIDKit, useSession };