GithubHelp home page GithubHelp logo

luxoft / cordentity Goto Github PK

View Code? Open in Web Editor NEW
31.0 19.0 20.0 39.27 MB

This project combines Hyperledger's Indy ledger for decentralized identity with the Corda platform

License: Apache License 2.0

Kotlin 99.06% Dockerfile 0.82% Shell 0.12%
blockchain-technology cordapp corda r3 hyperledger-indy

cordentity's Introduction

Cordentity

Note: This is a deprecated of the formal Hyperledger Labs repository, where active development is ongoing. Issue tracking is handled in Issues

logo

The Cordentity project integrates Hyperledger Indy capabilities into the Corda Platform.

Hyperledger Indy is a distributed ledger, purpose-built for decentralized identity.

Corda is a blockchain and smart contract platform. Corda allows parties to transact directly, with value. Smart contracts allow Corda to do this using complex agreements and any asset type. This capability has broad applications across industries including finance, supply chain and healthcare.

While Corda is best suited for developing decentralized applications for managing complex inter-organizational workflows, Indy is the leading open-source platform for self sovereign identity. This integration enables the development of decentralized applications on R3's best in class blockchain for business while utilizing the self-sovereign identity capabilities of Indy.

In the identity world, we are often required to prove identity assertions without necessarily wanting to reveal the underlying data. For example, an individual may need to prove that they are of a certain age without wanting to disclose their actual date of birth. Hyperledger Indy uses zero knowledge proofs to enable this functionality, allowing someone prove a statement is true while preserving confidentiality.

Usage

For full information about the processes and APIs see cordapp/README

Business Case "Legal Age Verification"

In many countries a person must be above the legal age to purchase alcohol drinks. Using services and flows provided by Indy-Codrapp it is possible to create a system that proves that the age of a customer is above the legal limit without exposing their actual age or other personal details.

Lets assume that those 3 nodes are connected as a part of a Corda network:

  • ministry - the Ministry of Home Affairs service

  • store - a grocery store payment center

  • alice - Alice's mobile device

    val ministry: StartedNode<> val alice: StartedNode<> val store: StartedNode<*>

Each Corda node has a X500 name:

val ministryX500 = ministry.info.singleIdentity().name
val aliceX500 = alice.info.singleIdentity().name

And each Indy node has a DID, a.k.a Decentralized ID, which can be obtained using GetDidFlow:

val ministryDID = store.services.startFlow(
        GetDidFlow.Initiator(ministryX500)).resultFuture.get()

To allow customers and shops to communicate, Ministry issues a shopping scheme using CreateSchemaFlow:

val schemaId = ministry.services.startFlow(
        CreateSchemaFlow.Authority(
                "shopping scheme",
                "1.0",
                listOf("NAME", "BORN"))).resultFuture.get()

Ministry creates a credential definition for the shopping scheme using CreateCredentialDefinitionFlow:

val credentialDefinitionId = ministry.services.startFlow(
        CreateCredentialDefinitionFlow.Authority(schemaId)).resultFuture.get()

Ministry verifies Alice's legal status and issues her a shopping credential using IssueCredentialFlow:

val credentialProposal = """
    {
    "NAME":{"raw":"Alice", "encoded":"119191919"},
    "BORN":{"raw":"2000",  "encoded":"2000"}
    }
    """

ministry.services.startFlow(
        IssueCredentialFlow.Issuer(
                UUID.randomUUID().toString(),
                credentialDefinitionId,
                credentialProposal,
                aliceX500)).resultFuture.get()

When Alice comes to grocery store, the store asks Alice to verify that she is legally allowed to buy drinks using VerifyCredentialFlow:

// Alice.BORN >= currentYear - 18
val eighteenYearsAgo = LocalDateTime.now().minusYears(18).year
val legalAgePredicate = VerifyCredentialFlow.ProofPredicate(schemaId, credentialDefinitionId, ministryDID, "BORN", eighteenYearsAgo)

val verified = store.services.startFlow(
        VerifyCredentialFlow.Verifier(
                UUID.randomUUID().toString(),
                emptyList(),
                listOf(legalAgePredicate),
                aliceX500)).resultFuture.get()

