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

166 Integrate VC Data Model Spec Test Suite #167

Merged
merged 46 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
76db3a5
started on cli
LuisOsta Nov 22, 2023
17a889e
started working on cli
LuisOsta Nov 22, 2023
a2f7dd7
fixed parsing issues
LuisOsta Nov 22, 2023
df33062
added context validation
LuisOsta Nov 22, 2023
40a7f92
added context validation
LuisOsta Nov 22, 2023
649b385
removed printout
LuisOsta Nov 22, 2023
50aa4c2
fixed context bug
LuisOsta Nov 22, 2023
b3dbfa4
added expiration date
LuisOsta Nov 22, 2023
8eaf21e
added multi-proof support
LuisOsta Nov 22, 2023
5f95dde
added context object support
LuisOsta Nov 22, 2023
2acc31b
fixed linting
LuisOsta Nov 22, 2023
d54acfc
added presentation type
LuisOsta Nov 23, 2023
ea2b349
fixed test
LuisOsta Nov 23, 2023
0d284cc
added serde to data integrity proofs
LuisOsta Nov 23, 2023
422152b
made verifiableCredentials optional
LuisOsta Nov 27, 2023
88492fa
added spec test github action
LuisOsta Nov 27, 2023
e8c04b9
changed name
LuisOsta Nov 27, 2023
18278ee
fixed config issue
LuisOsta Nov 27, 2023
37b84ce
fixed pathing issue
LuisOsta Nov 27, 2023
22eb5a2
fixed file issue
LuisOsta Nov 27, 2023
a897a5f
added config json doc
LuisOsta Nov 27, 2023
dfb7db0
cleaned up display function
LuisOsta Nov 27, 2023
f3d2a11
added credential from str
LuisOsta Nov 27, 2023
b8c4ebf
added from str to presentation
LuisOsta Nov 27, 2023
00d39fe
reordered structs
LuisOsta Nov 27, 2023
1afc37c
moved credential type impl
LuisOsta Nov 27, 2023
9451579
moved mod definition
LuisOsta Nov 27, 2023
58721b1
added comment and link
LuisOsta Nov 27, 2023
14c6891
remove unnecessary step
LuisOsta Nov 27, 2023
91effd8
upgraded node version
LuisOsta Nov 27, 2023
fdb22c8
moved comments to doc comments
LuisOsta Nov 27, 2023
caf2c30
addressed param comments
LuisOsta Nov 27, 2023
7468467
addressed comments
LuisOsta Nov 27, 2023
b9b1423
fixed test
LuisOsta Nov 27, 2023
e149dec
refactored id
LuisOsta Nov 27, 2023
0d89356
addressed comments
LuisOsta Nov 27, 2023
722adc4
addressed comments
LuisOsta Nov 27, 2023
e923c4d
addressed comment
LuisOsta Nov 27, 2023
165acfd
fixed linting
LuisOsta Nov 27, 2023
a6b949f
fixed linting
LuisOsta Nov 27, 2023
1a96bf0
addressed comments
LuisOsta Nov 27, 2023
d74e9a4
fixed linting issue
LuisOsta Nov 27, 2023
ab12f96
addressed comment
LuisOsta Nov 27, 2023
a79563c
addressed comment
LuisOsta Nov 27, 2023
a92cafd
addressed comment
LuisOsta Nov 27, 2023
34e90e0
added tests for context validation
LuisOsta Nov 28, 2023
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
50 changes: 50 additions & 0 deletions .github/workflows/vc_model_spec_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: VC Model Spec Test
# Tests the VC Model Spec against the vc-test-suite - https://github.com/w3c/vc-test-suite
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Install Protoc and cargo-make
run: ./container/deps.sh protoc cargo-make

- uses: knox-networks/github-actions-public/.github/actions/setup-protofetch@main
with:
cross-repo-username: "developersKnox"
cross-repo-token: ${{ secrets.PROTOFETCH_GITHUB_TOKEN }}

- name: Test protos
run: (cd registry_resolver; protofetch fetch) && git diff --exit-code

- name: Build CLI
run: cargo build --package cli --release

- name: Add CLI to bin
run: sudo cp $PWD/target/release/ssi_cli /bin/ssi_cli

- name: Install Node & NPM
uses: actions/setup-node@v2
with:
node-version: "20"

- name: Clone & Install vc-test-suite
run: |
git clone https://github.com/knox-networks/vc-test-suite
cd vc-test-suite
npm install

- name: Copy vc-test-suite config
run: cp tests/vc_model_spec_test/config.json vc-test-suite/config.json

- name: Run vc-test-suite
run: |
cd vc-test-suite
npm run test
172 changes: 172 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ members = [
"signature",
"ssi",
"ephemeral_resolver",
"ffi"
"ffi",
"cli",
]


Expand Down
15 changes: 15 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "cli"
version.workspace = true
edition.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = {version = "4.4.8", features = ["derive"]}
ssi = {path = "../ssi"}

# binary definition
[[bin]]
name = "ssi_cli"
path = "src/main.rs"
41 changes: 41 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use std::str::FromStr;

use clap::{command, Parser, Subcommand};

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
#[command(propagate_version = true)]
struct CliArguments {
#[command(subcommand)]
command: Command,
}

#[derive(Subcommand, Debug)]
enum Command {
TestIssueCredential {
#[arg(short, long)]
input_file_path: String,
LuisOsta marked this conversation as resolved.
Show resolved Hide resolved
},
TestIssuePresentation {
#[arg(short, long)]
input_file_path: String,
},
}

fn main() {
let args = CliArguments::parse();
match args.command {
Command::TestIssueCredential { input_file_path } => {
//read the JSON string file in input_file_path and parse it into a VerifiableCredential
//print the VerifiableCredential
LuisOsta marked this conversation as resolved.
Show resolved Hide resolved
let input = std::fs::read_to_string(input_file_path).unwrap();
LuisOsta marked this conversation as resolved.
Show resolved Hide resolved
let vc = ssi::credential::VerifiableCredential::from_str(&input).unwrap();
println!("{}", vc);
}
Command::TestIssuePresentation { input_file_path } => {
let input = std::fs::read_to_string(input_file_path).unwrap();
let vc = ssi::credential::VerifiablePresentation::from_str(&input).unwrap();
println!("{}", vc);
}
}
}
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ mockall = {workspace = true}
thiserror = {workspace = true}
json-ld = "0.15.0"
sophia = { git = "https://github.com/pchampin/sophia_rs.git", rev = "572512bd4a13dce4ca52f9310ac907b06dbea556", features = ["jsonld","http_client"] }
serde_valid = "0.16.3"

[dev-dependencies]
rstest = "0.15.0"
Expand Down
Loading
Loading