Skip to main content

Installation

The following programming languages are currently supported:

Client SDK:

Server SDK:

Installation

Client SDK

Pick one of the following methods to install the blindnet encryption engine.

Run the following command in your terminal.

npm i -S @blindnet/sdk-javascript

For more info, check the api reference.

Server SDK

composer require blindnet/blindnet-sdk-php

For more info, check the api reference.

Imports

Client SDK

The blindnet encryption API is enclosed in the Blindnet module. It should be imported together with the error types and optionally, utilities (e.g. to encode and decode the encrypted data).

If the SDK was installed as an npm package, it is imported as

import { Blindnet, util, error } from '@blindnet/sdk-javascript';

If it was imported as an umd package, use

const { Blindnet, util, error } = blindnet;

For more info, check the api reference.

Server SDK

require 'vendor/autoload.php';
use Blindnet\BlindnetSDKPHP\Blindnet;

For more info, check the api reference.

Initialization

Client SDK

The blindnet encryption engine must be initialized before you can use it (with the exception for some static methods, e.g. secret derivation).

To initialize the library, you need to provide the authentication token generated using the server SDK.

Also, blindnet endpoint url can be provided. The default value is https://api.blindnet.io.
If you are testing the library, use https://test.blindnet.io.

Initialization is done with the init method.

const blindnet = Blindnet.init(token);
// for testing
const blindnet = Blindnet.init(token, 'https://test.blindnet.io');

Server SDK

To initialize the server SDK, you need to obtain application id and application key. You can obtain them from the dashboard, or generate them on your own (see next section).

As for the client SDK, you can provide an endpoint. For testing, use https://test.blindnet.io.

$blindnet=Blindnet.init($appKey, $appId)
// for testing
$blindnet=Blindnet.init($appKey, $appId, 'https://test.blindnet.io')

Generating application keys

Application key is actually an Ed25519 private key used to sign the tokens that allow your users to access blindnet. You can generate it either in the blindnet dashboard or on your own. If you decide to generate the application key on your own, you need to generate an Ed25519 key pair, take the private key as your blindnet application key, and register the public key in your application on the dashboard.

Examples of how to generate the Ed25519 key pair:

import * as ed from 'noble-ed25519';
const privateKey = ed.utils.randomPrivateKey(32);
const publicKey = await ed.getPublicKey(privateKey);
console.log('application key: ' + btoa(String.fromCharCode(...privateKey, ...publicKey)));
console.log('public key: ' + btoa(String.fromCharCode(...publicKey)));

Examples of Ed25519 keys:

Ed25519 keys

public key: QqglmSldC4PerNo+zQJIkV5+CkCHL2Tlq5aO1NXiY7Y=
private key: GWuUnD5bn0Xuk8GdbLGoX+0UBanFmY3/Qq8JY8Fff2pCqCWZKV0Lg96s2j7NAkiRXn4KQIcvZOWrlo7U1eJjtg==