export { RpSignature, SignRequestParams, signRequest } from '@worldcoin/idkit-server';
export { hashSignal } from './hashing.cjs';

/**
 * Configuration types for IDKit
 *
 * Note: CredentialType, CredentialRequestType, and ConstraintNode are now
 * re-exported from WASM (source of truth: rust/core/src/wasm_bindings.rs)
 */
declare const brand: unique symbol;
type Brand<T, TBrand extends string> = T & {
    [brand]: TBrand;
};
type AbiEncodedValue = Brand<{
    types: string[];
    values: unknown[];
}, "AbiEncodedValue">;
/**
 * Relying Party context for IDKit requests
 *
 * Contains RP-specific data needed to construct a ProofRequest.
 * This should be generated and signed by your backend.
 */
type RpContext = {
    /** The registered RP ID (e.g., "rp_123456789abcdef0") */
    rp_id: string;
    /** Unique nonce for this proof request */
    nonce: string;
    /** Unix timestamp (seconds since epoch) when created */
    created_at: number;
    /** Unix timestamp (seconds since epoch) when expires */
    expires_at: number;
    /** The RP's ECDSA signature of the nonce and created_at timestamp */
    signature: string;
};
/**
 * Configuration for IDKit.request()
 */
type IDKitRequestConfig = {
    /** Unique identifier for the app verifying the action. This should be the app ID obtained from the Developer Portal. */
    app_id: `app_${string}`;
    /** Identifier for the action the user is performing. Should be left blank for [Sign in with Worldcoin](https://docs.world.org/id/sign-in). */
    action: AbiEncodedValue | string;
    /** RP context for protocol-level proof requests (required) */
    rp_context: RpContext;
    /** The description of the specific action (shown to users in World App). Only recommended for actions created on-the-fly. */
    action_description?: string;
    /** URL to a third-party bridge to use when connecting to the World App. Optional. */
    bridge_url?: string;
    /** Optional deep-link callback URL appended as `return_to` on the connector URL. */
    return_to?: string;
    /**
     * Whether to accept legacy (v3) World ID proofs as fallback.
     *
     * - `true`: Accept both v3 and v4 proofs. Use during migration.
     *   You must track both v3 and v4 nullifiers to prevent double-claims.
     * - `false`: Only accept v4 proofs. Use after migration cutoff or for new apps.
     */
    allow_legacy_proofs: boolean;
    /** Optional override for the connect base URL (e.g., for staging environments) */
    override_connect_base_url?: string;
    /** Optional environment override. Defaults to "production". */
    environment?: "production" | "staging";
};
/**
 * Configuration for IDKit.createSession() and IDKit.proveSession()
 *
 * Session requests don't have an action field - they're used for session-based
 * authentication where the user proves they're the same person across visits.
 *
 * Sessions are always World ID v4 - there is no legacy (v3) session support.
 */
type IDKitSessionConfig = {
    /** Unique identifier for the app verifying the session. This should be the app ID obtained from the Developer Portal. */
    app_id: `app_${string}`;
    /** RP context for protocol-level proof requests (required) */
    rp_context: RpContext;
    /** The description of the action (shown to users in World App). Optional. */
    action_description?: string;
    /** URL to a third-party bridge to use when connecting to the World App. Optional. */
    bridge_url?: string;
    /** Optional deep-link callback URL appended as `return_to` on the connector URL. */
    return_to?: string;
    /** Optional override for the connect base URL (e.g., for staging environments) */
    override_connect_base_url?: string;
    /** Optional environment override. Defaults to "production". */
    environment?: "production" | "staging";
};

/** V4 response item for World ID v4 uniqueness proofs */
interface ResponseItemV4 {
    /** Credential identifier (e.g., "proof_of_human", "face", "passport", "mnc") */
    identifier: string;
    /** Signal hash (optional, included if signal was provided in request) */
    signal_hash?: string;
    /** Encoded World ID proof: first 4 elements are compressed Groth16 proof, 5th is Merkle root (hex strings). Compatible with WorldIDVerifier.sol */
    proof: string[];
    /** RP-scoped nullifier (hex) */
    nullifier: string;
    /** Credential issuer schema ID (1=proof_of_human, 11=face, 9303=passport, 9310=mnc) */
    issuer_schema_id: number;
    /** Minimum expiration timestamp (unix seconds) */
    expires_at_min: number;
}

