( existing: Nip05Verification, outcome: Nip05VerificationOutcome, )
| 35 | * immediately blocking publishing. |
| 36 | */ |
| 37 | export 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 | |
| 73 | export class MaintenanceWorker implements IRunnable { |
| 74 | private interval: NodeJS.Timeout | undefined |
no outgoing calls
no test coverage detected