New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

secury

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

secury

AES-256-GCM encryption utility with Express middleware support for secure data transmission

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

secury

AES-256-GCM encryption utility with Express middleware support for secure data transmission.

Features

  • AES-256-GCM Encryption: Authenticated encryption with associated data (AEAD)
  • Flexible Key Handling: Support for string keys, buffers, or auto-generated keys
  • Express Middleware: Built-in middleware for decrypting request bodies
  • Basic Auth Middleware: Simple token-based authorization
  • Zero Dependencies: Uses only Node.js built-in crypto module

Installation

npm install secury




import secury from 'secury';

// Create AES handler with a string key
const aes = secury.aes('my-secret-key');

// Encrypt data
const encrypted = aes.encrypt('Hello, World!');
console.log(encrypted); // Base64 encoded string

// Decrypt data
const decrypted = aes.decrypt(encrypted);
console.log(decrypted); // 'Hello, World!'


import secury from 'secury';

// Generate a random 32-byte key
const aes = secury.aes(32);

// Get the generated key
const key = aes.aesKey();
console.log(key.toString('hex'));

// Renew the key
const newKey = aes.renew();




import express from 'express';
import secury from 'secury';

const app = express();
const aes = secury.aes('your-secret-key');

// Decrypt incoming requests
app.post('/secure', aes.authRoute(), (req, res) => {
  // req.body is automatically decrypted and parsed as JSON
  console.log(req.body);
  res.json({ success: true });
});



import express from 'express';
import secury from 'secury';

const app = express();

// Protect routes with a secret token
app.use('/admin', secury.basicAuthor('my-secret-token', { error: 'Unauthorized' }), (req, res) => {
  res.json({ message: 'Admin access granted' });
});

Keywords

encryption

FAQs

Package last updated on 04 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts