GithubHelp home page GithubHelp logo

trustbloc / orb Goto Github PK

View Code? Open in Web Editor NEW
35.0 16.0 22.0 6.43 MB

A DID method implementation that extends the Sidetree protocol into a Fediverse of interconnected nodes and witnessed using certificate transparency. Spec: https://trustbloc.github.io/did-method-orb/

License: Apache License 2.0

Makefile 0.14% Shell 0.22% Go 95.05% Dockerfile 0.08% Gherkin 4.51%
decentralized-identifiers activitypub certificate-transparency ipfs content-addressable-storage sidetree did-method fediverse

orb's Issues

Transaction Client

Transaction Client will:

  • figures out last orb transaction for for each did that is referenced in the anchor
  • creates new orb transaction with following information: anchor string, namespace, version and previous did transactions.

ActivityPub inbox

Implement an inbox for ActivityPub messages. The inbox receives an HTTP message with an activity and invokes a handler to process the activity.

Initial BDD test

Initial server components:

  • initial CAS IPFS client
  • core observer
  • mocks : protocol, store and operation queue (to be replaced with DB-backed implementations)

Initial BDD test

ActivityPub service

Implement an ActivityPub service that encapsulates an inbox and outbox. The service should allow clients to post messages to the outbox and also register for notifications of inbound activities.

In-memory Publisher-Subscriber

Implement an in-memory Publisher-Subscriber that supports the Watermill Subscriber and Publisher interfaces. This Publisher-Subscriber may later be replaced by a persistent message queue, such as RabbitMQ or Kafka.

Create Anchor Credential Builder

Anchor credential builder will build and sign anchor credential.

Configure anchor credential parameters for orb server:

  • ANCHOR_CREDENTIAL_ISSUER=http://peer1.com
  • ANCHOR_CREDENTIAL_SIGNATURE_SUITE=Ed25519Signature2018
  • ANCHOR_CREDENTIAL_DOMAIN=domain.com

HTTP Subscriber for Watermill

A new HTTP subscriber implementation is required in order to re-use ORB's HTTP server instance (so that all REST endpoints are served from the same address/port). The out-of-the-box HTTP subscriber for Watermill does not offer a way to pass in a service instance'. Also, this implementation does not support TLS.

Initial design concepts

Orb is a DID method based on the Sidetree protocol.
Conceptual overview: https://hackmd.io/@troyronda/Sy20HiD3v

This method relies on the following components:

  • A content addressable storage (CAS) that holds Sidetree files (same as the CAS in Sidetree).
  • Batch writers also create CAS objects that represent the graph of Sidetree anchors from their point-of-view (playing the role of the ledger in Sidetree).
  • Witness logs that observe nodes of the anchor graph. An individual log does not need to hold the entire anchor graph. This role is similar to certificate transparency in PKI.

This method defines the DID string such that a resolver can:

  • discover a DHT and/or HTTP hosted well-known for the anchor graph.
    • and from this graph, DHT, and/or HTTP hosted well-known, also be able to discover CAS objects for the Sidetree files.
  • discover a checkpoint in the graph for a particular unique suffix.
    • and from this checkpoint, be able to discover the chain of patches for the DID document.
  • discover the witness log server for each checkpoint in the graph for a particular suffix.
    • and be able to handle transitions between witness logs.

This method spec defines:

  • the CAS HTTP APIs that each orb did server MUST expose to have interoperability.
  • the discovery information for each supported DHT (starting with IPFS) and also HTTP well-known. there may be other interesting DHTs such as Tor.
  • the encodings for the graph (initially thought to be IPLD).
  • the witness HTTP APIs that each orb witness server MUST expose to have interoperability.
  • the structure of an anchor node including the anchor string, parent anchor CIDs, and witness log proofs.
  • the structure of witness log proofs and the properties of a witness log (similar to certificate transparency).
  • the sidetree checkpoint operation for a unique suffix that is at the same level as recover and deactivate - it is not prunable.

We would like to submit the method spec as a work item to W3C Credentials Community Group (CCG) or the Decentralized Identity Foundation (DIF).

