Socket
Socket
Sign inDemoInstall

@iota/identity-stronghold-nodejs

Package Overview
Dependencies
13
Maintainers
10
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @iota/identity-stronghold-nodejs

This is the beta version of the official Stronghold Account Storage plugin for Node.js with [IOTA Identity Wasm](https://github.com/iotaledger/identity.rs/tree/main/bindings/wasm).


Version published
Weekly downloads
1
Maintainers
10
Created
Weekly downloads
 

Readme

Source

IOTA Identity Stronghold Node.js

This is the beta version of the official Stronghold Account Storage plugin for Node.js with IOTA Identity Wasm.

Install the plugin:

Latest Release: this version matches the main branch of this repository and is stable.

npm install @iota/identity-stronghold-nodejs

Development Release: this version matches the dev branch of this repository, may see frequent breaking changes and has the latest code changes.

npm install @iota/identity-stronghold-nodejs@dev

Usage

const { AccountBuilder, ExplorerUrl } = require('@iota/identity-wasm/node')
const { Stronghold } = require('@iota/identity-stronghold-nodejs')


async function main() {
    // Stronghold settings for the Account storage.
    // This will load an existing Stronghold or create a new one automatically.
    const filepath = "./example-strong.hodl";
    const password = "my-password";
    const stronghold = await Stronghold.build(filepath, password);
    
    // This generates a new keypair stored securely in the above Stronghold, 
    // constructs a new DID Document, and publishes it to the IOTA Mainnet.
    let builder = new AccountBuilder({
        storage: stronghold,
    });
    let account = await builder.createIdentity();

    // Print the DID of the newly created identity.
    const did = account.did();
    console.log(did.toString());

    // Print the local state of the DID Document.
    const document = account.document();
    console.log(JSON.stringify(document, null, 2));

    // Print the Explorer URL for the DID.
    console.log(`Explorer URL:`, ExplorerUrl.mainnet().resolverUrl(did));
}

main()

Build

Alternatively, you can build the bindings if you have Rust installed. If not, refer to rustup.rs for the installation. Then install the necessary dependencies using:

npm install

To use the latest local changes from the Wasm bindings follow the build instructions from the IOTA Identity Wasm build section and then link the result with:

cd ../wasm
npm link
cd ../stronghold-nodejs
npm link @iota/identity-wasm

and then build the bindings

npm run build

If you linked the Wasm bindings, don't forget to unlink before packaging the module.

npm unlink --no-save @iota/identity-wasm
npm install

Minimum Requirements

The minimum supported version for node is: v16.0.0

FAQs

Last updated on 06 Apr 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc