ceramicnetwork / js-did

A simple interface to interact with DIDs that conform to the DID-provider interface.
Other
95 stars 28 forks source link

Add support for persisted sessions #164

Closed oed closed 12 months ago

oed commented 1 year ago

This PR adds support for sessions that are persisted. These sessions are created and loaded using DIDSession.get(...). The sessions use the new @didtools/key-webcrypto did provider where keys are stored securely in the browser (outside of DOM). These keys along with the Cacao are persisted using IndexedDB.

Currently only browsers are supported. The .get function will throw an error if called in nodejs.

How Has This Been Tested?

One new unit test where added that uses fake-indexeddb and jsdom jest env.

Definition of Done

oed commented 1 year ago

@zachferland do you think a method like hasSessionFor(account) would serve that purpose?

zachferland commented 1 year ago

@oed yeah that works, hasSessionFor(account) and returns list with resources for each or hasSessionFor(account, authopts/resources) and returns bool, probably the second makes sense