Rename signEvent to getSignature

This commit is contained in:
Alex Gleason
2023-04-23 11:12:44 -05:00
parent 55ff796b9f
commit 9a3e05ce5f
5 changed files with 17 additions and 16 deletions

View File

@@ -5,7 +5,7 @@ const {
getEventHash,
validateEvent,
verifySignature,
signEvent,
getSignature,
getPublicKey,
Kind
} = require('./lib/nostr.cjs')
@@ -281,8 +281,8 @@ describe('Event', () => {
})
})
describe('signEvent', () => {
it('should sign an event object', () => {
describe('getSignature', () => {
it('should produce the correct signature for an event object', () => {
const privateKey =
'd217c1ff2f8a65c3e3a1740db3b9f58b8c848bb45e26d00ed4714e4a0f4ceecf'
const publicKey = getPublicKey(privateKey)
@@ -295,7 +295,7 @@ describe('Event', () => {
pubkey: publicKey
}
const sig = signEvent(unsignedEvent, privateKey)
const sig = getSignature(unsignedEvent, privateKey)
// verify the signature
const isValid = verifySignature({
@@ -324,7 +324,7 @@ describe('Event', () => {
pubkey: publicKey
}
const sig = signEvent(unsignedEvent, wrongPrivateKey)
const sig = getSignature(unsignedEvent, wrongPrivateKey)
// verify the signature
const isValid = verifySignature({