Node/JavaScript SDK (ECDSA only)

πŸ“˜

SDK's and Authentication

Authentication Token and SDK's
Given that utilizing the Authentication Token is less complex than the ECDSA Authentication we have NOT provided SDK support for the Authentication Token and we do not intend to add support to SDKs for auth token.

Migrating from ECDSA to Authentication Token
Customers with apps using ECDSA will eventually be required to migrate their existing apps in the near future. Deprecating the ECDSA (legacy) Authentication Scheme is on the roadmap, but does not yet have an ETA.

Sila will send out communication via the news letter and update the docs when this migration needs to take place.

Set up the private key and handle for the SDK to use for signing subsequent requests with configure. The other SDK functionality will not be available until this configuration is completed. The SDK does not store this information outside of the instance that is configured. It is never transmitted over the network or stored outside the scope of that instance.

  

Installation

/* 
Suported versions of Node
10 LTS
12 LTS
14 LTS
*/

// Installation

> npm i @silamoney/sdk

// Import the package

// Common JS syntax
const Sila = require('@silamoney/sdk').default;

// ES6 module syntax
import Sila from '@silamoney/sdk';

// Initialize the application
const config = {
  handle: 'app.silamoney.eth',
  key: "Your app handle's private key",
};

Sila.configure(config);

// PRODUCTION ONLY
Sila.disableSandbox();
Sila.setEnvironment('PROD');

❗️

Legacy Package Names

Prior to 0.2.49 this was the unscoped package sila-sdk-javascript. If you are still running the legacy package and want to upgrade to >= 0.2.49 you can do so without breaking changes by replacing the legacy package with the scoped @silamoney/sdk package

Wallet Generation

The installation step does not include ==wallet generation== the Wallet Generation code provided here are the wallet environment variables that you will need when you get to the register step. They will live with the other environment variable but you do not need them in the initial installation set up.

// Generate a new wallet
const wallet = Sila.generateWallet();
console.log(wallet.address); // Public wallet address
console.log(wallet.privateKey); // Private wallet key