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

fix: add signSchnorr to keychain api #171

Merged
merged 1 commit into from
Nov 13, 2024
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
16 changes: 16 additions & 0 deletions features/keychain/api/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,21 @@ describe('keychain api', () => {
'3045022100f3aab0f6b44f62ef387050c86fb79bacabb36b254d3017d83dc801b8e72ad58602202339bf7576cb07eadd82c9ce97d5c117ceeaa3d0b990695ae9f6e7659f535fac'
)
})

test('signSchnorr signs binary data', async () => {
const data = await hash('sha256', "Batman's identity was revealed as Harvey Dent")
const signature = await api.secp256k1.signSchnorr({
seedId,
keyId,
data,
extraEntropy: Buffer.from(
'1230000000000000000000000000000000000000000000000000000000000000',
'hex'
),
})
expect(Buffer.from(signature).toString('hex')).toBe(
'd8a41b022fab008d1d8bc32ce99dd16a4edae37da691047b3729d626c47d6e0850f78245656bc0edccf6002936b96fe04bb4553be5334cf425ac94ca2da33a2e'
)
})
})
})
1 change: 1 addition & 0 deletions features/keychain/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const createKeychainApi = ({ keychain }) => {
},
secp256k1: {
signBuffer: keychain.secp256k1.signBuffer,
signSchnorr: keychain.secp256k1.signSchnorr,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a type added to index.d.ts as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding them now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forgot to mention I added in #174.

},
},
}
Expand Down
Loading