(args: {
message: string;
derivationPath: string;
encoding?: BufferEncoding | 'base58';
})
| 612 | } |
| 613 | |
| 614 | async signMessage(args: { |
| 615 | message: string; |
| 616 | derivationPath: string; |
| 617 | encoding?: BufferEncoding | 'base58'; |
| 618 | }): Promise<CWCTypes.Message.ISignedMessage> { |
| 619 | const { message, derivationPath, encoding } = args; |
| 620 | |
| 621 | if (!this.client) { |
| 622 | await this.getClient({ mustExist: true }); |
| 623 | } |
| 624 | const password = await this.getPasswordWithRetry(); |
| 625 | const chain = this.client.credentials.chain; |
| 626 | |
| 627 | if (this.#walletData.key instanceof TssKey.TssKey) { |
| 628 | const messageHash = Message.getMessageHash({ chain, message }) as Buffer; |
| 629 | return this._signMessageWithTss({ messageHash, derivationPath, password, encoding }); |
| 630 | } |
| 631 | |
| 632 | const hdPrivateKey = this.#walletData.key.get(password).xPrivKey; |
| 633 | const fullDerivationPath = this.client.getRootPath() + derivationPath.replace('m', ''); |
| 634 | return Message.signMessageWithPath({ chain, message, derivationPath: fullDerivationPath, hdPrivateKey, encoding }); |
| 635 | } |
| 636 | |
| 637 | async _signMessageWithTss(args: { |
| 638 | messageHash: Buffer; |
nothing calls this directly
no test coverage detected