Skip to Content
New: a threat-model-first guide to choosing your network defence, plus the nym-smoldvpn dVPN package and nym-swizzle sender hygiene.

@nymproject/sdk • Docs


@nymproject/sdk / Client

Interface: Client

Properties

start()

start: (opts?) => Promise<void>

Start the client.

Example

const client = await createNymMixnetClient(); await client.start({ clientId: 'my-client', nymApiUrl: 'https://validator.nymtech.net/api', }); #### Parameters • **opts?**: `ClientOpts` #### Returns `Promise`\<`void`\> #### Source [mixnet/wasm/types.ts:33](https://github.com/nymtech/nym/blob/develop/sdk/typescript/packages/sdk/src/mixnet/wasm/types.ts#L33) *** ### stop() > **stop**: () => `Promise`\<`void`\> Stop the client. #### Example ```typescript const client = await createNymMixnetClient(); await client.start({ clientId: 'my-client', nymApiUrl: 'https://validator.nymtech.net/api', }); await client.stop();

Returns

Promise<void>

Source

mixnet/wasm/types.ts:46 


selfAddress()

selfAddress: () => Promise<undefined | string>

Get the client address

Example

const client = await createNymMixnetClient(); await client.start({ clientId: 'my-client', nymApiUrl: 'https://validator.nymtech.net/api', }); const address = await client.selfAddress();

Returns

Promise<undefined | string>

Source

mixnet/wasm/types.ts:59 


setTextMimeTypes()

setTextMimeTypes: (mimeTypes) => void

Set the mime-types that should be used when using the Client.send method.

Example

const client = await createNymMixnetClient(); await client.start({ clientId: 'my-client', nymApiUrl: 'https://validator.nymtech.net/api', }); await client.setTextMimeTypes(['text/plain', 'application/json']);

See

Parameters

• mimeTypes: string[]

Returns

void

Source

mixnet/wasm/types.ts:76 


getTextMimeTypes()

getTextMimeTypes: () => Promise<string[]>

Get the mime-types that are automatically converted to strings.

Example

const client = await createNymMixnetClient(); await client.start({ clientId: 'my-client', nymApiUrl: 'https://validator.nymtech.net/api', }); const mimeTypes = await client.getTextMimeTypes();

See

Returns

Promise<string[]>

Source

mixnet/wasm/types.ts:93 


send()

send: (args) => Promise<void>

Send some data through the mixnet message.

Example

const client = await createNymMixnetClient(); await client.start({ clientId: 'my-client', nymApiUrl: 'https://validator.nymtech.net/api', }); await client.send({ payload: 'Hello world', recipient: // recipient address, });

See

Parameters

• args

• args.payload: Payload

• args.recipient: string

• args.replySurbs?: number

Returns

Promise<void>

Source

mixnet/wasm/types.ts:111 


rawSend()

rawSend: (args) => Promise<void>

Send a raw payload, without any mime-type conversion.

Example

const client = await createNymMixnetClient(); await client.start({ clientId: 'my-client', nymApiUrl: 'https://validator.nymtech.net/api', }); const payload = new Uint8Array([1, 2, 3]); await client.rawSend({ payload, recipient: // recipient address, });

See

Parameters

• args

• args.payload: Uint8Array

• args.recipient: string

• args.replySurbs?: number

Returns

Promise<void>

Source

mixnet/wasm/types.ts:130 

Last updated on