/** V3 response item for World ID v3 (legacy format) */
interface ResponseItemV3 {
    /** Credential identifier (e.g., "proof_of_human", "face") */
    identifier: string;
    /** Signal hash (optional, included if signal was provided in request) */
    signal_hash?: string;
    /** ABI-encoded proof (hex) */
    proof: string;
    /** Merkle root (hex) */
    merkle_root: string;
    /** Nullifier (hex) */
    nullifier: string;
}

/** Session response item for World ID v4 session proofs */
interface ResponseItemSession {
    /** Credential identifier (e.g., "proof_of_human", "face", "passport", "mnc") */
    identifier: string;
    /** Signal hash (optional, included if signal was provided in request) */
    signal_hash?: string;
    /** Encoded World ID proof: first 4 elements are compressed Groth16 proof, 5th is Merkle root (hex strings). Compatible with WorldIDVerifier.sol */
    proof: string[];
    /** Session nullifier: 1st element is the session nullifier, 2nd is the generated action (hex strings) */
    session_nullifier: string[];
    /** Credential issuer schema ID (1=proof_of_human, 11=face, 9303=passport, 9310=mnc) */
    issuer_schema_id: number;
    /** Minimum expiration timestamp (unix seconds) */
    expires_at_min: number;
}

/** V3 result (legacy format - no session support) */
interface IDKitResultV3 {
    /** Protocol version 3.0 */
    protocol_version: "3.0";
    /** Nonce used in the request */
    nonce: string;
    /** Action identifier (only for uniqueness proofs) */
    action?: string;
    /** Action description (only if provided in input) */
    action_description?: string;
    /** Array of V3 credential responses */
    responses: ResponseItemV3[];
    /** The environment used for this request ("production" or "staging") */
    environment: string;
}

/** V4 result for uniqueness proofs */
interface IDKitResultV4 {
    /** Protocol version 4.0 */
    protocol_version: "4.0";
    /** Nonce used in the request */
    nonce: string;
    /** Action identifier (required for uniqueness proofs) */
    action: string;
    /** Action description (only if provided in input) */
    action_description?: string;
    /** Array of V4 credential responses */
    responses: ResponseItemV4[];
    /** The environment used for this request ("production" or "staging") */
    environment: string;
}

/** V4 result for session proofs */
interface IDKitResultSession {
    /** Protocol version 4.0 */
    protocol_version: "4.0";
    /** Nonce used in the request */
    nonce: string;
    /** Action description (only if provided in input) */
    action_description?: string;
    /** Opaque session identifier returned by the World App in `session_<hex>` format */
    session_id: `session_${string}`;
    /** Array of session credential responses */
    responses: ResponseItemSession[];
    /** The environment used for this request ("production" or "staging") */
    environment: string;
}

/**
 * The unified result structure for all proof types.
 * Check `session_id` to determine if this is a session proof:
 * - session_id !== undefined → session proof
 * - session_id === undefined → uniqueness proof
 */
type IDKitResult = IDKitResultV3 | IDKitResultV4 | IDKitResultSession;

/** Error codes from World App (mirrors Rust AppError) */
type IDKitErrorCode =
| "user_rejected"
| "verification_rejected"
| "credential_unavailable"
| "world_id_4_not_available"
| "world_id_3_not_available"
| "malformed_request"
| "invalid_network"
| "inclusion_proof_pending"
| "inclusion_proof_failed"
| "unexpected_response"
| "connection_failed"
| "max_verifications_reached"
| "failed_by_host_app"
| "invalid_rp_signature"
| "nullifier_replayed"
| "duplicate_nonce"
| "unknown_rp"
| "inactive_rp"
| "timestamp_too_old"
| "timestamp_too_far_in_future"
| "invalid_timestamp"
| "rp_signature_expired"
| "identity_attributes_not_matched"
| "generic_error";

/** Status returned from pollForStatus() */
type Status$1 =
| { type: "waiting_for_connection" }
| { type: "awaiting_confirmation" }
| { type: "confirmed"; result: IDKitResult }
| { type: "failed"; error: IDKitErrorCode };



interface OrbLegacyPreset {
    /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
    type: "OrbLegacy";
    signal?: string;
}

interface SecureDocumentLegacyPreset {
    /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
    type: "SecureDocumentLegacy";
    signal?: string;
}

