hypercore 10.0.0-alpha.1 → 10.0.0-alpha.13

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.
@@ -1,5 +1,4 @@
1
1
  name: Build Status
2
-
3
2
  on:
4
3
  push:
5
4
  branches:
@@ -11,7 +10,7 @@ jobs:
11
10
  build:
12
11
  strategy:
13
12
  matrix:
14
- node-version: [14.x]
13
+ node-version: [lts/*]
15
14
  os: [ubuntu-latest, macos-latest, windows-latest]
16
15
  runs-on: ${{ matrix.os }}
17
16
  steps:
package/README.md CHANGED
@@ -63,7 +63,8 @@ Note that `tree`, `data`, and `bitfield` are normally heavily sparse files.
63
63
  createIfMissing: true, // create a new Hypercore key pair if none was present in storage
64
64
  overwrite: false, // overwrite any old Hypercore that might already exist
65
65
  valueEncoding: 'json' | 'utf-8' | 'binary', // defaults to binary
66
- keyPair: kp // optionally pass the public key and secret key as a key pair
66
+ keyPair: kp, // optionally pass the public key and secret key as a key pair
67
+ encryptionKey: k // optionally pass an encryption key to enable block encryption
67
68
  }
68
69
  ```
69
70
 
@@ -97,6 +98,19 @@ Truncate the core to a smaller length.
97
98
  Per default this will update the fork id of the core to `+ 1`, but you can set the fork id you prefer with the option.
98
99
  Note that the fork id should be monotonely incrementing.
99
100
 
101
+ #### `const stream = core.createReadStream([options])`
102
+
103
+ Make a read stream. Options include:
104
+
105
+ ``` js
106
+ {
107
+ start: 0,
108
+ end: core.length,
109
+ live: false,
110
+ snapshot: true // auto set end to core.length on open or update it on every read
111
+ }
112
+ ```
113
+
100
114
  #### `const range = core.download([range])`
101
115
 
102
116
  Download a range of data.
@@ -113,6 +127,7 @@ A range can have the following properties:
113
127
  {
114
128
  start: startIndex,
115
129
  end: nonInclusiveEndIndex,
130
+ blocks: [index1, index2, ...],
116
131
  linear: false // download range linearly and not randomly
117
132
  }
118
133
  ```
@@ -125,6 +140,12 @@ To download the full core continously (often referred to as non sparse mode) do
125
140
  core.download({ start: 0, end: -1 })
126
141
  ```
127
142
 
143
+ To downloaded a discrete range of blocks pass a list of indices.
144
+
145
+ ```js
146
+ core.download({ blocks: [4, 9, 7] });
147
+ ```
148
+
128
149
  To cancel downloading a range simply destroy the range instance.
129
150
 
130
151
  ``` js
@@ -195,6 +216,10 @@ In contrast to `core.key` this key does not allow you to verify the data but can
195
216
 
196
217
  Populated after `ready` has been emitted. Will be `null` before the event.
197
218
 
219
+ #### `core.encryptionKey`
220
+
221
+ Buffer containing the optional block encryption key of this core. Will be `null` unless block encryption is enabled.
222
+
198
223
  #### `core.length`
199
224
 
200
225
  How many blocks of data are available on this core?
@@ -213,6 +238,10 @@ What is the current fork id of this core?
213
238
 
214
239
  Populated after `ready` has been emitted. Will be `0` before the event.
215
240
 
241
+ #### `core.padding`
242
+
243
+ How much padding is applied to each block of this core? Will be `0` unless block encryption is enabled.
244
+
216
245
  #### `const stream = core.replicate(isInitiatorOrReplicationStream)`
217
246
 
218
247
  Create a replication stream. You should pipe this to another Hypercore instance.
package/UPGRADE.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Notes for downstream developers who are upgrading their modules to new, breaking versions of hypercore.
4
4
 
5
+ ## 10.0.0
6
+
7
+ - All number encodings are now LE
8
+ - Introduces an "oplog" to atomically track changes locally
9
+ - Updated merkle format that only requires a single signature (stored in the oplog)
10
+
5
11
  ## 9.0.0
6
12
 
7
13
  - The format of signatures [has been changed](https://github.com/mafintosh/hypercore/issues/260). This is backwards-compatible (v9 can read v8 signatures), but forward-incompatible (v8 cannot read v9 signatures). If a v8 peer replicates with a v9 peer, it will emit a "REMOTE SIGNTURE INVALID" error on the replication stream.