Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chmac committed Aug 9, 2024
1 parent 70256f7 commit f96c3a4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions validation/repost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ console.log(`connecting to ${RELAY}…`);
const relay = await Relay.connect(RELAY);
console.log(`connected to ${relay.url}`);

/**
* Does this event meet our requirements for automated validation?
*
* Check things like, is the event signed by the pubkey which is linked to the
* correct trustroots profile.
*/
function validateEvent(event: Event) {
if (!event.kind == MAP_NOTE_KIND) {
return false;
Expand All @@ -32,6 +38,9 @@ async function publishEvent(event: VerifiedEvent) {
await relay.publish(event);
}

/**
* Take a nostr event that was signed by a user and generate the repost event.
*/
function generateRepostedEvent(originalEvent: Event, privateKey: Uint8Array) {
const derivedTags = deriveTags(originalEvent);
const derivedContent = deriveContent(originalEvent);
Expand All @@ -57,6 +66,9 @@ function deriveContent(event: Event): string {
return event.content;
}

/**
* Create the filters to listen for events that we want to repost
*/
function createFilter(isDev: true | undefined): nostrTools.Filter {
const baseFilter: nostrTools.Filter = {
kinds: [MAP_NOTE_KIND],
Expand Down

0 comments on commit f96c3a4

Please sign in to comment.