interface DocumentLegacyPreset {
    /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
    type: "DocumentLegacy";
    signal?: string;
}

interface SelfieCheckLegacyPreset {
    /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
    /** Preview: Selfie Check is currently in preview. Contact us if you need it enabled. */
    type: "SelfieCheckLegacy";
    signal?: string;
}

interface DeviceLegacyPreset {
    /** This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions. */
    type: "DeviceLegacy";
    signal?: string;
}

interface ProofOfHumanPreset {
    /** Requests a World ID 4.0 proof-of-human credential with legacy Orb fallback. */
    type: "ProofOfHuman";
    signal?: string;
}

interface PassportPreset {
    /** Requests a World ID 4.0 passport credential with legacy document fallback. */
    type: "Passport";
    signal?: string;
}

type Preset = OrbLegacyPreset | SecureDocumentLegacyPreset | DocumentLegacyPreset | SelfieCheckLegacyPreset | DeviceLegacyPreset | ProofOfHumanPreset | PassportPreset;



type CredentialType = "proof_of_human" | "face" | "passport" | "mnc";

interface CredentialRequestType {
    type: CredentialType;
    /** Signal can be a string or raw bytes (Uint8Array) */
    signal?: string | Uint8Array;
    genesis_issued_at_min?: number;
    expires_at_min?: number;
}

type ConstraintNode =
| CredentialRequestType
| { any: ConstraintNode[] }
| { all: ConstraintNode[] }
| { enumerate: ConstraintNode[] };

/**
 * Result types - re-exported from WASM bindings
 *
 * Source of truth: rust/core/src/wasm_bindings.rs (typescript_custom_section)
 */

/**
 * IDKit error codes enum — runtime values for matching against errors.
 * Values mirror Rust's AppError enum (snake_case via serde rename_all).
 * Includes client-side codes (timeout, cancelled) not from World App.
 */
declare enum IDKitErrorCodes {
    UserRejected = "user_rejected",
    VerificationRejected = "verification_rejected",
    CredentialUnavailable = "credential_unavailable",
    WorldId4NotAvailable = "world_id_4_not_available",
    WorldId3NotAvailable = "world_id_3_not_available",
    MalformedRequest = "malformed_request",
    InvalidNetwork = "invalid_network",
    InclusionProofPending = "inclusion_proof_pending",
    InclusionProofFailed = "inclusion_proof_failed",
    UnexpectedResponse = "unexpected_response",
    ConnectionFailed = "connection_failed",
    MaxVerificationsReached = "max_verifications_reached",
    FailedByHostApp = "failed_by_host_app",
    InvalidRpSignature = "invalid_rp_signature",
    NullifierReplayed = "nullifier_replayed",
    DuplicateNonce = "duplicate_nonce",
    UnknownRp = "unknown_rp",
    InactiveRp = "inactive_rp",
    TimestampTooOld = "timestamp_too_old",
    TimestampTooFarInFuture = "timestamp_too_far_in_future",
    InvalidTimestamp = "invalid_timestamp",
    RpSignatureExpired = "rp_signature_expired",
    IdentityAttributesNotMatched = "identity_attributes_not_matched",
    GenericError = "generic_error",
    InvalidRpIdFormat = "invalid_rp_id_format",
    Timeout = "timeout",
    Cancelled = "cancelled"
}

/**
 * Check if running inside World App
 */
declare function isInWorldApp(): boolean;
interface BuilderConfig {
    type: "request" | "createSession" | "proveSession";
    app_id: string;
    action?: string;
    session_id?: `session_${string}`;
    rp_context?: RpContext;
    action_description?: string;
    bridge_url?: string;
    return_to?: string;
    allow_legacy_proofs?: boolean;
    override_connect_base_url?: string;
    environment?: string;
}

/**
 * IDKit Request
 * Pure functional API for World ID verification - no dependencies
 */

/** Options for pollUntilCompletion() */
interface WaitOptions {
    /** Milliseconds between polls (default: 1000) */
    pollInterval?: number;
    /** Total timeout in milliseconds (default: 900000 = 15 minutes) */
    timeout?: number;
    /** AbortSignal for cancellation */
    signal?: AbortSignal;
}
/** Status returned from pollOnce() */
interface Status {
    type: "waiting_for_connection" | "awaiting_confirmation" | "confirmed" | "failed";
    result?: IDKitResult;
    error?: IDKitErrorCodes;
}
/** Result from pollUntilCompletion() — discriminated union, never throws */
type IDKitCompletionResult = {
    success: true;
    result: IDKitResult;
} | {
    success: false;
    error: IDKitErrorCodes;
};

