
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@lanonasis/security-sdk
Advanced tools
Centralized security and encryption SDK for LanOnasis ecosystem
Centralized Security and Encryption SDK for the Lanonasis/Onasis Ecosystem.
This SDK provides a unified, secure encryption layer used across all Onasis services:
# In monorepo (workspace)
bun add @lanonasis/security-sdk
# External (npm registry)
npm install @lanonasis/security-sdk
import { SecuritySDK } from "@lanonasis/security-sdk";
// Initialize with master key
const security = new SecuritySDK(process.env.ONASIS_MASTER_KEY);
// Encrypt user credentials
const encrypted = security.encrypt(
{ stripe_key: "sk_live_abc123" },
"user_123_stripe" // context for key derivation
);
// Store encrypted.encrypted, encrypted.iv, encrypted.authTag, encrypted.keyId in database
// Later, decrypt
const decrypted = security.decryptJSON(encrypted, "user_123_stripe");
console.log(decrypted.stripe_key); // 'sk_live_abc123'
import { getSecuritySDK } from "@lanonasis/security-sdk";
// Get singleton instance
const security = getSecuritySDK();
const encrypted = security.encrypt("sensitive-data", "context");
// Rotate credentials (generates new key)
const newEncrypted = security.rotate(oldEncrypted, "user_123_stripe");
// Hash password
const hashed = security.hash("user-password");
// Verify password
const isValid = security.verifyHash("user-password", hashed); // true
// Generate API key
const apiKey = security.generateAPIKey("onasis"); // 'onasis_abc123...'
// Generate random token
const token = security.generateToken(32); // 64 hex characters
For SHA-256 hashing of API keys (separate from password hashing):
import {
hashApiKey,
hashApiKeyBrowser,
ensureApiKeyHash,
ensureApiKeyHashBrowser,
verifyApiKey,
generateApiKey,
isSha256Hash
} from "@lanonasis/security-sdk/hash-utils";
// Hash API key (Node.js/server-side)
const hash = hashApiKey("lns_abc123..."); // Returns 64-char hex string
// Hash API key (Browser/async)
const hash = await hashApiKeyBrowser("lns_abc123...");
// Normalize (hash if needed, leave hash as-is if already hashed)
const normalized = ensureApiKeyHash("lns_abc123..."); // Always returns hash
const normalized = ensureApiKeyHash("a".repeat(64)); // Returns lowercase hash
// Verify API key against stored hash (constant-time comparison)
const isValid = verifyApiKey("lns_abc123...", storedHash); // true/false
// Generate secure API key
const apiKey = generateApiKey(); // 'lns_...' format
// Check if value is already a hash
const isHash = isSha256Hash(value); // true if 64-char hex string
// Sanitize for logging
const sanitized = security.sanitize("sk_live_abc123def456"); // 'sk_l...f456'
# Required: 32-byte (64 hex characters) master key
ONASIS_MASTER_KEY=your_64_character_hex_key
# Alternative name (for backward compatibility)
VSECURE_MASTER_KEY=your_64_character_hex_key
import { SecuritySDK } from "@lanonasis/security-sdk";
// Generate a new master key (do this once, store securely)
const masterKey = SecuritySDK.generateMasterKey();
console.log(masterKey); // 64 hex characters
SecuritySDKnew SecuritySDK(masterKeyHex?: string)
Encryption
encrypt(data, context, options?) - Encrypt datadecrypt(encryptedData, context) - Decrypt datadecryptJSON<T>(encryptedData, context) - Decrypt and parse JSONrotate(oldEncrypted, context, newData?) - Rotate encryptionHashing
hash(data, salt?) - Create secure hashverifyHash(data, hashedData) - Verify hashgenerateToken(bytes?) - Generate random tokengenerateAPIKey(prefix?) - Generate API keyUtilities
sanitize(data, showChars?) - Sanitize for loggingisValidEncryptedData(data) - Validate encrypted data structureStatic
SecuritySDK.generateMasterKey() - Generate new master keyMaster Key Storage
Context Usage
user_${userId}_${serviceKey}Key Rotation
rotate() method for seamless rotationLogging
sanitize() before logging sensitive dataimport { getSecuritySDK } from "@lanonasis/security-sdk";
const security = getSecuritySDK();
// Encrypt user's Stripe key
const encrypted = security.encrypt(
{ secret_key: userStripeKey },
`user_${userId}_stripe`
);
// Store in database
await db.insert("user_mcp_services", {
user_id: userId,
service_key: "stripe",
encrypted_credentials: JSON.stringify(encrypted),
});
// Later, decrypt for use
const encryptedData = JSON.parse(row.encrypted_credentials);
const credentials = security.decryptJSON(
encryptedData,
`user_${userId}_stripe`
);
import { getSecuritySDK } from "@lanonasis/security-sdk";
const security = getSecuritySDK();
// Store vendor API key
const encrypted = security.encrypt(apiKey, `vendor_${vendorName}`);
// Retrieve and decrypt
const decrypted = security.decrypt(encrypted, `vendor_${vendorName}`);
If you have existing encrypted data using the old key-manager encryption:
// Old format (from key-manager/server.js)
const oldEncrypted = {
encrypted: "...",
iv: "...",
authTag: "...",
};
// Decrypt with old method, re-encrypt with new SDK
const security = new SecuritySDK();
// ... decrypt old data ...
const newEncrypted = security.encrypt(decryptedData, context);
bun test
MIT
For issues or questions, contact the Onasis security team.
FAQs
Centralized security and encryption SDK for LanOnasis ecosystem
We found that @lanonasis/security-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.