This project offers a faster feedback loop for validating protocols and protocol structure in a test browser DWN. This should help you explore and validate your protocol types and structures. It might also help with debugging your Web5 application when working with DWN protocols.
To get started, you can run it locally or check out the live demo.
The app will spin up a test DWN in your browser for you. Follow the steps to install a protocol into your test DWN and write records against the protocol paths:
- In the first field, paste a Protocol Definition in valid JSON format.
- Click
Install
to install the protocol into your test browser DWN. - If the protocol is installed successfully, you should see the protocol
types
that you included in your protocol displayed back to you.
- In the second field, paste a Record Write/Create Request Payload in valid JSON format.
- Click
Check
to check the result of your Record Write/Create Request. - If the record is successfully created, you should see the
recordId
,contextId
, andparentId
associated with the resulting record displayed back to you. - Copy the
contextId
and/orparentId
for use in subsequent child record writes.
For example, let's say you have three types blogpost
, image
, and alt_text
. If you write a record to a protocolPath
called 'blogpost'
, save that record's contextId
. You can use it as the contextId
for a new record at a protocolPath
called 'blogpost/image'
.
Going further, you can save your 'blogpost/image'
record's id
and contextId
to use them as the parentId
and contextId
respectively for another new record at a protocolPath
called 'blogpost/image/alt_text'
.
- Make sure the details of the record you just created are still visible to you for this next part: In the third field, paste a DID pointing to another DWN.
- Click
Send
to check the result of your attempt to send your record to another DID's DWN. - If the send operation is successful, you should see a success message with the correct record's
id
displayed back to you.
- In the fourth field, paste a Record Read Request Payload in valid JSON format. You'll need a valid record's
id
to read. You can optionally pass thefrom
property into your request to read from another DID's DWN. - Click
Read
to see the result of your Record Read Request. - If the record read operation is successful, you should see the
recordId
,contextId
, andparentId
associated with the resulting record displayed back to you.
- Your DID is logged to the console for easy access. If you open a browser window in a private browsing context in addition to your existing session, you can experiment with sending records between two different DIDs.
- Resulting protocols, records, and sends are also logged to the console for further inspection if needed.
If you don't have a protocol definition ready to test out, you can get started with one of the protocol definition test vectors shared in the DWN SDK.
- Node - Installation
- Npm - Installation
- Nvm (recommended) - Installation
- Clone this repository and
cd
into the project.
$ git clone https://github.com/kirahsapong/protocol-validator.git
$ cd protocol-validator
- Run the code in your browser
$ npx http-server . -o -c-1
Resource | Description |
---|---|
CODEOWNERS | Outlines the project lead(s) |
CODE_OF_CONDUCT.md | Expected behavior for project contributors, promoting a welcoming environment |
CONTRIBUTING.md | Developer guide to build, test, run, access CI, chat, discuss, file issues |
GOVERNANCE.md | Project governance |
LICENSE | Apache License, Version 2.0 |