/**
 * A World ID verification request
 *
 * Provides a clean, promise-based API for World ID verification flows.
 * Each request represents a single verification attempt.
 */
interface IDKitRequest {
    /** QR code URL for World App - display this as a QR code for users to scan */
    readonly connectorURI: string;
    /** Unique request ID for this verification */
    readonly requestId: string;
    /** Poll once for current status (for manual polling) */
    pollOnce(): Promise<Status>;
    /** Poll continuously until completion or timeout */
    pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
}
/**
 * An invite-code mode World ID verification request (WDP-73).
 *
 * Sibling shape to {@link IDKitRequest}, but discovery happens through a
 * URL pointing at the `world.org/verify` landing page (which displays the
 * code for the user to type into World App). The polling lifecycle is
 * byte-identical to URL mode — same `Status`, same `IDKitCompletionResult` —
 * so adopters write the same poll loop.
 */
interface IDKitInviteCodeRequest {
    /** URL to display to the user. Same shape as URL/QR mode's `connectorURI` with `&c=<code>&a=<app_id>` appended. */
    readonly connectorURI: string;
    /** Unix-seconds expiry of the unredeemed code. After this point bridge will reject the redeem. */
    readonly expiresAt: number;
    /** Unique request ID for this verification */
    readonly requestId: string;
    /** Poll once for current status (for manual polling) */
    pollOnce(): Promise<Status>;
    /** Poll continuously until completion or timeout */
    pollUntilCompletion(options?: WaitOptions): Promise<IDKitCompletionResult>;
}
/**
 * Creates a CredentialRequest for a credential type
 *
 * @param credential_type - The type of credential to request (e.g., 'proof_of_human', 'face')
 * @param options - Optional signal, genesis_issued_at_min, and expires_at_min
 * @returns A CredentialRequest object
 *
 * @example
 * ```typescript
 * const orb = CredentialRequest('proof_of_human', { signal: 'user-123' })
 * const face = CredentialRequest('face')
 * // Require credential to be valid for at least one year
 * const withExpiry = CredentialRequest('proof_of_human', { expires_at_min: Date.now() / 1000 + 60 * 60 * 60 * 24 * 365 })
 * ```
 */
declare function CredentialRequest(credential_type: CredentialType, options?: {
    signal?: string;
    genesis_issued_at_min?: number;
    expires_at_min?: number;
}): CredentialRequestType;
/**
 * Creates an OR constraint - at least one child must be satisfied
 *
 * @param nodes - Constraint nodes (CredentialRequests or nested constraints)
 * @returns An "any" constraint node
 *
 * @example
 * ```typescript
 * const constraint = any(CredentialRequest('proof_of_human'), CredentialRequest('face'))
 * ```
 */
declare function any(...nodes: ConstraintNode[]): {
    any: ConstraintNode[];
};
/**
 * Creates an AND constraint - all children must be satisfied
 *
 * @param nodes - Constraint nodes (CredentialRequests or nested constraints)
 * @returns An "all" constraint node
 *
 * @example
 * ```typescript
 * const constraint = all(CredentialRequest('proof_of_human'), any(CredentialRequest('passport'), CredentialRequest('mnc')))
 * ```
 */
declare function all(...nodes: ConstraintNode[]): {
    all: ConstraintNode[];
};
/**
 * Creates an enumerate constraint - all satisfiable children should be selected
 *
 * `enumerate` is satisfied when at least one child is satisfied.
 *
 * @param nodes - Constraint nodes (CredentialRequests or nested constraints)
 * @returns An "enumerate" constraint node
 *
 * @example
 * ```typescript
 * const constraint = enumerate(
 *   CredentialRequest('passport'),
 *   CredentialRequest('mnc'),
 * )
 * ```
 */
declare function enumerate(...nodes: ConstraintNode[]): {
    enumerate: ConstraintNode[];
};

/**
 * Creates an OrbLegacy preset for World ID 3.0 legacy support
 *
 * This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
 *
 * @param opts - Optional configuration with signal
 * @returns An OrbLegacy preset
 *
 * @example
 * ```typescript
 * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
 *   .preset(orbLegacy({ signal: 'user-123' }))
 * ```
 */
