UNPKG

@decentralized-identity/ion-cli

Version:

A Command Line Interface (CLI) to make working with the ION network and using ION DIDs easy peasy lemon squeezy.

50 lines (49 loc) 1.7 kB
/** * Class describing a cache item for saving and reading * cached DIDs. */ export default class CacheItem { readonly name: string; readonly did: string; document: any; lastResolved: Date; published: boolean; /** * Package version. */ readonly version: string; /** * Date indicating the date and time * the cache item was created. */ readonly created: Date; /** * Constructs a new instance on the @see Message class. * @param name for the cache item. * @param did being cached. * @param document containing the latest state of the DID. * @param lastResolved indicating the last time the cached item was resolved. * @param published indicating whether the DID has been published to the network. */ constructor(name: string, did: string, document: any, lastResolved: Date, published: boolean); /** * Loads the cache item with @param name from the specified directory. * @param directory that contains the cache. * @param name of the cache item to read. * @returns the cached item if found, otherwise undefined. */ static read(directory: string, name: string): Promise<CacheItem | undefined>; /** * Saves the instance of the cache item to specified directory * as a json file. * @param directory to save the package to. */ save(directory: string): Promise<void>; /** * Checks to see if the file name includes the * type '.json' and if not appends. * @param fileName to check. * @returns the filename with type appended. */ private static appendType; }