Socket
Socket
Sign inDemoInstall

@holochain/hcid-js

Package Overview
Dependencies
1
Maintainers
7
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @holochain/hcid-js

javascript (wasm) build for rust Holochain base32 encoding scheme for keys, agents, identifiers, etc


Version published
Maintainers
7
Created

Readme

Source

HCID-JS

Generate Holochain IDs in javascript. A thin wrapper around rust compiled to WASM

Installation

This package is distributed via npm and can be installed using

npm install @holochain/hcid-js

Usage

This module exports a class called Encoding which can be used to construct an encoding for the different types of Holochain identifiers. Each of these identifiers are given a three character prefix:

  • AgentID (from signing key) : 'hcs'
  • ...

Depending on if you are using the module in node.js or the browser the calling syntax is slightly different. This is because in the browser the WASM must be asynchronously compiled and instantiated to prevent blocking the main thread. As a result all of the constructor returns a promises in the browser but not in node.


const publicKey = [...] // UInt8Array of bytes of public key

const enc = new Encoding('hcs0') // node.js
const enc = await new Encoding('hcs0') // browser

const agentId = enc.encode(publicKey)
const restoredPublicKey = enc.decode(id)

Building

From the root of the repo (hcid) the package can be build using

make build

and tests run using

make test

Note this runs browser tests which may fail if you do not have both firefox and chrome installed. On linux set the environment variable CHROME_BIN=chromium.

Keywords

FAQs

Last updated on 03 May 2019

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