logo

A Rails demo for DIDComm Messaging protocol

Posted by onyxblade |3 hours ago |1 comments

onyxblade 3 hours ago

I made a Rails demo that sends and receives [DIDComm](https://identity.foundation/didcomm-messaging/spec/v2.1/) messages — a decentralized messaging protocol based on W3C DIDs (Decentralized Identifiers).

An server implementing DID(did:web more precisely) will serve an identity document at `/.well-known/did.json`, including the public keys for encryption and available service endpoints(DIDComm). For example, my demo server has its document here https://dc.mbkr.ca/.well-known/did.json . This server amounts to the DID `did:web:dc.mbkr.ca`. To send a message to me, you only need this DID and the message itself.

I also set up a public demo server at https://dc-public.mbkr.ca/ which can be logged in using `public` as password.

When implementing, I first tried to generate a Ruby implementation of DIDComm specification, it kind of works but I have no confidence on it since I'm not expert on encryption. Then I think it's better to reuse the [Rust reference implementation](https://github.com/sicpa-dlab/didcomm-rust) . The Rust implementation emits a wasm module, but `wasmtime-rb` seems not mature enough to use it. Eventually I made a sidecar HTTP server to wrap the wasm library, and expose HTTP endpoints that can be called by Ruby or any language. https://github.com/onyxblade/didcomm-http

Hope you find it fun!