import * as ed25519 from '@noble/ed25519';
import { isSigner, } from '../../types';
import { DriverNotProvidedError } from '../../errors';
/**
 * @group Modules
 */
export class IdentityClient {
    constructor() {
        this._driver = null;
    }
    driver() {
        if (!this._driver) {
            throw new DriverNotProvidedError('IdentityDriver');
        }
        return this._driver;
    }
    setDriver(newDriver) {
        this._driver = newDriver;
    }
    get publicKey() {
        return this.driver().publicKey;
    }
    get secretKey() {
        return this.driver().secretKey;
    }
    signMessage(message) {
        return this.driver().signMessage(message);
    }
    signTransaction(transaction) {
        return this.driver().signTransaction(transaction);
    }
    signAllTransactions(transactions) {
        return this.driver().signAllTransactions(transactions);
    }
    verifyMessage(message, signature) {
        return ed25519.sync.verify(message, signature, this.publicKey.toBytes());
    }
    equals(that) {
        if (isSigner(that)) {
            that = that.publicKey;
        }
        return this.publicKey.equals(that);
    }
    hasSecretKey() {
        return this.secretKey != null;
    }
}
//# sourceMappingURL=IdentityClient.js.map