
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
ldn-inbox-server
Advanced tools
An experimental LDN inbox server for Event Notification messages.
yarn add ldn-inbox-server
Create required directories
mkdir config inbox public
Copy an example JSON Schema as config/notification_schema.json from this project.
Start the server:
npx ldn-inbox-server start-server --port 8000
Send a demonstration Event Notifications message:
curl -X POST -H 'Content-Type: application/ld+json' --data-binary '@examples/offer.jsonld' http://localhost:8000/inbox/
Start an inbox handler with a demo handler (that creates an Accept message in the ./outbox).
npx ldn-inbox-server handler @inbox -hn ./handler/accept_notification_handler.js
Start an outbox handler that send the notifications that are available outbox:
npx ldn-inbox-server handler @outbox -hn ./handler/send_notification_handler.js
LOG4JS : log4js logging levelLDN_SERVER_HOST : LDN inbox hostLDN_SERVER_PORT : LDN inbox portLDN_SERVER_INBOX_URL : LDN inbox url (path)LDN_SERVER_INBOX_PATH : LDN inbox pathLDN_SERVER_ERROR_PATH : LDN error pathLDN_SERVER_OUTBOX_PATH : LDN outbox pathLDN_SERVER_PUBLIC_PATH : public (HTML) pathLDN_SERVER_JSON_SCHEMA : notification JSON validation schemaLDN_SERVER_BASEURL : baseurl of the LDN inbox serverLDN_SERVER_INBOX_GLOB : glob of files to process in inbox directoryLDN_SERVER_HAS_PUBLIC_INBOX : if true, then public read access is allowed on inboxServer extensions are possible by providing custom inbox and notification handlers. E.g.
npx ldn-inbox-server handler @inbox -hn handler/my_handler.js
Or, in JavaScript:
const { handle_inbox } = require('ldn-inbox-handler');
main();
async function main() {
await handle_inbox('./inbox', {
'inbox': './inbox',
'outbox': './outbox',
'public': './public',
'error': './error',
'batch_size': 5,
'glob': '^.*\\.jsonld$',
'config': './config/inbox_config.json',
'notification_handler': 'handler/my_handler.js'
});
}
with my_handler.js :
async function handle({path,options}) {
//...
return { path, options, success: true };
}
module.exports = { handle };
A handler can be started on any directory. E.g. a workflow might be:
A handler that creates for an incoming notification an Accept notification in the @outbox.
A handler that updates an event log with the incoming notification.
Requires a configuration file with property notification_handler.eventlog:
log: the path to the event log (starting from the public directory)dir: the path to a container to store the events (starting from the public directory)The log and dir path may contain a @artifact(:strip)?@ directive to fill in the
path of the current artifact. The :strip filter is used to strip an artifact path of a file extension. E.g. path/artifact.html becomes path/artifact when using a :strip.
A handler/multi_notification_handler.js is available to start multiple handler for each notification messages. The handlers to start are specified in a configuraton file that can be passed via the config parameter of an handle_inbox. In the commmand line tool bin/ldn-inbox-server the default location of such config file is config/inbox_config.json when processing an @inbox, and config/outbox_config.json when processing an @outbox.
A handler to Offer an event log to a memento server.
Requires a configuration file with property notification_handler.offer_memento:
actor: the LDN+AS2 actor to use in a notificationtarget: the LDN+AS2 target to use in a notificationA hanlder to send notification that live in the @outbox via the LDN protocol to the LDN target.
A handler that validates the incoming notification and checks if the object or context contains an artifact that is part of the public resources. See 'Artifact support' below.
This code base contains Event Notifications support for Data Node artifacts. See the examples
in public/artifacts-example. Move this directory tp public/artifacts to get a running example.
.meta file with the X-Artifact header set to true to be recognized by the software as an artifactLink-Template header in the .meta fileconfig/inbox_config.json and config/outbox_config.json define the location of the possible event logs for the artifactFAQs
A demonstration Event Notifications Inbox server
We found that ldn-inbox-server 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.