1.1.12 • Published 12 months ago

ntv-sdk v1.1.12

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
12 months ago

Nym SDK (Typescript)

The Nym SDK for Typescript will get you creating apps that can use the Nym Mixnet and Coconut credentials quickly.

TL;DR

Include the SDK in your project:

npm install @nymproject/sdk

Open a connection to a Gateway on the Nym Mixnet:

import { createNymMixnetClient } from '@nymproject/sdk';

const main = async () => {
  const nym = await createNymMixnetClient();

  const nymApiUrl = 'https://validator.nymtech.net/api';

  // show message payload content when received 
  nym.events.subscribeToTextMessageReceivedEvent((e) => {
    console.log('Got a message: ', e.args.payload);
  });

  // start the client and connect to a gateway
  await nym.client.start({
    clientId: 'My awesome client',
    nymApiUrl,
  });

  // send a message to yourself
  const payload = 'Hello mixnet';
  const recipient = nym.client.selfAddress();
  nym.client.send({ payload, recipient });
  
};

This will start the WASM client on a worker thread, so that your code can stay nice and snappy.

Send a message to another user (you will need to know their address at a Gateway):

  const payload = 'Hello mixnet';
  const recipient = '<< RECIPIENT ADDRESS GOES HERE >>';
  await nym.client.send({ payload, recipient });
1.1.12

12 months ago

1.1.9

12 months ago

1.1.11

12 months ago

1.1.8

12 months ago

1.1.10

12 months ago

1.1.7

12 months ago

1.1.5

1 year ago

1.1.4

1 year ago