Skip to content

A versatile cryptographic library designed for cross-platform compatibility, implementing the Web Cryptography API. It supports secure key generation, encryption, decryption, signing, and verification for modern web and server applications.

License

Notifications You must be signed in to change notification settings

SuperDappAI/superdapp-crypto

 
 

Repository files navigation

Open Source? Yes!

SuperDapp WebCrypto

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.


Key Features

  • 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.

Documentation

Comprehensive documentation will be available soon. For now, explore the source code and examples to understand its capabilities.


Getting Started

To use this library in your project, follow these steps:

Installation

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

Example Usage

Browser

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);

Node.js

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);

Testing

Run the test suite using:

npm test

Debugging

To debug tests, follow the AVA Debug Guide.


Development

Contributions are welcome! Follow these steps to get started with development:

  1. Clone the repository:

    git clone https://github.com/SuperDappAI/superdapp-webcrypto.git
  2. Install dependencies:

    npm install
  3. Run tests to ensure everything is working:

    npm test
  4. Make your changes and submit a pull request.


License

This library is licensed under the Apache License 2.0.


Acknowledgments

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.

About

A versatile cryptographic library designed for cross-platform compatibility, implementing the Web Cryptography API. It supports secure key generation, encryption, decryption, signing, and verification for modern web and server applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.8%
  • HTML 0.2%