Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
dat-registry-api
Advanced tools
More info on active projects and modules at dat-ecosystem.org
A web registry API including database and REST endpoints. Example hosted at http://datbase.org.
Install dat-registry-api
using npm and initialize the database:
npm install dat-registry-api --save
dat-registry-api <config>
See a default configuration file in config/config.default.js
.
var api = API(config)
The API takes required configuration variables. Here's an example config. See below in the Configuration section for more details about what configuration variables can be changed.
config.js
{
data: 'data',
admins: [
'admin', 'pam', 'willywonka'
]
township: {
secret: 'very very not secret',
db: 'township.db'
},
email: {
fromEmail: 'hi@example.com'
},
db: {
dialect: 'sqlite3',
connection: {
filename: 'sqlite.db'
},
useNullAsDefault: true
},
whitelist: false,
archiver: {
dir: 'archiver',
verifyConnection: false,
timeout: 3000
}
}
Destroys the underlying database connection.
var express = require('express')
var Api = require('dat-registry-api')
var config = require('./config')
var api = Api(config)
var router = express()
router.post('/users', api.users.post)
router.get('/users', api.users.get)
router.put('/users', api.users.put)
router.put('/users/suspend', api.users.suspend)
router.delete('/users', api.users.delete)
router.get('/dats', api.dats.get)
router.post('/dats', api.dats.post)
router.put('/dats', api.dats.put)
router.delete('/dats', api.dats.delete)
router.post('/register', api.auth.register)
router.post('/login', api.auth.login)
router.post('/password-reset', api.auth.passwordReset)
router.post('/password-reset-confirm', api.auth.passwordResetConfirm)
Admins can add, modify, and delete dats that they do not own. Admins can also delete and modify other users. You can specify a list of admin users by their usernames in the configuration.
{
"admins": ["admin", "pam", "willywonka"]
}
Each deployment should have a different secret key. You want to set the secret key for generating password hashes and salts.
{
township: '<SECRET_KEY>'
}
Specify where you want data for the app (databases and also by default the archiver) to be located. By default, all the data will be stored in ./data
. If you'd like the data to be stored somewhere else, add a data
key:
{
data: '/path/to/my/data'
}
To create a closed beta, add the whitelist
key with the path to a newline-delimited list of emails allowed to sign up. Default value false
allows anyone to register an account.
{
whitelist: '/path/to/my/list/of/folks.txt'
}
folks.txt
should have a list of valid emails, each separated by a new line character. For example:
pamlikesdata@gmail.com
robert.singletown@sbcglobal.netw
You can set the location where dat data is cached on the filesystem. By default it is stored in the data
directory (above), in the archiver
subdirectory. You can change this by using the archiver
key:
{
archiver: '/mnt1/bigdisk/archiver-data'
}
The site will report basic information to Mixpanel if you have an account. It will by default use the environment variable MIXPANEL_KEY
.
This can also be set in the configuration file by using the mixpanel
key:
{
mixpanel: '<my-api-key-here>'
}
If you want to have advanced security for generating passwords, you can use ES512 keys, for example. Generate the keys using this tutorial and set their locations in the configuration file.
{
township: {
db: 'township.db',
publicKey: path.join('secrets', 'ecdsa-p521-public.pem'),
privateKey: path.join('secrets', 'ecdsa-p521-private.pem'),
algorithm: 'ES512'
}
}
FAQs
A web registry API including database and REST endpoints.
The npm package dat-registry-api receives a total of 0 weekly downloads. As such, dat-registry-api popularity was classified as not popular.
We found that dat-registry-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.