import type { ServiceMetadata, ServiceSearchCriteria } from '../../lib/resolver.ts';
import * as KeetaNet from '@keetanetwork/keetanet-client';
import * as Signing from '../../lib/utils/signing.js';
import { KeetaAnchorUserError } from '../../lib/error.js';
import type { HTTPSignedField } from '../../lib/http-server/common.js';
type KeetaNetToken = InstanceType<typeof KeetaNet.lib.Account<typeof KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN>>;
export type CountryCodesSearchCriteria = ServiceSearchCriteria<'kyc'>['countryCodes'];
export type Operations = NonNullable<ServiceMetadata['services']['kyc']>[string]['operations'];
export type OperationNames = keyof Operations;
export type KYCRedirectStatus = 'completed' | 'cancelled' | 'failed';
export interface KeetaKYCAnchorCreateVerificationRequest {
    countryCodes: CountryCodesSearchCriteria;
    account: ReturnType<InstanceType<typeof KeetaNet.lib.Account>['publicKeyString']['get']>;
    signed: HTTPSignedField;
    /**
     * An optional URL that the KYC provider will redirect the user to
     * after the verification flow ends. The provider appends a
     * {@link KYCRedirectStatus} query parameter indicating the outcome.
     */
    redirectURL?: string;
}
type KeetaNetTokenPublicKeyString = ReturnType<InstanceType<typeof KeetaNet.lib.Account<typeof KeetaNet.lib.Account.AccountKeyAlgorithm.TOKEN>>['publicKeyString']['get']>;
export type KeetaKYCAnchorCreateVerificationResponse = ({
    ok: true;
    /**
     * The ID of the verification request -- this is a unique identifier
     * for the verification request that can be used to fetch the
     * certificate later
     */
    id: string;
    /**
     * The expected cost of the verification request, in the form of a
     * token and a range of minimum and maximum expected costs
     */
    expectedCost: {
        min: string;
        max: string;
        token: KeetaNetTokenPublicKeyString;
    };
    /**
     * The URL to the verification service where the user can complete the
     * verification process. This URL is expected to be a web URL that the
     * user can visit to complete the verification.
     */
    webURL: string;
} | {
    ok: false;
    error: string;
});
export type KeetaKYCAnchorGetCertificateResponse = ({
    ok: true;
    /**
     * The certificates that were issued by the KYC Anchor service.
     * Typically this will just be a single certificate, but
     * it could also be multiple certificates if the service
     * issues multiple certificates for a single verification.
     *
     * Each certificate is represented as a PEM-encoded string.
     * The `intermediates` field is optional and may contain
     * additional intermediate certificates that are required to
     * validate the certificate chain.
     */
    results: ({
        certificate: string;
        intermediates?: string[];
    })[];
} | {
    ok: false;
    error: string;
});
declare class KeetaKYCAnchorVerificationNotFoundError extends KeetaAnchorUserError {
    static readonly name: string;
    private readonly KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID;
    private static readonly KeetaKYCAnchorVerificationNotFoundErrorObjectTypeID;
    readonly logLevel = "DEBUG";
    constructor(message?: string);
    static isInstance(input: unknown): input is KeetaKYCAnchorVerificationNotFoundError;
}
declare class KeetaKYCAnchorCertificateNotFoundError extends KeetaAnchorUserError {
    static readonly name: string;
    private readonly KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID;
    private static readonly KeetaKYCAnchorCertificateNotFoundErrorObjectTypeID;
    constructor(message?: string);
    static isInstance(input: unknown): input is KeetaKYCAnchorCertificateNotFoundError;
}
declare class KeetaKYCAnchorCertificatePaymentRequired extends KeetaAnchorUserError {
    static readonly name: string;
    private readonly KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID;
    private static readonly KeetaKYCAnchorCertificatePaymentRequiredObjectTypeID;
    readonly amount: bigint;
    readonly token: KeetaNetToken;
    constructor(cost: {
        amount: bigint | string;
        token: KeetaNetToken | string;
    }, message?: string);
    static isInstance(input: unknown): input is KeetaKYCAnchorCertificatePaymentRequired;
    asErrorResponse(contentType: 'text/plain' | 'application/json'): {
        error: string;
        statusCode: number;
        contentType: string;
    };
    toJSON(): {
        ok: false;
        retryable: boolean;
        error: string;
        name: string;
        statusCode: number;
        amount: string;
        token: string;
    };
    static fromJSON(input: unknown): Promise<KeetaKYCAnchorCertificatePaymentRequired>;
}
export declare const Errors: {
    VerificationNotFound: typeof KeetaKYCAnchorVerificationNotFoundError;
    CertificateNotFound: typeof KeetaKYCAnchorCertificateNotFoundError;
    PaymentRequired: typeof KeetaKYCAnchorCertificatePaymentRequired;
};
export declare function generateSignedData(account: Signing.SignableAccount): Promise<{
    nonce: string;
    timestamp: string;
    signature: string;
}>;
export declare function verifySignedData(request: Pick<KeetaKYCAnchorCreateVerificationRequest, 'account' | 'signed'>): Promise<boolean>;
export {};
//# sourceMappingURL=common.d.ts.map