βœ”οΈπŸ“‡ Your Own Permanent Identity on Web3, with 1 click!

Overview

DID:AR

I just wrote this, so there will be some changes, improvements and bugs. But feel free to play around with it.

Enables users to create a smartweave contract on Arweave to store their Decentralized Identity Document (DID Doc).

βœ”οΈ πŸ“‡ Your Own Permanent Identity on Web3

βœ”οΈ πŸ—ƒοΈ Resolve DID from .ar name, so douganderson444.ar -> did:ar:....

βœ”οΈ πŸ’° No Tokens / cryptocurrency (under 100kb), thanks to Bundlr!

βœ”οΈ ♾️ Lasts forever, thanks to Arweave!

βœ”οΈ πŸ’» Saves to your OWN device, thanks to PeerPiper!

βœ”οΈ πŸ—ƒοΈ Conveniently Control Your Data

Install

Package deployed to npm @peerpiper/did-ar

npm i @peerpiper/did-ar

Initialize

import { init } from 'did-ar';

const didar: DIDAr = await init({
	// local: true, // default is false, uses local Arweave instance
	// wallet: JWKInterface, // default is 'use_wallet' if no wallet is set
});

// which gives you a DIDAr instance:
interface DIDAr {
	warp: WarpFactory;
	wallet: JWKInterface | 'use_wallet';
	create: Function;
	read: Function;
	update: Function;
}

Create DID

Pass an RSA Public Key JWK and Ed25519PublicKey bytes (Uint8Array) to create, which will create a did and did document saved as the Arweave Smartweave contract state.

The Demo uses the keys from a PeerPiper/web3-wallet-connector to create the DID.

const did = await didar.create({ RSAPublicKey: JWK, Ed25519PublicKey: Uint8Array });
console.log(did); // did:ar:abc123zyx-ELEMENOPee
// or when running in `vite dev` mode:
console.log(did); // did:arlocal:abc123zyx-ELEMENOPee

Read DID (Resolve)

If you have a didar instance, you can simply read from it:

const didDoc = await didar.read(did);

If you are using DID from an external source, read using the resolver, as this library exports a standalone DID Resolver compliant with the DIF.

import { didArResolver } from '@peerpiper/did-ar';
import { Resolver } from 'did-resolver'; // Decentralized Identity Foundation

const did = `did:ar:abc123zyx-ELEMENOPeeeeeeeeeeeeeeee`;
// or when running in `vite dev` mode:
// did:arlocal

const arResolver = didArResolver.getResolver();
resolver = new Resolver(arResolver);
const didDoc = (await resolver.resolve(did)).didDocument;

console.log(didDoc.verificationMethod[0].publicKeyJwk); // one of the did's public keys

Read from .ar name (Resolve DID from Arweave Name Service / Name Token)

import { arnsResolver } from '@peerpiper/did-ar';

const arnsName = 'douganderson444'; // From: douganderson444.ar or 'douganderson444.arweave.dev' || 'douganderson444.ar.page';
const did = await arnsResolver(arnsName);

console.log(did); // did:ar:UGnqpxdraMbkmG-4F6jU7xkFhErNgaXLQf39tW7yYck

Update DID Document

To update, just pass the new DID Doc properties you wish to update. Then, did-ar verifies that the caller is the wallet owner (and by extention the did:ar owner). If anyone other than the owner of the contract tries to update the did document, the contract will only return the current DID Doc state.

The contract then replaces the old DID Document properties with the new properties.

const id = did;
let didDoc; // exsiting DID Doc

const replaceProperties = {
	service: [
		...didDoc.service, // keep existing service listings
		{
			id: `${did}#linked-domain`,
			type: 'LinkedDomains',
			serviceEndpoint: 'https://douganderson444.arweave.dev'
		}
	]
};

await didar.update({ id, ...replaceProperties }); // will change service property of DID Doc

Transfer

You can add or transfer controller of this DID by adding/changing the array of controllers.

Be careful! Only the controller can update the DID Doc. Make sure you know what you are doing here.

Controllers

Transfer is just an update where the controller is updated. Send an update command with the added/changed controller property:

const id = did;
let didDoc; // exsiting DID Doc

const replaceProperties = {
	...didDoc,
	controller: ['did:ar:newControllerDID']
};

await didar.update({ id, ...replaceProperties }); // will change service property of DID Doc

Delete

TODO: Implement ANS-106 Do Not Store Request

What can you do with a DeID?

You can grab the keys out of the document. From the RSA key, you can get an Arweave address and look up their Arweave data. You can grab their DAG from ArDAG and interact with that data and apps too.

Forking The Smart Contract

With Arweave, using Warp Contract's deployFromSourceTx you can use an existing deployed contract and add your own initial state to make a new DID Doc.

TODO: List published version so others can deploy from source.

References

DID Core W3C Reccomendation

JOSE JWK RFC

You might also like...

This React-Based WebPage allows the client/user system to create their own blog, where users can publish their own opinions.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Jul 28, 2022

