import './tap-encryption-extension';
import '@iotize/tap/service/impl/group';
import '@iotize/tap/service/impl/interface';
import { Encoder } from '@iotize/common/converter/api';
import { Tap } from '@iotize/tap';
import { ScramLoginResponseBody } from '@iotize/tap/service/impl/scram';
import { AuthMethod, UsernamePassword } from './definitions';
export declare type InputDataType = Uint8Array | string;
export declare namespace ScramAuth {
    interface ConstantKeys {
        storedKey: Uint8Array;
        serverKey: Uint8Array;
        saltedPassword: Uint8Array;
        hashedPassword: Uint8Array;
    }
    interface Keys extends ConstantKeys {
        clientProof: Uint8Array;
        serverProof: Uint8Array;
    }
    interface SessionData {
        key?: Uint8Array;
        clientNonce?: number;
        storedKey?: Uint8Array;
        serverKey?: Uint8Array;
    }
}
export declare function DEFAULT_SCRAM_SALT_GENERATOR(): Uint8Array;
export declare class ScramAuth implements AuthMethod<UsernamePassword, ScramAuth.SessionData> {
    protected tap: Tap;
    static CRC_LENGTH: number;
    static CLIENT_NONCE_SIZE: number;
    static SERVER_NONCE_SIZE: number;
    static ITERATION_NUMBER_SIZE: number;
    static COMMUNICATION_KEY_LABEL: string;
    static CLIENT_KEY_LABEL: string;
    static SERVER_KEY_LABEL: string;
    static KEY_SIZE: number;
    static CLIENT_KEY_ITERATION_NUMBER: number;
    static SERVER_KEY_ITERATION_NUMBER: number;
    static USER_SALT_SIZE: number;
    static SCRAM_PASSWORD_LENGTH: number;
    nonceGenerator: () => number;
    saltGenerator: () => Uint8Array;
    static stringConverter: Encoder<string, Uint8Array>;
    constructor(tap: Tap);
    changePassword(newPassword: string, groupId: number, salt?: Uint8Array): Promise<void>;
    /**
     * Perform login
     *
     * @param params
     *
     * @throws Error if scram is not activated
     */
    login(params: UsernamePassword): Promise<ScramAuth.SessionData>;
    static createScramPasswordKey(newPassword: string, options: {
        salt: Uint8Array;
        iterationNumber: number;
    }): Uint8Array;
    static computeBaseKeys(password: string, options: {
        salt: Uint8Array;
        iterationNumber: number;
    }): ScramAuth.ConstantKeys;
    static computeKeys(credentials: UsernamePassword, loginBody: ScramLoginResponseBody, clientNonce: number): ScramAuth.Keys;
    logout(): Promise<any>;
    static clientProof(storedKey: Uint8Array, clientNonce: number, serverNonce: number): Uint8Array;
    static serverProof(serverKey: Uint8Array, clientNonce: number, serverNonce: number): Uint8Array;
    generateNonce(): number;
    /**
     * SaltedPwd = PBKDF2 ( HashedPassword, UserSalt, ItCnt )
     * @param password
     * @param userSalt
     * @param iteration
     */
    static saltedPassword(hashedPassword: InputDataType, userSalt: InputDataType, iterations: number): Uint8Array;
    /**
     * ClientKey = HMAC ( SaltedPwd | « ClientKey »)
     * @param saltedPassword
     */
    /**
     * StoredKey = H ( ClientKey )
     * @param saltedPassword
     */
    static storedKey(saltedPassword: InputDataType): Uint8Array;
    static serverKey(saltedPassword: InputDataType): Uint8Array;
    private static HASH;
    /**
     * ClientSignature = HMAC ( StoredKey | ClientNonce | ServerNonce )
     * @param key
     * @param nonce1
     * @param nonce2
     */
    static computeProof(key: Uint8Array, nonce1: number, nonce2: number): Uint8Array;
    /**
     * ClientProofCheck = StoredKey ^ ClientProof
     * @param storedKey
     * @param clientProof
     */
    static clientProofCheck(storedKey: Uint8Array, clientProof: Uint8Array): Uint8Array;
    /**
     * CommunicationKey = H ( ClientNonce | ServerNonce | StoredKey | « CommunicationKey » )
     * @param clientNonce
     * @param serverNonce
     * @param storedKey
     */
    static computeSessionKey(clientNonce: number, serverNonce: number, userSalt: Uint8Array, serverKey: Uint8Array, storedKey: Uint8Array): Uint8Array;
    /**
     *
     * @param input
     */
    static encodeLabel(input: string): Uint8Array;
}