declare function orbLegacy(opts?: {
    signal?: string;
}): OrbLegacyPreset;
/**
 * Creates a SecureDocumentLegacy preset for World ID 3.0 legacy support
 *
 * This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
 *
 * @param opts - Optional configuration with signal
 * @returns A SecureDocumentLegacy preset
 *
 * @example
 * ```typescript
 * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
 *   .preset(secureDocumentLegacy({ signal: 'user-123' }))
 * ```
 */
declare function secureDocumentLegacy(opts?: {
    signal?: string;
}): SecureDocumentLegacyPreset;
/**
 * Creates a DocumentLegacy preset for World ID 3.0 legacy support
 *
 * This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
 *
 * @param opts - Optional configuration with signal
 * @returns A DocumentLegacy preset
 *
 * @example
 * ```typescript
 * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
 *   .preset(documentLegacy({ signal: 'user-123' }))
 * ```
 */
declare function documentLegacy(opts?: {
    signal?: string;
}): DocumentLegacyPreset;
/**
 * Creates a DeviceLegacy preset for World ID 3.0 legacy support
 *
 * This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
 *
 * @param opts - Optional configuration with signal
 * @returns A DeviceLegacy preset
 *
 * @example
 * ```typescript
 * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
 *   .preset(deviceLegacy({ signal: 'user-123' }))
 * ```
 */
declare function deviceLegacy(opts?: {
    signal?: string;
}): DeviceLegacyPreset;
/**
 * Creates a SelfieCheckLegacy preset for face verification
 *
 * Preview: Selfie Check is currently in preview.
 * Contact us if you need it enabled.
 *
 * This preset only returns World ID 3.0 proofs. Use it for compatibility with older IDKit versions.
 *
 * @param opts - Optional configuration with signal
 * @returns A SelfieCheckLegacy preset
 *
 * @example
 * ```typescript
 * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
 *   .preset(selfieCheckLegacy({ signal: 'user-123' }))
 * ```
 */
declare function selfieCheckLegacy(opts?: {
    signal?: string;
}): SelfieCheckLegacyPreset;
/**
 * Creates a ProofOfHuman preset for World ID 4.0 with legacy Orb fallback
 *
 * @param opts - Optional configuration with signal
 * @returns A ProofOfHuman preset
 *
 * @example
 * ```typescript
 * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
 *   .preset(proofOfHuman({ signal: 'user-123' }))
 * ```
 */
declare function proofOfHuman(opts?: {
    signal?: string;
}): ProofOfHumanPreset;
/**
 * Creates a Passport preset for World ID 4.0 with legacy document fallback
 *
 * @param opts - Optional configuration with signal
 * @returns A Passport preset
 *
 * @example
 * ```typescript
 * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: false })
 *   .preset(passport({ signal: 'user-123' }))
 * ```
 */
declare function passport(opts?: {
    signal?: string;
}): PassportPreset;
/**
 * Builder for IDKit requests
 *
 * Stores configuration and defers transport selection to `.preset()` / `.constraints()`.
 * In World App: uses native postMessage transport (no WASM needed).
 * On web: uses WASM bridge transport (QR code + polling).
 */
declare class IDKitBuilder {
    private config;
    constructor(config: BuilderConfig);
    /**
     * Creates an IDKit request with the given constraints
     *
     * @param constraints - Constraint tree (CredentialRequest or any/all/enumerate combinators)
     * @returns A new IDKitRequest instance
     *
     * @example
     * ```typescript
     * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: false })
     *   .constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
     * ```
     */
    constraints(constraints: ConstraintNode): Promise<IDKitRequest>;
    /**
     * Creates an IDKit request from a preset (works for all request types)
     *
     * Presets provide a simplified way to create requests with predefined
     * credential configurations.
     *
     * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), deviceLegacy(), proofOfHuman(), or passport()
     * @returns A new IDKitRequest instance
     *
     * @example
     * ```typescript
     * const request = await IDKit.request({ app_id, action, rp_context, allow_legacy_proofs: true })
     *   .preset(orbLegacy({ signal: 'user-123' }));
     * ```
     */
    preset(preset: Preset): Promise<IDKitRequest>;
}
/**
 * Builder for invite-code mode requests (WDP-73).
 *
 * Code mode is bridge-only by definition: the user is on a different device
 * than World App (e.g. desktop browser ↔ phone), so there's no in-app native
 * postMessage path to branch on. This builder skips the `isInWorldApp()`
 * check that {@link IDKitBuilder} performs.
 */
