Skip to content

Commit

Permalink
refactor: rename "disclosed informations" to "disclosed kv"
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-cristino authored and jaromil committed Oct 24, 2024
1 parent 6bc9885 commit 160540e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/lua/zencode_sd_jwt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -479,16 +479,16 @@ IfWhen("verify signed selective disclosure '' issued by '' is valid", function(o

end)

When("create disclosed informations from signed selective disclosure ''", function(ssd_name)
When("create disclosed kv from signed selective disclosure ''", function(ssd_name)
local ssd, ssd_c = have(ssd_name)
zencode_assert(ssd_c.schema and ssd_c.schema == "signed_selective_disclosure",
"Object is not a signed selective disclosure: " .. ssd_name)
local disclosed_informations = {}
local disclosed_kv = {}
for _, v in pairs(ssd.disclosures) do
disclosed_informations[v[2]:str()] = v[3]
disclosed_kv[v[2]:str()] = v[3]
end
ACK.disclosed_informations = disclosed_informations
new_codec('disclosed_informations', {
ACK.disclosed_kv = disclosed_kv
new_codec('disclosed kv', {
encoding = 'string',
luatype = 'table',
zentype = 'd'
Expand Down
12 changes: 6 additions & 6 deletions test/zencode/sd_jwt.bats
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,17 @@ EOF
#issuer key from https://github.com/oauth-wg/oauth-selective-disclosure-jwt/blob/master/examples/settings.yml
}

@test "create table of disclosed informations" {
cat <<EOF | zexe create_disclosed_informations.zen test_A3.out.json
@test "create table of disclosed kv" {
cat <<EOF | zexe create_disclosed_kv.zen test_A3.out.json
Scenario 'sd_jwt'
Given I have 'signed_selective_disclosure'
When I create the disclosed informations from signed selective disclosure 'signed_selective_disclosure'
When I create the disclosed kv from signed selective disclosure 'signed_selective_disclosure'
Then print the 'disclosed_informations'
Then print the 'disclosed kv'
EOF
save_output create_disclosed_informations.out.json
assert_output '{"disclosed_informations":{"address":{"country_code":"DE","locality":"Irgendwo","postal_code":"12345","street_address":"Sonnenstrasse 23"},"birth_family_name":"Schmidt","birthdate":"1973-01-01","family_name":"Mustermann","first_name":"Erika","is_over_18":true,"is_over_21":true,"is_over_65":false,"nationalities":[{"...":"JuL32QXDzizl-L6CLrfxfjpZsX3O6vsfpCVd1jkwJYg"}]}}'
save_output create_disclosed_kv.out.json
assert_output '{"disclosed_kv":{"address":{"country_code":"DE","locality":"Irgendwo","postal_code":"12345","street_address":"Sonnenstrasse 23"},"birth_family_name":"Schmidt","birthdate":"1973-01-01","family_name":"Mustermann","first_name":"Erika","is_over_18":true,"is_over_21":true,"is_over_65":false,"nationalities":[{"...":"JuL32QXDzizl-L6CLrfxfjpZsX3O6vsfpCVd1jkwJYg"}]}}'
}

0 comments on commit 160540e

Please sign in to comment.