import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
import type { ToJSONSerializable } from '../../lib/utils/json.ts';
import type { HTTPSignedField } from '../../lib/http-server/common.js';
import type { Signable } from '../../lib/utils/signing.js';
import { KeetaAnchorCertificateRequiredError, KeetaAnchorUserError } from '../../lib/error.js';
export * from './common.generated.js';
export declare const USERNAME_DELIMITER = "$";
export declare const USERNAME_MIN_LENGTH = 1;
export declare const USERNAME_MAX_LENGTH = 256;
export type UsernameValidationReason = 'length' | 'latin1';
export interface UsernameValidationIssue {
    reason: UsernameValidationReason;
    message: string;
}
type ValidateUsernameOptions = {
    pattern?: string | RegExp | undefined;
    fieldPath?: string;
};
export declare function validateUsernameDefault(username: string, options?: ValidateUsernameOptions): void;
export type KeetaNetAccount = InstanceType<typeof KeetaNetLib.Account>;
export type GloballyIdentifiableUsername = `${string}${typeof USERNAME_DELIMITER}${string}`;
export interface UsernameComponents {
    username: string;
    providerID: string;
}
export interface KeetaUsernameAnchorAccountResolutionContext {
    account: KeetaNetAccount;
}
export interface KeetaUsernameAnchorUsernameResolutionContext {
    username: string;
}
export interface KeetaUsernameAnchorSearchRequestParameters {
    search: string;
}
export interface KeetaUsernameAnchorUsernameWithAccount {
    username: string;
    account: KeetaNetAccount;
}
export type KeetaUsernameAnchorSearchResponse = ({
    ok: true;
    results: KeetaUsernameAnchorUsernameWithAccount[];
}) | ({
    ok: false;
    error: string;
});
export type KeetaUsernameAnchorSearchResponseJSON = ToJSONSerializable<KeetaUsernameAnchorSearchResponse>;
export type KeetaUsernameAnchorResolveResponse = ({
    ok: true;
} & KeetaUsernameAnchorUsernameWithAccount) | ({
    ok: false;
    error: string;
});
export type KeetaUsernameAnchorResolveResponseJSON = ToJSONSerializable<KeetaUsernameAnchorResolveResponse>;
export interface KeetaUsernameAnchorClaimContext {
    username: string;
    account: KeetaNetAccount;
    fromUser: KeetaNetAccount | null;
}
export interface KeetaUsernameAnchorClaimRequestPayload {
    transfer?: Pick<TransferUsernameOwnershipSignablePayload, 'from'> & {
        signed: HTTPSignedField;
    };
    username: string;
    account: KeetaNetAccount;
}
export interface KeetaUsernameAnchorClaimRequest extends KeetaUsernameAnchorClaimRequestPayload {
    signed: HTTPSignedField;
}
export type KeetaUsernameAnchorClaimRequestJSON = ToJSONSerializable<KeetaUsernameAnchorClaimRequest>;
export type KeetaUsernameAnchorClaimResponseJSON = ({
    ok: true;
}) | ({
    ok: false;
    error: string;
});
export interface KeetaUsernameAnchorReleaseRequestPayload {
    account: KeetaNetAccount;
}
export interface KeetaUsernameAnchorReleaseRequest extends KeetaUsernameAnchorReleaseRequestPayload {
    signed: HTTPSignedField;
}
export type KeetaUsernameAnchorReleaseRequestJSON = ToJSONSerializable<KeetaUsernameAnchorReleaseRequest>;
export type KeetaUsernameAnchorReleaseResponseJSON = ({
    ok: true;
}) | ({
    ok: false;
    error: string;
});
export declare function formatGloballyIdentifiableUsername(providerIssuedName: string, providerID: string): GloballyIdentifiableUsername;
export declare function isGloballyIdentifiableUsername(input: unknown): input is GloballyIdentifiableUsername;
export declare function parseGloballyIdentifiableUsername(input: GloballyIdentifiableUsername): UsernameComponents;
export declare function getUsernameClaimSignable(request: KeetaUsernameAnchorClaimRequestPayload): Signable;
export interface TransferUsernameOwnershipSignablePayload {
    username: string;
    to: KeetaNetAccount;
    from: KeetaNetAccount;
}
export declare function getUsernameTransferSignable(payload: TransferUsernameOwnershipSignablePayload): Signable;
export declare function getUsernameReleaseSignable(payload: KeetaUsernameAnchorReleaseRequestPayload): Signable;
interface KeetaUsernameAnchorUsernameAlreadyTakenErrorProperties {
    username: string;
}
type KeetaUsernameAnchorUsernameAlreadyTakenErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaUsernameAnchorUsernameAlreadyTakenErrorProperties;
declare class KeetaUsernameAnchorUsernameAlreadyTakenError extends KeetaAnchorUserError implements KeetaUsernameAnchorUsernameAlreadyTakenErrorProperties {
    static readonly name: string;
    private readonly KeetaUsernameAnchorUsernameAlreadyTakenErrorObjectTypeID;
    private static readonly KeetaUsernameAnchorUsernameAlreadyTakenErrorObjectTypeID;
    readonly logLevel = "INFO";
    readonly username: string;
    constructor(properties: KeetaUsernameAnchorUsernameAlreadyTakenErrorProperties, message?: string);
    static isInstance(input: unknown): input is KeetaUsernameAnchorUsernameAlreadyTakenError;
    toJSON(): KeetaUsernameAnchorUsernameAlreadyTakenErrorJSON;
    static fromJSON(input: unknown): Promise<KeetaUsernameAnchorUsernameAlreadyTakenError>;
}
interface KeetaUsernameAnchorUserNotFoundErrorProperties {
    username?: string | undefined;
    account?: KeetaNetAccount | undefined;
}
type KeetaUsernameAnchorUserNotFoundErrorJSON = ReturnType<KeetaAnchorUserError['toJSON']> & KeetaUsernameAnchorUserNotFoundErrorProperties;
declare class KeetaUsernameAnchorUserNotFoundError extends KeetaAnchorUserError implements KeetaUsernameAnchorUserNotFoundErrorProperties {
    static readonly name: string;
    private readonly KeetaUsernameAnchorUserNotFoundErrorObjectTypeID;
    private static readonly KeetaUsernameAnchorUserNotFoundErrorObjectTypeID;
    readonly logLevel = "INFO";
    readonly username: string | undefined;
    readonly account: KeetaNetAccount | undefined;
    constructor(properties: KeetaUsernameAnchorUserNotFoundErrorProperties, message?: string);
    static isInstance(input: unknown): input is KeetaUsernameAnchorUserNotFoundError;
    toJSON(): KeetaUsernameAnchorUserNotFoundErrorJSON;
    static fromJSON(input: unknown): Promise<KeetaUsernameAnchorUserNotFoundError>;
}
export declare const Errors: {
    UsernameAlreadyTaken: typeof KeetaUsernameAnchorUsernameAlreadyTakenError;
    UserNotFound: typeof KeetaUsernameAnchorUserNotFoundError;
    CertificateRequired: typeof KeetaAnchorCertificateRequiredError;
};
//# sourceMappingURL=common.d.ts.map