declare class IDKitInviteCodeBuilder {
    private config;
    constructor(config: BuilderConfig);
    /**
     * Creates an invite-code mode IDKit request with the given constraints.
     *
     * @param constraints - Constraint tree (CredentialRequest or any/all/enumerate combinators)
     * @returns A new IDKitInviteCodeRequest instance
     *
     * @example
     * ```typescript
     * const request = await IDKit.requestWithInviteCode({ app_id, action, rp_context, allow_legacy_proofs: false })
     *   .constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
     * displayLink(request.connectorURI);
     * ```
     */
    constraints(constraints: ConstraintNode): Promise<IDKitInviteCodeRequest>;
    /**
     * Creates an invite-code mode IDKit request from a preset.
     *
     * @param preset - A preset object from orbLegacy(), secureDocumentLegacy(), documentLegacy(), selfieCheckLegacy(), deviceLegacy(), proofOfHuman(), or passport()
     * @returns A new IDKitInviteCodeRequest instance
     */
    preset(preset: Preset): Promise<IDKitInviteCodeRequest>;
}
/**
 * Creates an IDKit verification request builder
 *
 * This is the main entry point for creating World ID verification requests.
 * Use the builder pattern with `.preset()` or `.constraints()` to specify
 * which credentials to accept.
 *
 * @param config - Request configuration
 * @returns IDKitBuilder - A builder instance
 *
 * @example
 * ```typescript
 * import { IDKit, CredentialRequest, any, enumerate, orbLegacy } from '@worldcoin/idkit-core'
 *
 * // With preset (legacy support)
 * const request = await IDKit.request({
 *   app_id: 'app_staging_xxxxx',
 *   action: 'my-action',
 *   rp_context: { ... },
 *   allow_legacy_proofs: true,
 * }).preset(orbLegacy({ signal: 'user-123' }));
 *
 * // With constraints (v4 only)
 * const request = await IDKit.request({
 *   app_id: 'app_staging_xxxxx',
 *   action: 'my-action',
 *   rp_context: { ... },
 *   allow_legacy_proofs: false,
 * }).constraints(enumerate(CredentialRequest('proof_of_human'), CredentialRequest('face')));
 *
 * // In World App: connectorURI is empty, result comes via postMessage
 * // On web: connectorURI is the QR URL to display
 * console.log(request.connectorURI);
 *
 * // Wait for result — same interface in both environments
 * const proof = await request.pollUntilCompletion();
 * ```
 */
declare function createRequest(config: IDKitRequestConfig): IDKitBuilder;
/**
 * Creates an invite-code mode IDKit request builder (WDP-73).
 *
 * Sibling entry point to {@link createRequest}. Validates the same required
 * fields, returns a {@link IDKitInviteCodeBuilder} whose `.constraints()` /
 * `.preset()` methods produce {@link IDKitInviteCodeRequest} handles.
 *
 * @example
 * ```typescript
 * const request = await IDKit.requestWithInviteCode({
 *   app_id: 'app_staging_xxxxx',
 *   action: 'my-action',
 *   rp_context: { ... },
 *   allow_legacy_proofs: false,
 * }).constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
 *
 * displayLink(request.connectorURI);          // user opens this URL on their phone
 * const proof = await request.pollUntilCompletion();
 * ```
 */
declare function createRequestWithInviteCode(config: IDKitRequestConfig): IDKitInviteCodeBuilder;
/**
 * Creates a new session builder (no action, no existing session_id)
 *
 * Use this when creating a new session for a user who doesn't have one yet.
 * The response will include a `session_id` that should be saved for future
 * session proofs with `proveSession()`.
 *
 * @param config - Session configuration (no action field)
 * @returns IDKitBuilder - A builder instance
 *
 * @example
 * ```typescript
 * import { IDKit, CredentialRequest, any } from '@worldcoin/idkit-core'
 *
 * // Create a new session (user doesn't have session_id yet)
 * const request = await IDKit.createSession({
 *   app_id: 'app_staging_xxxxx',
 *   rp_context: { ... },
 * }).constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
 *
 * // Display QR, wait for proof
 * const result = await request.pollUntilCompletion();
 * // result.session_id -> save this for future sessions
 * // result.responses[0].session_nullifier -> for session tracking
 * ```
 */
