forked from hyperledger/anoncreds-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ahmed Moussa <[email protected]>
- Loading branch information
Showing
136 changed files
with
5,766 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: 'Pull Request - Linter' | ||
|
||
env: | ||
ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
lint_pr: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
name: 'Pull Request - Compile Build' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
concurrency: | ||
group: ${{ github.head_ref }}${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
JAVA_VERSION: 11 | ||
ATALA_GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} | ||
ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
token: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
|
||
- name: "Install Java ${{ env.JAVA_VERSION }}" | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: "${{ env.JAVA_VERSION }}" | ||
distribution: zulu | ||
|
||
- name: Gradle Build Action | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Test Kotlin code is properly formatted | ||
working-directory: ./anoncred-kmm | ||
run: ./gradlew ktlintCheck | ||
|
||
- name: Install Homebrew | ||
run: > | ||
/bin/bash -c "$(curl -fsSL | ||
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
- name: "Install autoconf, automake, libtool" | ||
run: | | ||
brew install autoconf automake libtool | ||
- name: "Install Mac ToolChain" | ||
run: | | ||
brew tap messense/macos-cross-toolchains | ||
- name: "Brew Linking issue fix" | ||
run: | | ||
rm '/usr/local/bin/2to3' | ||
- name: "Install Linux GNU for x86_64" | ||
run: | | ||
rm '/usr/local/bin/2to3-3.11' | ||
rm '/usr/local/bin/idle3' | ||
brew install --overwrite x86_64-unknown-linux-gnu | ||
- name: "Install Linux GNU for aarch64" | ||
run: | | ||
brew install --overwrite aarch64-unknown-linux-gnu | ||
- name: "Install Rust" | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -y | ||
- name: "Install Rust Targets" | ||
run: | | ||
rustup target add armv7-linux-androideabi & rustup target add i686-linux-android & rustup target add aarch64-linux-android & rustup target add x86_64-linux-android & rustup target add aarch64-apple-darwin & rustup target add x86_64-apple-darwin & rustup target add aarch64-unknown-linux-gnu & rustup target add x86_64-unknown-linux-gnu | ||
- name: "Install Rust Cargo NDK" | ||
run: | | ||
cargo install cargo-ndk | ||
- name: Build Check All tests | ||
working-directory: ./anoncred-kmm | ||
run: ./gradlew :anoncreds-kmp:allTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*.{kt,kts}] | ||
ktlint_code_style = ktlint_official | ||
ktlint_standard_no_semi = disabled | ||
ktlint_standard_trailing-comma-on-call-site = disabled | ||
ktlint_standard_trailing-comma-on-declaration-site = disabled | ||
ktlint_standard_function-signature = disabled | ||
ktlint_standard_max-line-length = disabled | ||
ktlint_standard_property-naming = disabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.gradle | ||
.idea | ||
.DS_STORE | ||
anoncred-wrapper-rust/build/generated | ||
**/build/* | ||
uniffi-kmm/Cargo.lock | ||
uniffi-kmm/target | ||
local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
APPLY_FIXES: none | ||
FILTER_REGEX_EXCLUDE: (karma.config.js|polyfill.js|timeout.js) | ||
VALIDATE_ALL_CODEBASE: true | ||
REPOSITORY_DEVSKIM_DISABLE_ERRORS: true | ||
MARKDOWN_MARKDOWN_LINK_CHECK_FILTER_REGEX_EXCLUDE: (pull-request.yml|Deployment.yml|badge.svg) | ||
|
||
DISABLE: | ||
- COPYPASTE | ||
- SPELL | ||
|
||
DISABLE_LINTERS: | ||
- MARKDOWN_MARKDOWN_LINK_CHECK | ||
- C_CPPLINT | ||
- CPP_CPPLINT | ||
- BASH_SHELLCHECK | ||
- BASH_EXEC | ||
- REPOSITORY_TRIVY | ||
- REPOSITORY_TRUFFLEHOG | ||
- REPOSITORY_KICS | ||
- REPOSITORY_CHECKOV | ||
- RUST_CLIPPY | ||
|
||
DISABLE_ERRORS_LINTERS: | ||
- REPOSITORY_TRUFFLEHOG | ||
- REPOSITORY_TRIVY | ||
- REPOSITORY_KICS | ||
- RUST_CLIPPY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# AnonCred-KMP | ||
|
||
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.20-blue.svg?logo=kotlin)](http://kotlinlang.org) | ||
|
||
![apple-silicon](https://camo.githubusercontent.com/a92c841ffd377756a144d5723ff04ecec886953d40ac03baa738590514714921/687474703a2f2f696d672e736869656c64732e696f2f62616467652f737570706f72742d2535424170706c6553696c69636f6e2535442d3433424246462e7376673f7374796c653d666c6174) | ||
![ios](https://camo.githubusercontent.com/1fec6f0d044c5e1d73656bfceed9a78fd4121b17e82a2705d2a47f6fd1f0e3e5/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d696f732d4344434443442e7376673f7374796c653d666c6174) | ||
![jvm](https://camo.githubusercontent.com/700f5dcd442fd835875568c038ae5cd53518c80ae5a0cf12c7c5cf4743b5225b/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6a766d2d4442343133442e7376673f7374796c653d666c6174) | ||
![macos](https://camo.githubusercontent.com/1b8313498db244646b38a4480186ae2b25464e5e8d71a1920c52b2be5212b909/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6d61636f732d3131313131312e7376673f7374796c653d666c6174) | ||
|
||
## Introduction | ||
|
||
This is a Kotlin MultiPlatform (KMP) wrapper of a rust library and reference implementation of the [Anoncreds V1.0 | ||
specification](https://hyperledger.github.io/anoncreds-spec/). | ||
|
||
|
||
The AnonCreds (Anonymous Credentials) specification is based on the open source verifiable credential implementation of AnonCreds that has been in use since 2017, initially as part of the Hyperledger Indy open source project and now in the Hyperledger AnonCreds project. The extensive use of AnonCreds around the world has made it a de facto standard for ZKP-based verifiable credentials, and this specification is the formalization of that implementation. | ||
|
||
## Library | ||
|
||
AnonCred-KMP exposes three main parts: [`issuer`](./anoncred-wrapper-rust/src/issuer/mod.rs), | ||
[`prover`](./anoncred-wrapper-rust/src/prover/mod.rs) and | ||
[`verifier`](./anoncred-wrapper-rust/src/verifier/mod.rs). | ||
|
||
The library provides wrapper for the following operations | ||
|
||
### Issuer | ||
|
||
- Create a [schema](https://hyperledger.github.io/anoncreds-spec/#schema-publisher-publish-schema-object) | ||
- Create a [credential definition](https://hyperledger.github.io/anoncreds-spec/#issuer-create-and-publish-credential-definition-object) | ||
- Create a [revocation registry definition](https://hyperledger.github.io/anoncreds-spec/#issuer-create-and-publish-revocation-registry-objects) | ||
- Create a [revocation status list](https://hyperledger.github.io/anoncreds-spec/#publishing-the-initial-initial-revocation-status-list-object) | ||
- Update a [revocation status list](https://hyperledger.github.io/anoncreds-spec/#publishing-the-initial-initial-revocation-status-list-object) | ||
- Update a [revocation status list](https://hyperledger.github.io/anoncreds-spec/#publishing-the-initial-initial-revocation-status-list-object)'s timestamp | ||
- Create a [credential offer](https://hyperledger.github.io/anoncreds-spec/#credential-offer) | ||
- Create a [credential](https://hyperledger.github.io/anoncreds-spec/#issue-credential) | ||
|
||
### Prover / Holder | ||
|
||
- Create a [credential request](https://hyperledger.github.io/anoncreds-spec/#credential-request) | ||
- Process an incoming [credential](https://hyperledger.github.io/anoncreds-spec/#receiving-a-credential) | ||
- Create a [presentation](https://hyperledger.github.io/anoncreds-spec/#generate-presentation) | ||
- Create, and update, a revocation state | ||
- Create, and update, a revocation state with a witness | ||
|
||
### Verifier | ||
|
||
- [Verify a presentation](https://hyperledger.github.io/anoncreds-spec/#verify-presentation) | ||
- generate a nonce | ||
|
||
## Requirement | ||
|
||
- Rust v1.72.0 | ||
- KMP v1.8.20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[target.aarch64-unknown-linux-gnu] | ||
linker = "aarch64-linux-gnu-gcc" | ||
[target.x86_64-unknown-linux-gnu] | ||
linker = "x86_64-linux-gnu-gcc" | ||
[target.aarch64-linux-android] | ||
linker = "aarch64-linux-android21-clang++" | ||
[target.x86_64-linux-android] | ||
linker = "x86_64-linux-android21-clang++" | ||
[target.i686-linux-android] | ||
linker = "i686-linux-android21-clang++" | ||
[target.armv7-linux-androideabi] | ||
linker = "armv7a-linux-androideabi21-clang++" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
.DS_Store | ||
debug/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[package] | ||
name = "anoncreds_wrapper" | ||
version = "0.1.0" | ||
authors = ['Ahmed Moussa <[email protected]>'] | ||
edition = "2021" | ||
description = 'FFI wrapper for Anoncreds' | ||
|
||
[lib] | ||
name = "anoncreds_wrapper" | ||
path = "src/lib.rs" | ||
crate-type = ['cdylib', 'staticlib'] | ||
|
||
[dependencies.anoncreds_core] | ||
path = '../' | ||
package = "anoncreds" | ||
features = ["vendored"] | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
uniffi = "0.23.0" | ||
uniffi_macros = "0.23.0" | ||
once_cell = "1.12" | ||
thiserror = "1.0" | ||
lazy_static = "1.3" | ||
futures = { version = "0.3.17", features = ["thread-pool"] } | ||
num_cpus = "1.8.0" | ||
async-trait = '0.1' | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = '1.0' | ||
ursa = { version = "0.3.7", default-features = false, features = ["cl_native", "serde"] } | ||
swift-bridge = "0.1.51" | ||
openssl = "0.10.45" | ||
amcl = "0.2" | ||
|
||
[dev-dependencies.tokio] | ||
version = '1.9' | ||
features = ['rt', 'macros'] | ||
|
||
[build-dependencies] | ||
uniffi = { version = "0.23.0", features=["build"] } | ||
uniffi_bindgen = "0.23.0" | ||
camino = "1.1.1" | ||
swift-bridge-build = "0.1.51" | ||
uniffi-kmm = { path = "../uniffi-kmm" } |
Oops, something went wrong.