Skip to content

Commit

Permalink
Add an implementation of a VC issuer (#2057)
Browse files Browse the repository at this point in the history
* Add an implementation of a VC issuer.

* Remove commmented out deps, fix an URL

* Fix an issuer bug, extend a test

* Document issuer's candid interface

* Address review comments

* Update demos/vc_issuer/build.sh

Co-authored-by: Nicolas Mattia <[email protected]>

* +=prettier

* fix vc_issuer/build.sh

---------

Co-authored-by: Nicolas Mattia <[email protected]>
  • Loading branch information
przydatek and nmattia authored Nov 17, 2023
1 parent 1529c7f commit 76ada8a
Show file tree
Hide file tree
Showing 11 changed files with 4,681 additions and 2 deletions.
3,276 changes: 3,276 additions & 0 deletions demos/vc_issuer/Cargo.lock

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions demos/vc_issuer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[workspace]

[package]
name = "vc_issuer"
description = "Verifiable Credentials Issuer"
version = "0.1.0"
edition = "2021"

[dependencies]
# local dependencies
canister_sig_util = { path = "../../src/canister_sig_util" }
internet_identity_interface = { path = "../../src/internet_identity_interface" }
vc_util = { path = "../../src/vc_util" }
# ic dependencies
candid = "0.9"
ic-cdk = "0.10"
ic-cdk-macros = "0.7"
ic-certified-map = "0.4"
ic-stable-structures = "0.6.0"
# vc dependencies
identity_core = { git = "https://github.com/frederikrothenberger/identity.rs.git", branch = "frederik/wasm-test", default-features = false}
identity_credential = {git = "https://github.com/frederikrothenberger/identity.rs.git", branch = "frederik/wasm-test", default-features = false, features = ["credential"]}
identity_jose = { git = "https://github.com/frederikrothenberger/identity.rs.git", branch = "frederik/wasm-test", default-features = false, features = ["iccs"]}

# other dependencies
hex = "0.4"
serde = { version = "1", features = ["derive"] }
serde_bytes = "0.11"
serde_cbor = "0.11"
serde_json = "1"
sha2 = "^0.10" # set bound to match ic-certified-map bound

[dev-dependencies]
assert_matches = "1.5.0"
ic-test-state-machine-client = "3"
canister_tests = { path = "../../src/canister_tests" }
lazy_static = "1.4"
15 changes: 15 additions & 0 deletions demos/vc_issuer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# An example issuer of verifiable credentials

This is an example implementation of an issuer of verifiable credentials for
the [attribute sharing flow on the IC](https://github.com/dfinity/wg-identity-authentication/blob/main/topics/attribute-sharing.md).

## Supported Behavior

The app implements the interface of the issuer from [the spec](../../docs/vc-spec.md), plus some additional
APIs for configuring and testing, cf. [vc_issuer.did](./vc_issuer.did).
Please note that this issuer is for demonstrating the use of issuer APIS, and is **not meant
for real-world deployment**, as it does not have proper management of user data.

## Development

Run `./build.sh` script to build the issuer canister.
13 changes: 13 additions & 0 deletions demos/vc_issuer/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail


# Make sure we always run from the issuer root
VC_ISSUER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$VC_ISSUER_DIR"

cargo build --release --target wasm32-unknown-unknown --manifest-path ./Cargo.toml -j1
ic-wasm "target/wasm32-unknown-unknown/release/vc_issuer.wasm" -o "./vc_issuer.wasm" shrink
ic-wasm vc_issuer.wasm -o vc_issuer.wasm metadata candid:service -f vc_issuer.did -v public
gzip --no-name --force "vc_issuer.wasm"

28 changes: 28 additions & 0 deletions demos/vc_issuer/dfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"canisters": {
"internet_identity": {
"type": "custom",
"candid": "../../src/internet_identity/internet_identity.did",
"wasm": "../../internet_identity.wasm.gz",

"remote": {
"id": {
"ic": "rdmx6-jaaaa-aaaaa-aaadq-cai"
}
}
},

"issuer": {
"type": "custom",
"candid": "vc_issuer.did",
"wasm": "vc_issuer.wasm.gz",
"build": "./build.sh"
}
},
"defaults": {
"build": {
"packtool": ""
}
},
"version": 1
}
Loading

0 comments on commit 76ada8a

Please sign in to comment.