CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-polkadot--util-crypto

A collection of useful crypto utilities for Polkadot ecosystem projects

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

crypto-init.mddocs/

Crypto Initialization

Core initialization functions to prepare the WebAssembly crypto backend before using cryptographic operations.

Capabilities

Crypto Wait Ready

Waits for the crypto WebAssembly backend to initialize and returns a promise indicating success or failure.

/**
 * Wait for the crypto WebAssembly backend to initialize
 * @returns Promise that resolves to true on success, false on failure
 */
function cryptoWaitReady(): Promise<boolean>;

Usage Example:

import { cryptoWaitReady } from "@polkadot/util-crypto";

// Wait for crypto to be ready before performing operations
const isReady = await cryptoWaitReady();
if (isReady) {
  // Safe to use crypto functions
  console.log("Crypto backend is ready");
} else {
  console.error("Failed to initialize crypto backend");
}

Crypto Is Ready

Synchronously checks if the crypto WebAssembly backend is ready for use.

/**
 * Check if the crypto WebAssembly backend is ready
 * @returns true if ready, false otherwise
 */
function cryptoIsReady(): boolean;

Usage Example:

import { cryptoIsReady, cryptoWaitReady } from "@polkadot/util-crypto";

// Check if already ready
if (cryptoIsReady()) {
  // Use crypto functions immediately
} else {
  // Need to wait
  await cryptoWaitReady();
}

Notes

  • Always call cryptoWaitReady() before using any cryptographic functions
  • The WebAssembly backend provides performance-critical implementations
  • In browser environments, the backend may take time to load and compile
  • Functions will throw errors if used before the backend is ready

Install with Tessl CLI

npx tessl i tessl/npm-polkadot--util-crypto

docs

address.md

base-encoding.md

crypto-init.md

ethereum.md

hashing.md

index.md

json-encryption.md

key-derivation-pbkdf.md

key-derivation.md

keypairs.md

mnemonic.md

random.md

signatures.md

tile.json