The TrustBloc implementation will be pluggable to allow additional DHTs to be plugged-in. This core repo will support HTTP and we also plan to initially support an IPFS DHT.

Additional Notes:

  • Can discover CAS endpoints via DHT or http well-known.
  • The anchor graph needs to be available at the DHT or http well-known. The rest of the files can be fetched via REST API (but can also support network like IPFS).
  • List the checkpoint node as a CAS CID in the DID string. The resolver should roll forward to the latest known checkpoint but return the same checkpoint ID as was in the DID string. If the resolver doesn’t know the CID then the DID is unresolvable.
  • Use witness logs in the similar manner to certificate transparency. The log doesn’t have the complete graph, it just observes certain nodes. It issues proofs that are included in the graph and maintains its own merkle log of what it has observed.

Orb Transaction Processor

Orb Txn Processor will:

  • will use sidetree-core operation provider to parse operation from batch files
  • store anchored operations to operation store (did operation order is set based on previous operations for that did)

Initial server components

Initial server components:

  • initial CAS IPFS client
  • core observer

Mocks (to be replaced with DB-backed implementations) :

  • operation store
  • operation queue

mock protocol (to be replaced with versioning solution)

Component Diagram

orb-component-diagram-2021-02-04

Notes:

  • Each of the non-cache and non-ledger databases can be kept within the same DB instance.
  • We are planning for the DB to be CouchDB or Postgres.
  • The ledger implementation is pluggable. Our initial ledger implementation is planned to be Verifiable Credential Transparency (Certificate Transparency).
  • The optional DHT implementation is pluggable. The initial implementation is planned to be IPFS.
  • Ledger monitoring and auditing is not shown in this diagram (but will be needed).

Integrate anchor origin and anchor times

Included:

  • configure allowed anchor origins for server
  • add anchor origin validator
  • add anchor time validator
  • set operation transaction/anchoring time to anchor credential's issued time

Handler for the ActivityPub 'Like' activity

Implement a handler for the ActivityPub 'Like' (endorse) activity. The handler should invoke a 'proof' handler with the embedded proof so that it may handle the endorsed operation. The activity should also be added to the service's 'likes' list.

Rename txn client to anchor writer

Rename/move packages:
-- rename txn client to anchor writer
-- organize anchor credential related code (graph, writer, builder, util, model) under pk/anchor folder.

Handler for the ActivityPub 'Follow' activity

Implement a handler for the ActivityPub 'Follow' activity. The handler should ask an authorization handler if the service should accept or reject the follow request. If accepted, the handler should post an 'Accept' activity to the requesting actor and add the actor to the list of followers; otherwise a 'Reject' activity should be posted.

Sign Anchor Credential Setup

Batch writer should sign anchor credential before creating an offer for witnesses. In order to do this we have to setup kms, crypto, couch db during server start-up.

Don't require check for nil on ActivityPub properties

Currently ActivityPub properties need to be checked for nil before the property may be dereferenced, which makes it cumbersome for clients to use. For example:

typeProperty := activity.Type()
if typeProperty != nil {
if typeProperty.Is(TypeCreate) {
. . .
}
}

This should be simplified as:

if activity.Type().Is(TypeCreate) {
. . .
}

Even if activity.Type() returns nil, the function Is(TypeCreate) should return false without panicing.

ActivityPub outbox

Implement an outbox for ActivityPub messages. The outbox sends an HTTP message with an activity and monitors whether or not the message was sent. If an error occurs then it should retry according to type of error.

Handle CID as part of did

Handle CID as part of did:

  • add CID to canonical ID in resolution result
  • resolve did using canonical ID
  • change canonical ID during recover

Orb Observer

Orb Observer

  • will listen to orb transactions
  • retrieve transaction info from transaction graph before passing anchor string to sidetree-core for batch processing

Handler for the ActivityPub 'Offer' activity

Implement a handler for the ActivityPub 'Offer' activity. The handler should invoke a 'witness' handler with the embedded anchor credential so that it may generate proofs. If successful, the handler should post a 'Like' activity with the proofs back to the actor (requestor). The activity should also be added to the service's 'liked' list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.