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

Feat Support Keystone 3 Pro #393

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
fix: keystone sdk signature check
keystoneGithub committed Jan 9, 2025
commit 6ec2c65fa1a3f3fdbafd5236e59cec094e0db88f
3 changes: 3 additions & 0 deletions keystone/btcMessageSigning.ts
Original file line number Diff line number Diff line change
@@ -43,6 +43,9 @@ const createMessageSignature = async (
psbtToSign.addOutput({ script: Buffer.from('6a', 'hex'), value: 0 });
const signatures = await app.signPsbt(psbtToSign.toBase64());
for (const signature of signatures) {
if (!signature[1]) {
continue;
}
if (isSegwit) {
psbtToSign.updateInput(signature[0], {
partialSig: [signature[1]],
10 changes: 8 additions & 2 deletions transactions/bitcoin/context.ts
Original file line number Diff line number Diff line change
@@ -544,6 +544,9 @@ export class KeystoneP2wpkhAddressContext extends P2wpkhAddressContext {
const cleanedSignatures = this.cleanPsbtSig(psbtBase64, signatures);

for (const signature of cleanedSignatures) {
if (!signature[1]) {
continue;
}
transaction.updateInput(signature[0], {
partialSig: [[signature[1].pubkey, signature[1].signature]],
});
@@ -572,7 +575,7 @@ export class KeystoneP2wpkhAddressContext extends P2wpkhAddressContext {
return psbtObj.toBase64();
}

cleanPsbtSig(psbtBase64: string, signatures: [number, PartialSignature][]) {
cleanPsbtSig(psbtBase64: string, signatures: [number, PartialSignature | undefined][]) {
const results = [];
const path = 84;

@@ -845,6 +848,9 @@ export class KeystoneP2trAddressContext extends P2trAddressContext {
const cleanedSignatures = this.cleanPsbtSig(psbtBase64, signatures);

for (const signature of cleanedSignatures) {
if (!signature[1]) {
continue;
}
transaction.updateInput(signature[0], {
tapKeySig: signature[1].signature,
});
@@ -873,7 +879,7 @@ export class KeystoneP2trAddressContext extends P2trAddressContext {
return psbtObj.toBase64();
}

cleanPsbtSig(psbt: string, signatures: [number, PartialSignature][]) {
cleanPsbtSig(psbt: string, signatures: [number, PartialSignature | undefined][]) {
const results = [];
const path = 86;