UNPKG

web-enc-at-rest

Version:
26 lines (25 loc) 1.22 kB
/** @class WearContext * Encapsulates all state needed for API usage, including the credential-derived key used for encryption/decryption. * Only keep this instance in memory. Or in other words, don't store it or data retrieved from the instance in any * form of persistent storage, e.g. LocalStorage, SessionStorage, WebSQL, IndexedDb, querystring params (browser history). */ declare class WearContext { private _key; _preventSerialization: WearContext; constructor(key: CryptoKey); /** Method intended for internal usage only. If you retrieve the key for app usage, you should plan to think very * carefully about what vulnerabilities you'll be introducing. * * @return {CryptoKey} A CryptoKey usable for encryption/decryption or null if the context has been cleared. */ dangerouslyGetKey(): CryptoKey | null; /** Has this context been cleared? * * @return {boolean} True, if it has. False, if not. */ isClear(): boolean; /** Clear all data in the context, which disables the context for use in calling WEaR APIs and prevents the * context data from being accessed by Javascript. */ clear(): void; } export default WearContext;