Skip to content

Conversation

@ieow
Copy link
Contributor

@ieow ieow commented May 5, 2023

== Breaking ==
Tkey should not be opinionated on how the device share is being stored.
remove the storeDeviceShare, the deviceShare can be coded outside tkey.

Example webstorage code implementation

      const tb2 = new ThresholdKey({ serviceProvider: customSP, storageLayer: customSL, manualSync: mode });
      const keyDetails = await tb2.initialize();


      // store device share
      const webStorage = new WebStorageModule();
      webStorage.setModuleReference(tb2)
      
      // if new user, deviceShare should be present
      if (keyDetails.deviceShare) {
          await webStorage.storeDeviceShare(keyDetails.deviceShare, keyDetails.deviceShare.polynomialID)
      } else {
      // not new user, try get deviceShare from web storage
          await webStorage.inputShareFromWebStorage();
      }

     tb2.reconstruct();

I think passing the tkey instance in to the webStorage function would make more clear and prevent mistake.
But the webstorage API will need to change (refactor).
https://github.com/tkey/tkey/tree/feat/refactorWebStorage

example

      const tb2 = new ThresholdKey({ serviceProvider: customSP, storageLayer: customSL, manualSync: mode });
      const keyDetails = await tb2.initialize();


      // store device share
      const webStorage = new WebStorageModule();
      
      // if new user, deviceShare should be present
      if (keyDetails.deviceShare) {
          await webStorage.storeDeviceShare( tb2,  keyDetails.deviceShare, keyDetails.deviceShare.polynomialID)
      } else {
      // not new user, try get deviceShare from web storage
          await webStorage.inputShareFromWebStorage(tb2);
      }

     tb2.reconstruct();

@ieow
Copy link
Contributor Author

ieow commented Jun 6, 2023

closed in favor of pr #214

@ieow ieow closed this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants