UNPKG

@arcblock/did

Version:

Javascript lib to work with ArcBlock DID

30 lines 963 B
//#region src/short-form.d.ts /** * Short-form DID Resolution * * Deterministic expansion of short-form identifiers to full DIDs. * Based on base58 checksum validation (not heuristic guessing). * * Rules: * - Already a full DID (starts with "did:") → return as-is * - Valid cryptographic address (passes isValid checksum) → did:abt:{address} * - Everything else → did:name:{input} */ /** * Expand a short-form identifier to a full DID. * * @param input - Short-form identifier (address, name, or full DID) * @returns Full DID string * @throws If input is not a non-empty string */ declare function expandShortForm(input: unknown): string; /** * Convert a full DID to its short form (strip the did:{method}: prefix). * * @param did - Full DID string * @returns Short-form identifier * @throws If input is not a non-empty string */ declare function toShortForm(did: unknown): string; //#endregion export { expandShortForm, toShortForm };