/** The DID is the authority of an at:// URI. */ export function didFromAtUri(uri: string): string | undefined { const match = /^at:\/\/([^/]+)\//.exec(uri) const did = match?.[1] return did?.startsWith('did:') ? did : undefined } /** Only the author of the root post may export the thread. */ export function isOwnThread(uri: string, sessionDid: string): boolean { const did = didFromAtUri(uri) return Boolean(did && sessionDid && did === sessionDid) }