Skip to content

Commit 1c21543

Browse files
authored
Merge branch 'master' into feature/rc_1_4_0
2 parents adae518 + 57674d7 commit 1c21543

File tree

244 files changed

+13459
-1539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+13459
-1539
lines changed

README.md

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,67 @@
1-
2-
## Before you Continue
3-
4-
If you haven't done so already, please visit the main resource for all things "Indy" to get acquainted with the code base, helpful resources, and up-to-date information: [Hyperledger Wiki-Indy](https://wiki.hyperledger.org/projects/indy).
5-
61
# Indy SDK
7-
2+
![logo](https://raw.githubusercontent.com/hyperledger/indy-node/master/collateral/logos/indy-logo.png)
83
This is the official SDK for [Hyperledger Indy](https://www.hyperledger.org/projects),
9-
which provides a distributed-ledger-based foundation for [self-sovereign identity](https://sovrin.org).
4+
which provides a distributed-ledger-based foundation for [self-sovereign identity](https://sovrin.org). Indy provides a software ecosystem for private, secure, and powerful identity, and the Indy SDK enables clients for it.
105
The major artifact of the SDK is a c-callable
116
library; there are also convenience wrappers for various programming languages and Indy CLI tool.
127

13-
All bugs, stories, and backlog for this project are managed through [Hyperledger's Jira](https://jira.hyperledger.org)
14-
in project IS (note that regular Indy tickets are in the INDY project instead...). Also, join
15-
us on [Hyperledger's Rocket.Chat](https://chat.hyperledger.org/) at #indy-sdk to discuss.
8+
All bugs, stories, and backlog for this project are managed through [Hyperledger's Jira](https://jira.hyperledger.org/secure/RapidBoard.jspa)
9+
in project IS (note that regular Indy tickets are in the INDY project instead...). Also, make sure to join
10+
us on [Hyperledger's Rocket.Chat](https://chat.hyperledger.org/) at #indy-sdk to discuss. You will need a Linux Foundation login to get access to these channels
11+
12+
## Understanding Hyperledger Indy
13+
14+
If you have just started learning about self-sovereign identity, here are some resources to increase your understanding:
15+
16+
* This extended tutorial introduces Indy, explains how the whole ecosystem works, and how the
17+
functions in the SDK can be used to construct rich clients: [Indy-SDK Getting-Started Guide](doc/getting-started/getting-started.md)
18+
19+
* A recent webinar explaining self-sovereign identity using Hyperledger Indy and Sovrin: [SSI Meetup Webinar](https://youtu.be/RllH91rcFdE?t=4m30s)
20+
21+
* Visit the main resource for all things "Indy" to get acquainted with the code base, helpful resources, and up-to-date information: [Hyperledger Wiki-Indy](https://wiki.hyperledger.org/projects/indy).
22+
23+
* You may also want to look at the [older guide](https://github.com/hyperledger/indy-node/blob/stable/getting-started.md)
24+
that explored the ecosystem via command line. That material is being
25+
rewritten but still contains some useful ideas.
26+
27+
## How-To Tutorials
28+
29+
Short, simple tutorials that demonstrate how to accomplish common tasks
30+
are also available. See the [doc/how-tos](doc/how-tos) folder.
1631

32+
1. [Write a DID and Query Its Verkey](doc/how-tos/write-did-and-query-verkey/README.md)
33+
2. [Rotate a Key](doc/how-tos/rotate-key/README.md)
34+
3. [Save a Schema and Cred Def](doc/how-tos/save-schema-and-cred-def/README.md)
35+
4. [Issue a Credential](doc/how-tos/issue-credential/README.md)
36+
5. [Negotiate a Proof](doc/how-tos/negotiate-proof/README.md)
37+
6. [Send a Secure Message](doc/how-tos/send-secure-msg/README.md)
1738

18-
## Installation
39+
## Installing the SDK
1940
### Release channels
20-
Indy SDK release process defines the following release channels:
41+
The Indy SDK release process defines the following release channels:
2142

2243
* `master` - development builds for each push to master branch.
2344
* `rc` - release candidates.
2445
* `stable` - stable releases.
2546

26-
Please refer to [release workflow](doc/release-workflow.md) for more details.
47+
Please refer to our [release workflow](doc/release-workflow.md) for more details.
2748

2849
### Ubuntu based distributions (Ubuntu 16.04)
29-
It is recommended to install packages with APT:
50+
It is recommended to install the SDK packages with APT:
3051

3152
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
3253
sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial {release channel}"
3354
sudo apt-get update
3455
sudo apt-get install -y libindy
3556

3657
{release channel} must be replaced with master, rc or stable to define corresponded release channel.
37-
See section "Release channels" for more details.
58+
Please See the section "Release channels" above for more details.
3859

3960
### Windows
4061

41-
1. follow to https://repo.sovrin.org/windows/libindy/{release-channel}.
42-
2. download last version of libindy.
43-
3. unzip archives to directory, where you want to save working library.
62+
1. Go to https://repo.sovrin.org/windows/libindy/{release-channel}.
63+
2. Download last version of libindy.
64+
3. Unzip archives to the directory where you want to save working library.
4465
4. After unzip you will get next structure of files:
4566

4667
* `Your working directory`
@@ -71,7 +92,7 @@ See [wrapper iOS install documentation](wrappers/ios/README.md "How to install")
7192
Pre-built libraries are not provided for MacOS. Please look [here](doc/mac-build.md)
7293
for details on building from source for MacOS.
7394

74-
After building `libindy`, add the path containing the library the `LD_LIBRARY_PATH` and
95+
**Note:** After building `libindy`, add the path containing the library the `LD_LIBRARY_PATH` and
7596
`DYLD_LIBRARY_PATH` environment variables. This is necessary for dynamically linking
7697
your application with `libindy`. The dynamic linker will first check for the library in
7798
`LD_LIBRARY_PATH` if the library in your application doesn't include directory names.
@@ -87,23 +108,24 @@ After successfully compiling `libindy`, you will need to add the path containing
87108
`LD_LIBRARY_PATH` environment variable. This is required for your application to link to
88109
`libindy`.
89110

90-
## How to build
111+
## How to build Indy SDK from source
91112

92113
* [Ubuntu based distributions (Ubuntu 16.04)](doc/ubuntu-build.md)
93114
* [RHEL based distributions (Amazon Linux 2017.03)](doc/rhel-build.md)
94115
* [Windows](doc/windows-build.md)
95116
* [MacOS](doc/mac-build.md)
96117

97118
## How to start local nodes pool with docker
119+
To test the SDK codebase with a virtual Indy node network, you can start a pool of local nodes using docker:
98120

99-
Start local nodes pool on `127.0.0.1:9701-9708` with Docker:
121+
Start the pool of local nodes on `127.0.0.1:9701-9708` with Docker by running:
100122

101123
```
102124
docker build -f ci/indy-pool.dockerfile -t indy_pool .
103125
docker run -itd -p 9701-9708:9701-9708 indy_pool
104126
```
105127

106-
Dockerfile `ci/indy-pool.dockerfile` supports optional pool_ip param that allows
128+
Dockerfile `ci/indy-pool.dockerfile` supports an optional pool_ip param that allows
107129
changing ip of pool nodes in generated pool configuration. The following commands
108130
allow to start local nodes pool in custom docker network and access this pool
109131
by custom ip in docker network:
@@ -115,7 +137,7 @@ docker run -itd -p 9701-9708:9701-9708 indy_pool
115137
```
116138
Note that for Windows and MacOS this approach has some issues. Docker for these OS run in
117139
their virtual environment. First command creates network for container and host can't
118-
get access to that network because container placed on virtual machine. You must appropriate set up
140+
get access to that network because container placed on virtual machine. You must appropriate set up
119141
networking on your virtual environment. See the instructions for MacOS below.
120142

121143
### Docker port mapping on MacOS
@@ -159,23 +181,9 @@ details.
159181
* [iOS](wrappers/ios/README.md)
160182

161183
## Indy CLI documentation
162-
* [Indy CLI](cli/README.md)
163-
164-
## Getting started
165-
166-
This extended tutorial shows how the whole ecosystem works, and how
167-
functions in the SDK can be used to construct rich clients. (You may also
168-
want to look at the [older guide](https://github.com/hyperledger/indy-node/blob/stable/getting-started.md)
169-
that explored the ecosystem via command line. That material is being
170-
rewritten but still contains some useful ideas.)
171-
172-
* [Libindy Getting-Started Guide](doc/getting-started/getting-started.md)
173-
174-
## How Tos
175-
176-
Short, simple tutorials that demonstrate how to accomplish common tasks
177-
are also available. See [the doc/how-tos folder](doc/how-tos).
184+
* An explanation of how to install the official command line interface for that provides commands to manage wallets and interactions with the ledger: [Indy CLI](cli/README.md)
178185

179186
## How to migrate
180-
The documents that provide necessary information for Libindy migration.
187+
The documents that provide necessary information for Libindy migration. This document is written for developers using Libindy 1.3.0 to provide necessary information and
188+
to simplify their transition to API of Libindy 1.4.0.
181189
* [v1.3.0 → v1.4.0](doc/migration-guide.md)

ci/acceptance/ubuntu_acceptance.dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ RUN apt-get update && \
1414
RUN add-apt-repository ppa:jonathonf/python-3.6
1515
RUN apt-get update && \
1616
apt-get install -y \
17-
python3.6 \
18-
python3-pip
17+
python3.5 \
18+
python3-pip \
19+
vim
20+
21+
RUN pip3 install -U pip
1922

2023
ARG indy_sdk_deb
2124
RUN echo ${indy_sdk_deb}
@@ -24,5 +27,5 @@ ADD ${indy_sdk_deb} indy-sdk.deb
2427
RUN dpkg -i indy-sdk.deb || apt-get install -y -f
2528

2629
RUN useradd -ms /bin/bash indy
27-
WORKDIR /home/indy
2830
USER indy
31+
WORKDIR /home/indy

doc/before-and-after.png

52.9 KB
Loading

doc/cred-revocation.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# How Credential Revocation Works
2+
3+
This doc aims to explain credential revocation at a conceptual level.
4+
If this doc still feels too low-level, you might consider watching [this
5+
introductory video](https://drive.google.com/open?id=1FxdgkYwwLfpln6MnsZJAwnYjM6LpCoP0) from time offset 0:30 to 4:30.
6+
7+
## Background: Cryptographic Accumulators
8+
9+
Before explaining the mechanism in detail, it's necessary to understand
10+
__cryptographic accumulators__ at a very high level.
11+
We will try to avoid daunting math in our explanation.
12+
13+
You can think of an accumulator as the product of multiplying many numbers
14+
together. In the equation `a * b * c * d = ` __`e`__,
15+
the accumulator would be __`e`__;
16+
it _accumulates_ a value as each new factor is multiplied in. We could
17+
plug in numbers; if `a`=2 and `b`=3 and `c`=5 and `d`=7, then our accumulator
18+
__`e`__ has a value of 210. If `e` has this value, we
19+
say that 3 is "in" `e` because it is a factor. If we want to take 3 out
20+
of the accumulator, we divide 210 by 3 and get 70 (=2*5*7); 3 has now been
21+
"removed".
22+
23+
Notice that you can also produce __`e`__ by multiplying any single
24+
factor such as `a` by the product of all the other factors (`b * c * d`).
25+
This is a useful characteristic; it means you can tell someone else
26+
the value of `a` and _the product of all the other inputs to the accumulator,
27+
but not the other inputs themselves_, and they can produce the output.
28+
29+
## Background: Tails Files
30+
31+
In our simple example above, we only have 4 factors, and we are using small
32+
numbers. We are also using standard arithmetic, where you can reverse
33+
multiplication by dividing. In such a system, the contents of an accumulator
34+
can be reverse-engineered by simple prime factorization.
35+
36+
To be useful for revocation, Indy's accumulators can't be reversible; that is,
37+
it must be the case that the only way to derive the accumulator
38+
value is to know the factors.
39+
We accomplish this by using modular arithmetic (where division is undefined),
40+
and by using massive numbers for the factors and accumulators.
41+
42+
A __tails file__ is associated with an accumulator
43+
and its factors. It is a binary file that contains an
44+
array of randomly generated factors for an accumulator. Instead of small
45+
numbers like 2 and 3 and 7, these factors are massive numbers, far too
46+
big to display conveniently on a screen. Typically the quantity of these
47+
numeric factors in a tails file is large--hundreds of thousands to tens of
48+
millions.
49+
50+
A tails file is not secret; it is published as plain text to the world
51+
and freely downloadable by anyone. The contents of this file never change.
52+
53+
Each potential or actual credential issued by a particular issuer is
54+
assigned an index to an accumulator factor in a tails file. However,
55+
only credentials that have not been revoked contribute to the value of the
56+
accumulator. We will see how this works, below.
57+
58+
![tails file and accumulator](tails.png)
59+
60+
## Setup
61+
62+
Before revocable credentials can be issued, a number of things must be
63+
true about the ecosystem:
64+
65+
1. A __schema__ for each credential type
66+
must be written to the ledger.
67+
For example, if companies wish to issue proof of employment, then
68+
a "Employee Credential" schema would need to be published. Similarly,
69+
before birth certificate credentials can be issued, a "Birth Certificate"
70+
schema would need to be defined and made available to the public. Any number
71+
of issuers can reference the same schema. Schemas can be versioned and
72+
evolved over time. Any individual or institution can write a schema
73+
to the ledger; it does not require special privileges.
74+
75+
2. Each issuer must publish on the ledger one __credential
76+
definition__ for each credential type they intend
77+
to create. The definition announces the issuer's intention to
78+
create credentials that match a particular schema, and specifies the
79+
keys that the issuer will use to sign such credentials. (The verkey+
80+
signing key pair used to authenticate the issuer's DID should be kept
81+
separate from the keys used to sign credentials, so that each key
82+
pair can be rotated independently; it would be bad if a sysadmin
83+
rotated a DID keypair and accidentally invalidated all credentials
84+
issued by an institution...)
85+
86+
3. Each issuer must also publish on the ledger a __revocation
87+
registry__. This metadata references a credential definition and
88+
specifies how revocation for that credential type will be handled.
89+
The revocation registry tells which cryptographic __accumulator__
90+
can be used to test revocation, and gives the URI and
91+
hash of the associated __tails file__.
92+
93+
4. Each issuer must publish on the ledger an accumulator value that
94+
describes the revocation status for all associated credentials. This
95+
accumulator must be updated on a periodic or as-needed basis. For
96+
example, if a driver's license division revokes 3 licenses during a
97+
given work day, then when they close their doors at 5 pm, they might
98+
issue a ledger transaction that updates the accumulator value for
99+
their driver's license credentials, removing the 3 revoked credentials
100+
from the accumulator. What we mean by "removing" is as described above--
101+
the factors listed in the tails file for the indexes associated with
102+
the 3 revoked credentials are no longer multiplied into the accumulator.
103+
104+
![before and after revocation](before-and-after.png)
105+
106+
## How Revocation Will Be Tested
107+
108+
Let us now skip ahead to think about what needs to happen much later.
109+
When a prover gives proof to a verifier, we normally think about the proof
110+
as focusing on core information demands: _What is your birthdate?_ _Please
111+
disclose your address_. This is __primary proof__.
112+
113+
But there is another dimension of proof that's also necessary: _The prover
114+
must demonstrate that the credentials behind the primary proof have not
115+
been revoked._ This is called __proof of non-revocation__.
116+
117+
In Indy, proof of non-revocation is accomplished by having provers show
118+
that they can derive the value of the accumulator for their credential
119+
using a factor for the accumulator that they know, plus the product of
120+
all other factors.
121+
The verifier can see that the prover produces the right answer (because
122+
the answer is on the ledger), but does not know certain details of how the
123+
prover derived it. The issuer can revoke by changing the answer to the
124+
math problem in a way that defeats the prover.
125+
126+
## Preparing for Revocation at Issuance
127+
128+
When a credential is issued, the actual credential file is transmitted
129+
to the holder (who will later become a prover). In addition, the issuer
130+
communicates two other pieces of vital information:
131+
132+
* The index corresponding to this credential, in the tails file. This
133+
lets the holder look up their private factor, which we could map to
134+
`a` in the simple equation from the accumulator background section
135+
at the top of the doc.
136+
* The product of the _other_ factors contributing to the accumulator (all
137+
factors except the private one for this credential).
138+
This value is like `b * c * d` from the simple equation above, and
139+
is called a __witness__.
140+
141+
## Presenting Proof of Non-Revocation
142+
143+
When the prover needs to demonstrate that her credential is not revoked,
144+
she shows that she can provide math that derives the accumulator value
145+
on the ledger using her private factor times the witness. She does this
146+
without actually disclosing what her private value is; this is important
147+
to avoid correlation.
148+
149+
But there is a complication: what if the accumulator has changed value
150+
since the time the credential was issued? In this case, the private
151+
factor times the witness will not equal the accumulator...
152+
153+
This is handled by requiring accumulator updates to also publish a
154+
__witness delta__ as part of the same transaction.
155+
This tells provers how to adjust their witness (referencing other indexes
156+
in the public tails file) to bring it back into
157+
harmony with the current value of the accumulator. Updating witnesses
158+
requires the prover (but not the verifier) to download the tails file.
159+
160+
## Putting It All Together
161+
162+
This discussion has suppressed some details. The math has been simplified,
163+
and we haven't discussed how an issuer copes with multiple tails files
164+
and revocation registries, or why that might be desirable. However, the
165+
broad flow of the mechanism should be apparent, and its features are
166+
now easy to summarize:
167+
168+
* Issuers revoke by changing a number on the ledger. They can revoke
169+
as many credentials as they want in a single transaction, since
170+
they are just changing the answer to a math problem that either does
171+
or doesn't include the factors they choose. Issuers do not have to
172+
contact anybody--provers or verifiers--to revoke. Changes take place
173+
globally, the instant the accumulator update transaction appears
174+
on the ledger.
175+
* Revocation is reversible.
176+
* Provers demonstrate proof of non-revocation in a privacy-preserving
177+
way. They cannot be correlated by something like a credential ID or
178+
a tails index. This is radically different from a revocation list
179+
approach, which requires correlation to test.
180+
* Verification of proof of non-revocation is extremely easy and cheap.
181+
No tails files are needed by verifiers, and computation is trivial.
182+
Proving non-revocation is somewhat more expensive for provers, but
183+
is also not overly complex.
184+
* Verifiers do not need to contact issuers or consult a revocation list
185+
to test revocation.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)