import { KeyManager } from '../sdk/storage/keymanager';
import { Issuer } from 'did-jwt-vc';
import { PersistentStorageClean, StorageFactory } from '../sdk/storage/storage';
import { Name, API, NameType } from '@wharfkit/antelope';
import { TonomyUsername } from '../sdk/util/username';
import { LoginRequest } from '../sdk/util/request';
import { DataSharingRequest } from '../sdk/util';
import { AuthenticationMessage, Communication, Message } from '../sdk';
import { VerifiableCredential } from '../sdk/util/ssi/vc';
import { DIDurl } from '../sdk/util/ssi/types';
import { Signer } from '../sdk/services/blockchain/eosio/transaction';
import { IOnPressLoginOptions } from '../sdk/types/User';
/**
 * The storage data for an external user that has logged in with Tonomy ID
 *
 * @param {Name} accountName - the account name of the user
 * @param {TonomyUsername} [username] - the username of the user
 * @param {Name} appPermission - the account name of the app the user is logged in with
 * @param {string} did - the DID of the user
 */
export type ExternalUserStorage = {
    accountName: Name;
    username?: TonomyUsername;
    appPermission: Name;
    did: string;
};
export type VerifyLoginOptions = {
    checkKeys?: boolean;
    keyManager?: KeyManager;
    storageFactory?: StorageFactory;
};
export type LoginWithTonomyMessages = {
    loginRequest: LoginRequest;
    dataSharingRequest?: DataSharingRequest;
    loginToCommunication: AuthenticationMessage;
};
/**
 * An external user on a website that is being logged into by a Tonomy ID user
 *
 */
export declare class ExternalUser {
    keyManager: KeyManager;
    storage: ExternalUserStorage & PersistentStorageClean;
    did: string;
    communication: Communication;
    /**
     * Creates a new external user
     *
     * @param {KeyManager} _keyManager - the key manager to use for signing
     * @param {StorageFactory} _storageFactory - the storage factory to use for persistent storage
     */
    constructor(_keyManager: KeyManager, _storageFactory: StorageFactory);
    /**
     * Removes the keys and clear storage
     *
     */
    logout(): Promise<void>;
    /**
     * Retrieves the user from persistent storage if it exists and verifies the keys are valid
     *
     * @property {boolean} [options.autoLogout] - automatically logsout on error if this key is false
     * @property {StorageFactory} [options.storageFactory=browserStorageFactory] - the storage factory to use for persistent storage
     * @property {KeyManager} [options.keyManager=new JsKeyManager()] - the key manager to use for signing
     * @returns {Promise<ExternalUser>} - the user
     */
    static getUser(options?: {
        autoLogout?: boolean;
        storageFactory?: StorageFactory;
        keyManager?: KeyManager;
    }): Promise<ExternalUser>;
    /**
     * Returns the DID URL of the logged in user
     *
     * @returns {Promise<DIDurl>} - the DID of the user
     */
    getDid(): Promise<DIDurl>;
    /**
     * @returns {Promise{DIDurl}} the DID URL of the Tonomy ID wallet with #local fragment
     */
    getWalletDid(): Promise<DIDurl>;
    /**
     * Sets the account name of the user
     *
     * @param {Name} accountName - the account name of the user
     */
    private setAccountName;
    /**
     * Sets the username of the user
     *
     * @param {string} username - the username of the user
     */
    private setUsername;
    /**
     * Sets the permission name of the app the user is logged into
     *
     * @param {Name} appPermission - the account name of the app
     */
    private setAppPermission;
    /**
     * Gets the username of the user
     *
     * @returns {Promise<TonomyUsername>} - the username of the user
     */
    getUsername(): Promise<TonomyUsername | undefined>;
    /**
     * Gets the account name of the user
     *
     * @returns {Promise<Name>} - the account name of the user
     */
    getAccountName(): Promise<Name>;
    /**
     * Gets the permission name of the app the user is logged into
     *
     * @returns {Promise<Name>} - the account name of the app
     */
    getAppPermission(): Promise<Name>;
    /**
     * Redirects the user to login to the app with their Tonomy ID account
     *
     * @description should be called when the user clicks on the login button
     *
     * @param {IOnPressLoginOptions} onPressLoginOptions - options for the login
     * @property {boolean} onPressLoginOptions.redirect - if true, redirects the user to the login page, if false, returns the token
     * @property {string} onPressLoginOptions.callbackPath - the path to redirect the user to after login
     * @param {KeyManager} [keyManager] - the key manager to use to store the keys
     * @returns {Promise<LoginWithTonomyMessages | void>} - if redirect is true, returns void, if redirect is false, returns the login request in the form of a JWT token
     */
    static loginWithTonomy({ redirect, callbackPath, dataRequest }: IOnPressLoginOptions, keyManager?: KeyManager): Promise<LoginWithTonomyMessages | void>;
    /**
     * Returns the issuer of the user for use with did-jwt and VCs
     *
     * @returns {Promise<Issuer>} - the issuer of the user
     */
    getIssuer(): Promise<Issuer>;
    /**
     * Receives the login request from Tonomy ID and verifies the login was successful
     *
     * @description should be called in the callback page
     *
     * @param {VerifyLoginOptions} [options] - options for the login
     * @property {boolean} [options.checkKeys = true] - if true, checks the keys in the keyManager against the blockchain
     * @property {KeyManager} [options.keyManager] - the key manager to use to storage and manage keys
     * @property {StorageFactory} [options.storageFactory] - the storage factory to use to store data
     *
     * @returns {Promise<ExternalUser>} an external user object ready to use
     */
    static verifyLoginRequest(options?: VerifyLoginOptions): Promise<ExternalUser>;
    /**
     * Signs a Verifiable Credential
     *
     * @param {string} id - the id of the VC
     * @param {string | string[]} type - the type of the VC
     * @param {object} data - the data of the VC
     * @property {string} [options.subject] - the subject of the VC
     *
     * @returns {Promise<VerifiableCredential>} - the signed VC
     */
    signVc<T extends object = object>(id: string, type: string | string[], data: T, options?: {
        subject?: string;
    }): Promise<VerifiableCredential<T>>;
    /**
     * Return a signer to use to sign transactions
     *
     * @returns {Promise<Signer>} - the signer to use to sign transactions
     */
    getTransactionSigner(): Signer;
    /**
     * Signs a transaction and send it to the blockchain
     *
     * Note: It is signed with the permission of the current app
     * e.g. if user signed into app "marketcom", this will be the name of the permission used to sign the transaction
     *
     * Note: This is a convenience method that signs one action on one smart contract with the current
     * user's account and app permission. To sign a more complex transaction, get a signer with
     * getTransactionSigner() and use eosjs or @wharfkit/antelope directly
     *
     * @param {Name} contract - the smart contract account name
     * @param {Name} action - the action to sign (function of the smart contract)
     * @param {object} data - the data to sign
     *
     * @returns {Promise<API.v1.PushTransactionResponse>} - the signed transaction
     */
    signTransaction(contract: NameType | TonomyUsername, action: NameType, data: object): Promise<API.v1.PushTransactionResponse>;
    private checkLinkAuthRequirements;
    /**
     * Sends a message to another DID
     *
     * @param {Message} message - the message to send
     */
    sendMessage(message: Message): Promise<void>;
    private loginToCommunication;
}
//# sourceMappingURL=externalUser.d.ts.map