@arcblock/did
Version:
Javascript lib to work with ArcBlock DID
30 lines • 1.5 kB
text/typescript
//#region src/method.d.ts
/**
* DID Method Registry
*
* Defines supported DID methods, their categories, and helper functions.
* Crypto methods (abt, afs, aos, spaces) share a unified identifier encoding.
* Alias methods (name) use human-readable identifiers with DNS-style hierarchy.
*/
/** Crypto methods share unified identifier encoding */
type CryptoMethod = 'abt' | 'afs' | 'aos' | 'spaces';
/** Alias methods use human-readable identifiers */
type AliasMethod = 'name';
/** All supported DID methods */
type DIDMethod = CryptoMethod | AliasMethod;
/** Crypto methods: share unified identifier encoding (base58 checksum / ethereum / base16) */
declare const CRYPTO_METHODS: readonly CryptoMethod[];
/** Alias methods: human-readable identifiers */
declare const ALIAS_METHODS: readonly AliasMethod[];
/** All supported methods */
declare const ALL_METHODS: readonly DIDMethod[];
/** Default method when none is specified */
declare const DEFAULT_METHOD: CryptoMethod;
/** Check if a value is a known crypto method */
declare function isCryptoMethod(method: unknown): method is CryptoMethod;
/** Check if a value is a known alias method */
declare function isAliasMethod(method: unknown): method is AliasMethod;
/** Check if a value is any known method */
declare function isKnownMethod(method: unknown): method is DIDMethod;
//#endregion
export { ALIAS_METHODS, ALL_METHODS, AliasMethod, CRYPTO_METHODS, CryptoMethod, DEFAULT_METHOD, DIDMethod, isAliasMethod, isCryptoMethod, isKnownMethod };