0.0.7 • Published 12 months ago

@polkadot-labs/schnorrkel-wasm v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@polkadot-labs/schnorrkel-wasm

@polkadot-labs/schnorrkel-wasm is a JavaScript WebAssembly (WASM) wrapper for the schnorrkel Rust crate. This package provides a convenient interface for using Schnorrkel's cryptographic functions in JavaScript applications.

Features

  • Schnorrkel: Provides access to Schnorrkel's cryptographic functions via WebAssembly.

Installation

To install the library, you can use npm or yarn or pnpm:

npm install @polkadot-labs/schnorrkel-wasm

Usage

Here is an example of how to use the library:

import {
  sr25519_secret_from_seed,
  sr25519_pubkey,
  sr25519_sign,
  sr25519_verify,
} from "@polkadot-labs/schnorrkel-wasm"

const seed = new Uint8Array(32)

// Example usage for generating a sr25519 keypair
const privateKey = sr25519_secret_from_seed(seed)
const publicKey = sr25519_pubkey(privateKey)

// Example usage for signing a message
const message = new TextEncoder().encode("Hello")
const signature = sr25519_sign(publicKey, privateKey, message)

// Example usage for verifying a signature
const isValid = sr25519_verify(publicKey, message, signature)
console.log("Is valid:", isValid)

License

This project is licensed under the MIT License. See the LICENSE file for details.

0.0.7

12 months ago

0.0.6

1 year ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago