fix: use inner created_at timestamp nip17

This commit is contained in:
2024-09-22 15:46:26 +01:00
parent a6e6e0a632
commit baed390beb
4 changed files with 4 additions and 3 deletions

View File

@ -98,7 +98,7 @@ export class EventBuilder {
pubkey: this.#pubkey ?? "",
content: this.#content ?? "",
kind: this.#kind,
created_at: (this.#createdAt ?? unixNow()) + (this.#jitter ? jitter(this.#jitter) : 0),
created_at: (this.#createdAt ?? unixNow()) - (this.#jitter ? jitter(this.#jitter) : 0),
tags: this.#tags.sort((a, b) => a[0].localeCompare(b[0])),
} as NostrEvent;
ev.id = EventExt.createId(ev);

View File

@ -314,6 +314,7 @@ export class EventPublisher {
eb.pow(powTarget, powMiner);
}
eb.content(await signer.nip44Encrypt(JSON.stringify(inner), pTag));
eb.jitter(60 * 60 * 24);
return await eb.buildAndSign(secret);
}