1.0.1 • Published 9 months ago

thencrypt v1.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

thencrypt

An easy-to-use encryption module based on Crypto.

Installation

npm install thencrypt

Usage

import thencrypt from 'thencrypt';

interface Encryptor {
    encrypt(text: string): Promise<string>;
    decrypt(encryptedText: string): Promise<string>;
}

async function dokuzKey(): Promise<void> {
    const secretKey: string = 'SECRET_KEY';
    const encryptor: Encryptor = new thencrypt(secretKey);
    const text: string = 'I love musti!';

    try {
        const encrypted: string = await encryptor.encrypt(text);
        console.log('Encrypted data: ', encrypted);

        const decrypted: string = await encryptor.decrypt(encrypted);
        console.log('Decrypted data: ', decrypted);
    } catch (error) {
        console.error('Encryption error: ', error);
    }
}

dokuzKey();

License

The thencrypt package is licensed under the Apache 2.0 license. More can be found in LICENSE

1.0.1

9 months ago

1.0.0

9 months ago

0.9.3

9 months ago

0.9.22

9 months ago

0.9.21

9 months ago

0.9.2

9 months ago

0.9.1

9 months ago

0.1.13

9 months ago

0.1.12

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago