(event: Event)
| 237 | } |
| 238 | |
| 239 | export const getEventExpiration = (event: Event): number | undefined => { |
| 240 | const [, rawExpirationTime] = event.tags.find((tag) => tag.length >= 2 && tag[0] === EventTags.Expiration) ?? [] |
| 241 | if (!rawExpirationTime) { |
| 242 | return |
| 243 | } |
| 244 | |
| 245 | const expirationTime = Number(rawExpirationTime) |
| 246 | |
| 247 | if (Number.isSafeInteger(expirationTime) && Math.log10(expirationTime) < 10) { |
| 248 | return expirationTime |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | export const getEventProofOfWork = (eventId: EventId): number => { |
| 253 | return getLeadingZeroBits(Buffer.from(eventId, 'hex')) |
no outgoing calls
no test coverage detected