import type { NetworkName } from '@did-btcr2/bitcoin'; import type { KeyBytes } from '@did-btcr2/common'; import type { Btcr2DidDocument, SingletonScriptKind } from '@did-btcr2/method'; import type { DidService } from '@web5/dids'; /** * A verification relationship of a DID document. * @public */ export type VerificationRelationship = 'authentication' | 'assertionMethod' | 'capabilityInvocation' | 'capabilityDelegation'; /** * The four verification relationships, in the order the built document lists them. * @public */ export declare const VERIFICATION_RELATIONSHIPS: readonly VerificationRelationship[]; /** * The service `type` of a beacon, per the specification's beacon types table. * @public */ export type BeaconType = 'SingletonBeacon' | 'CASBeacon' | 'SMTBeacon'; /** * The three beacon types. * @public */ export declare const BEACON_TYPES: readonly BeaconType[]; /** * The script kind of a beacon address that the api derives from a public key. * @public */ export type BeaconAddressType = SingletonScriptKind; /** * The beacon address types. * @public */ export declare const BEACON_ADDRESS_TYPES: readonly BeaconAddressType[]; /** * The address type of a beacon derived from a key when the spec names none. * The same kind as the `#initialP2WPKH` beacon of a KEY identifier. * @public */ export declare const DEFAULT_BEACON_ADDRESS_TYPE: BeaconAddressType; /** * One verification method of a genesis document. * @public */ export interface GenesisVerificationMethodSpec { /** The 33-byte compressed secp256k1 public key. */ publicKey: KeyBytes; /** * The verification relationships that reference the method. Default: all * four. An empty array adds the method with no relationship. */ relationships?: VerificationRelationship[]; /** The fragment of the method id, without `#`. Default: `key-`. */ fragment?: string; } /** * One beacon service of a genesis document. Give `publicKey` to derive the * beacon address from a key, or `address` to use a Bitcoin address as given. * @public */ export interface GenesisBeaconSpec { /** The beacon type. */ type: BeaconType; /** The key that the beacon address is derived from. Exclusive with `address`. */ publicKey?: KeyBytes; /** * The script kind of the derived address. Default: * {@link DEFAULT_BEACON_ADDRESS_TYPE}. Only with `publicKey`. */ addressType?: BeaconAddressType; /** * A Bitcoin address of the network, without the `bitcoin:` scheme. Exclusive * with `publicKey`. A CAS or SMT beacon usually names the address of an * aggregation cohort here. */ address?: string; /** The fragment of the service id, without `#`. Default: `service-`. */ fragment?: string; } /** * The input of {@link buildGenesisDocument}: the keys, the beacons, and the * services of a genesis document. * @public */ export interface GenesisDocumentSpec { /** * The network of the beacon addresses. Required here; the api facade fills * its default network when the caller names none. */ network: NetworkName; /** The verification methods. At least one. */ verificationMethods: GenesisVerificationMethodSpec[]; /** * The beacon services. Default: one Singleton beacon with the * {@link DEFAULT_BEACON_ADDRESS_TYPE} address of the first verification method. */ beacons?: GenesisBeaconSpec[]; /** * Other services. The `id` is a fragment (`#name`) or a full id that contains * the placeholder `did:btcr2:_`. A beacon type is refused here; use `beacons`. */ services?: DidService[]; } /** * Builds a Genesis Document: a DID document with the placeholder id * `did:btcr2:_` in every id and controller, one Multikey verification method * per key, the verification relationships, one beacon service per beacon, and * the other services. The result hashes to the genesis bytes of an EXTERNAL * identifier. * * The builder refuses a spec that cannot produce an updatable DID: the * specification requires at least one verification method with the * `capabilityInvocation` relationship and at least one beacon service. * @param spec The keys, beacons, and services. * @returns The genesis document. * @throws {DidDocumentError} If the spec is not valid. */ export declare function buildGenesisDocument(spec: GenesisDocumentSpec): Btcr2DidDocument; /** * Checks that a genesis document has the shape the specification requires * before it is hashed: a JSON object with the id `did:btcr2:_`, the two * required contexts, and placeholder ids in every verification method and * service. * @param genesisDocument The document to check. * @throws {DidDocumentError} If the document is not a valid genesis document. */ export declare function assertGenesisDocument(genesisDocument: unknown): asserts genesisDocument is Btcr2DidDocument; //# sourceMappingURL=genesis.d.ts.map