From 5579a71678a6b0a97623446b3bad9c6c4b5106a6 Mon Sep 17 00:00:00 2001 From: xevisalle Date: Mon, 25 Nov 2024 18:15:45 +0100 Subject: [PATCH] Restructure workspace --- .gitignore | 3 +- Cargo.toml | 40 +++----------------- README.md | 22 +++-------- contract/Cargo.toml | 6 +++ contract/LICENSE | 1 + contract/README.md | 9 +++++ contract/src/main.rs | 9 +++++ CHANGELOG.md => core/CHANGELOG.md | 0 core/Cargo.toml | 34 +++++++++++++++++ core/LICENSE | 1 + core/README.md | 24 ++++++++++++ {benches => core/benches}/license_circuit.rs | 0 {src => core/src}/error.rs | 0 {src => core/src}/gadgets.rs | 0 {src => core/src}/lib.rs | 0 {src => core/src}/license.rs | 0 {src => core/src}/request.rs | 0 {src => core/src}/session.rs | 0 {tests => core/tests}/citadel.rs | 0 19 files changed, 97 insertions(+), 52 deletions(-) create mode 100644 contract/Cargo.toml create mode 100644 contract/LICENSE create mode 100644 contract/README.md create mode 100644 contract/src/main.rs rename CHANGELOG.md => core/CHANGELOG.md (100%) create mode 100644 core/Cargo.toml create mode 100644 core/LICENSE create mode 100644 core/README.md rename {benches => core/benches}/license_circuit.rs (100%) rename {src => core/src}/error.rs (100%) rename {src => core/src}/gadgets.rs (100%) rename {src => core/src}/lib.rs (100%) rename {src => core/src}/license.rs (100%) rename {src => core/src}/request.rs (100%) rename {src => core/src}/session.rs (100%) rename {tests => core/tests}/citadel.rs (100%) diff --git a/.gitignore b/.gitignore index 80ef275..17ff44b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -/target/ -/setup/ +**/target/ Cargo.lock **/*.rs.bk .DS_Store diff --git a/Cargo.toml b/Cargo.toml index 6715b4d..86e2c28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,34 +1,6 @@ -[package] -name = "zk-citadel" -version = "0.14.0" -repository = "https://github.com/dusk-network/citadel" -description = "Implementation of Citadel, a SSI system integrated in Dusk Network." -categories = ["cryptography", "authentication", "mathematics", "science"] -keywords = ["cryptography", "self-sovereign", "identity", "zk-snarks", "zero-knowledge"] -edition = "2021" -license = "MPL-2.0" - -[dependencies] -dusk-bytes = "0.1" -dusk-poseidon = { version = "0.40", features = ["zk"] } -poseidon-merkle = { version = "0.7", features = ["rkyv-impl", "zk", "size_32"] } -dusk-plonk = { version = "0.20", default-features = false, features = ["rkyv-impl", "alloc"] } -dusk-bls12_381 = { version = "0.13", default-features = false, features = ["rkyv-impl", "alloc"] } -dusk-jubjub = { version = "0.14", default-features = false, features = ["rkyv-impl", "alloc"] } -ff = { version = "0.13", default-features = false } -jubjub-schnorr = { version = "0.5", features = ["zk", "rkyv-impl", "alloc"] } -phoenix-core = { version = "0.32", features = ["rkyv-impl", "alloc"] } -rand_core = { version = "0.6", default-features=false, features = ["getrandom"] } -rkyv = { version = "0.7", default-features = false } -bytecheck = { version = "0.6", default-features = false } - -[dev-dependencies] -criterion = "0.5" - -[[bench]] -name = "license_circuit" -harness = false - -[features] -rkyv-impl = [] -default=["rkyv-impl"] +[workspace] +members = [ + "core", + "contract", +] +resolver = "2" diff --git a/README.md b/README.md index 0b2af05..07270fb 100644 --- a/README.md +++ b/README.md @@ -3,22 +3,12 @@ ![Build Status](https://github.com/dusk-network/citadel/workflows/Continuous%20integration/badge.svg) [![Repository](https://img.shields.io/badge/github-citadel-blueviolet?logo=github)](https://github.com/dusk-network/citadel) -This repository contains the implementation of Citadel, a protocol that integrates a self-sovereign identity system into the Dusk blockchain. A document with all the details about the protocol can be found [here](https://github.com/dusk-network/citadel/tree/main/docs/specs.pdf). +This repository contains the implementation of Citadel, a protocol that integrates a self-sovereign identity system into the Dusk blockchain. Our implementation is based on the original idea from this [paper](https://arxiv.org/pdf/2301.09378). -**DISCLAIMER**: this library **has not gone through an exhaustive security analysis**, so it is not intended to be used in a production environment, only for academic purposes. +This repository is structured as follows: -## Tests +- :computer: [**Core**](core): the core Citadel protocol implementation, containing all the involved data types, the protocol workflows, and the license circuit. +- :pencil: [**License Contract**](contract): The license contract, along with all the required code to test and deploy it. +- :scroll: [**Docs**](docs): A folder where you can find the documentation concerning the our Citadel specific implementation. -The library can be tested by running: - -``` -cargo t --release -``` - -## Benchmarks - -The library can be benchmarked by running: - -``` -cargo bench -``` +**DISCLAIMER**: the code in this repository **has not gone through an exhaustive security analysis**, so it is not intended to be used in a production environment, only for academic purposes. diff --git a/contract/Cargo.toml b/contract/Cargo.toml new file mode 100644 index 0000000..55ec65b --- /dev/null +++ b/contract/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "license-contract" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/contract/LICENSE b/contract/LICENSE new file mode 100644 index 0000000..ea5b606 --- /dev/null +++ b/contract/LICENSE @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/contract/README.md b/contract/README.md new file mode 100644 index 0000000..6e89376 --- /dev/null +++ b/contract/README.md @@ -0,0 +1,9 @@ +# (WIP) Citadel Contract + +![Build Status](https://github.com/dusk-network/citadel/workflows/Continuous%20integration/badge.svg) +[![Repository](https://img.shields.io/badge/github-citadel-blueviolet?logo=github)](https://github.com/dusk-network/citadel) + +This package contains the Citadel contract. + +**DISCLAIMER**: this contract **has not gone through an exhaustive security analysis**, so it is not intended to be used in a production environment, only for academic purposes. + diff --git a/contract/src/main.rs b/contract/src/main.rs new file mode 100644 index 0000000..52a6975 --- /dev/null +++ b/contract/src/main.rs @@ -0,0 +1,9 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. +// +// Copyright (c) DUSK NETWORK. All rights reserved. + +fn main() { + println!("Hello, world!"); +} diff --git a/CHANGELOG.md b/core/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to core/CHANGELOG.md diff --git a/core/Cargo.toml b/core/Cargo.toml new file mode 100644 index 0000000..ea9f561 --- /dev/null +++ b/core/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "zk-citadel" +version = "0.14.0" +repository = "https://github.com/dusk-network/citadel/core" +description = "Implementation of Citadel, a SSI system integrated in Dusk Network." +categories = ["cryptography", "authentication", "mathematics", "science"] +keywords = ["cryptography", "self-sovereign", "identity", "zk-snarks", "zero-knowledge"] +edition = "2021" +license = "MPL-2.0" + +[dependencies] +dusk-bytes = "0.1" +dusk-poseidon = { version = "0.40", features = ["zk"] } +poseidon-merkle = { version = "0.7", features = ["rkyv-impl", "zk", "size_32"] } +dusk-plonk = { version = "0.20", default-features = false, features = ["rkyv-impl", "alloc"] } +dusk-bls12_381 = { version = "0.13", default-features = false, features = ["rkyv-impl", "alloc"] } +dusk-jubjub = { version = "0.14", default-features = false, features = ["rkyv-impl", "alloc"] } +ff = { version = "0.13", default-features = false } +jubjub-schnorr = { version = "0.5", features = ["zk", "rkyv-impl", "alloc"] } +phoenix-core = { version = "0.32", features = ["rkyv-impl", "alloc"] } +rand_core = { version = "0.6", default-features=false, features = ["getrandom"] } +rkyv = { version = "0.7", default-features = false } +bytecheck = { version = "0.6", default-features = false } + +[dev-dependencies] +criterion = "0.5" + +[[bench]] +name = "license_circuit" +harness = false + +[features] +rkyv-impl = [] +default=["rkyv-impl"] diff --git a/core/LICENSE b/core/LICENSE new file mode 100644 index 0000000..ea5b606 --- /dev/null +++ b/core/LICENSE @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/core/README.md b/core/README.md new file mode 100644 index 0000000..7698d57 --- /dev/null +++ b/core/README.md @@ -0,0 +1,24 @@ +# Citadel Core + +![Build Status](https://github.com/dusk-network/citadel/workflows/Continuous%20integration/badge.svg) +[![Repository](https://img.shields.io/badge/github-citadel-blueviolet?logo=github)](https://github.com/dusk-network/citadel) + +This package contains the core implementation of Citadel. + +**DISCLAIMER**: this package **has not gone through an exhaustive security analysis**, so it is not intended to be used in a production environment, only for academic purposes. + +## Tests + +The package can be tested by running: + +``` +cargo t --release +``` + +## Benchmarks + +The package can be benchmarked by running: + +``` +cargo bench +``` diff --git a/benches/license_circuit.rs b/core/benches/license_circuit.rs similarity index 100% rename from benches/license_circuit.rs rename to core/benches/license_circuit.rs diff --git a/src/error.rs b/core/src/error.rs similarity index 100% rename from src/error.rs rename to core/src/error.rs diff --git a/src/gadgets.rs b/core/src/gadgets.rs similarity index 100% rename from src/gadgets.rs rename to core/src/gadgets.rs diff --git a/src/lib.rs b/core/src/lib.rs similarity index 100% rename from src/lib.rs rename to core/src/lib.rs diff --git a/src/license.rs b/core/src/license.rs similarity index 100% rename from src/license.rs rename to core/src/license.rs diff --git a/src/request.rs b/core/src/request.rs similarity index 100% rename from src/request.rs rename to core/src/request.rs diff --git a/src/session.rs b/core/src/session.rs similarity index 100% rename from src/session.rs rename to core/src/session.rs diff --git a/tests/citadel.rs b/core/tests/citadel.rs similarity index 100% rename from tests/citadel.rs rename to core/tests/citadel.rs