import { ARCCertificateIndex, RequestCertificate } from './legacy/models/ClientCertificate.js';
export type CertificateType = 'p12' | 'pem';
export declare const Kind = "Core#Certificate";
export type CertificateDataFormat = string | ArrayBuffer | Uint8Array;
/**
 * Represents a single certificate object (cert/key)
 */
export interface ICertificateData {
    /**
     * The certificate to use.
     * The `p12` type certificate must be a Buffer.
     */
    data: CertificateDataFormat;
    /**
     * A passphrase to use to unlock the certificate.
     */
    passphrase?: string;
    /**
     * The original data type of the certificate. This is only used internally by the data store
     * to move between buffers and string values stored in the store.
     * Outside the internal procedure of the data store this
     * is always `undefined` and the `data` contains the original data format.
     */
    type?: 'buffer';
}
export interface ICertificate {
    kind: typeof Kind;
    /**
     * The data store key to refer under which this certificate is stored.
     */
    key: string;
    /**
     * The custom name of the certificate.
     */
    name: string;
    /**
     * The timestamp when the certificate was inserted into the data store.
     * Required when returning a result. Auto-generated when inserting, if missing.
     */
    created?: number;
    /**
     * Certificate type. Either `p12` or `pem`.
     */
    type: CertificateType;
    /**
     * Certificate or list of certificates to use.
     */
    cert: ICertificateData;
}
export interface IP12Certificate extends ICertificate {
    type: 'p12';
}
/**
 * Represents a complete certificate configuration required to make
 * an HTTP request.
 */
export interface IPemCertificate extends ICertificate {
    type: 'pem';
    /**
     * The key for the `pem` type certificate.
     */
    certKey: ICertificateData;
}
export type HttpCertificate = IP12Certificate | IPemCertificate | ICertificate;
/**
 * @deprecated Do not use this type anymore. Create a cert instance instead.
 */
export interface IPemCreateOptions {
    type: 'p12';
    /**
     * The certificate contents.
     */
    cert: CertificateDataFormat;
    /**
     * The key contents.
     */
    key: CertificateDataFormat;
    /**
     * Optional name for the certificate.
     */
    name?: string;
    /**
     * Optional passphrase for the key.
     */
    passphrase?: string;
}
/**
 * @deprecated Do not use this type anymore. Create a cert instance instead.
 */
export interface IP12CreateOptions {
    type: 'pem';
    /**
     * The certificate contents.
     */
    cert: CertificateDataFormat;
    /**
     * Optional name for the certificate.
     */
    name?: string;
    /**
     * Optional passphrase for the certificate.
     */
    passphrase?: string;
}
/**
 * @deprecated Do not use this type anymore. Create a cert instance instead.
 */
export type ICertificateCreateOptions = IPemCreateOptions | IP12CreateOptions;
/**
 * A class that represents a certificate in the system
 */
export declare class Certificate {
    kind: string;
    /**
     * The data store key to refer.
     */
    key: string;
    /**
     * Custom name of the certificate.
     */
    name: string;
    /**
     * Timestamp when the certificate was inserted into the data store.
     * Required when returning a result. Auto-generated when inserting, if missing.
     */
    created: number;
    /**
     * Certificate type. Either `p12` or `pem`.
     */
    type: CertificateType;
    /**
     * Certificate or list of certificates to use.
     */
    cert: ICertificateData;
    /**
     * The key for the `pem` type certificate.
     */
    certKey?: ICertificateData;
    /**
     * Creates a new certificate instance for a PEM key
     *
     * @param pem The certificate contents
     * @param key The key contents
     * @param name The certificate name
     * @param keyPassphrase The key passphrase
     */
    static fromPem(pem: CertificateDataFormat, key: CertificateDataFormat, name?: string, keyPassphrase?: string): Certificate;
    /**
     * Creates a new certificate instance for a P12 key
     *
     * @param cert The certificate contents
     * @param name The certificate name
     * @param passphrase The key passphrase
     */
    static fromP12(cert: CertificateDataFormat, name?: string, passphrase?: string): Certificate;
    /**
     * Creates a certificate object from the ARC's legacy certificate definition.
     *
     * @param index The legacy certificate index object. If it has set `_id` it will be used as the `key`.
     * @param index The certificate data object as read from the data store. Do not restore the data
     *              to its original format.
     */
    static fromLegacy(index: ARCCertificateIndex, cert: RequestCertificate): Certificate;
    constructor(certificate: HttpCertificate);
    /**
     * When needed it reads the certificate's original format.
     * @param data The certificate data.
     * @returns The restored certificate.
     */
    static fromStore(data: ICertificateData): ICertificateData;
    /**
     * Prepares certificate object to be stored in the data store.
     * If the `data` property is not string then it assumes buffer (either
     * Node's or ArrayBuffer). In this case it converts buffer to base64 string.
     * It also adds `type` property set to `buffer` for the `fromStore()`
     * function to recognize what to do with the data.
     *
     * Note, for optimization, PEM keys should be strings as the content of the
     * certificate is already a base62 string. To spare double base64 conversion
     * use string data.
     *
     * @param data The certificate data object.
     * @throws When data is not set
     */
    static toStore(data: ICertificateData): ICertificateData;
    toJSON(): HttpCertificate;
}
//# sourceMappingURL=ClientCertificate.d.ts.map