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

@appliedblockchain/mantle

Package Overview
Dependencies
Maintainers
33
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appliedblockchain/mantle

Mantle is a blockchain SDK targeting Ethereum and Hyperledger Fabric

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-82.35%
Maintainers
33
Weekly downloads
 
Created
Source

Mantle

Mantle SDK repository

Initialising a new Mantle instance:

const mantle = new Mantle()

The mantle instance exposes methods to facilitate, amongst other things, mnemonic and HD public/private key generation, IPFS API access etc.

Mnemonic generation

Mnemonic, HD private/public keys and private/public keys are generated via loadMnemonic. Supply a mnemonic associated with an existing account in order to retrieve key information, or supply no argument in order to generate a new set of keys.

Symmetric encryption

Facilitated via the encryptSymmetric and decryptSymmetric static methods. Shared secrets can be generated via createSymmetricKey.

IPFS setup

  • Install IPFS: https://ipfs.io/docs/install/

  • Ensure that you have initialized IPFS and have an IPFS daemon instance running before attempting to interact with the API:

    • ipfs init
    • ipfs daemon

Examples

Please see tests in test/mantle.spec.js for further examples.

Mnemonic generation and key removal

mantle.mnemonic // undefined

mantle.loadMnemonic() // No argument supplied - used for new accounts

mantle.mnemonic // 'knife zone arch average surround tape napkin elephant share fuel jeans false'

mantle.removeKeys()
mantle.mnemonic // null

mantle.loadMnemonic('tragic panic toast hazard royal marine visual laptop salmon guard finger upper') // Mnemonc supplied - should be used to load existing keys

Asymmetric encryption/decryption

const data = 'foo'

const encrypted = Mantle.encrypt(data, mantle.publicKey) // Returns a buffer

const decrypted = Mantle.decrypt(encrypted, mantle.privateKey) // 'foo'

Symmetric encryption/decryption

const data = 'foo'
const secret = Mantle.createSymmetricKey()

const encrypted = Mantle.encryptSymmetric(data, secret) // Returns a Buffer

const decrypted = Mantle.decryptSymmetric(encrypted, secret) // 'foo'

Local testing

  • Install dependencies: npm install
  • Install and initialize IPFS (see IPFS setup section)
  • Run the IPFS daemon: ipfs daemon
  • Run test suite: npm test

Documentation

Please check the documentation created in this repo: https://github.com/appliedblockchain/mantle-intro-doc

FAQs

Package last updated on 21 Sep 2018

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