SuperDapp WebCrypto is an open-source, cross-platform cryptographic library that implements the Web Cryptography API. It supports symmetric and asymmetric key pair generation, key derivation, key wrapping/unwrapping, encryption, decryption, signing, and verification.
This library serves as the core end-to-end encryption solution for SuperDapp applications and now includes full support for Node.js, making it suitable for both browser and server environments.
- Cross-Platform: Fully functional in both browser and Node.js environments.
- Robust Security: Implements advanced cryptographic primitives for secure encryption and signing.
- Node.js Support: Leverages
@peculiar/webcrypto
to provide efficient cryptographic operations in Node.js. - Comprehensive API: Covers symmetric, asymmetric, and key management operations.
- Modular Design: Lightweight and designed for flexibility and ease of use.
Comprehensive documentation will be available soon. For now, explore the source code and examples to understand its capabilities.
To use this library in your project, follow these steps:
Install the package via npm:
npm install @superdapp/superdapp-webcrypto
Or link it locally during development:
# From the library directory:
(cd ../superdapp-webcrypto; npm link)
# From your importing project:
npm link @superdapp/superdapp-webcrypto
import { encryptMessage, decryptMessage } from '@superdapp/superdapp-webcrypto';
const key = 'secure-key';
const message = 'Hello, SuperDapp!';
const encrypted = await encryptMessage(message, key);
console.log('Encrypted:', encrypted);
const decrypted = await decryptMessage(encrypted, key);
console.log('Decrypted:', decrypted);
import { encryptMessage, decryptMessage } from '@superdapp/superdapp-webcrypto';
import { Crypto } from '@peculiar/webcrypto';
// Initialize the crypto shim for Node.js
global.crypto = new Crypto();
const key = 'secure-key';
const message = 'Hello, SuperDapp!';
const encrypted = await encryptMessage(message, key);
console.log('Encrypted:', encrypted);
const decrypted = await decryptMessage(encrypted, key);
console.log('Decrypted:', decrypted);
Run the test suite using:
npm test
To debug tests, follow the AVA Debug Guide.
Contributions are welcome! Follow these steps to get started with development:
-
Clone the repository:
git clone https://github.com/SuperDappAI/superdapp-webcrypto.git
-
Install dependencies:
npm install
-
Run tests to ensure everything is working:
npm test
-
Make your changes and submit a pull request.
This library is licensed under the Apache License 2.0.
SuperDapp WebCrypto is inspired by FortKnoxster Crypto Web, with enhanced features and Node.js support to meet the evolving needs of modern web and server applications.