Skip to content

Commit

Permalink
Merge pull request #30 from secretkeylabs/mahmoud/eng-4642-sats-conne…
Browse files Browse the repository at this point in the history
…ct-signmessage-let-developers-select-the-signature

mahmoud/eng-4642-sats-connect-signmessage-let-developers-select-the-signature
  • Loading branch information
m-aboelenein authored Jul 16, 2024
2 parents 997aa7e + eeb584a commit c8d4614
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sats-connect/core",
"version": "0.1.0",
"version": "0.1.1",
"main": "dist/index.mjs",
"module": "dist/index.mjs",
"types": "dist/index.d.mts",
Expand Down
2 changes: 2 additions & 0 deletions src/messages/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { MessageSigningProtocols } from 'src/request';
import type { RequestOptions, RequestPayload } from '../types';

export interface SignMessagePayload extends RequestPayload {
address: string;
message: string;
protocol?: MessageSigningProtocols;
}

export type SignMessageResponse = string;
Expand Down
14 changes: 14 additions & 0 deletions src/request/types/btcMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export type GetAddresses = MethodParamsAndResult<
>;

export const signMessageMethodName = 'signMessage';

export enum MessageSigningProtocols {
ECDSA = 'ECDSA',
BIP322 = 'BIP322',
}

export const signMessageParamsSchema = v.object({
/**
* The address used for signing.
Expand All @@ -85,6 +91,10 @@ export const signMessageParamsSchema = v.object({
* The message to sign.
**/
message: v.string(),
/**
* The protocol to use for signing the message.
*/
protocol: v.optional(v.enum(MessageSigningProtocols)),
});
export type SignMessageParams = v.InferOutput<typeof signMessageParamsSchema>;
export const signMessageResultSchema = v.object({
Expand All @@ -100,6 +110,10 @@ export const signMessageResultSchema = v.object({
* The address used for signing.
*/
address: v.string(),
/**
* The protocol to use for signing the message.
*/
protocol: v.enum(MessageSigningProtocols),
});
export type SignMessageResult = v.InferOutput<typeof signMessageResultSchema>;
export const signMessageRequestMessageSchema = v.object({
Expand Down

0 comments on commit c8d4614

Please sign in to comment.