@worldcoin/idkit 0.0.1 → 0.0.2
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/components/IDKitWidget/BaseWidget.d.ts +2 -7
- package/build/components/IDKitWidget/index.d.ts +1 -5
- package/build/components/Icons/WorldcoinLogomark.d.ts +5 -0
- package/build/components/QRCode.d.ts +6 -0
- package/build/hooks/useMedia.d.ts +2 -0
- package/build/idkit-js.js +73 -19
- package/build/index.css +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.js +8 -2
- package/build/index.js.map +3 -3
- package/build/lib/hashing.d.ts +37 -0
- package/build/lib/qr.d.ts +5 -0
- package/build/lib/telemetry.d.ts +4 -0
- package/build/lib/utils.d.ts +2 -1
- package/build/services/phone.d.ts +1 -1
- package/build/services/walletconnect.d.ts +14 -0
- package/build/store/idkit.d.ts +8 -7
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/config.d.ts +13 -1
- package/build/types/index.d.ts +4 -0
- package/build/types/orb.d.ts +21 -0
- package/package.json +29 -9
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { BytesLike } from '@ethersproject/bytes';
|
|
3
|
+
import type { StringOrAdvanced } from '../types/config';
|
|
4
|
+
export interface HashFunctionOutput {
|
|
5
|
+
hash: BigInt;
|
|
6
|
+
digest: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hashes an input using the `keccak256` hashing function used across the World ID protocol, to be used as
|
|
10
|
+
* a ZKP input. The function will try to determine the best hashing mechanism, if the string already looks like hex-encoded
|
|
11
|
+
* bytes (e.g. `0x0000000000000000000000000000000000000000`), it will be hashed directly.
|
|
12
|
+
* @param input Any string, hex-like string, bytes represented as a hex string.
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function worldIDHash(input: Buffer | BytesLike | StringOrAdvanced): HashFunctionOutput;
|
|
16
|
+
/**
|
|
17
|
+
* Using `worldIDHash` is recommended! Use this if you're certain you want to hash a string.
|
|
18
|
+
* Converts an input to bytes and then hashes it with the World ID protocol hashing function.
|
|
19
|
+
* @param input - String to hash
|
|
20
|
+
* @returns hash
|
|
21
|
+
*/
|
|
22
|
+
export declare function hashString(input: string): HashFunctionOutput;
|
|
23
|
+
/**
|
|
24
|
+
* Using `worldIDHash` is recommended! Use this if you're certain you want to hash raw bytes.
|
|
25
|
+
* Hashes raw bytes input using the `keccak256` hashing function used across the World ID protocol, to be used as
|
|
26
|
+
* a ZKP input. Example use cases include when you're hashing an address to be verified in a smart contract.
|
|
27
|
+
* @param input - Bytes represented as a hex string.
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
export declare function hashEncodedBytes(input: BytesLike): HashFunctionOutput;
|
|
31
|
+
/**
|
|
32
|
+
* Partial implementation of `keccak256` hash from @ethersproject/solidity; only supports hashing a single BytesLike value
|
|
33
|
+
* @param value value to hash
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare function keccak256(value: BytesLike): string;
|
|
37
|
+
export declare const validateABILikeEncoding: (value: string) => boolean;
|
package/build/lib/utils.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const classNames: (...classes:
|
|
1
|
+
export declare const classNames: (...classes: unknown[]) => string;
|
|
2
|
+
export declare const randomNumber: (min: number, max: number) => number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PhoneSignalProof } from '../types';
|
|
2
2
|
export declare function requestCode(phone_number: string, action_id: string, ph_distinct_id: string): Promise<void>;
|
|
3
|
-
interface VerifyCodeSuccess extends Pick<PhoneSignalProof, '
|
|
3
|
+
interface VerifyCodeSuccess extends Pick<PhoneSignalProof, 'signature' | 'timestamp'> {
|
|
4
4
|
success: true;
|
|
5
5
|
nullifier_hash: string;
|
|
6
6
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OrbResponse } from '../types/orb';
|
|
2
|
+
import type { StringOrAdvanced } from '../types/config';
|
|
3
|
+
import { ErrorCodes, VerificationState } from '../types/orb';
|
|
4
|
+
type UseOrbSignalResponse = {
|
|
5
|
+
result: OrbResponse | null;
|
|
6
|
+
errorCode: ErrorCodes | null;
|
|
7
|
+
verificationState: VerificationState;
|
|
8
|
+
qrData: {
|
|
9
|
+
default: string;
|
|
10
|
+
mobile: string;
|
|
11
|
+
} | null;
|
|
12
|
+
};
|
|
13
|
+
declare const useOrbSignal: (action_id: StringOrAdvanced, signal: StringOrAdvanced) => UseOrbSignalResponse;
|
|
14
|
+
export default useOrbSignal;
|
package/build/store/idkit.d.ts
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { IDKITStage } from '../types';
|
|
2
|
-
import type { Config } from '../types/config';
|
|
3
2
|
import type { CallbackFn, ErrorState, ISuccessResult } from '../types';
|
|
3
|
+
import type { Config, ConfigSource, StringOrAdvanced } from '../types/config';
|
|
4
4
|
export type IDKitStore = {
|
|
5
5
|
code: string;
|
|
6
6
|
open: boolean;
|
|
7
|
-
actionId: string;
|
|
8
7
|
stage: IDKITStage;
|
|
9
8
|
autoClose: boolean;
|
|
10
9
|
phoneNumber: string;
|
|
11
|
-
copy: Config['copy'];
|
|
12
10
|
processing: boolean;
|
|
11
|
+
copy: Config['copy'];
|
|
12
|
+
signal: StringOrAdvanced;
|
|
13
|
+
actionId: StringOrAdvanced;
|
|
14
|
+
stringifiedActionId: string;
|
|
13
15
|
errorState: ErrorState | null;
|
|
14
|
-
successCallbacks:
|
|
16
|
+
successCallbacks: Record<ConfigSource, CallbackFn | undefined> | Record<string, never>;
|
|
15
17
|
retryFlow: () => void;
|
|
16
18
|
setCode: (code: string) => void;
|
|
17
19
|
setOpen: (open: boolean) => void;
|
|
18
20
|
setStage: (stage: IDKITStage) => void;
|
|
19
|
-
setOptions: (options: Config) => void;
|
|
20
21
|
onOpenChange: (open: boolean) => void;
|
|
21
|
-
setActionId: (actionId: string) => void;
|
|
22
22
|
onSuccess: (result: ISuccessResult) => void;
|
|
23
23
|
setProcessing: (processing: boolean) => void;
|
|
24
|
-
addSuccessCallback: (cb: CallbackFn) => void;
|
|
25
24
|
setPhoneNumber: (phoneNumber: string) => void;
|
|
26
25
|
setErrorState: (errorState: ErrorState | null) => void;
|
|
26
|
+
setOptions: (options: Config, source: ConfigSource) => void;
|
|
27
|
+
addSuccessCallback: (cb: CallbackFn, source: ConfigSource) => void;
|
|
27
28
|
};
|
|
28
29
|
declare const useIDKitStore: import("zustand").UseBoundStore<import("zustand").StoreApi<IDKitStore>>;
|
|
29
30
|
export default useIDKitStore;
|