JSPM

@ocap/mcrypto

1.8.28
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21941
  • Score
    100M100P100Q158581F
  • License Apache-2.0

Crypto lib that provides signer,crypter,hasher interface

Package Exports

  • @ocap/mcrypto

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ocap/mcrypto) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mcrypto:js

styled with prettier docs Gitter

Forge mcrypto implementation for javascript, just a wrapper around existing javascript crypto libraries.

Usage

npm i @ocap/mcrypto -S
# OR
yarn add @ocap/mcrypto

Sign/Verify

const { Signer } = require('@ocap/mcrypto');

const keyPair = Signer.Ed25519.genKeyPair();
const message = 'some message to sign';
const signature = Signer.Ed25519.sign(message, keyPair.secretKey);
const result = Signer.Ed25519.verify(message, signature, keyPair.publicKey);
assert.ok(result);

Hashing

const { Hasher } = require('@ocap/mcrypto');

const message = 'message to hash';
const hash = Hasher.SHA2.hash256(message);

Documentation

For full documentation, checkout https://ocap-js.netlify.com

Implementation

Hasher

  • keccakf1600: js-sha3
  • sha2: hash.js
  • sha3: js-sha3

Signer

  • ed25519: tweetnacl
  • secp256k1: elliptic

Crypter

  • aes-cbc-256: crypto-js