Skip to content

JavaScript Modules

Note: This feature is currently under development and will be available in a future release.

Sentrie will support integration with JavaScript modules, allowing you to use existing JavaScript libraries and functions within your policies. This enables complex business logic, data processing, and integration with external services.

  • ES6 Modules: Support for modern JavaScript module syntax
  • CommonJS: Support for Node.js-style modules
  • NPM Packages: Integration with npm package ecosystem
  • Local Modules: Support for local JavaScript files
  • UUID Generation: uuid() function for generating unique identifiers
  • Cryptographic Functions: Hashing, encryption, and digital signatures
  • Base64 Encoding: Base64 encoding and decoding
  • Date/Time Utilities: Date manipulation and formatting
  • String Processing: Advanced string operations
  • Data Validation: Input validation and sanitization
  • Sandboxing: JavaScript execution in a secure sandbox
  • Permission System: Fine-grained control over module access
  • Resource Limits: Memory and CPU usage limits
  • Network Access: Controlled network access for modules
namespace com/example/advanced
policy user {
use uuid from "uuid" as uuidLib
use { hash, verify } from "crypto-js" as cryptoLib
rule generateToken = default "" {
let userId = user.id
let timestamp = now()
let payload = {
"userId": userId,
"timestamp": timestamp
}
let token = uuidLib.uuid()
let signature = cryptoLib.hash(JSON.stringify(payload))
yield {
"token": token,
"signature": signature,
"payload": payload
}
}
export decision of generateToken
}

This feature is actively being developed. Check back for updates or follow our GitHub repository for the latest news.