@worldcoin/idkit-core 4.1.3 → 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/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"
@@ -202,6 +204,16 @@ type IDKitErrorCode =
202
204
  | "connection_failed"
203
205
  | "max_verifications_reached"
204
206
  | "failed_by_host_app"
207
+ | "invalid_rp_signature"
208
+ | "nullifier_replayed"
209
+ | "duplicate_nonce"
210
+ | "unknown_rp"
211
+ | "inactive_rp"
212
+ | "timestamp_too_old"
213
+ | "timestamp_too_far_in_future"
214
+ | "invalid_timestamp"
215
+ | "rp_signature_expired"
216
+ | "identity_attributes_not_matched"
205
217
  | "generic_error";
206
218
 
207
219
  /** Status returned from pollForStatus() */
@@ -279,6 +291,8 @@ declare enum IDKitErrorCodes {
279
291
  UserRejected = "user_rejected",
280
292
  VerificationRejected = "verification_rejected",
281
293
  CredentialUnavailable = "credential_unavailable",
294
+ WorldId4NotAvailable = "world_id_4_not_available",
295
+ WorldId3NotAvailable = "world_id_3_not_available",
282
296
  MalformedRequest = "malformed_request",
283
297
  InvalidNetwork = "invalid_network",
284
298
  InclusionProofPending = "inclusion_proof_pending",
@@ -287,7 +301,18 @@ declare enum IDKitErrorCodes {
287
301
  ConnectionFailed = "connection_failed",
288
302
  MaxVerificationsReached = "max_verifications_reached",
289
303
  FailedByHostApp = "failed_by_host_app",
304
+ InvalidRpSignature = "invalid_rp_signature",
305
+ NullifierReplayed = "nullifier_replayed",
306
+ DuplicateNonce = "duplicate_nonce",
307
+ UnknownRp = "unknown_rp",
308
+ InactiveRp = "inactive_rp",
309
+ TimestampTooOld = "timestamp_too_old",
310
+ TimestampTooFarInFuture = "timestamp_too_far_in_future",
311
+ InvalidTimestamp = "invalid_timestamp",
312
+ RpSignatureExpired = "rp_signature_expired",
313
+ IdentityAttributesNotMatched = "identity_attributes_not_matched",
290
314
  GenericError = "generic_error",
315
+ InvalidRpIdFormat = "invalid_rp_id_format",
291
316
  Timeout = "timeout",
292
317
  Cancelled = "cancelled"
293
318
  }
@@ -355,6 +380,27 @@ interface IDKitRequest {
355
380
  /** Poll continuously until completion or timeout */
356
381
  pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
357
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
+ }
358
404
  /**
359
405
  * Creates a CredentialRequest for a credential type
360
406
  *
@@ -551,6 +597,39 @@ declare class IDKitBuilder {
551
597
  */
552
598
  preset(preset: Preset): Promise<IDKitRequest>;
553
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
+ }
554
633
  /**
555
634
  * Creates an IDKit verification request builder
556
635
  *
@@ -590,6 +669,27 @@ declare class IDKitBuilder {
590
669
  * ```
591
670
  */
592
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;
593
693
  /**
594
694
  * Creates a new session builder (no action, no existing session_id)
595
695
  *
@@ -668,6 +768,8 @@ declare function proveSession(sessionId: `session_${string}`, config: IDKitSessi
668
768
  declare const IDKit: {
669
769
  /** Create a new verification request */
670
770
  request: typeof createRequest;
771
+ /** Create a new invite-code mode verification request (WDP-73) */
772
+ requestWithInviteCode: typeof createRequestWithInviteCode;
671
773
  /** Create a new session (no action, no existing session_id) */
672
774
  createSession: typeof createSession;
673
775
  /** Prove an existing session (no action, has session_id) */
@@ -717,4 +819,4 @@ declare const isNode: () => boolean;
717
819
  declare function isDebug(): boolean;
718
820
  declare function setDebug(enabled: boolean): void;
