hypercore-storage 1.0.10 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +19 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -567,6 +567,25 @@ class CorestoreStorage {
567
567
  return (await promise) !== null
568
568
  }
569
569
 
570
+ async getAuth (discoveryKey) {
571
+ if (this.version === 0) await this._migrateStore()
572
+
573
+ const rx = new CorestoreRX(this.db, EMPTY)
574
+ const corePromise = rx.getCore(discoveryKey)
575
+
576
+ rx.tryFlush()
577
+
578
+ const core = await corePromise
579
+ if (core === null) return null
580
+
581
+ const coreRx = new CoreRX(core, this.db, EMPTY)
582
+ const authPromise = coreRx.getAuth()
583
+
584
+ coreRx.tryFlush()
585
+
586
+ return authPromise
587
+ }
588
+
570
589
  async resume (discoveryKey) {
571
590
  if (this.version === 0) await this._migrateStore()
572
591
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore-storage",
3
- "version": "1.0.10",
3
+ "version": "1.1.0",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js",