Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mahmoud/eng-4642-sats-connect-signmessage-let-developers-select-the-signature #30

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
aryzing marked this conversation as resolved.
Show resolved Hide resolved
});
export type SignMessageResult = v.InferOutput<typeof signMessageResultSchema>;
export const signMessageRequestMessageSchema = v.object({
Expand Down