719
821
 
720
- 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"
@@ -202,6 +204,16 @@ type IDKitErrorCode =
202
204
  | "connection_failed"
203
205
  | "max_verifications_reached"
204
206
  | "failed_by_host_app"
207
+ | "invalid_rp_signature"
208
+ | "nullifier_replayed"
209
+ | "duplicate_nonce"
210
+ | "unknown_rp"
211
+ | "inactive_rp"
212
+ | "timestamp_too_old"
213
+ | "timestamp_too_far_in_future"
214
+ | "invalid_timestamp"
215
+ | "rp_signature_expired"
216
+ | "identity_attributes_not_matched"
205
217
  | "generic_error";
206
218
 
207
219
  /** Status returned from pollForStatus() */
@@ -279,6 +291,8 @@ declare enum IDKitErrorCodes {
279
291
  UserRejected = "user_rejected",
280
292
  VerificationRejected = "verification_rejected",
281
293
  CredentialUnavailable = "credential_unavailable",
294
+ WorldId4NotAvailable = "world_id_4_not_available",
295
+ WorldId3NotAvailable = "world_id_3_not_available",
282
296
  MalformedRequest = "malformed_request",
283
297
  InvalidNetwork = "invalid_network",
284
298
  InclusionProofPending = "inclusion_proof_pending",
@@ -287,7 +301,18 @@ declare enum IDKitErrorCodes {
287
301
  ConnectionFailed = "connection_failed",
288
302
  MaxVerificationsReached = "max_verifications_reached",
289
303
  FailedByHostApp = "failed_by_host_app",
304
+ InvalidRpSignature = "invalid_rp_signature",
305
+ NullifierReplayed = "nullifier_replayed",
306
+ DuplicateNonce = "duplicate_nonce",
307
+ UnknownRp = "unknown_rp",
308
+ InactiveRp = "inactive_rp",
309
+ TimestampTooOld = "timestamp_too_old",
310
+ TimestampTooFarInFuture = "timestamp_too_far_in_future",
311
+ InvalidTimestamp = "invalid_timestamp",
312
+ RpSignatureExpired = "rp_signature_expired",
313
+ IdentityAttributesNotMatched = "identity_attributes_not_matched",
290
314
  GenericError = "generic_error",
315
+ InvalidRpIdFormat = "invalid_rp_id_format",
291
316
  Timeout = "timeout",
292
317
  Cancelled = "cancelled"
293
318
  }
@@ -355,6 +380,27 @@ interface IDKitRequest {
355
380
  /** Poll continuously until completion or timeout */
356
381
  pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
357
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
+ }
358
404
  /**
359
405
  * Creates a CredentialRequest for a credential type
360
406
  *
@@ -551,6 +597,39 @@ declare class IDKitBuilder {
551
597
  */
552
598
  preset(preset: Preset): Promise<IDKitRequest>;
553
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
+ }
554
633
  /**
555
634
  * Creates an IDKit verification request builder
556
635
  *
@@ -590,6 +669,27 @@ declare class IDKitBuilder {
590
669
  * ```
591
670
  */
592
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;
593
693
  /**
594
694
  * Creates a new session builder (no action, no existing session_id)
595
695
  *
@@ -668,6 +768,8 @@ declare function proveSession(sessionId: `session_${string}`, config: IDKitSessi
668
768
  declare const IDKit: {
669
769
  /** Create a new verification request */
670
770
  request: typeof createRequest;
771
+ /** Create a new invite-code mode verification request (WDP-73) */
772
+ requestWithInviteCode: typeof createRequestWithInviteCode;
671
773
  /** Create a new session (no action, no existing session_id) */
672
774
  createSession: typeof createSession;
673
775
  /** Prove an existing session (no action, has session_id) */
@@ -717,4 +819,4 @@ declare const isNode: () => boolean;
717
819
  declare function isDebug(): boolean;
718
820
  declare function setDebug(enabled: boolean): void;
719
821
 
720
- 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 };