@worldcoin/idkit-core 4.1.4 → 4.1.6
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 +384 -79
- package/dist/index.d.cts +133 -4
- package/dist/index.d.ts +133 -4
- package/dist/index.js +383 -80
- 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() */
|
|
@@ -253,7 +256,19 @@ interface DeviceLegacyPreset {
|
|
|
253
256
|
signal?: string;
|
|
254
257
|
}
|
|
255
258
|
|
|
256
|
-
|
|
259
|
+
interface ProofOfHumanPreset {
|
|
260
|
+
/** Requests a World ID 4.0 proof-of-human credential with legacy Orb fallback. */
|
|
261
|
+
type: "ProofOfHuman";
|
|
262
|
+
signal?: string;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
interface PassportPreset {
|
|
266
|
+
/** Requests a World ID 4.0 passport credential with legacy document fallback. */
|
|
267
|
+
type: "Passport";
|
|
268
|
+
signal?: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset | DeviceLegacyPreset | ProofOfHumanPreset | PassportPreset;
|
|
257
272
|
|
|
258
273
|
|
|
259
274
|
|
|
@@ -288,6 +303,8 @@ declare enum IDKitErrorCodes {
|
|
|
288
303
|
UserRejected = "user_rejected",
|
|
289
304
|
VerificationRejected = "verification_rejected",
|
|
290
305
|
CredentialUnavailable = "credential_unavailable",
|
|
306
|
+
WorldId4NotAvailable = "world_id_4_not_available",
|
|
307
|
+
WorldId3NotAvailable = "world_id_3_not_available",
|
|
291
308
|
MalformedRequest = "malformed_request",
|
|
292
309
|
InvalidNetwork = "invalid_network",
|
|
293
310
|
InclusionProofPending = "inclusion_proof_pending",
|
|
@@ -305,6 +322,7 @@ declare enum IDKitErrorCodes {
|
|
|
305
322
|
TimestampTooFarInFuture = "timestamp_too_far_in_future",
|
|
306
323
|
InvalidTimestamp = "invalid_timestamp",
|
|
307
324
|
RpSignatureExpired = "rp_signature_expired",
|
|
325
|
+
IdentityAttributesNotMatched = "identity_attributes_not_matched",
|
|
308
326
|
GenericError = "generic_error",
|
|
309
327
|
InvalidRpIdFormat = "invalid_rp_id_format",
|
|
310
328
|
Timeout = "timeout",
|
|
@@ -374,6 +392,27 @@ interface IDKitRequest {
|
|
|
374
392
|
/** Poll continuously until completion or timeout */
|
|
375
393
|
pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
|
|
376
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* An invite-code mode World ID verification request (WDP-73).
|
|
397
|
+
*
|
|
398
|
+
* Sibling shape to {@link IDKitRequest}, but discovery happens through a
|
|
399
|
+
* URL pointing at the `world.org/verify` landing page (which displays the
|
|
400
|
+
* code for the user to type into World App). The polling lifecycle is
|
|
401
|
+
* byte-identical to URL mode — same `Status`, same `IDKitCompletionResult` —
|
|
402
|
+
* so adopters write the same poll loop.
|
|
403
|
+
*/
|
|
404
|
+
interface IDKitInviteCodeRequest {
|
|
405
|
+
/** URL to display to the user. Same shape as URL/QR mode's `connectorURI` with `&c=<code>&a=<app_id>` appended. */
|
|
406
|
+
readonly connectorURI: string;
|
|
407
|
+
/** Unix-seconds expiry of the unredeemed code. After this point bridge will reject the redeem. */
|
|
408
|
+
readonly expiresAt: number;
|
|
409
|
+
/** Unique request ID for this verification */
|
|
410
|
+
readonly requestId: string;
|
|
411
|
+
/** Poll once for current status (for manual polling) */
|
|
412
|
+
pollOnce(): Promise<Status>;
|
|
413
|
+
/** Poll continuously until completion or timeout */
|
|
414
|
+
pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
|
|
415
|
+
}
|
|
377
416
|
/**
|
|
378
417
|
* Creates a CredentialRequest for a credential type
|
|
379
418
|
*
|
|
@@ -523,13 +562,43 @@ declare function deviceLegacy(opts?: {
|
|
|
523
562
|
*
|
|
524
563
|
* @example
|
|
525
564
|
* ```typescript
|
|
526
|
-
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs:
|
|
565
|
+
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
|
|
527
566
|
* .preset(selfieCheckLegacy({ signal: 'user-123' }))
|
|
528
567
|
* ```
|
|
529
568
|
*/
|
|
530
569
|
declare function selfieCheckLegacy(opts?: {
|
|
531
570
|
signal?: string;
|
|
532
571
|
}): SelfieCheckLegacyPreset;
|
|
572
|
+
/**
|
|
573
|
+
* Creates a ProofOfHuman preset for World ID 4.0 with legacy Orb fallback
|
|
574
|
+
*
|
|
575
|
+
* @param opts - Optional configuration with signal
|
|
576
|
+
* @returns A ProofOfHuman preset
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```typescript
|
|
580
|
+
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
|
|
581
|
+
* .preset(proofOfHuman({ signal: 'user-123' }))
|
|
582
|
+
* ```
|
|
583
|
+
*/
|
|
584
|
+
declare function proofOfHuman(opts?: {
|
|
585
|
+
signal?: string;
|
|
586
|
+
}): ProofOfHumanPreset;
|
|
587
|
+
/**
|
|
588
|
+
* Creates a Passport preset for World ID 4.0 with legacy document fallback
|
|
589
|
+
*
|
|
590
|
+
* @param opts - Optional configuration with signal
|
|
591
|
+
* @returns A Passport preset
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```typescript
|
|
595
|
+
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: false })
|
|
596
|
+
* .preset(passport({ signal: 'user-123' }))
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
599
|
+
declare function passport(opts?: {
|
|
600
|
+
signal?: string;
|
|
601
|
+
}): PassportPreset;
|
|
533
602
|
/**
|
|
534
603
|
* Builder for IDKit requests
|
|
535
604
|
*
|
|
@@ -559,7 +628,7 @@ declare class IDKitBuilder {
|
|
|
559
628
|
* Presets provide a simplified way to create requests with predefined
|
|
560
629
|
* credential configurations.
|
|
561
630
|
*
|
|
562
|
-
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or
|
|
631
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), deviceLegacy(), proofOfHuman(), or passport()
|
|
563
632
|
* @returns A new IDKitRequest instance
|
|
564
633
|
*
|
|
565
634
|
* @example
|
|
@@ -570,6 +639,39 @@ declare class IDKitBuilder {
|
|
|
570
639
|
*/
|
|
571
640
|
preset(preset: Preset): Promise<IDKitRequest>;
|
|
572
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* Builder for invite-code mode requests (WDP-73).
|
|
644
|
+
*
|
|
645
|
+
* Code mode is bridge-only by definition: the user is on a different device
|
|
646
|
+
* than World App (e.g. desktop browser ↔ phone), so there's no in-app native
|
|
647
|
+
* postMessage path to branch on. This builder skips the `isInWorldApp()`
|
|
648
|
+
* check that {@link IDKitBuilder} performs.
|
|
649
|
+
*/
|
|
650
|
+
declare class IDKitInviteCodeBuilder {
|
|
651
|
+
private config;
|
|
652
|
+
constructor(config: BuilderConfig);
|
|
653
|
+
/**
|
|
654
|
+
* Creates an invite-code mode IDKit request with the given constraints.
|
|
655
|
+
*
|
|
656
|
+
* @param constraints - Constraint tree (CredentialRequest or any/all/enumerate combinators)
|
|
657
|
+
* @returns A new IDKitInviteCodeRequest instance
|
|
658
|
+
*
|
|
659
|
+
* @example
|
|
660
|
+
* ```typescript
|
|
661
|
+
* const request = await IDKit.requestWithInviteCode({ app_id, action, rp_context, allow_legacy_proofs: false })
|
|
662
|
+
* .constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
|
|
663
|
+
* displayLink(request.connectorURI);
|
|
664
|
+
* ```
|
|
665
|
+
*/
|
|
666
|
+
constraints(constraints: ConstraintNode): Promise<IDKitInviteCodeRequest>;
|
|
667
|
+
/**
|
|
668
|
+
* Creates an invite-code mode IDKit request from a preset.
|
|
669
|
+
*
|
|
670
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), deviceLegacy(), proofOfHuman(), or passport()
|
|
671
|
+
* @returns A new IDKitInviteCodeRequest instance
|
|
672
|
+
*/
|
|
673
|
+
preset(preset: Preset): Promise<IDKitInviteCodeRequest>;
|
|
674
|
+
}
|
|
573
675
|
/**
|
|
574
676
|
* Creates an IDKit verification request builder
|
|
575
677
|
*
|
|
@@ -609,6 +711,27 @@ declare class IDKitBuilder {
|
|
|
609
711
|
* ```
|
|
610
712
|
*/
|
|
611
713
|
declare function createRequest(config: IDKitRequestConfig): IDKitBuilder;
|
|
714
|
+
/**
|
|
715
|
+
* Creates an invite-code mode IDKit request builder (WDP-73).
|
|
716
|
+
*
|
|
717
|
+
* Sibling entry point to {@link createRequest}. Validates the same required
|
|
718
|
+
* fields, returns a {@link IDKitInviteCodeBuilder} whose `.constraints()` /
|
|
719
|
+
* `.preset()` methods produce {@link IDKitInviteCodeRequest} handles.
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* ```typescript
|
|
723
|
+
* const request = await IDKit.requestWithInviteCode({
|
|
724
|
+
* app_id: 'app_staging_xxxxx',
|
|
725
|
+
* action: 'my-action',
|
|
726
|
+
* rp_context: { ... },
|
|
727
|
+
* allow_legacy_proofs: false,
|
|
728
|
+
* }).constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
|
|
729
|
+
*
|
|
730
|
+
* displayLink(request.connectorURI); // user opens this URL on their phone
|
|
731
|
+
* const proof = await request.pollUntilCompletion();
|
|
732
|
+
* ```
|
|
733
|
+
*/
|
|
734
|
+
declare function createRequestWithInviteCode(config: IDKitRequestConfig): IDKitInviteCodeBuilder;
|
|
612
735
|
/**
|
|
613
736
|
* Creates a new session builder (no action, no existing session_id)
|
|
614
737
|
*
|
|
@@ -687,6 +810,8 @@ declare function proveSession(sessionId: `session_${string}`, config: IDKitSessi
|
|
|
687
810
|
declare const IDKit: {
|
|
688
811
|
/** Create a new verification request */
|
|
689
812
|
request: typeof createRequest;
|
|
813
|
+
/** Create a new invite-code mode verification request (WDP-73) */
|
|
814
|
+
requestWithInviteCode: typeof createRequestWithInviteCode;
|
|
690
815
|
/** Create a new session (no action, no existing session_id) */
|
|
691
816
|
createSession: typeof createSession;
|
|
692
817
|
/** Prove an existing session (no action, has session_id) */
|
|
@@ -709,6 +834,10 @@ declare const IDKit: {
|
|
|
709
834
|
deviceLegacy: typeof deviceLegacy;
|
|
710
835
|
/** Create a SelfieCheckLegacy preset for face verification */
|
|
711
836
|
selfieCheckLegacy: typeof selfieCheckLegacy;
|
|
837
|
+
/** Create a ProofOfHuman preset for World ID 4.0 with legacy Orb fallback */
|
|
838
|
+
proofOfHuman: typeof proofOfHuman;
|
|
839
|
+
/** Create a Passport preset for World ID 4.0 with legacy document fallback */
|
|
840
|
+
passport: typeof passport;
|
|
712
841
|
};
|
|
713
842
|
|
|
714
843
|
/**
|
|
@@ -736,4 +865,4 @@ declare const isNode: () => boolean;
|
|
|
736
865
|
declare function isDebug(): boolean;
|
|
737
866
|
declare function setDebug(enabled: boolean): void;
|
|
738
867
|
|
|
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 };
|
|
868
|
+
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 PassportPreset, type Preset, type ProofOfHumanPreset, 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, passport, proofOfHuman, 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() */
|
|
@@ -253,7 +256,19 @@ interface DeviceLegacyPreset {
|
|
|
253
256
|
signal?: string;
|
|
254
257
|
}
|
|
255
258
|
|
|
256
|
-
|
|
259
|
+
interface ProofOfHumanPreset {
|
|
260
|
+
/** Requests a World ID 4.0 proof-of-human credential with legacy Orb fallback. */
|
|
261
|
+
type: "ProofOfHuman";
|
|
262
|
+
signal?: string;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
interface PassportPreset {
|
|
266
|
+
/** Requests a World ID 4.0 passport credential with legacy document fallback. */
|
|
267
|
+
type: "Passport";
|
|
268
|
+
signal?: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset | DeviceLegacyPreset | ProofOfHumanPreset | PassportPreset;
|
|
257
272
|
|
|
258
273
|
|
|
259
274
|
|
|
@@ -288,6 +303,8 @@ declare enum IDKitErrorCodes {
|
|
|
288
303
|
UserRejected = "user_rejected",
|
|
289
304
|
VerificationRejected = "verification_rejected",
|
|
290
305
|
CredentialUnavailable = "credential_unavailable",
|
|
306
|
+
WorldId4NotAvailable = "world_id_4_not_available",
|
|
307
|
+
WorldId3NotAvailable = "world_id_3_not_available",
|
|
291
308
|
MalformedRequest = "malformed_request",
|
|
292
309
|
InvalidNetwork = "invalid_network",
|
|
293
310
|
InclusionProofPending = "inclusion_proof_pending",
|
|
@@ -305,6 +322,7 @@ declare enum IDKitErrorCodes {
|
|
|
305
322
|
TimestampTooFarInFuture = "timestamp_too_far_in_future",
|
|
306
323
|
InvalidTimestamp = "invalid_timestamp",
|
|
307
324
|
RpSignatureExpired = "rp_signature_expired",
|
|
325
|
+
IdentityAttributesNotMatched = "identity_attributes_not_matched",
|
|
308
326
|
GenericError = "generic_error",
|
|
309
327
|
InvalidRpIdFormat = "invalid_rp_id_format",
|
|
310
328
|
Timeout = "timeout",
|
|
@@ -374,6 +392,27 @@ interface IDKitRequest {
|
|
|
374
392
|
/** Poll continuously until completion or timeout */
|
|
375
393
|
pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
|
|
376
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* An invite-code mode World ID verification request (WDP-73).
|
|
397
|
+
*
|
|
398
|
+
* Sibling shape to {@link IDKitRequest}, but discovery happens through a
|
|
399
|
+
* URL pointing at the `world.org/verify` landing page (which displays the
|
|
400
|
+
* code for the user to type into World App). The polling lifecycle is
|
|
401
|
+
* byte-identical to URL mode — same `Status`, same `IDKitCompletionResult` —
|
|
402
|
+
* so adopters write the same poll loop.
|
|
403
|
+
*/
|
|
404
|
+
interface IDKitInviteCodeRequest {
|
|
405
|
+
/** URL to display to the user. Same shape as URL/QR mode's `connectorURI` with `&c=<code>&a=<app_id>` appended. */
|
|
406
|
+
readonly connectorURI: string;
|
|
407
|
+
/** Unix-seconds expiry of the unredeemed code. After this point bridge will reject the redeem. */
|
|
408
|
+
readonly expiresAt: number;
|
|
409
|
+
/** Unique request ID for this verification */
|
|
410
|
+
readonly requestId: string;
|
|
411
|
+
/** Poll once for current status (for manual polling) */
|
|
412
|
+
pollOnce(): Promise<Status>;
|
|
413
|
+
/** Poll continuously until completion or timeout */
|
|
414
|
+
pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
|
|
415
|
+
}
|
|
377
416
|
/**
|
|
378
417
|
* Creates a CredentialRequest for a credential type
|
|
379
418
|
*
|
|
@@ -523,13 +562,43 @@ declare function deviceLegacy(opts?: {
|
|
|
523
562
|
*
|
|
524
563
|
* @example
|
|
525
564
|
* ```typescript
|
|
526
|
-
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs:
|
|
565
|
+
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
|
|
527
566
|
* .preset(selfieCheckLegacy({ signal: 'user-123' }))
|
|
528
567
|
* ```
|
|
529
568
|
*/
|
|
530
569
|
declare function selfieCheckLegacy(opts?: {
|
|
531
570
|
signal?: string;
|
|
532
571
|
}): SelfieCheckLegacyPreset;
|
|
572
|
+
/**
|
|
573
|
+
* Creates a ProofOfHuman preset for World ID 4.0 with legacy Orb fallback
|
|
574
|
+
*
|
|
575
|
+
* @param opts - Optional configuration with signal
|
|
576
|
+
* @returns A ProofOfHuman preset
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```typescript
|
|
580
|
+
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
|
|
581
|
+
* .preset(proofOfHuman({ signal: 'user-123' }))
|
|
582
|
+
* ```
|
|
583
|
+
*/
|
|
584
|
+
declare function proofOfHuman(opts?: {
|
|
585
|
+
signal?: string;
|
|
586
|
+
}): ProofOfHumanPreset;
|
|
587
|
+
/**
|
|
588
|
+
* Creates a Passport preset for World ID 4.0 with legacy document fallback
|
|
589
|
+
*
|
|
590
|
+
* @param opts - Optional configuration with signal
|
|
591
|
+
* @returns A Passport preset
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```typescript
|
|
595
|
+
* const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: false })
|
|
596
|
+
* .preset(passport({ signal: 'user-123' }))
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
599
|
+
declare function passport(opts?: {
|
|
600
|
+
signal?: string;
|
|
601
|
+
}): PassportPreset;
|
|
533
602
|
/**
|
|
534
603
|
* Builder for IDKit requests
|
|
535
604
|
*
|
|
@@ -559,7 +628,7 @@ declare class IDKitBuilder {
|
|
|
559
628
|
* Presets provide a simplified way to create requests with predefined
|
|
560
629
|
* credential configurations.
|
|
561
630
|
*
|
|
562
|
-
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), or
|
|
631
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), deviceLegacy(), proofOfHuman(), or passport()
|
|
563
632
|
* @returns A new IDKitRequest instance
|
|
564
633
|
*
|
|
565
634
|
* @example
|
|
@@ -570,6 +639,39 @@ declare class IDKitBuilder {
|
|
|
570
639
|
*/
|
|
571
640
|
preset(preset: Preset): Promise<IDKitRequest>;
|
|
572
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* Builder for invite-code mode requests (WDP-73).
|
|
644
|
+
*
|
|
645
|
+
* Code mode is bridge-only by definition: the user is on a different device
|
|
646
|
+
* than World App (e.g. desktop browser ↔ phone), so there's no in-app native
|
|
647
|
+
* postMessage path to branch on. This builder skips the `isInWorldApp()`
|
|
648
|
+
* check that {@link IDKitBuilder} performs.
|
|
649
|
+
*/
|
|
650
|
+
declare class IDKitInviteCodeBuilder {
|
|
651
|
+
private config;
|
|
652
|
+
constructor(config: BuilderConfig);
|
|
653
|
+
/**
|
|
654
|
+
* Creates an invite-code mode IDKit request with the given constraints.
|
|
655
|
+
*
|
|
656
|
+
* @param constraints - Constraint tree (CredentialRequest or any/all/enumerate combinators)
|
|
657
|
+
* @returns A new IDKitInviteCodeRequest instance
|
|
658
|
+
*
|
|
659
|
+
* @example
|
|
660
|
+
* ```typescript
|
|
661
|
+
* const request = await IDKit.requestWithInviteCode({ app_id, action, rp_context, allow_legacy_proofs: false })
|
|
662
|
+
* .constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
|
|
663
|
+
* displayLink(request.connectorURI);
|
|
664
|
+
* ```
|
|
665
|
+
*/
|
|
666
|
+
constraints(constraints: ConstraintNode): Promise<IDKitInviteCodeRequest>;
|
|
667
|
+
/**
|
|
668
|
+
* Creates an invite-code mode IDKit request from a preset.
|
|
669
|
+
*
|
|
670
|
+
* @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), deviceLegacy(), proofOfHuman(), or passport()
|
|
671
|
+
* @returns A new IDKitInviteCodeRequest instance
|
|
672
|
+
*/
|
|
673
|
+
preset(preset: Preset): Promise<IDKitInviteCodeRequest>;
|
|
674
|
+
}
|
|
573
675
|
/**
|
|
574
676
|
* Creates an IDKit verification request builder
|
|
575
677
|
*
|
|
@@ -609,6 +711,27 @@ declare class IDKitBuilder {
|
|
|
609
711
|
* ```
|
|
610
712
|
*/
|
|
611
713
|
declare function createRequest(config: IDKitRequestConfig): IDKitBuilder;
|
|
714
|
+
/**
|
|
715
|
+
* Creates an invite-code mode IDKit request builder (WDP-73).
|
|
716
|
+
*
|
|
717
|
+
* Sibling entry point to {@link createRequest}. Validates the same required
|
|
718
|
+
* fields, returns a {@link IDKitInviteCodeBuilder} whose `.constraints()` /
|
|
719
|
+
* `.preset()` methods produce {@link IDKitInviteCodeRequest} handles.
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* ```typescript
|
|
723
|
+
* const request = await IDKit.requestWithInviteCode({
|
|
724
|
+
* app_id: 'app_staging_xxxxx',
|
|
725
|
+
* action: 'my-action',
|
|
726
|
+
* rp_context: { ... },
|
|
727
|
+
* allow_legacy_proofs: false,
|
|
728
|
+
* }).constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
|
|
729
|
+
*
|
|
730
|
+
* displayLink(request.connectorURI); // user opens this URL on their phone
|
|
731
|
+
* const proof = await request.pollUntilCompletion();
|
|
732
|
+
* ```
|
|
733
|
+
*/
|
|
734
|
+
declare function createRequestWithInviteCode(config: IDKitRequestConfig): IDKitInviteCodeBuilder;
|
|
612
735
|
/**
|
|
613
736
|
* Creates a new session builder (no action, no existing session_id)
|
|
614
737
|
*
|
|
@@ -687,6 +810,8 @@ declare function proveSession(sessionId: `session_${string}`, config: IDKitSessi
|
|
|
687
810
|
declare const IDKit: {
|
|
688
811
|
/** Create a new verification request */
|
|
689
812
|
request: typeof createRequest;
|
|
813
|
+
/** Create a new invite-code mode verification request (WDP-73) */
|
|
814
|
+
requestWithInviteCode: typeof createRequestWithInviteCode;
|
|
690
815
|
/** Create a new session (no action, no existing session_id) */
|
|
691
816
|
createSession: typeof createSession;
|
|
692
817
|
/** Prove an existing session (no action, has session_id) */
|
|
@@ -709,6 +834,10 @@ declare const IDKit: {
|
|
|
709
834
|
deviceLegacy: typeof deviceLegacy;
|
|
710
835
|
/** Create a SelfieCheckLegacy preset for face verification */
|
|
711
836
|
selfieCheckLegacy: typeof selfieCheckLegacy;
|
|
837
|
+
/** Create a ProofOfHuman preset for World ID 4.0 with legacy Orb fallback */
|
|
838
|
+
proofOfHuman: typeof proofOfHuman;
|
|
839
|
+
/** Create a Passport preset for World ID 4.0 with legacy document fallback */
|
|
840
|
+
passport: typeof passport;
|
|
712
841
|
};
|
|
713
842
|
|
|
714
843
|
/**
|
|
@@ -736,4 +865,4 @@ declare const isNode: () => boolean;
|
|
|
736
865
|
declare function isDebug(): boolean;
|
|
737
866
|
declare function setDebug(enabled: boolean): void;
|
|
738
867
|
|
|
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 };
|
|
868
|
+
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 PassportPreset, type Preset, type ProofOfHumanPreset, 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, passport, proofOfHuman, secureDocumentLegacy, selfieCheckLegacy, setDebug };
|