+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ new Entry()
+ + + + + + +
+ An ipfs-log entry
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Methods
+ + + + + + + +(static) compare(a, b) → {number}
+ + + + + + +
+ Compares two entries.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
a |
+
+
+ + + +Entry + + + + | + + + + + ++ |
b |
+
+
+ + + +Entry + + + + | + + + + + ++ |
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +
+ 1 if a is greater, -1 is b is greater
+
+
+
+
+-
+
- + Type + +
- + +number + + + +
(async, static) create(ipfs, identity, logId, data, nextopt, clockopt) → {Promise.<Entry>}
+ + + + + + +
+ Create an Entry
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + +Attributes | + + + +Default | + + +Description | +
---|---|---|---|---|
ipfs |
+
+
+ + + +IPFS + + + + | + + ++ + + + + + | + + + ++ + | + + +An IPFS instance | +
identity |
+
+
+ + + +Identity + + + + | + + ++ + + + + + | + + + ++ + | + + +The identity instance | +
logId |
+
+
+ + + +string + + + + | + + ++ + + + + + | + + + ++ + | + + +The unique identifier for this log | +
data |
+
+
+ + + +* + + + + | + + ++ + + + + + | + + + ++ + | + + +Data of the entry to be added. Can be any JSON.stringifyable data | +
next |
+
+
+ + + +Array.<(string|Entry)> + + + + | + + +
+
+ <optional> + + + + + + |
+
+
+
+ + + [] + + | + + +Parent hashes or entries | +
clock |
+
+
+ + + +LamportClock + + + + | + + +
+
+ <optional> + + + + + + |
+
+
+
+ + + | + + +The lamport clock | +
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + + + +-
+
- + Type + +
- + +Promise.<Entry> + + + +
Example
+ +const entry = await Entry.create(ipfs, identity, 'hello')
+console.log(entry)
+// { hash: null, payload: "hello", next: [] }
+
+
+
+
+
+
+
+
+
+ (static) findChildren(entry, values) → {Array.<Entry>}
+ + + + + + +
+ Find entry's children from an Array of entries.
+Returns entry's children as an Array up to the last know child.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
entry |
+
+
+ + + +Entry + + + + | + + + + + +Entry for which to find the parents | +
values |
+
+
+ + + +Array.<Entry> + + + + | + + + + + +Entries to search parents from | +
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + + + +-
+
- + Type + +
- + +Array.<Entry> + + + +
(async, static) fromMultihash(ipfs, hash) → {Promise.<Entry>}
+ + + + + + +
+ Create an Entry from a hash.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
ipfs |
+
+
+ + + +IPFS + + + + | + + + + + +An IPFS instance | +
hash |
+
+
+ + + +string + + + + | + + + + + +The hash to create an Entry from | +
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + + + +-
+
- + Type + +
- + +Promise.<Entry> + + + +
Example
+ +const entry = await Entry.fromMultihash(ipfs, "zd...Foo")
+console.log(entry)
+// { hash: "Zd...Foo", payload: "hello", next: [] }
+
+
+
+
+
+
+
+
+
+ (static) isEntry(obj) → {boolean}
+ + + + + + +
+ Check if an object is an Entry.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
obj |
+
+
+ + + +Entry + + + + | + + + + + ++ |
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + + + +-
+
- + Type + +
- + +boolean + + + +
(static) isEqual(a, b) → {boolean}
+ + + + + + +
+ Check if an entry equals another entry.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
a |
+
+
+ + + +Entry + + + + | + + + + + ++ |
b |
+
+
+ + + +Entry + + + + | + + + + + ++ |
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + + + +-
+
- + Type + +
- + +boolean + + + +
(static) isParent(entry1, entry2) → {boolean}
+ + + + + + +
+ Check if an entry is a parent to another entry.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
entry1 |
+
+
+ + + +Entry + + + + | + + + + + +Entry to check | +
entry2 |
+
+
+ + + +Entry + + + + | + + + + + +The parent Entry | +
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + + + +-
+
- + Type + +
- + +boolean + + + +
(static) toBuffer(entry) → {Buffer}
+ + + + + + +
+ Transforms an entry into a Buffer.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
entry |
+
+
+ + + +Entry + + + + | + + + + + +The entry | +
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +
+ The buffer
+
+
+
+
+-
+
- + Type + +
- + +Buffer + + + +
(async, static) toMultihash(ipfs, entry) → {Promise.<string>}
+ + + + + + +
+ Get the multihash of an Entry.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
ipfs |
+
+
+ + + +IPFS + + + + | + + + + + +An IPFS instance | +
entry |
+
+
+ + + +Entry + + + + | + + + + + +Entry to get a multihash for | +
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Deprecated:
- Yes
+
+
+
+
+
+
+
+
+
+
+
+ - Source: +
- + + + + + + + +
Returns:
+ + + + +-
+
- + Type + +
- + +Promise.<string> + + + +
Example
+ +const multihash = await Entry.toMultihash(ipfs, entry)
+console.log(multihash)
+// "Qm...Foo"
+
+
+
+
+
+
+
+
+
+ (async, static) verify(identityProvider, entry) → {Promise}
+ + + + + + +
+ Verifies an entry signature.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+ + +Name | + + +Type | + + + + + +Description | +
---|---|---|
identityProvider |
+
+
+ + + +IdentityProvider + + + + | + + + + + +The identity provider to use | +
entry |
+
+
+ + + +Entry + + + + | + + + + + +The entry being verified | +
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + + + + + + + +
Returns:
+ + +
+ A promise that resolves to a boolean value indicating if the signature is valid
+
+
+
+
+-
+
- + Type + +
- + +Promise + + + +