@worldcoin/idkit-core 4.1.4 → 4.1.5
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/dist/idkit_wasm_bg.wasm +0 -0
- package/dist/index.cjs +370 -77
- package/dist/index.d.cts +84 -1
- package/dist/index.d.ts +84 -1
- package/dist/index.js +370 -77
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -194,6 +194,8 @@ type IDKitErrorCode =
|
|
|
194
194
|
| "user_rejected"
|
|
195
195
|
| "verification_rejected"
|
|
196
196
|
| "credential_unavailable"
|
|
197
|
+
| "world_id_4_not_available"
|
|
198
|
+
| "world_id_3_not_available"
|
|
197
199
|
| "malformed_request"
|
|
198
200
|
| "invalid_network"
|
|
199
201
|
| "inclusion_proof_pending"
|
|
@@ -211,6 +213,7 @@ type IDKitErrorCode =
|
|
|
211
213
|
| "timestamp_too_far_in_future"
|
|
212
214
|
| "invalid_timestamp"
|
|
213
215
|
| "rp_signature_expired"
|
|
216
|
+
| "identity_attributes_not_matched"
|
|
214
217
|
| "generic_error";
|
|
215
218
|
|
|
216
219
|
/** Status returned from pollForStatus() */
|
|
@@ -288,6 +291,8 @@ declare enum IDKitErrorCodes {
|
|
|
288
291
|
UserRejected = "user_rejected",
|
|
289
292
|
VerificationRejected = "verification_rejected",
|
|
290
293
|
CredentialUnavailable = "credential_unavailable",
|
|
294
|
+
WorldId4NotAvailable = "world_id_4_not_available",
|
|
295
|
+
WorldId3NotAvailable = "world_id_3_not_available",
|
|
291
296
|
MalformedRequest = "malformed_request",
|
|
292
297
|
InvalidNetwork = "invalid_network",
|
|
293
298
|
InclusionProofPending = "inclusion_proof_pending",
|
|
@@ -305,6 +310,7 @@ declare enum IDKitErrorCodes {
|
|
|
305
310
|
TimestampTooFarInFuture = "timestamp_too_far_in_future",
|
|
306
311
|
InvalidTimestamp = "invalid_timestamp",
|
|
307
312
|
RpSignatureExpired = "rp_signature_expired",
|
|
313
|
+
IdentityAttributesNotMatched = "identity_attributes_not_matched",
|
|
308
314
|
GenericError = "generic_error",
|
|
309
315
|
InvalidRpIdFormat = "invalid_rp_id_format",
|
|
310
316
|
Timeout = "timeout",
|
|
@@ -374,6 +380,27 @@ interface IDKitRequest {
|
|
|
374
380
|
/** Poll continuously until completion or timeout */
|
|
375
381
|
pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
|
|
376
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* An invite-code mode World ID verification request (WDP-73).
|
|
385
|
+
*
|
|
386
|
+
* Sibling shape to {@link IDKitRequest}, but discovery happens through a
|
|
387
|
+
* URL pointing at the `world.org/verify` landing page (which displays the
|
|
388
|
+
* code for the user to type into World App). The polling lifecycle is
|
|
389
|
+
* byte-identical to URL mode — same `Status`, same `IDKitCompletionResult` —
|
|
390
|
+
* so adopters write the same poll loop.
|
|
391
|
+
*/
|
|
392
|
+
interface IDKitInviteCodeRequest {
|
|
393
|
+
/** URL to display to the user. Same shape as URL/QR mode's `connectorURI` with `&c=<code>&a=<app_id>` appended. */
|
|
394
|
+
readonly connectorURI: string;
|
|
395
|
+
/** Unix-seconds expiry of the unredeemed code. After this point bridge will reject the redeem. */
|
|
396
|
+
readonly expiresAt: number;
|
|
397
|
+
/** Unique request ID for this verification */
|
|
398
|
+
readonly requestId: string;
|
|
399
|
+
/** Poll once for current status (for manual polling) */
|
|
400
|
+
pollOnce(): Promise<Status>;
|
|
401
|
+
/** Poll continuously until completion or timeout */
|
|
402
|
+
pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
|
|
403
|
+
}
|
|
377
404
|
/**
|
|
378
405
|
* Creates a CredentialRequest for a credential type
|
|
379
406
|
*
|
|
@@ -570,6 +597,39 @@ declare class IDKitBuilder {
|
|
|
570
597
|
*/
|
|
571
598
|
preset(preset: Preset): Promise<IDKitRequest>;
|
|
572
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* Builder for invite-code mode requests (WDP-73).
|
|
602
|
+
*
|
|
603
|
+
* Code mode is bridge-only by definition: the user is on a different device
|
|
604
|
+
* than World App (e.g. desktop browser ↔ phone), so there's no in-app native
|
|
605
|
+
* postMessage path to branch on. This builder skips the `isInWorldApp()`
|
|
606
|
+
* check that {@link IDKitBuilder} performs.
|
|
607
|
+
*/
|
|
608
|
+
declare class IDKitInviteCodeBuilder {
|
|
609
|
+
private config;
|
|
610
|
+
constructor(config: BuilderConfig);
|
|
611
|
+
/**
|
|
612
|
+
* Creates an invite-code mode IDKit request with the given constraints.
|
|
613
|
+
*
|
|
614
|
+
* @param constraints - Constraint tree (CredentialRequest or any/all/enumerate combinators)
|
|
615
|
+
* @returns A new IDKitInviteCodeRequest instance
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* ```typescript
|
|
619
|
+
* const request = await IDKit.requestWithInviteCode({ app_id, action, rp_context, allow_legacy_proofs: false })
|
|
620
|
+
* .constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
|
|
621
|
+
* displayLink(request.connectorURI);
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
constraints(constraints: ConstraintNode): Promise<IDKitInviteCodeRequest>;
|
|
625
|
+
/**
|
|
626
|
+
* Creates an invite-code mode IDKit request from a preset.
|
|
627
|
+
*
|
|
628
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or deviceLegacy()
|
|
629
|
+
* @returns A new IDKitInviteCodeRequest instance
|
|
630
|
+
*/
|
|
631
|
+
preset(preset: Preset): Promise<IDKitInviteCodeRequest>;
|
|
632
|
+
}
|
|
573
633
|
/**
|
|
574
634
|
* Creates an IDKit verification request builder
|
|
575
635
|
*
|
|
@@ -609,6 +669,27 @@ declare class IDKitBuilder {
|
|
|
609
669
|
* ```
|
|
610
670
|
*/
|
|
611
671
|
declare function createRequest(config: IDKitRequestConfig): IDKitBuilder;
|
|
672
|
+
/**
|
|
673
|
+
* Creates an invite-code mode IDKit request builder (WDP-73).
|
|
674
|
+
*
|
|
675
|
+
* Sibling entry point to {@link createRequest}. Validates the same required
|
|
676
|
+
* fields, returns a {@link IDKitInviteCodeBuilder} whose `.constraints()` /
|
|
677
|
+
* `.preset()` methods produce {@link IDKitInviteCodeRequest} handles.
|
|
678
|
+
*
|
|
679
|
+
* @example
|
|
680
|
+
* ```typescript
|
|
681
|
+
* const request = await IDKit.requestWithInviteCode({
|
|
682
|
+
* app_id: 'app_staging_xxxxx',
|
|
683
|
+
* action: 'my-action',
|
|
684
|
+
* rp_context: { ... },
|
|
685
|
+
* allow_legacy_proofs: false,
|
|
686
|
+
* }).constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
|
|
687
|
+
*
|
|
688
|
+
* displayLink(request.connectorURI); // user opens this URL on their phone
|
|
689
|
+
* const proof = await request.pollUntilCompletion();
|
|
690
|
+
* ```
|
|
691
|
+
*/
|
|
692
|
+
declare function createRequestWithInviteCode(config: IDKitRequestConfig): IDKitInviteCodeBuilder;
|
|
612
693
|
/**
|
|
613
694
|
* Creates a new session builder (no action, no existing session_id)
|
|
614
695
|
*
|
|
@@ -687,6 +768,8 @@ declare function proveSession(sessionId: `session_${string}`, config: IDKitSessi
|
|
|
687
768
|
declare const IDKit: {
|
|
688
769
|
/** Create a new verification request */
|
|
689
770
|
request: typeof createRequest;
|
|
771
|
+
/** Create a new invite-code mode verification request (WDP-73) */
|
|
772
|
+
requestWithInviteCode: typeof createRequestWithInviteCode;
|
|
690
773
|
/** Create a new session (no action, no existing session_id) */
|
|
691
774
|
createSession: typeof createSession;
|
|
692
775
|
/** Prove an existing session (no action, has session_id) */
|
|
@@ -736,4 +819,4 @@ declare const isNode: () => boolean;
|
|
|
736
819
|
declare function isDebug(): boolean;
|
|
737
820
|
declare function setDebug(enabled: boolean): void;
|
|
738
821
|
|
|
739
|
-
export { type AbiEncodedValue, type ConstraintNode, CredentialRequest, type CredentialRequestType, type CredentialType, type DeviceLegacyPreset, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, all, any, deviceLegacy, documentLegacy, enumerate, isDebug, isInWorldApp, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy, setDebug };
|
|
822
|
+
export { type AbiEncodedValue, type ConstraintNode, CredentialRequest, type CredentialRequestType, type CredentialType, type DeviceLegacyPreset, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitInviteCodeRequest, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, all, any, deviceLegacy, documentLegacy, enumerate, isDebug, isInWorldApp, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy, setDebug };
|
package/dist/index.d.ts
CHANGED
|
@@ -194,6 +194,8 @@ type IDKitErrorCode =
|
|
|
194
194
|
| "user_rejected"
|
|
195
195
|
| "verification_rejected"
|
|
196
196
|
| "credential_unavailable"
|
|
197
|
+
| "world_id_4_not_available"
|
|
198
|
+
| "world_id_3_not_available"
|
|
197
199
|
| "malformed_request"
|
|
198
200
|
| "invalid_network"
|
|
199
201
|
| "inclusion_proof_pending"
|
|
@@ -211,6 +213,7 @@ type IDKitErrorCode =
|
|
|
211
213
|
| "timestamp_too_far_in_future"
|
|
212
214
|
| "invalid_timestamp"
|
|
213
215
|
| "rp_signature_expired"
|
|
216
|
+
| "identity_attributes_not_matched"
|
|
214
217
|
| "generic_error";
|
|
215
218
|
|
|
216
219
|
/** Status returned from pollForStatus() */
|
|
@@ -288,6 +291,8 @@ declare enum IDKitErrorCodes {
|
|
|
288
291
|
UserRejected = "user_rejected",
|
|
289
292
|
VerificationRejected = "verification_rejected",
|
|
290
293
|
CredentialUnavailable = "credential_unavailable",
|
|
294
|
+
WorldId4NotAvailable = "world_id_4_not_available",
|
|
295
|
+
WorldId3NotAvailable = "world_id_3_not_available",
|
|
291
296
|
MalformedRequest = "malformed_request",
|
|
292
297
|
InvalidNetwork = "invalid_network",
|
|
293
298
|
InclusionProofPending = "inclusion_proof_pending",
|
|
@@ -305,6 +310,7 @@ declare enum IDKitErrorCodes {
|
|
|
305
310
|
TimestampTooFarInFuture = "timestamp_too_far_in_future",
|
|
306
311
|
InvalidTimestamp = "invalid_timestamp",
|
|
307
312
|
RpSignatureExpired = "rp_signature_expired",
|
|
313
|
+
IdentityAttributesNotMatched = "identity_attributes_not_matched",
|
|
308
314
|
GenericError = "generic_error",
|
|
309
315
|
InvalidRpIdFormat = "invalid_rp_id_format",
|
|
310
316
|
Timeout = "timeout",
|
|
@@ -374,6 +380,27 @@ interface IDKitRequest {
|
|
|
374
380
|
/** Poll continuously until completion or timeout */
|
|
375
381
|
pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
|
|
376
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* An invite-code mode World ID verification request (WDP-73).
|
|
385
|
+
*
|
|
386
|
+
* Sibling shape to {@link IDKitRequest}, but discovery happens through a
|
|
387
|
+
* URL pointing at the `world.org/verify` landing page (which displays the
|
|
388
|
+
* code for the user to type into World App). The polling lifecycle is
|
|
389
|
+
* byte-identical to URL mode — same `Status`, same `IDKitCompletionResult` —
|
|
390
|
+
* so adopters write the same poll loop.
|
|
391
|
+
*/
|
|
392
|
+
interface IDKitInviteCodeRequest {
|
|
393
|
+
/** URL to display to the user. Same shape as URL/QR mode's `connectorURI` with `&c=<code>&a=<app_id>` appended. */
|
|
394
|
+
readonly connectorURI: string;
|
|
395
|
+
/** Unix-seconds expiry of the unredeemed code. After this point bridge will reject the redeem. */
|
|
396
|
+
readonly expiresAt: number;
|
|
397
|
+
/** Unique request ID for this verification */
|
|
398
|
+
readonly requestId: string;
|
|
399
|
+
/** Poll once for current status (for manual polling) */
|
|
400
|
+
pollOnce(): Promise<Status>;
|
|
401
|
+
/** Poll continuously until completion or timeout */
|
|
402
|
+
pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
|
|
403
|
+
}
|
|
377
404
|
/**
|
|
378
405
|
* Creates a CredentialRequest for a credential type
|
|
379
406
|
*
|
|
@@ -570,6 +597,39 @@ declare class IDKitBuilder {
|
|
|
570
597
|
*/
|
|
571
598
|
preset(preset: Preset): Promise<IDKitRequest>;
|
|
572
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* Builder for invite-code mode requests (WDP-73).
|
|
602
|
+
*
|
|
603
|
+
* Code mode is bridge-only by definition: the user is on a different device
|
|
604
|
+
* than World App (e.g. desktop browser ↔ phone), so there's no in-app native
|
|
605
|
+
* postMessage path to branch on. This builder skips the `isInWorldApp()`
|
|
606
|
+
* check that {@link IDKitBuilder} performs.
|
|
607
|
+
*/
|
|
608
|
+
declare class IDKitInviteCodeBuilder {
|
|
609
|
+
private config;
|
|
610
|
+
constructor(config: BuilderConfig);
|
|
611
|
+
/**
|
|
612
|
+
* Creates an invite-code mode IDKit request with the given constraints.
|
|
613
|
+
*
|
|
614
|
+
* @param constraints - Constraint tree (CredentialRequest or any/all/enumerate combinators)
|
|
615
|
+
* @returns A new IDKitInviteCodeRequest instance
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* ```typescript
|
|
619
|
+
* const request = await IDKit.requestWithInviteCode({ app_id, action, rp_context, allow_legacy_proofs: false })
|
|
620
|
+
* .constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
|
|
621
|
+
* displayLink(request.connectorURI);
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
constraints(constraints: ConstraintNode): Promise<IDKitInviteCodeRequest>;
|
|
625
|
+
/**
|
|
626
|
+
* Creates an invite-code mode IDKit request from a preset.
|
|
627
|
+
*
|
|
628
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or deviceLegacy()
|
|
629
|
+
* @returns A new IDKitInviteCodeRequest instance
|
|
630
|
+
*/
|
|
631
|
+
preset(preset: Preset): Promise<IDKitInviteCodeRequest>;
|
|
632
|
+
}
|
|
573
633
|
/**
|
|
574
634
|
* Creates an IDKit verification request builder
|
|
575
635
|
*
|
|
@@ -609,6 +669,27 @@ declare class IDKitBuilder {
|
|
|
609
669
|
* ```
|
|
610
670
|
*/
|
|
611
671
|
declare function createRequest(config: IDKitRequestConfig): IDKitBuilder;
|
|
672
|
+
/**
|
|
673
|
+
* Creates an invite-code mode IDKit request builder (WDP-73).
|
|
674
|
+
*
|
|
675
|
+
* Sibling entry point to {@link createRequest}. Validates the same required
|
|
676
|
+
* fields, returns a {@link IDKitInviteCodeBuilder} whose `.constraints()` /
|
|
677
|
+
* `.preset()` methods produce {@link IDKitInviteCodeRequest} handles.
|
|
678
|
+
*
|
|
679
|
+
* @example
|
|
680
|
+
* ```typescript
|
|
681
|
+
* const request = await IDKit.requestWithInviteCode({
|
|
682
|
+
* app_id: 'app_staging_xxxxx',
|
|
683
|
+
* action: 'my-action',
|
|
684
|
+
* rp_context: { ... },
|
|
685
|
+
* allow_legacy_proofs: false,
|
|
686
|
+
* }).constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
|
|
687
|
+
*
|
|
688
|
+
* displayLink(request.connectorURI); // user opens this URL on their phone
|
|
689
|
+
* const proof = await request.pollUntilCompletion();
|
|
690
|
+
* ```
|
|
691
|
+
*/
|
|
692
|
+
declare function createRequestWithInviteCode(config: IDKitRequestConfig): IDKitInviteCodeBuilder;
|
|
612
693
|
/**
|
|
613
694
|
* Creates a new session builder (no action, no existing session_id)
|
|
614
695
|
*
|
|
@@ -687,6 +768,8 @@ declare function proveSession(sessionId: `session_${string}`, config: IDKitSessi
|
|
|
687
768
|
declare const IDKit: {
|
|
688
769
|
/** Create a new verification request */
|
|
689
770
|
request: typeof createRequest;
|
|
771
|
+
/** Create a new invite-code mode verification request (WDP-73) */
|
|
772
|
+
requestWithInviteCode: typeof createRequestWithInviteCode;
|
|
690
773
|
/** Create a new session (no action, no existing session_id) */
|
|
691
774
|
createSession: typeof createSession;
|
|
692
775
|
/** Prove an existing session (no action, has session_id) */
|
|
@@ -736,4 +819,4 @@ declare const isNode: () => boolean;
|
|
|
736
819
|
declare function isDebug(): boolean;
|
|
737
820
|
declare function setDebug(enabled: boolean): void;
|
|
738
821
|
|
|
739
|
-
export { type AbiEncodedValue, type ConstraintNode, CredentialRequest, type CredentialRequestType, type CredentialType, type DeviceLegacyPreset, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, all, any, deviceLegacy, documentLegacy, enumerate, isDebug, isInWorldApp, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy, setDebug };
|
|
822
|
+
export { type AbiEncodedValue, type ConstraintNode, CredentialRequest, type CredentialRequestType, type CredentialType, type DeviceLegacyPreset, type DocumentLegacyPreset, IDKit, type IDKitCompletionResult, type IDKitErrorCode, IDKitErrorCodes, type IDKitInviteCodeRequest, type IDKitRequest, type IDKitRequestConfig, type IDKitResult, type IDKitResultSession, type IDKitSessionConfig, type OrbLegacyPreset, type Preset, type ResponseItemSession, type ResponseItemV3, type ResponseItemV4, type RpContext, type SecureDocumentLegacyPreset, type SelfieCheckLegacyPreset, type Status$1 as Status, type WaitOptions, all, any, deviceLegacy, documentLegacy, enumerate, isDebug, isInWorldApp, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, selfieCheckLegacy, setDebug };
|