@dyne/did
v1.15.1
Published
Create and manage did:dyne identifiers
Downloads
9
Readme
Create and manage Dyne.org's W3C-DID in JavaScript
🚀 Quick start
Start by reading the documentation to understand better how Dyne.org's W3C-DID works
https://dyne.org/W3C-DID
💾 Install
Stable releases are published on https://www.npmjs.com/package/dyne-did that have a slow pace release schedule that you can install with
yarn add @dyne/did
# or if you use npm
npm install @dyne/did
🎮 Usage
The bindings are composed of four main functions:
createKeyring
: takes as input a string that will be used as description inside the did document and return the string under the key controller along with your keyring.createRequest
: takes as input the output of the above function along with a string containg the domain and aDidActions
value and return an unsigned request that will later be signed by an admin.signRequest
: takes as input an unsigned request, the signer keyring and the signer domain and return the signed request ready to be sent in order to create, update or deactivate a did document.sendRequest
: takes as input an endpoint and a request and sends the latter todid.dyne.org/*endpoint*
.
There are other functions related to particular domains as well, but the functioning is almost identical.
All functions return a Promise.
To start using the Dyne.org's W3C-DID you have to create a domain admin request and send it to us. This can be created by using:
import { createKeyring, createRequest, DidActions } from "@dyne/did";
// or if you don't use >ES6
// const { createKeyring, createRequest, DidActions } = require('@dyne/did')
// Create a new did document request
const keyring = await createKeyring("new_domain_admin_request");
const request = await createRequest(keyring, "domain_A", DidActions.CREATE);
console.log(request);
Once your request has been accepted people can create a request for a special context of your domain in the following way:
import { createKeyring, createRequest, DidActions } from "@dyne/did";
// or if you don't use >ES6
// const { createKeyring, createRequest, DidActions } = require('@dyne/did')
// Create a new did document request
const keyring = await createKeyring("new_domain_context_admin_request");
const request = await createRequest(keyring, "domain.context_A", DidActions.CREATE);
console.log(request);
This request will be sent to you and you will have to sign it and you or the participant will send the result to did.dyne.org
in order to create the new did document.
import { signRequest, sendRequest } from "@dyne/did";
// or if you don't use >ES6
// const { signRequest, sendRequest } = require('@dyne/did')
//Sign and send did document request
const signedRequest = await signRequest(request, keyring, "domain_A");
const result = await sendRequest("api/v1/domain/pubkeys-accept.chain", signedRequest);
Update and deactivate procedure follow the same idea.
😍 Acknowledgements
Copyright (C) 2022-2023 by Dyne.org foundation, Amsterdam
Designed, written and maintained by Denis Jaromil, Puria Nafisi Azizi, Andrea D'Intino, Alberto Lerda and Matteo Cristino.
👤 Contributing
Please first take a look at the Dyne.org - Contributor License Agreement then
- 🔀 FORK IT
- Create your feature branch
git checkout -b feature/branch
- Commit your changes
git commit -am 'Add some fooBar'
- Push to the branch
git push origin feature/branch
- Create a new Pull Request
- Thank you
💼 License
dyne-did js - a javascript wrapper of Dyne.org's W3C-DID
Copyright (C) 2022-2023 Dyne.org foundation
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.