zkPoB is a mobile compatible tool that lets anyone prove they own a Bufficorn (or any NFT) without revealing which Buffi they own or the address they are verifying themselves with

zkPoB is a mobile compatible tool that lets anyone prove they own a Bufficorn (or any NFT) without revealing which Buffi they own or the address they are verifying themselves with

zkPoB is a mobile compatible tool that lets anyone prove they own a Bufficorn (or any NFT) without revealing which Buffi they own or the address they are verifying themselves with

Aug 25, 2022

Type Identity - a powerful and highly customizable authentication and authrozation and access-control framework

Type Identity is a powerful and highly customizable authentication and authrozation and access-control framework. It is the de-facto standard for securing Type Script api beta release

Jan 1, 2023

Open-source NFID SDK for Internet Identity, a blockchain authentication system for the Internet Computer.

Open-source NFID SDK for Internet Identity, a blockchain authentication system for the Internet Computer.

NFID-SDK is an open source software development kit that contains examples and packages for developers to integrate NFID into your application

Dec 23, 2022

Identity APIs to used to generate DID documents for entities based on external identifiers.

Identity API This API is used to generate and decentralized identity documents for all entities that are stored in a registry. These documents contain

Nov 24, 2022

click your any waifu, or...... friend?

popwaifu Here is popwaifu.click backend project. Frontend project is on popwaifu-web run server Install Node.js I use 14.17.6 when writing this, recom

Feb 17, 2022

⛺️ Tipi is a homeserver for everyone! One command setup, one click installs for your favorites self-hosted apps. ✨

⛺️ Tipi is a homeserver for everyone! One command setup, one click installs for your favorites self-hosted apps. ✨

⛺️ Tipi β€” A personal homeserver for everyone ⚠️ Tipi is still at an early stage of development and issues are to be expected. Feel free to open an iss

Jan 4, 2023

Your non mega-corporate Open source PLM. Click the website down below for more information.

Your non mega-corporate Open source PLM. Click the website down below for more information.

PLMore PLMore is an open-source Product Lifecycle Management Software. It offers an alternative to the heavily priced archahic Windchill/Teamcenter so

Aug 23, 2022
Owner
Doug A
I figure stuff out for a living. How? Dissect, Diagram & Diagnose
Doug A
Perma is a prototype of permanent video storage and viewing using Next.js, Arweave, and Bundlr.

PERMA Perma is a prototype of permanent video storage and client-side rendering using Next.js, Arweave, and Bundlr. Technologies used: Arweave - File

Nader Dabit 116 Oct 22, 2022
A carbon credit marketplace for permanent removal (HackMIT 22 Project)

Bamboo HackMIT Project Link: https://spectacle.hackmit.org/project/173 Demo video: https://youtu.be/gmk8nwtwqiE Bamboo is a trading platform for carbo

null 2 Oct 8, 2022
Easiest 1-click way to install and use Stable Diffusion on your own computer. Provides a browser UI for generating images from text prompts and images. Just enter your text prompt, and see the generated image.

Stable Diffusion UI Easiest way to install and use Stable Diffusion on your own computer. No dependencies or technical knowledge required. 1-click ins

null 3.5k Dec 30, 2022
This is a boilerplate for creating your own languages for various use cases. You can even create your own programming language from scratch!

Bootstrap compiler This is a bootstrap compiler that can be used to compile to compiler written in the target language. You can write a compiler in th

Kaan 3 Nov 14, 2022
Web3-citizens-app - React application based on smart contract using web3 and MetaMask extention.

Citizens App (web3-react-redux) React application based on smart contract using web3 and MetaMask extention. Start the applicarion Recomend to install

Denys Voloshyn 3 Aug 25, 2022
A web3 starter project using Typescript, Hardhat, ethers.js and @web3-react

Starter React Typescript Ethers.js Hardhat Project This repo contains a Hardhat and React Dapp starter project. The React Dapp in the frontend dir of

ChainShot 39 Dec 31, 2022
(πŸ”—, 🌲) Web3 Link Tree is a free & open-source alternative to Linktree built with React.js, Next.js, Tailwind and Web3-React

Getting Started Read the detailed guide here Customize Add your name, wallet address, social media links and more in config.ts Images Save images to t

Naut 35 Sep 20, 2022
πŸ›  Solana Web3 Tools - A set of tools to improve the user experience on Web3 Solana Frontends.

?? Solana Web3 Tools - A set of tools to improve the user experience on Web3 Solana Frontends.

Holaplex 30 May 21, 2022
Prove your identity, for example you are BYR.

Usay For what? Prove your identity, for example you are BYR. Code Quality All code is written by Copilot, so if you find any bug, please report it to

null 9 Aug 10, 2022
πŸ” w3auth - Integrate w3auth for your identity needs

w3auth w3auth app allows access to JWTs and refresh cookies. Provide admins with the ability to limit access by allowlist, NFT gating, and token gatin

Devzstudio 10 Oct 30, 2022