npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

evr-websocket-server

v0.4.1

Published

evr-websocket-server - a websocket adapter for everarch

Downloads

1

Readme

evr-websocket-server - a websocket adapter for everarch

  1. Introduction
  2. Installation
  3. Run
  4. Interface

Introduction

evr-websocket-server listens for websocket connections. Each connection can perform a subset of the evr cli commands after authentication.


Installation

$ npm install


Run

evr-websocket-server is configured via a JSON file. The configuration file might look like this:

{ "port": 8030, "user": { "test": { "password": "pazz", "signing-key": "BD1C9FFF…0F3B3", "gpg-keys": [ "BD1C9FFF…0F3B3" ] } } }

signing-key is the GPG key used for signing put claims. The property is optional. If omitted the default GPG key configured for evr cli is used.

gpg-keys contains a list of GPG key fingerprints. The related user should be the only one who can sign claims using these keys.

$ node . evr-websocket-server.conf.json


Interface

evr-websocket-server will listen on the configured port for connections following the WebSocket protocol as defined in RFC 6455. All sent and received messages are expected to be text messages which contain JSON. The client sends commands which are responded by the server. The client must provide a channel identifier with every command. The server responses will use the same channel number so that the response can be related to a command from the client.

The first command must be an authentication command.

{ "ch": 123, "cmd": "auth", "type": "basic", "user": "mr-x", "password": "pazz" }

After the authentication command any of the following commands can follow.

The watch command tells the server to watch for modified blobs.

{ "ch": 123, "cmd": "watch", "lastModifiedAfter": 1684012031, "flags": 1, "filter": { "type": "namespace", "ns": "https://evr.ma300k.de/claims/" } }

The lastModifiedAfter property is optional. The default value is 0. The meaning of lastModifiedAfter is defined by the --last-modified-after argument for the evr cli. See evr --help for more details.

The flags property is optional. The default value is that no flags are used. The meaning of flags is defined by the --flags argument for the evr cli.

The filter property is optional. The default value is no filtering. It specifies filters which are applied to the found blobs before reporting them to the client. Right now only a namespace filter is supported. It filters blobs which do not use the given namespace.

Responses from the server to the watch command might look like this:

{ "ch": 123, "status": "blob-modified", "ref": "sha3-224-…", "lastModified": 1684012032 }

If something goes wrong the server might respond with an error status:

{ "ch": 123, "status": "error", "errorCode": 1 }

The error code 1 is a general no further specified error. Could be anything like someone stumbled over the network cable or your dog ate the homework.

The meaning of the other error codes is defined by the evr cli program. It's exit code is reported as the error code. The most important ones are 2 for 'not found' and 5 for 'user data invalid'. For a complete list look at the source file src/errors.h.

This kind off errors can also be reported for the further commands described below.

The get-claim-set command tells the server to respond a claim set's content.

{ "ch": 123, "cmd": "get-verify", "ref": "sha3-224-…", "meta": true }

The meta property is optional. The default value is false. A value of true indicates that the response should also contain metadata about the fetched blob.

Responses from the server might look like this:

{ "ch": 123, "status": "get", "body": "…", "meta": { "signed-by": "BD1C9FFF…0F3B3", "signed-by-user": "test" } }

The put-claim-set command tells the server to store a provided claim set.

{ "ch": 123, "cmd": "sign-put", "body": "…" }

Responses from the server might look like this:

{ "ch": 123, "status": "put", "ref": "sha3-224-…" }

The list-users command asks the server for a list of user names.

{ "ch": 123, "cmd": "list-users" }

Responses from the server might look like this:

{ "ch": 123, "status": "users", "users": ["bob", "joe"] }