Skip to content

danubetech/uni-registrar-driver-did-btcr2

Repository files navigation

Universal Registrar Driver: did:btcr2

This is a Universal Registrar driver for did:btcr2 identifiers.

Specifications

Build and Run (Docker)

docker compose build
docker compose up

Example Requests

curl -X POST "http://localhost:9080/1.0/create?method=btcr2" \
     -H "Content-Type: application/json" \
     -d '{
       "didDocument": {
         "@context": ["https://www.w3.org/TR/did-1.1", "https://btcr2.dev/context/v1"]
       },
       "options": {
         "clientSecretMode": true,
         "network": "mutinynet"
       },
       "secret": { }
     }'
curl -X POST "http://localhost:9080/1.0/create?method=btcr2" \
     -H "Content-Type: application/json" \
     -d '{
       "didDocument" : {
         "@context": ["https://www.w3.org/TR/did-1.1", "https://btcr2.dev/context/v1"],
         "verificationMethod" : [ {
           "id" : "#initialKey",
           "type" : "Multikey",
           "publicKeyMultibase" : "zQ3shrogQZQDjQe6boF6Sas9occwW7rZVVLR3qQ85qt7JHXq4"
         } ],
         "assertionMethod" : [ "#initialKey" ],
         "capabilityDelegation" : [ "#initialKey" ],
         "capabilityInvocation" : [ "#initialKey" ],
         "authentication" : [ "#initialKey" ]
       },
       "options" : {
         "clientSecretMode" : true,
         "network" : "mutinynet"
       },
       "secret" : { }
     }'

Driver Environment Variables

The driver recognizes the following environment variables:

uniregistrar_driver_did_btcr2_bitcoinConnections

  • Specifies how the driver interacts with the Bitcoin blockchain.
  • Possible values:
    • bitcoind: Connects to a bitcoind instance via JSON-RPC
    • btcd: Connects to a btcd instance via JSON-RPC
    • bitcoinj: Connects to Bitcoin using a local bitcoinj client
    • blockcypherapi: Connects to BlockCypher's API
    • esploraelectrsrest: Connects to Esplora/Electrs REST API
  • Default value: bitcoind

uniregistrar_driver_did_btcr2_bitcoinConnectionsUrls

  • Specifies the JSON-RPC URLs of the Bitcoin connections.

uniregistrar_driver_did_btcr2_bitcoinConnectionsCerts

  • Specifies the server TLS certificates of the Bitcoin connections.
  • Default value: ``

uniregistrar_driver_did_btcr2_genesisHashes

  • Specifies genesis hashes associated with the Bitcoin connections.
  • Default value: ``

uniregistrar_driver_did_btcr2_ipfs

  • Specifies a MultiAddress if an IPFS connection to be used as CAS.
  • Default value: /ip4/127.0.0.1/tcp/5001

uniregistrar_driver_did_btcr2_ipfsTimeout

  • Specifies a connect/read timeout in milliseconds for the IPFS connection.
  • Default value: 10000

Options for DID Operations

See https://identity.foundation/did-registration/#options.

create()

{
    "version": 1,
    "network": "mutinynet",
    "publishToIpfs": true,
    "generateInitialKey": true,
    "generateStandardBeacons": false,
    "generateAggregateBeacon": "cohort-mutinynet-cas-2"    
}
  • network: The version of the did:btcr2 method.
    • Default value: 1
  • version: The name of the network where a DID should be registered. Values depend on bitcoinConnections environment variable, but are typically: bitcoin, testnet3, signet, mutinynet.
    • Default value: bitcoin
  • publishToIpfs: This boolean option indicates whether the genesis DID document should be published to IPFS. This is only available if an IPFS connection is configured.
    • Default value: true
  • generateInitialKey: This boolean option indicates whether a default initial keypair with ID #initialKey should be generated.
    • Default value: true
  • generateStandardBeacons: This boolean option indicates whether standard beacon services of types SingletonBeacon, CASBeacon, SMTBeacon should be generated in the genesis document. This option requires generateInitialKey: true.
    • Default value: false
  • generateAggregateBeacon: This string option indicates whether an aggregate beacon service for an aggregation cohort should be generated in the genesis document. The value of this option is the name of the aggregation cohort. This option requires generateInitialKey: true.
    • Default value: null
  • smtNonce: A Base64-encoded nonce to be used for the Update operation.
    • Default value: null

update() and deactivate()

{
    "didSourceDocument": { ... },
    "targetVersionId": 2,
    "beaconServiceId": "#initialP2PKH",
    "beaconServiceType": "SingletonBeacon",
    "publishToIpfs": true
}
  • didSourceDocument: The didSourceDocument for the update/deactivate operation.
    • Default value: none - must be provided
  • targetVersionId: The targetVersionId for the update/deactivate operation.
    • Default value: none - must be provided
  • beaconServiceId: The URI of the beacon service that should be used for announcing updates.
    • Default value: none - can optionally be provided
  • beaconServiceType: The type of the beacon service that should be used for announcing updates.
    • Default value: none - can optionally be provided
  • publishToIpfs: This boolean option indicates whether the update should be published to IPFS. This is only available if an IPFS connection is configured.
    • Default value: true

About

A Universal Registrar driver for did:btcr2 identifiers.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Packages

 
 
 

Contributors