diff --git a/README.md b/README.md index 7aefbde..827fafc 100644 --- a/README.md +++ b/README.md @@ -261,6 +261,7 @@ Please have a look a the Alby OAuth2 Wallet API: - accountBalance - accountSummary +- signMessage - accountInformation - accountValue4Value - invoices diff --git a/src/client.ts b/src/client.ts index 841c0da..caa52da 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,3 +1,4 @@ +import { SignMessageResponse } from "@webbtc/webln-types"; import { OAuth2Bearer } from "./auth"; import { keysendParamsFromBoostagram } from "./helpers"; import { RequestOptions, rest } from "./request"; @@ -20,6 +21,7 @@ import { SendPaymentResponse, SendBoostagramToAlbyRequestParams, SwapInfoResponse, + SignMessageRequestParams, } from "./types"; export class Client { @@ -52,6 +54,20 @@ export class Client { }); } + signMessage( + message: SignMessageRequestParams, + request_options?: Partial, + ): Promise { + return rest({ + auth: this.auth, + ...this.defaultRequestOptions, + ...request_options, + endpoint: `/signatures`, + request_body: message, + method: "POST", + }); + } + accountSummary( // eslint-disable-next-line @typescript-eslint/ban-types params: {}, diff --git a/src/types.ts b/src/types.ts index e730bb0..6d579ee 100644 --- a/src/types.ts +++ b/src/types.ts @@ -255,6 +255,10 @@ export type GetAccountBalanceResponse = { unit: string; }; +export type SignMessageRequestParams = { + message: string; +}; + export type GetAccountInformationResponse = { identifier: string; email: string;