Skip to main content

@bitahon/browser-crypto

Implementation of Bitahon ICryptoProvider for use on the web.

Depends on:

Installation

General

To obtain the latest version, simply require the project using npm:

npm install @bitahon/browser-crypto

Usage

Initialize the required crypto-provider implementing the ICryptoProvider interface.

import {initCryptoProvider} from '@bitahon/crypto';

const provider = await import('@bitahon/browser-crypto');
initCryptoProvider(provider.default);

Once initialized, you can proceed to utilize the methods provided by the ICryptoProvider interface.

import crypto from '@bitahon/crypto';

const data: Buffer = await crypto.randomBytes(64);
const hash: Buffer = crypto.sha256(data);

console.log(hash.toString('hex'));

API

@bitahon/crypto