Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@entropyxyz/sdk

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entropyxyz/sdk

JS SDK for entropy blockchain

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
149
increased by609.52%
Maintainers
0
Weekly downloads
 
Created
Source

Entropy JavaScript SDK

[!WARNING]
This project is currently in alpha, and should be considered unstable.

The @entropyxyz/sdk is a typescript library allowing developers to interact with the Entropy network and easily request signatures. This includes concise wrappers to execute tasks such as registering a set of programs for a resulting verifying key (entropy account) and requesting signatures from that verifying key.

SDK

Installation

NPM:

npm install @entropyxyz/sdk --save

Yarn:

yarn add @entropyxyz/sdk

Usage

The main interface to interact with Entropy. This class provides methods to register, check registration status, interact with programs, and sign transactions. Users should await the ready promise to ensure the class is initialized before performing operations.

Basic example

The example below walks you through registering an account, requesting signatures from the validating group, and then verifying those signatures. For a more in-depth walkthrough, see our end-to-end test.

import { Keyring } from '@entropyxyz/sdk/keys';
import { wasmGlobalsReady, Entropy } from '@entropyxyz/sdk';

async function basicExample() {
    await wasmGlobalsReady();
    
    const seed = '0x786ad0e2df456fe43dd1f91ebca22e235bc162e0bb8d53c633e8c85b2af68b7a';
    const keyStore = { seed };
    const keyring = new Keyring(keyStore);
    const opts = {
        endpoint: 'ws://127.0.0.1:9944',
        keyring
    };
    const entropy = new Entropy(opts);

    await entropy.ready;
    
    // This is the default program registration and configuration.
    const msgObject = {
        msg: Buffer.from('Hello world: signature from entropy!').toString('hex')
    };
    
    const verifyingKey = await entropy.register();
    const signatureData = await entropy.signWithAdaptersInOrder({
        msg: msgObject,
        order: ['deviceKeyProxy']
    });
    
    if (!await entropy.verify(signatureData)) throw new Error('can not verify signature');
    const { signature } = signatureData;
    
    // ------------------
    // Here is where you 
    // could do stuff 
    // with the signature.
    // ------------------

    await entropy.close()
}

basicExample();

Issues and bugs

This tool is in early development. As such, a lot of things may not work as expected. Feel free to play around with the SDK and report any issues in the issues tab.

FAQs

Package last updated on 09 Jan 2025

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc