import * as KeetaNetClient from '@keetanetwork/keetanet-client';
import { Buffer } from './utils/buffer.js';
import type { CertificateAttributeValue } from '../services/kyc/iso20022.generated.js';
import { SensitiveAttribute, type CertificateAttributeNames } from './sensitive-attribute.js';
export { SensitiveAttribute } from './sensitive-attribute.js';
export type { CertificateAttributeNames } from './sensitive-attribute.js';
/**
 * Short alias for the KeetaNetAccount type
 */
declare const KeetaNetAccount: typeof KeetaNetClient.lib.Account;
type AccountKeyAlgorithm = InstanceType<typeof KeetaNetClient.lib.Account>['keyType'];
/**
 * An alias for the KeetaNetAccount type
 */
type KeetaNetAccount = ReturnType<typeof KeetaNetClient.lib.Account.fromSeed<AccountKeyAlgorithm>>;
type BaseCertificateClass = typeof KeetaNetClient.lib.Utils.Certificate.Certificate;
type BaseCertificate = InstanceType<BaseCertificateClass>;
declare const BaseCertificate: BaseCertificateClass;
type BaseCertificateBuilderClass = typeof KeetaNetClient.lib.Utils.Certificate.CertificateBuilder;
type BaseCertificateBuilder = InstanceType<BaseCertificateBuilderClass>;
declare const BaseCertificateBuilder: BaseCertificateBuilderClass;
declare function assertCertificateAttributeNames(name: string): asserts name is CertificateAttributeNames;
type BaseCertificateBuilderParams = NonNullable<ConstructorParameters<BaseCertificateBuilderClass>[0]>;
type CertificateBuilderParams = Required<Pick<BaseCertificateBuilderParams, 'issuer' | 'validFrom' | 'validTo' | 'serial' | 'hashLib' | 'issuerDN' | 'subjectDN' | 'isCA'> & {
    /**
     * The key of the subject -- used for Sensitive Attributes as well
     * as the certificate Subject
     */
    subject: BaseCertificateBuilderParams['subjectPublicKey'];
}>;
type CertificateAttributeInput<NAME extends CertificateAttributeNames> = CertificateAttributeValue<NAME>;
export declare class CertificateBuilder extends BaseCertificateBuilder {
    #private;
    /**
     * Map the parameters from the public interface to the internal
     * (Certificate library) interface
     */
    private static mapParams;
    constructor(params?: Partial<CertificateBuilderParams>);
    /**
     * Set a KYC Attribute to a given value.
     * The sensitive flag is required.
     *
     * If an attribute is marked sensitive, the value is encoded
     * into the certificate using a commitment scheme so that the
     * value can be proven later without revealing it.
     */
    setAttribute<NAME extends CertificateAttributeNames>(name: NAME, sensitive: boolean, value: CertificateAttributeInput<NAME>): void;
    /**
     * Set a pre-built SensitiveAttribute for a given attribute name.
     *
     * The attribute must have been encrypted for this certificate's subject.
     *
     * @throws Error if the attribute was encrypted for a different subject
     */
    setSensitiveAttribute<NAME extends CertificateAttributeNames>(name: NAME, attribute: SensitiveAttribute<CertificateAttributeValue<NAME>>): void;
    protected addExtensions(...args: Parameters<BaseCertificateBuilder['addExtensions']>): ReturnType<BaseCertificateBuilder['addExtensions']>;
    /**
     * Create a Certificate object from the builder
     *
     * The parameters passed in are merged with the parameters passed in
     * when constructing the builder
     */
    build(params?: Partial<CertificateBuilderParams>): Promise<Certificate>;
}
export declare class Certificate extends BaseCertificate {
    private readonly subjectKey;
    static readonly Builder: typeof CertificateBuilder;
    static readonly SharableAttributes: typeof SharableCertificateAttributes;
    /**
     * User KYC Attributes
     */
    readonly attributes: {
        [name in CertificateAttributeNames]?: {
            sensitive: true;
            value: SensitiveAttribute<CertificateAttributeValue<name>>;
        } | {
            sensitive: false;
            value: ArrayBuffer;
        };
    };
    constructor(input: ConstructorParameters<BaseCertificateClass>[0], options?: ConstructorParameters<BaseCertificateClass>[1] & {
        subjectKey?: KeetaNetAccount;
    });
    protected finalizeConstruction(): void;
    private setPlainAttribute;
    private setSensitiveAttribute;
    /**
     * Get the underlying value for an attribute.
     *
     * If the attribute is sensitive, this will decrypt it using the
     * subject's private key, otherwise it will return the value.
     */
    getAttributeValue<NAME extends CertificateAttributeNames>(attributeName: NAME): Promise<CertificateAttributeValue<NAME>>;
    protected processExtension(id: string, value: ArrayBuffer): boolean;
}
export declare namespace SharableCertificateAttributesTypes {
    type ExportOptions = {
        /**
         * Format of the exported data
         * - 'string': PEM-encoded string
         * - 'arraybuffer': raw ArrayBuffer
         */
        format?: 'string' | 'arraybuffer';
    };
    type ImportOptions = {
        /**
         * Principals that will be used to try to access the
         * encrypted contents of the sharable certificate
         */
        principals?: Set<KeetaNetAccount> | KeetaNetAccount[] | KeetaNetAccount | null;
    };
    type ContentsSchema = {
        certificate: string;
        intermediates?: string[] | undefined;
        attributes: {
            [name: string]: {
                sensitive: true;
                value: Awaited<ReturnType<SensitiveAttribute['getProof']>>;
                references?: {
                    [id: string]: string;
                };
            } | {
                sensitive: false;
                value: string;
                references?: {
                    [id: string]: string;
                };
            };
        };
    };
}
type SharableCertificateAttributesExportOptions = SharableCertificateAttributesTypes.ExportOptions;
type SharableCertificateAttributesImportOptions = SharableCertificateAttributesTypes.ImportOptions;
export declare class SharableCertificateAttributes {
    #private;
    private container;
    private populatedFromInit;
    static assertCertificateAttributeName: typeof assertCertificateAttributeNames;
    constructor(input: ArrayBuffer | Buffer | string, options?: SharableCertificateAttributesImportOptions);
    /**
     * Create a SharableCertificateAttributes from a Certificate
     * and a list of attribute names to include -- if no list is
     * provided, all attributes are included.
     */
    static fromCertificate(certificate: Certificate, intermediates?: Set<BaseCertificate>, attributeNames?: CertificateAttributeNames[]): Promise<SharableCertificateAttributes>;
    /** @deprecated Use the overload with three parameters instead */
    static fromCertificate(certificate: Certificate, attributeNames?: CertificateAttributeNames[]): Promise<SharableCertificateAttributes>;
    grantAccess(principal: KeetaNetAccount): Promise<this>;
    revokeAccess(principal: KeetaNetAccount): Promise<this>;
    get principals(): KeetaNetAccount[];
    getCertificate(): Promise<Certificate>;
    /**
     * Get the intermediate certificates included in this sharable
     * certificate container
     *
     * @return A set of BaseCertificate objects representing the
     *         intermediate certificates attached to this container
     */
    getIntermediates(): Promise<Set<BaseCertificate>>;
    getAttributeBuffer(name: string): Promise<ArrayBuffer | undefined>;
    getAttribute<NAME extends CertificateAttributeNames>(name: NAME): Promise<CertificateAttributeValue<NAME> | undefined>;
    getAttributeNames(includeUnknown: true): Promise<string[]>;
    getAttributeNames(includeUnknown?: false): Promise<CertificateAttributeNames[]>;
    export(options?: Omit<SharableCertificateAttributesExportOptions, 'format'> & {
        format?: never;
    }): Promise<ArrayBuffer>;
    export(options: (Omit<SharableCertificateAttributesExportOptions, 'format'> & {
        format: 'arraybuffer';
    })): Promise<ArrayBuffer>;
    export(options: Omit<SharableCertificateAttributesExportOptions, 'format'> & {
        format: 'string';
    }): Promise<string>;
    export(options?: SharableCertificateAttributesExportOptions): Promise<ArrayBuffer | string>;
}
//# sourceMappingURL=certificates.d.ts.map