If the verification succeeds, the store can be sure that Alice's age is above 18.

println("You can buy drinks: $verified")

You can run the whole example as a test in ReadmeExampleTest file.

Business Cases "Personalized Health Care Supply Chain"

Another use case for Indy CorDapp is a Personalized Health Care Supply Chain project (in early development).

This system allows sharing private patients' information while providing extensive control over the usage of that information.

The connected parties in this case would usually be Insurance Providers, Patients, Hospitals, Personal Medicine Manufacturers and Government Agencies. The sensitive information may include patient’s age, nationality, results of medical analyses or guarantee of insurance coverage.

Thanks to our Indy CorDapp solution, patient’s personal data is disclosed only to the eligible parties and only to the extent required in each particular business case.

Installation

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    cordapp "com.github.Luxoft.cordentity:cordapp:0.4.11"
    cordapp "com.github.Luxoft.cordentity:cordapp-contracts-states:0.4.11"
}

On all machines that are going to run IndyService install the libindy package:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial stable"
sudo apt-get update
sudo apt-get install -y libindy=1.6.4

Please follow to the official indy-sdk repo for installation instructions for Windows, iOS, Android and MacOS.

Development

Subprojects

External dependancies

Version cordapp 0.4.11 requires installation of indy-sdk version 1.6.4.

Build

To run the tests you need to install the libindy package:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial stable"
sudo apt-get update
sudo apt-get install -y libindy=1.6.4

Make sure that Docker is installed:

sudo apt update
sudo apt install docker

After that use the standard Gradle build procedure:

gradle clean build

Troubleshooting

Before every test run it is recommended to clean local pool and wallets data, which by default are stored in ~/.indy_client/:

gradle cleanDefaultPool

Also re-creating the indypool docker container is needed to get a clean system:

gradle dockerCleanRun

To manually start the indy-pool container on ports 9701-9708:

docker pull teamblockchain/indy-pool:1.6.4
docker create -p 9701-9708:9701-9708 --name indypool --rm teamblockchain/indy-pool:1.6.4
docker start indypool

Contributors

cordentity's People

Contributors

abaaz avatar alkopnin avatar jeremiah avatar seniorjoinu avatar voddan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordentity's Issues

Will Jackson versions interfere?

Detailed Description

indy-utils module contains Jackson as a dependency. In general, this is not a problem but potentially it can create some difficulties when Cordentity will be used in Spring-based projects (which also uses Jackson).

Context

This is important because Spring is a de-facto standard for web development in JVM so every Cordentity
user should have an opportunity to use it.

Possible Implementation

This issue should be well investigated and tested. If there is no opportunity of using Jackson in Cordentity we should find an alternative library for Kotlin. If everything is ok and no action is needed - let it be as it is.

Extract IndyUser interface

Detailed Description

IndyUser is a heavy class with a lot of code so it would be great to decouple its interface from implementation.

Context

This would help other developers to understand IndyUser logic.

Possible Implementation

Break down IndyUser into interface and class that implements this interface

Fix weird code formatting in README

The root readme file contains a weird line:

val ministry: StartedNode<> val alice: StartedNode<> val store: StartedNode<*>

I think it is a bug GitHub markdown engine, but we still gotta do a workaround.

Prepare Indy-utils as library fried from corda

In the current state indy-utils module has corda-core dependency. I guess it's a very big dependency for any separate project where you want to use indy-utils and don't need to use corda.

I'm trying to use indy-utils in the android project but I have problems with dependency set.

Getting error when running ReadmeExampleTest

Hi team,

I got when trying to run the ReadmeExampleTest by using gradle build

The error is as below:

