// // Copyright 2021 DXOS.org // import { Record as RawRecord } from '../proto'; import { AccountKey } from './account-key'; import { CID } from './cid'; import { DomainKey } from './domain-key'; import { DXN } from './dxn'; /** * Authorities provide namespaces for records. * Domain names for authorities are auctioned. */ export type Authority = { key: DomainKey domainName?: string owner: string } export type RecordWithCid = RawRecord & { cid: CID } /** * Minimal API for DXNS registry client backend. */ export interface RegistryClientBackend { getDomainKey (domain: string): Promise listAuthorities (): Promise registerAuthority (owner: AccountKey): Promise getResource (name: DXN): Promise listResources (): Promise<[DXN, CID][]> registerResource ( name: DXN, cid: CID | undefined, owner: AccountKey ): Promise getRecord (cid: CID): Promise listRecords (): Promise registerRecord (record: RawRecord): Promise }