declare function createSession(config: IDKitSessionConfig): IDKitBuilder;
/**
 * Creates a builder for proving an existing session (no action, has session_id)
 *
 * Use this when a returning user needs to prove they own an existing session.
 * The `sessionId` should be the opaque `session_<hex>` value previously returned
 * from `createSession()`.
 *
 * @param sessionId - The protocol session ID from a previous session creation
 * @param config - Session configuration (no action field)
 * @returns IDKitBuilder - A builder instance
 *
 * @example
 * ```typescript
 * import { IDKit, CredentialRequest, any } from '@worldcoin/idkit-core'
 *
 * // Prove an existing session (user returns)
 * const request = await IDKit.proveSession(savedSessionId, {
 *   app_id: 'app_staging_xxxxx',
 *   rp_context: { ... },
 * }).constraints(any(CredentialRequest('proof_of_human'), CredentialRequest('face')));
 *
 * const result = await request.pollUntilCompletion();
 * // result.session_id -> same session
 * // result.responses[0].session_nullifier -> should match for same user
 * ```
 */
declare function proveSession(sessionId: `session_${string}`, config: IDKitSessionConfig): IDKitBuilder;
/**
 * IDKit namespace providing the main API entry points
 *
 * @example
 * ```typescript
 * import { IDKit, CredentialRequest, any, enumerate, orbLegacy } from '@worldcoin/idkit-core'
 *
 * // Create a verification request
 * const request = await IDKit.request({
 *   app_id: 'app_staging_xxxxx',
 *   action: 'my-action',
 *   rp_context: { ... },
 *   allow_legacy_proofs: true,
 * }).preset(orbLegacy({ signal: 'user-123' }))
 *
 * // In World App: result comes via postMessage (no QR needed)
 * // On web: display QR code and wait for proof
 * console.log(request.connectorURI)
 * const proof = await request.pollUntilCompletion()
 * ```
 */
declare const IDKit: {
    /** Create a new verification request */
    request: typeof createRequest;
    /** Create a new invite-code mode verification request (WDP-73) */
    requestWithInviteCode: typeof createRequestWithInviteCode;
    /** Create a new session (no action, no existing session_id) */
    createSession: typeof createSession;
    /** Prove an existing session (no action, has session_id) */
    proveSession: typeof proveSession;
    /** Create a CredentialRequest for a credential type */
    CredentialRequest: typeof CredentialRequest;
    /** Create an OR constraint - at least one child must be satisfied */
    any: typeof any;
    /** Create an AND constraint - all children must be satisfied */
    all: typeof all;
    /** Create an enumerate constraint - all satisfiable children should be selected */
    enumerate: typeof enumerate;
    /** Create an OrbLegacy preset for World ID 3.0 legacy support */
    orbLegacy: typeof orbLegacy;
    /** Create a SecureDocumentLegacy preset for World ID 3.0 legacy support */
    secureDocumentLegacy: typeof secureDocumentLegacy;
    /** Create a DocumentLegacy preset for World ID 3.0 legacy support */
    documentLegacy: typeof documentLegacy;
    /** Create a DeviceLegacy preset for World ID 3.0 legacy support */
    deviceLegacy: typeof deviceLegacy;
    /** Create a SelfieCheckLegacy preset for face verification */
    selfieCheckLegacy: typeof selfieCheckLegacy;
    /** Create a ProofOfHuman preset for World ID 4.0 with legacy Orb fallback */
    proofOfHuman: typeof proofOfHuman;
    /** Create a Passport preset for World ID 4.0 with legacy document fallback */
    passport: typeof passport;
};

/**
 * Platform detection utilities
 *
 * These functions help detect the runtime environment (React Native, Web, Node.js)
 * to enable platform-specific behavior or warnings.
 */
/**
 * Checks if the code is running in React Native environment
 * @returns true if running in React Native, false otherwise
 */
declare const isReactNative: () => boolean;
/**
 * Checks if the code is running in a web browser environment
 * @returns true if running in a browser, false otherwise
 */
declare const isWeb: () => boolean;
/**
 * Checks if the code is running in Node.js environment
 * @returns true if running in Node.js, false otherwise
 */
declare const isNode: () => boolean;

declare function isDebug(): boolean;
declare function setDebug(enabled: boolean): void;

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 };