[ERROR] 01:22:43,650 [Mock network] (VerifyCredentialFlow.kt:177) flow.[4edd6dbb-b59c-4251-86bb-bcdba5e6d895].call - {}
java.util.concurrent.ExecutionException: org.hyperledger.indy.sdk.InvalidStructureException: A value being processed is not valid.
...
You can buy drinks: false
[INFO ] 01:22:43,802 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-1 - Close initiated... {}
[INFO ] 01:22:43,809 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-1 - Closed. {}
[INFO ] 01:22:43,813 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-2 - Close initiated... {}
[INFO ] 01:22:43,817 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-2 - Closed. {}
[INFO ] 01:22:43,819 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-3 - Close initiated... {}
[INFO ] 01:22:43,824 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-3 - Closed. {}
[INFO ] 01:22:43,827 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-4 - Close initiated... {}
[INFO ] 01:22:43,833 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-4 - Closed. {}
[INFO ] 01:22:43,834 [Test worker] (HikariPool.java:204) pool.HikariPool.shutdown - HikariPool-5 - Close initiated... {}
[INFO ] 01:22:43,844 [Test worker] (HikariPool.java:241) pool.HikariPool.shutdown - HikariPool-5 - Closed. {}
]]>

Do you know how to fix the issue in order to have

You can buy drinks: true

?

Thank you for your help,
AD

Add asynchronous API to IndyUser

Detailed Description

Right now IndyUser is only providing synchronous API

Context

This would bring all the advantages of using asynchronous code

Possible Implementation

Coroutines?

Remove credential Id

Detailed Description

Right now a credential has an Id in Corda (uuid). It is not useful at all because it should be stored and tracked somehow and there is also no use-case when you use this Id without DID of the prover.

Possible implementation

Get rid of it and get target credential using DID.

Request to add signed-off-by line to *each* commit

Detailed Description

Hyperledger requires that every commit be signed. This is done via git -s if you're on the command line and produces the signed-off-by line in the commit. Since we haven't done this we can either

  • Try to amend every commit with a signature
  • Squash the commits and sign the squashed list for the Hyperledger git repo

What is the preference? It is faster if I squash and sign but perhaps we don't want that? Can we sign commits going forward?

Increase test coverage with unit tests

Detailed Description

There are only E2E tests right now.

Context

This will reveal possible errors (what else should tests do?)

Possible Implementation

There are many poorly tested util classes. I think we should start with them and add as many tests as possible.

Contracts don't have verification functionality

A change of state should be connected with command and contract. The contract checks the transaction correctness based on input/output and attached commands.

Description

There are 3 states: IndySchema, IndyCredentialDefinition, IndyCredential and 4 commands: Create, Upgrade, Consume and Revoke exist in cordentity.

Need to implement proper contracts and verification logic for each state and related command.

Expected Behavior

Currently the contracts don't really exist.

They should check such data as transactional signatures, credential definition limits, matching the attributes from schema to credential definition, list of revealed attributes, etc.

1.6.4 not found

I'm currently running it on ubuntu 18.04.
JDK installed, graddle installed, libindy installed.

It cannot find the version 1.6.4 on everdym.
I tried changing it to other versions, 1.8.1 per example but still not working.

* What went wrong:
Could not resolve all files for configuration ':indy-utils:compileClasspath'.
> Could not resolve org.hyperledger:indy:1.6.4.
  Required by:
      project :indy-utils
   > Could not resolve org.hyperledger:indy:1.6.4.
      > Could not get resource 'https://repo.evernym.com/artifactory/libindy-maven-local/org/hyperledger/indy/1.6.4/indy-1.6.4.pom'.
         > Could not GET 'https://repo.evernym.com/artifactory/libindy-maven-local/org/hyperledger/indy/1.6.4/indy-1.6.4.pom'.
            > Connect to repo.evernym.com:443 [repo.evernym.com/35.166.202.228] failed: Connection timed out (Connection timed out)

Refactor naming globally

Detailed Description

There are many different abbreviations in code like "revRegId" and "credDef".

Context

This will make code much more clear and understandable.

Possible Implementation

I think it's okay to have an inner variable having an abbreviation in its name but users of the public API must be able to easily read and understand it.

ReadmeExampleTest is a bit weird

ReadmeExampleTest file (in develop) is a bit weird:

    val ministry: StartedNode<InternalMockNetwork.MockNode> = issuer
    val alice: StartedNode<*> = alice
    val store: StartedNode<*> = bob

Why is InternalMockNetwork.MockNode part needed?

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.