MCPcopy Index your code
hub / github.com/cameri/nostream / applyReverificationOutcome

Function applyReverificationOutcome

src/app/maintenance-worker.ts:37–71  ·  view source on GitHub ↗
(
  existing: Nip05Verification,
  outcome: Nip05VerificationOutcome,
)

Source from the content-addressed store, hash-verified

35 * immediately blocking publishing.
36 */
37export function applyReverificationOutcome(
38 existing: Nip05Verification,
39 outcome: Nip05VerificationOutcome,
40): Nip05Verification {
41 const now = new Date()
42 const base: Nip05Verification = {
43 ...existing,
44 lastCheckedAt: now,
45 updatedAt: now,
46 }
47
48 switch (outcome.status) {
49 case 'verified':
50 return {
51 ...base,
52 isVerified: true,
53 lastVerifiedAt: now,
54 failureCount: 0,
55 }
56 case 'mismatch':
57 case 'invalid':
58 return {
59 ...base,
60 isVerified: false,
61 lastVerifiedAt: null,
62 failureCount: existing.failureCount + 1,
63 }
64 case 'error':
65 default:
66 return {
67 ...base,
68 failureCount: existing.failureCount + 1,
69 }
70 }
71}
72
73export class MaintenanceWorker implements IRunnable {
74 private interval: NodeJS.Timeout | undefined

Calls

no outgoing calls

Tested by

no test coverage detected