Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cryptix/js-gabbygrove
experimental, cbor based feed format for ssb
https://github.com/cryptix/js-gabbygrove
Last synced: about 1 month ago
JSON representation
experimental, cbor based feed format for ssb
- Host: GitHub
- URL: https://github.com/cryptix/js-gabbygrove
- Owner: cryptix
- License: mit
- Created: 2019-07-30T13:13:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-11T07:33:14.000Z (over 3 years ago)
- Last Synced: 2024-10-08T00:16:53.883Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gabby Grove
this is an experimental, CBOR based feed format for secure-scuttlebutt.
It spec draft will be published to the [ssb-spec-drafts](https://github.com/ssbc/ssb-spec-drafts). The current working copy can be found on the [core-gabbygrove-00 branch](https://github.com/ssbc/ssb-spec-drafts/tree/core-gabbygrove-00).
# Structures
See the working copy for an detailed description of the fields in the `Event` and `Transfer` strucutre.
# API
## verifyTransfer
`verifyTransfer(Buffer, cb)` expects a `Buffer` as it's first argument, it will be decoded as a `Transfer` message (three cbor arrays). Then, the first element of `Transfer` will be decoded as an `Event`. The author inside the event will be used to verify the `Signature` (field number to of `Transfer`). If present, the `content` will be hashed and compared against the `content.hash` inside the `Event`, as well.
If anything fails, the callback will be called with an error as it's first argument.
If successfull, the first argument will be null and the seconed one will get this decoded data:```js
{
key: BinaryRef(), // of the received event
evt: decodedEvent,
content: jsonObject, // JSON.parse of content (if that's the `content.encoding`)
}
```# makeEvent
`makeEvent(keyPair, sequence, prev, content)` creates a new `Transfer` object with a signed event inside. It's a **low level** function and should be wrapped apropriatly to create the right sequence numbers and use the correct `previous` hashes.
It throws in case of mis-use.
It returns this object:
```js
{
key: BinaryRef(), // of the new event
event: []..., // array of fields of event
trBytes: Buffer(), // complete encoded Transfer object
}
`