Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nmattia committed Feb 8, 2024
1 parent d3f0336 commit bda32b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions demos/vc_issuer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ fn calculate_seed(principal: &Principal) -> Hash {
fn bachelor_degree_credential(subject_principal: Principal, institution_name: &str) -> Credential {
let subject: Subject = Subject::from_json_value(json!({
"id": did_for_principal(subject_principal),
// TODO: double check that it matches credential_type
"degree": {
"type": "BachelorDegree",
"name": "Bachelor of Engineering",
Expand All @@ -462,6 +463,7 @@ fn bachelor_degree_credential(subject_principal: Principal, institution_name: &s
fn dfinity_employment_credential(subject_principal: Principal, employer_name: &str) -> Credential {
let subject: Subject = Subject::from_json_value(json!({
"id": did_for_principal(subject_principal),
// TODO: change for VerifiedEmployee
"employee_of": {
"employerId" : "did:web:dfinity.org",
"employerName": employer_name,
Expand All @@ -481,6 +483,7 @@ fn dfinity_employment_credential(subject_principal: Principal, employer_name: &s
}

fn verified_adult_credential(subject_principal: Principal, age_at_least: u16) -> Credential {
// TODO: change this to have { VerifiedAdult: { age_at_least : 18 } }
let subject: Subject = Subject::from_json_value(json!({
"id": did_for_principal(subject_principal),
"age_at_least": age_at_least,
Expand Down
1 change: 1 addition & 0 deletions src/vc_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ fn validate_claims_match_spec(

let empty_hashmap = HashMap::new();
// TODO: why iterate over an empty map?
// XXX: this is incorrect ;TODO: look at [credential_type] key in spec.arguments
let iter = spec.arguments.as_ref().unwrap_or(&empty_hashmap).iter();
for (key, value) in iter {
let foo = subject.properties.get(key);
Expand Down

0 comments on commit bda32b1

Please sign in to comment.