mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
get rid of create-hash, use noble hashes.
This commit is contained in:
6
event.ts
6
event.ts
@@ -1,7 +1,7 @@
|
||||
import {Buffer} from 'buffer'
|
||||
// @ts-ignore
|
||||
import createHash from 'create-hash'
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {sha256} from '@noble/hashes/sha256'
|
||||
|
||||
export type Event = {
|
||||
id?: string
|
||||
@@ -35,9 +35,7 @@ export function serializeEvent(evt: Event): string {
|
||||
}
|
||||
|
||||
export function getEventHash(event: Event): string {
|
||||
let eventHash = createHash('sha256')
|
||||
.update(Buffer.from(serializeEvent(event)))
|
||||
.digest()
|
||||
let eventHash = sha256(Buffer.from(serializeEvent(event)))
|
||||
return Buffer.from(eventHash).toString('hex')
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
"@scure/bip32": "^1.1.1",
|
||||
"@scure/bip39": "^1.1.0",
|
||||
"browserify-cipher": ">=1",
|
||||
"buffer": ">=5",
|
||||
"create-hash": "^1.2.0",
|
||||
"buffer": "^6.0.3",
|
||||
"websocket-polyfill": "^0.0.3"
|
||||
},
|
||||
"keywords": [
|
||||
|
||||
Reference in New Issue
Block a user