a demonstration replicated social networking web app built with anproto wiredove.net/
social ed25519 protocols
at master 20 lines 527 B view raw
1import { apds } from 'apds' 2 3export const isHash = (value) => typeof value === 'string' && value.length === 44 4 5export const getOpenedFromQuery = async (hash) => { 6 if (!hash) { return null } 7 const query = await apds.query(hash) 8 if (Array.isArray(query) && query[0] && query[0].opened) { 9 return query[0].opened 10 } 11 if (query && query.opened) { 12 return query.opened 13 } 14 return null 15} 16 17export const normalizeTimestamp = (ts) => { 18 const value = Number.parseInt(ts, 10) 19 return Number.isNaN(value) ? 0 : value 20}