nip04: functions shouldn't be async.

This commit is contained in:
fiatjaf 2025-04-02 10:19:27 -03:00
parent cbe3a9d683
commit 2a11c9ec91
3 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@nostr/tools",
"version": "2.11.1",
"version": "2.11.2",
"exports": {
".": "./index.ts",
"./core": "./core.ts",

View File

@ -5,7 +5,7 @@ import { base64 } from '@scure/base'
import { utf8Decoder, utf8Encoder } from './utils.ts'
export async function encrypt(secretKey: string | Uint8Array, pubkey: string, text: string): Promise<string> {
export function encrypt(secretKey: string | Uint8Array, pubkey: string, text: string): string {
const privkey: string = secretKey instanceof Uint8Array ? bytesToHex(secretKey) : secretKey
const key = secp256k1.getSharedSecret(privkey, '02' + pubkey)
const normalizedKey = getNormalizedX(key)
@ -21,7 +21,7 @@ export async function encrypt(secretKey: string | Uint8Array, pubkey: string, te
return `${ctb64}?iv=${ivb64}`
}
export async function decrypt(secretKey: string | Uint8Array, pubkey: string, data: string): Promise<string> {
export function decrypt(secretKey: string | Uint8Array, pubkey: string, data: string): string {
const privkey: string = secretKey instanceof Uint8Array ? bytesToHex(secretKey) : secretKey
let [ctb64, ivb64] = data.split('?iv=')
let key = secp256k1.getSharedSecret(privkey, '02' + pubkey)

View File

@ -1,7 +1,7 @@
{
"type": "module",
"name": "nostr-tools",
"version": "2.11.1",
"version": "2.11.2",
"description": "Tools for making a Nostr client.",
"repository": {
"type": "git",