UNPKG

@indra.ai/deva.security

Version:

The Security Deva the Security for Deva.space, Deva.cloud, and Deva.world.

62 lines (58 loc) 1.5 kB
// Copyright (c)2025 Quinn Michaels // Security Deva // Security Deva Manages Security in deva.world. import Deva from '@indra.ai/deva'; import pkg from './package.json' with {type:'json'}; const {agent,vars} = pkg.data; // set the __dirname import {dirname} from 'node:path'; import {fileURLToPath} from 'node:url'; const __dirname = dirname(fileURLToPath(import.meta.url)); const info = { id: pkg.id, name: pkg.name, describe: pkg.description, version: pkg.version, url: pkg.homepage, dir: __dirname, git: pkg.repository.url, bugs: pkg.bugs.url, author: pkg.author, license: pkg.license, copyright: pkg.copyright, }; const SECURITY = new Deva({ info, agent, vars, utils: { translate(input) {return input.trim();}, parse(input, route=false) { // with the parse method we are going to take the input with a // values object to provide the personalization let output = input; if (route) for (let x in route) { const key = `::${x}::`; const value = route[x]; output = output.replace(key, value); } return output.trim(); }, process(input) {return input.trim();} }, listeners: {}, modules: {}, devas: {}, func: {}, methods: {}, onReady(data, resolve) { this.prompt(this.vars.messages.ready); return resolve(data); }, onError(err, data, reject) { this.prompt(this.vars.messages.error); console.log(err); return reject(err); } }); export default SECURITY