Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated documentation #144

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
84 changes: 79 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# StudyBits

## Table of contents
1. [Introduction](#introduction)
2. [Contributing](#contributing)
2.1 [Repository Structure](#structure)
2.2 [Development Setup](#dev)
2.3 [How to send a PR](#pullrequests)
3. [Running StudyBits](#running)
3.1 [Running in Docker](#RunInDocker)
4. [System Diagrams](#diagrams)
5. [Links](#links)


## Introduction <a name="introduction"></a>
StudyBits allows students to receive credentials from their universities, and issue zero-knowledge proofs to other universities.

StudyBits leverages the [Sovrin network](https://sovrin.org/) to store DIDs, Schemas and Credential Definitions.
Expand All @@ -10,17 +23,78 @@ The agent is used through the [StudyBits Wallet](https://github.com/Quintor/Stud

Contact us on [Gitter](https://gitter.im/StudyBits/Lobby)

## Running in docker

Use `TEST_POOL_IP=127.0.0.1 docker-compose up --build --force-recreate pool university-agent-rug university-agent-gent`
## Contributing <a name="contributing"></a>

### Repository Structure <a name="structure"></a>

The StudyBits repo consists of the following parts:

```
* ci
* Contains docker files used by Circle-ci for ci.
* docs
* Contains design and implementation documentation.
* university-agent
* Contains java source-code for the university agent.
```

### Development Setup <a name="dev"></a>

In order to develop for StudyBits a couple of dependencies need to be installed:

1. Install [libindy](https://github.com/hyperledger/indy-sdk/tree/master/libindy)
The current version of StudyButs requires Libindy v1.6.6 to be installed, note that later versions are not supported currently.

2. Make sure [Project Lombok](https://projectlombok.org/) can work it's magic. In your IDE of choice, please enable precompiling.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's -> its


### How to send a PR <a name="pullrequests"></a>

Before sending a PR make sure to be compliant with the following:

## Running tests in docker
+ Do not create many PRs for one feature. Consider implementing a complete feature before sending a PR.
+ Consider sending a design doc folder for a new feature.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe replace this with "if design is needed, create an issue to discuss before starting to code"?

+ Make sure that a new feature or fix is covered by tests (try following TDD).
+ Make sure that documentation is updated according to your changes.
+ Provide a full description of changes in the PR.
+ Make sure that static code validation passed.
+ You need to make sure that all the tests pass.
+ A reviewer or maintainer will merge the PR.

## Running StudyBits <a name="running"></a>

### Running in docker <a name="RunInDocker"></a>

Use `TEST_POOL_IP=127.0.0.1 docker-compose up --build --force-recreate pool university-agent-rug university-agent-gent`

Running tests: `TEST_POOL_IP=127.0.0.1 docker-compose up --build --force-recreate --exit-code-from tests`

## Running outside of docker
Please note the the enviroment variable TEST_POOL_IP must be supplied as the IP of the HyperLedger indy nodes you wish to use.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "The TEST_POOL_IP variable must match the ip address used to reach the HyperLedger Indy nodes that are spun up with docker-compose. This relevant if you are trying to reach these nodes from software not running in the docker-compose setup" describes better what's going on?


## System Diagrams <a name="diagrams"></a>

The documentation folder [images](/doc/images) contains a collection of UML system diagram.

## Links <a name="links"></a>

#### StudyBits Native
[Quindy](https://github.com/Quintor/quindy)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to be lists to render properly

[StudentWallet](https://github.com/Quintor/StudyBitsWallet)

#### HyperLedger Indy
[Indy SDK](https://github.com/hyperledger/indy-sdk)
[Indy Node](https://github.com/hyperledger/indy-node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you feel these links are helpful? I get that they are parts of the eco-system, but the documentation tends to be kind of lacking. (Specifically: node/plenum/agents).

[Indy Agents](https://github.com/hyperledger/indy-agent)
[indy plenum](https://github.com/hyperledger/indy-plenum/tree/master/docs)
[indy crypto](https://github.com/hyperledger/indy-crypto/blob/master/README.md)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indy crypto is being phased out in favour of HyperLedger Ursa (which is basically a rename of indy-crypto)


[Indy documentation](https://hyperledger-indy.readthedocs.io/en/latest/)

#### Glossary
[Sovrin glossary](https://docs.google.com/document/d/1giOzpTFXypJ6bAUp_6g93kYOEiNa5eWI1KeIg6wb598/edit)

To run backend locally, install libindy matching the version that is installed in the Dockerfile, [following their instructions](https://github.com/hyperledger/indy-sdk#installing-the-sdk)
#### Communication
[Agent-to-Agent communication videoexplaination](https://drive.google.com/file/d/1PHAy8dMefZG9JNg87Zi33SfKkZvUvXvx/view)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't watched this, does it match the way we use an agent, or is it very specific to how the Indy people think agents should be built?


## Releasing

Expand Down
29 changes: 29 additions & 0 deletions SBdemo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
HELP.md
/target/
!.mvn/wrapper/maven-wrapper.jar

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
/build/

### VS Code ###
.vscode/
114 changes: 114 additions & 0 deletions SBdemo/.mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.Properties;

public class MavenWrapperDownloader {

/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: : " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
Binary file added SBdemo/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 1 addition & 0 deletions SBdemo/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
Loading