Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@runspace/ataraxia-auth

0x773GPL-3.00.0.0TypeScript support: included

RunSpace Ataraxia P2P Network Auth implementation

readme

@runspace/ataraxia-auth

Ataraxia JWT Auth implementation.

Example

import { Network } from 'ataraxia';
import { TCPTransport, TCPPeerMDNSDiscovery } from 'ataraxia-tcp';
import { RunSpaceAuth } from '@runspace/ataraxia-auth';

const net = new Network({
    name: 'name-of-your-app-or-network',
    authentication: [
        new RunSpaceAuth("your-secret")
    ]
});

net.addTransport(new TCPTransport({
    discovery: new TCPPeerMDNSDiscovery()
}));

net.onNodeAvailable(node => {
    console.log('A new node is available:', node.id);
    node.send('hey', 'there');
});

net.onMessage(msg => {
    console.log(msg);
});

net.start()
    .then(console.log)
    .catch(console.error);

see in src/example/index.ts