Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ updates:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
commit-message:
prefix: "deps"
prefix-development: "deps(dev)"
40 changes: 26 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
# datastore-pubsub <!-- omit in toc -->

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![](https://img.shields.io/codecov/c/github/ipfs/js-datastore-pubsub.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-datastore-pubsub)
[![Build Status](https://github.com/ipfs/js-datastore-pubsub/actions/workflows/js-test-and-release.yml/badge.svg?branch=master)](https://github.com/ipfs/js-datastore-pubsub/actions/workflows/js-test-and-release.yml)
[![Dependency Status](https://david-dm.org/ipfs/js-datastore-pubsub.svg?style=flat-square)](https://david-dm.org/ipfs/js-datastore-pubsub)
[![standard-readme](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)
[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-datastore-pubsub.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-datastore-pubsub)
[![CI](https://img.shields.io/github/workflow/status/ipfs/js-datastore-pubsub/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-datastore-pubsub/actions/workflows/js-test-and-release.yml)

> provides an implementation of an api for pubsub to be used as a datastore with TieredDatastore
> Responsible for providing an interface-datastore compliant api to pubsub

## Table of Contents <!-- omit in toc -->
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Usage](#usage)
- [API](#api)
- [Setup](#setup)
- - [Setup](#setup)
- [Get](#get)
- [Put](#put)
- [Unsubscribe](#unsubscribe)
- [Contribute](#contribute)
- [License](#license)
- [Contribute](#contribute-1)

### Install
## Install

> npm install datastore-pubsub
```console
$ npm i datastore-pubsub
```

## Usage

Expand Down Expand Up @@ -111,4 +112,15 @@ This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/c

## License

Copyright (c) Protocol Labs, Inc. under the **MIT License**. See [LICENSE file](./LICENSE) for details.
Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

## Contribute

Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs-importer/issues)!

This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).

[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./src/index.js"
}
},
Expand Down Expand Up @@ -83,15 +84,15 @@
"release": "patch"
},
{
"type": "chore",
"type": "docs",
"release": "patch"
},
{
"type": "docs",
"type": "test",
"release": "patch"
},
{
"type": "test",
"type": "deps",
"release": "patch"
},
{
Expand Down Expand Up @@ -121,7 +122,11 @@
},
{
"type": "docs",
"section": "Trivial Changes"
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
Expand Down Expand Up @@ -153,20 +158,20 @@
},
"dependencies": {
"@libp2p/interface-dht": "^1.0.1",
"@libp2p/interface-pubsub": "^1.0.4",
"@libp2p/interface-pubsub": "^2.0.1",
"@libp2p/interfaces": "^3.0.3",
"@libp2p/logger": "^2.0.0",
"datastore-core": "^7.0.0",
"datastore-core": "^8.0.1",
"debug": "^4.2.0",
"err-code": "^3.0.1",
"interface-datastore": "^6.0.2",
"interface-datastore": "^7.0.0",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"@libp2p/components": "^2.0.0",
"@libp2p/floodsub": "^3.0.0",
"@libp2p/interface-compliance-tests": "^3.0.2",
"@libp2p/interface-mocks": "^3.0.1",
"@libp2p/interface-mocks": "^4.0.2",
"@libp2p/peer-id-factory": "^1.0.9",
"@libp2p/record": "^2.0.0",
"@types/detect-node": "^2.0.0",
Expand All @@ -177,7 +182,7 @@
"it-pair": "^2.0.2",
"libp2p": "next",
"npm": "^8.10.0",
"p-wait-for": "^4.1.0",
"p-wait-for": "^5.0.0",
"peer-id": "^0.16.0",
"rimraf": "^3.0.2",
"sinon": "^14.0.0",
Expand Down
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ export class PubSubDatastore extends BaseDatastore {
*/
async _onMessage (evt) {
const msg = evt.detail

if (msg.type !== 'signed') {
log.error('unsigned message received, this module can only work with signed messages')
return
}

const { data, from, topic } = msg
let key
try {
Expand Down