
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.
didcomm-node
Advanced tools
Basic DIDComm v2 support for modern browsers and NodeJS.
This package is written in Rust using didcomm crate. It compiles
to wasm32 and exposes Javascript/Typescript API with wasm-bindgen help.
Also wasmp-pack helps in packaging and publishing.
To use didcomm install it with npm
npm install didcomm --save # If you plan use webpack or other bundler
npm install didcomm-node --save # If you plan use it without bundlers in NodeJS
WASM_TARGET=nodejs make # builds NodeJS package in pkg directory
cd ./demo
npm install
npm run start
wasm32 compatible environment (modern browsers and recent NodeJS are supported).SecretsResolver and DIDResolver interfaces must be implemented on the application level.
Demo application provides 2 simple implementations ExampleDIDResolver
and ExampleSecretsResolver that allows resolve locally known DID docs and secrets for tests/demo purposes.
SecretsResolver must match the corresponding key IDs from DID Doc verification methods.did#key-id.fromPrior field) is supported.A general usage of the API is the following:
Message (plaintext, payload).Message.pack_encrypted to build an Encrypted DIDComm messageMessage.pack_signed to build a Signed DIDComm messageMessage.pack_plaintext to build a Plaintext DIDComm messageMessage.unpack on receiver side that will decrypt the message, verify signature if needed
and return a Message for further processing on the application level.This is the most common DIDComm message to be used in most of the applications.
A DIDComm encrypted message is an encrypted JWM (JSON Web Messages) that
It is important in privacy-preserving routing. It is what normally moves over network transports in DIDComm applications, and is the safest format for storing DIDComm data at rest.
See Message::pack_encrypted documentation for more details.
Authentication encryption example (most common case):
// --- Build message from ALICE to BOB ---
const msg = new Message({
id: "1234567890",
typ: "application/didcomm-plain+json",
type: "http://example.com/protocols/lets_do_lunch/1.0/proposal",
from: "did:example:alice",
to: ["did:example:bob"],
created_time: 1516269022,
expires_time: 1516385931,
body: { messagespecificattribute: "and its value" },
});
// --- Packing encrypted and authenticated message ---
let didResolver = new ExampleDIDResolver([ALICE_DID_DOC, BOB_DID_DOC]);
let secretsResolver = new ExampleSecretsResolver(ALICE_SECRETS);
const [encryptedMsg, encryptMetadata] = await msg.pack_encrypted(
BOB_DID,
ALICE_DID,
null,
didResolver,
secretsResolver,
{
forward: false, // Forward wrapping is unsupported in current version
}
);
console.log("Encryption metadata is\n", encryptMetadata);
// --- Send message ---
console.log("Sending message\n", encryptedMsg);
// --- Unpacking message ---
didResolver = new ExampleDIDResolver([ALICE_DID_DOC, BOB_DID_DOC]);
secretsResolver = new ExampleSecretsResolver(BOB_SECRETS);
const [unpackedMsg, unpackMetadata] = await Message.unpack(
encrypted_msg,
didResolver,
secretsResolver,
{}
);
console.log("Receved message is\n", unpackedMsg.as_value());
console.log("Receved message unpack metadata is\n", unpackMetadata);
Anonymous encryption example:
let [encryptedMsg, encryptMetadata] = await msg.pack_encrypted(
BOB_DID,
null, // Keep sender as None here
null,
didResolver,
secretsResolver,
{
forward: false, // Forward wrapping is unsupported in current version
}
);
Encryption with non-repudiation example:
let [encrypted_msg, encrypt_metadata] = await msg.pack_encrypted(
BOB_DID,
ALICE_DID,
ALICE_DID, // Provide information about signer here
did_resolver,
secrets_resolver,
{
forward: false, // Forward wrapping is unsupported in current version
}
);
Signed messages are only necessary when
Adding a signature when one is not needed can degrade rather than enhance security because it relinquishes the sender’s ability to speak off the record.
See Message.pack_signed documentation for more details.
let [signed, metadata] = await msg.pack_signed(
ALICE_DID,
didResolver,
secretsResolver
);
A DIDComm message in its plaintext form that
They are therefore not normally transported across security boundaries.
let plaintext = msg.pack_plaintext(didResolver).expect("Unable pack_plaintext");
Install wasm-pack from https://rustwasm.github.io/wasm-pack/installer/ and then
make # Will output modules best-suited to be bundled with webpack
WASM_TARGET=nodejs make # Will output modules that can be directly consumed by NodeJS
WASM_TARGET=web make # Will output modules that can be directly consumed in browser without bundler usage
wasm-pack buildwasm-pack build # Will output modules best-suited to be bundled with webpack
wasm-pack build --target=nodejs # Will output modules that can be directly consumed by NodeJS
wasm-pack build --target=web # Will output modules that can be directly consumed in browser without bundler usage
WASM_TARGET=nodejs make
cd ./tests-js
npm install
npm test
WASM_TARGET=nodejs make
cd ./tests-js
npm install
npm run test-puppeteer
Note tests will be executed with jest+puppeteer in Chromium installed inside node_modules.
wasm-pack publishwasm-pack publish
wasm-bindgen for communicating
between WebAssembly and JavaScript.console_error_panic_hook
for logging panic messages to the developer console.wee_alloc, an allocator optimized
for small code size.PRs are welcome!
The following CI checks are run against every PR:
cargo check --all-targetsnpm run check in tests-js directorynpm run check in demo directorynpm test in tests-js directorycargo fmt --allnpx prettier --write .FAQs
WASM based javascript wrapper for DIDComm
The npm package didcomm-node receives a total of 89 weekly downloads. As such, didcomm-node popularity was classified as not popular.
We found that didcomm-node demonstrated a not healthy version release cadence and project activity because the last version was released 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.