New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@polkadot/wasm-schnorrkel

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/wasm-schnorrkel - npm Package Compare versions

Comparing version 0.3.1 to 0.4.1

2

package.json
{
"name": "@polkadot/wasm-schnorrkel",
"version": "0.3.1",
"version": "0.4.1",
"collaborators": [

@@ -5,0 +5,0 @@ "Jaco Greeff <jacogr@gmail.com>",

@@ -8,17 +8,41 @@ # @polkadot/wasm-schnorrkel

- Output bundle is wrapped with camelCase names (not including the `__***` internal functions)
- Full named functions and parameter TypeScript definitions
- Requires for crypto is wrapped, removing "on-demand-require" warnings in webpack environment
- Full named function definitions for TypeScript
- Requires for crypto is wrapped, removing the "on-demand-require" warnings in webpack-based environments
- WASM output is done via a base-64 encoded string, supporting both Node.js and browser environments
- Extensive code cleanups and addition of functions required for all sr25519 operations
- Extended tests to cover Rust, wasm (via Node) and wasm (via jest), remove (here unused) www interfaces
- TextDecoder is polyfilled by using the version from `@polkadot/util` (consistent support, alos on React Native)
- Code cleanups and addition of functions required for all sr25519 operations
- Extended tests to cover Rust, wasm (via Node) and wasm (via jest), removed the (here unused) www test interfaces
- TextDecoder is polyfilled by using the version from `@polkadot/util` (consistent support, also on React Native)
- Polyfill for crypto functions that are not available in some environments (e.g. Jest & React Native)
## development
## Usage
1. Build can be done via `./build.sh`
2. Tests can be done via `./test.sh`
Install the package (also requires `@polkadot/util` for `TextEncoder` polyfills - not included here as a dependency to keep the tree lean)
`yarn add @polkadot/wasm-schnorrkel @polkadot/util`
Use it -
```js
const { u8aToHex } = require('@polkadot/util');
const { waitReady, keypairFromSeed } = require('@polkadot/wasm-schnorrkel');
async function main () {
// first wait until the WASM has been loaded (async init)
await waitReady();
// generate keypair via all-0 seed
const pair = keypairFromSeed(new Uint8Array(32));
// extract the parts
const secretKey = pair.subarray(0, 64);
const publicKey = pair.subarray(64, 96);
// display
console.log('publicKey:', u8aToHex(publicKey));
console.log('secretKey:', u8aToHex(secretKey));
}
```
## future work
Support asm.js for environments (like React Native) that doesn't have WASM support. Initial attempts made at this, but not active.
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