1.2.4-rc.1 • Published 6 months ago

@nymproject/sdk v1.2.4-rc.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
6 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 });

Find the right package for you

Browsers:

NodeJS:

Why have all these variations? Each project is different, so hopefully we have something for you!

Choose a package depending on how your project is transpiled and packaged:

  • ESM: use import syntax and have your bundler copy the WASM bundles into your output distribution
  • CJS: you have an older project that needs ES5 Javascript
  • nodejs: you want to write your project server-side or locally without the browser on NodeJS

And then, to use *-full-fat or not, how do I choose? We have *-full-fat packages that are pre-bundled by including all web-workers and WASM as inline Base64.

Use the *-full-fat packages when you have trouble changing your bundler settings, or you can use an open CSP.

1.2.0

7 months ago

1.1.8

10 months ago

1.2.3

6 months ago

1.2.2

6 months ago

1.2.1

6 months ago

1.2.0-rc.9

8 months ago

1.2.0-rc.8

8 months ago

1.2.0-rc.7

8 months ago

1.2.4-rc.0

6 months ago

1.2.4-rc.1

6 months ago

1.2.0-rc.10

7 months ago

1.2.3-rc.0

6 months ago

1.2.0-rc.2

8 months ago

1.2.0-rc.1

9 months ago

1.2.0-rc.0

9 months ago

1.2.0-rc.6

8 months ago

1.2.0-rc.5

8 months ago

1.2.0-rc.4

8 months ago

1.2.0-rc.3

8 months ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago