"use strict";
|
Object.defineProperty(exports, "__esModule", { value: true });
|
exports.BaseSigner = void 0;
|
class BaseSigner {
|
_auth;
|
_config;
|
constructor(auth, config) {
|
this._auth = auth;
|
this._config = config;
|
}
|
get auth() {
|
return this._auth;
|
}
|
get config() {
|
return this._config;
|
}
|
get publicKey() {
|
return this.auth.getPublicKey(this.config.publicKey.isCompressed);
|
}
|
get publicKeyHash() {
|
return this.config.publicKey.hash(this.publicKey);
|
}
|
setAuth(auth) {
|
this._auth = auth;
|
}
|
setConfig(config) {
|
this._config = config;
|
}
|
signArbitrary(message) {
|
const signature = this.auth.sign(this.config.message.hash(message));
|
return this.config.signature.toCompact(signature, this.auth.algo);
|
}
|
verifyArbitrary(message, signature) {
|
if (!this.auth.verify) {
|
throw new Error("verify method is not implemented yet");
|
}
|
return this.auth.verify(this.config.message.hash(message), this.config.signature.fromCompact(signature, this.auth.algo));
|
}
|
}
|
exports.BaseSigner = BaseSigner;
|
//# sourceMappingURL=base-signer.js.map
|