import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
import * as CurrencyInfo from '@keetanetwork/currency-info';
import { getDefaultResolver } from '../../config.js';
import { Certificate as KYCCertificate } from '../../lib/certificates.js';
import type { Client as KeetaNetClient, UserClient as KeetaNetUserClient } from '@keetanetwork/keetanet-client';
import type { KeetaKYCAnchorCreateVerificationRequest } from './common.ts';
import type { Logger } from '../../lib/log/index.ts';
import type Resolver from '../../lib/resolver.ts';
import type { ServiceMetadata } from '../../lib/resolver.ts';
/**
 * The configuration options for the KYC Anchor client.
 */
export type KeetaKYCAnchorClientConfig = {
    /**
     * The ID of the client. This is used to identify the client in logs.
     * If not provided, a random ID will be generated.
     */
    id?: string;
    /**
     * The logger to use for logging messages. If not provided, no logging
     * will be done.
     */
    logger?: Logger;
    /**
     * The resolver to use for resolving KYC Anchor services. If not
     * provided, a default resolver will be created using the provided
     * client and network (if the network is also not provided and the
     * client is not a UserClient, an error occurs).
     */
    resolver?: Resolver;
} & Omit<NonNullable<Parameters<typeof getDefaultResolver>[1]>, 'client'>;
/**
 * Any kind of X.509v3 Certificate.  This may or may not be a KYC certificate.
 */
type BaseCertificate = InstanceType<typeof KeetaNetLib.Utils.Certificate.Certificate>;
/**
 * The response type for the {@link KeetaKYCAnchorClient['getCertificates']()} method of the KYC Anchor client.
 * It contains the certificate and optionally a set of intermediate certificates.
 */
type KeetaKYCAnchorClientGetCertificateResponse = ({
    ok: true;
    results: {
        certificate: KYCCertificate;
        intermediates?: Set<BaseCertificate> | undefined;
    }[];
} | {
    ok: false;
    retryAfter: number;
    reason: string;
});
type KeetaKYCAnchorClientCreateVerificationRequest = Omit<KeetaKYCAnchorCreateVerificationRequest, 'signed' | 'account'> & {
    account: InstanceType<typeof KeetaNetLib.Account>;
};
/**
 * An opaque type that represents a provider ID.
 */
type ProviderID = string & {
    readonly __providerID: unique symbol;
};
/**
 * An opaque type that represents a KYC Anchor request ID
 */
type RequestID = string & {
    readonly __requestID: unique symbol;
};
/**
 * A list of operations that can be performed by the KYC Anchor service.
 */
type KeetaKYCAnchorOperations = {
    [operation in keyof NonNullable<ServiceMetadata['services']['kyc']>[string]['operations']]?: (params?: {
        [key: string]: string;
    }) => URL;
};
/**
 * The service information for a KYC Anchor service.
 */
type KeetaKYCVerificationServiceInfo = {
    operations: {
        [operation in keyof KeetaKYCAnchorOperations]: Promise<KeetaKYCAnchorOperations[operation]>;
    };
    countryCodes?: CurrencyInfo.Country[] | undefined;
    ca: () => Promise<KYCCertificate>;
};
type KeetaKYCAnchorCommonConfig = {
    id: ProviderID;
    serviceInfo: KeetaKYCVerificationServiceInfo;
    request: KeetaKYCAnchorCreateVerificationRequest;
    client: KeetaKYCAnchorClient;
    operations: NonNullable<Pick<KeetaKYCAnchorOperations, 'createVerification' | 'getCertificates'>>;
    logger?: Logger | undefined;
};
/**
 * Represents an in-progress KYC verification request.
 */
declare class KeetaKYCVerification {
    readonly providerID: KeetaKYCAnchorCommonConfig['id'];
    readonly id: RequestID;
    private readonly serviceInfo;
    private readonly request;
    private readonly logger?;
    private readonly client;
    private readonly response;
    private constructor();
    static start(args: KeetaKYCAnchorCommonConfig): Promise<KeetaKYCVerification>;
    get expectedCost(): typeof this.response.expectedCost;
    get webURL(): URL;
    getProviderIssuerCertificate(): Promise<KYCCertificate>;
    getCertificates(): Promise<KeetaKYCAnchorClientGetCertificateResponse>;
}
/**
 * Represents the KYC operations for a specific provider
 */
declare class KeetaKYCProvider {
    readonly id: ProviderID;
    private readonly serviceInfo;
    private readonly request;
    private readonly logger?;
    private readonly client;
    private readonly operations;
    private cachedCA?;
    constructor(args: KeetaKYCAnchorCommonConfig);
    countryCodes(): Promise<CurrencyInfo.Country[] | undefined>;
    ca(): Promise<KYCCertificate>;
    startVerification(): Promise<KeetaKYCVerification>;
}
declare class KeetaKYCAnchorClient {
    readonly resolver: Resolver;
    readonly id: string;
    private readonly logger?;
    constructor(client: KeetaNetClient | KeetaNetUserClient, config?: KeetaKYCAnchorClientConfig);
    createVerification(request: KeetaKYCAnchorClientCreateVerificationRequest): Promise<KeetaKYCProvider[]>;
    getCertificates(providerID: ProviderID, request: KeetaKYCAnchorCreateVerificationRequest & {
        id: RequestID;
    }): Promise<KeetaKYCAnchorClientGetCertificateResponse>;
    getSupportedCountries(): Promise<CurrencyInfo.Country[]>;
    getEstimate(..._ignore_args: unknown[]): Promise<never>;
    checkLocality(..._ignore_args: unknown[]): Promise<never>;
}
export default KeetaKYCAnchorClient;
//# sourceMappingURL=client.d.ts.map