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

@greymass/keycert

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@greymass/keycert

Anchor key certificate encoding and decoding library

  • 1.5.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

@greymass/keycert

Anchor key certificate encoding and decoding library for JavaScript.

Installation

The @greymass/keycert package is distributed as a module on npm.

yarn add @greymass/keycert
# or
npm install --save @greymass/keycert

Usage

import {generate, decrypt} from '@greymass/keycert'

generate({
    privateKey: '5KYnSy2U9y8Ua1AbWYDQxuEa6Smc9WPtBNsQ6TZRPsZBqFB3AqS',
    account: {actor: 'foobar', permission: 'owner'},
    chainId: '2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840',
}).then(({cert, encryptionWords}) => {
    console.log(String(cert)) // anchorcert:KgKgBT5ajPc6VroP2hHk2S4COKSiqnT8z0bVqRB0aEAAAAAAXHMoXQAAAACAqyanACTh3X6hzLZx-dGsO0swCpi2WDg_Xd8mSK-C2kY_gygHpHe8jNk
    console.log(encryptionWords) // [ 'number', 'arrow', 'twenty', 'permit', 'much', 'caution' ]
})

decrypt(
    'anchorcert:KgKgBT5ajPc6VroP2hHk2S4COKSiqnT8z0bVqRB0aEAAAAAAXHMoXQAAAACAqyanACTh3X6hzLZx-dGsO0swCpi2WDg_Xd8mSK-C2kY_gygHpHe8jNk',
    ['number', 'arrow', 'twenty', 'permit', 'much', 'caution']
).then(({chainId, account, privateKey}) => {
    console.log(String(chainId)) // 2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840
    console.log(JSON.stringify(account)) // {"actor": "foobar", "permission": "owner"}
    console.log(privateKey.toWif()) // 5KYnSy2U9y8Ua1AbWYDQxuEa6Smc9WPtBNsQ6TZRPsZBqFB3AqS
})

Developing

You need Make, node.js and yarn installed.

Clone the repository and run make to checkout all dependencies and build the project. See the Makefile for other useful targets. Before submitting a pull request make sure to run make lint.


Made with ☕️ & ❤️ by Greymass, if you find this useful please consider supporting us.

FAQs

Package last updated on 09 Apr 2024

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