# Imports

All these methods expose a constructor with the same SealdSDK constructor function interface.

# Browser

There are 2 ways to use the Seald SDK in your browser, depending on your needs and your web app architecture.

# Library

This imports @seald-io/sdk-web/lib/seald-sdk.js, which is the wrapper for web project.

Use this method if you are using a bundler such as webpack. For this purpose, see the Custom bundling and transpilation section.

# Bundle

Copy the file @seald-io/sdk-web/lib/seald-sdk.browser.js into your project, then load it in a <script> tag.

In the same way, you can copy the following files for plugins:

  • @seald-io/sdk-web/lib/seald-sdk-plugin-ssks-password.browser.js
  • @seald-io/sdk-web/lib/seald-sdk-plugin-ssks-2mr.browser.js
  • @seald-io/sdk-web/lib/seald-sdk-plugin-localstorage.browser.js (deprecated)

For example, to import the SDK and the SSKS-Password plugin:

This is a bundle, which already includes all necessary libraries, dependencies, and polyfills.

It exposes the Seald SDK constructor function at window.SealdSDK.

Plugins are exposed in the global variables:

  • window.SealdSDKPluginSSKSPassword
  • window.SealdSDKPluginSSKS2MR
  • window.SealdSDKPluginLocalStorage (deprecated)

# Node.js / Electron

import SealdSDK from '@seald-io/sdk'

const seald = SealdSDK({ appId })

This imports the Node wrapper for the Seald SDK.

You may want to use this on your NodeJS server, in an Electron desktop application, for your unit-tests ...

You will need to install node-fetch separately:

npm i -S node-fetch

# React-Native

# Installation

The Seald SDK for react-native has four peer dependencies that must be installed separately:

  • react-native-modpow
  • @react-native-community/async-storage
  • react-native-scrypt
  • react-native-rsa-native

You can install them with the command:

npm i -S react-native-modpow @react-native-community/async-storage react-native-scrypt react-native-rsa-native

All four packages are autolinked.

# Bundle

The library exposed by default is a bundle, which already includes all necessary libraries, dependencies, and polyfills.

In the same way, you can import the following files for plugins:

# Library

If your application is itself transpiled, you can import the source library. This will allow you to optimise the size of your application.

This library will need to be transpiled before it can be used. See the [Custom bundling and transpilation](#custom-bundling-and-transpilation) section.

# Custom bundling and transpilation

To transpile the SDK, you may need to enable polyfilling of Node's internal modules.

Here is an example configuration for the Webpack 5 bundler :

module.exports = {
  // ... ,
  node: {
    global: true
  resolve: {
    fallback: {
      assert: require.resolve('assert/'),
      fs: false,
      path: require.resolve('path-browserify'),
      events: require.resolve('events/'),
      constants: require.resolve('constants-browserify'),
      os: require.resolve('os-browserify/browser'),
      util: require.resolve('util/'),
      stream: require.resolve('stream-browserify'),
      crypto: false
  plugins: [
    new webpack.ProvidePlugin({
      process: 'process/browser',
      Buffer: ['buffer', 'Buffer'],
      setImmediate: ['timers-browserify', 'setImmediate'],
      clearImmediate: ['timers-browserify', 'clearImmediate']
  // ...

You may need to install as devDependencies the packages assert path-browserify events constants-browserify os-browserify util stream-browserify process buffer timers-browserify.

For more details, see the webpack documentation (opens new window).