hypercore-storage 1.0.10 → 1.1.1

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 (3) hide show
  1. package/index.js +19 -0
  2. package/lib/view.js +1 -1
  3. 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/lib/view.js CHANGED
@@ -266,8 +266,8 @@ class View {
266
266
  return
267
267
  }
268
268
 
269
- if (this.changes.length === this.indexed) return
270
269
  if (this.map === null) this.map = new Map()
270
+ if (this.changes.length === this.indexed) return
271
271
 
272
272
  while (this.indexed < this.changes.length) {
273
273
  const c = this.changes[this.indexed++]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore-storage",
3
- "version": "1.0.10",
3
+ "version": "1.1.1",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js",