secret-castle-auth
v1.0.8
Published
Authentication library for managing secrets securely.
Downloads
6
Maintainers
Readme
secret-castle-auth
Secure authentication library for managing secrets, leveraging Node.js's built-in crypto
module for encryption and decryption of sensitive information.
Installation
Run the following command to install secret-castle-auth
:
npm install secret-castle-auth
Usage
First, import secret-castle-auth
into your project:
const SecretCastleAuth = require('secret-castle-auth');
Create an instance of SecretCastleAuth
with your secret key:
const secretKey = 'your-secret-key-here'; // Ensure this is securely generated and stored
const sca = new SecretCastleAuth(secretKey);
Encrypting Data
To encrypt data, use the encrypt
method:
const encryptedData = sca.encrypt('Sensitive information');
console.log(encryptedData);
Decrypting Data
To decrypt data, use the decrypt
method with the output from the encrypt
method:
const decryptedData = sca.decrypt(encryptedData);
console.log(decryptedData); // Outputs: Sensitive information
Contributing
Contributions are welcome! Please submit a pull request or create an issue for any features or bug fixes.
License
This project is licensed under the MIT License - see the LICENSE file for details.