Skip to content

Commit

Permalink
fix: credential_configurations_supported is a dictionary (#61)
Browse files Browse the repository at this point in the history
* fix: first fixes to credential_configurations_supported

from array to dictionary

* chore: remove unnecessary line of code

* test: update credential_configurations_supported

* test: checkout the relative DIDRoom_microservices branch

* test: update url to uri in logo object

* test: insert description in well-known output check

* test: various fixes on contract output checks

* chore: bump ncr from 1.39.5 to 1.39.6

* test: point back to DIDRoom_microservices main branch
  • Loading branch information
matteo-cristino authored Oct 30, 2024
1 parent 33e689e commit 3231540
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ help: ## 🛟 Show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-7s\033[0m %s\n", $$1, $$2}'

ncr: ## 📦 Install and setup the server
@wget -q --show-progress https://github.com/ForkbombEu/ncr/releases/download/v1.39.5/ncr;
@wget -q --show-progress https://github.com/ForkbombEu/ncr/releases/download/v1.39.6/ncr;
@chmod +x ./ncr
@echo "📦 Setup is done!"

Expand Down
6 changes: 3 additions & 3 deletions test/wallet.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ load ./bats_utils
curl -X GET $url | jq -c '.' 1> $TMP/out
save_tmp_output credential_issuer_well-known.output.json
assert_output --partial '{"credential_issuer":"http://localhost:3001/credential_issuer","credential_endpoint":"http://localhost:3001/credential_issuer/credential","authorization_servers":["http://localhost:3000/authz_server"],"display":[{"name":"DIDroom_Test_Issuer","locale":"en-US"}],"jwks":{"keys":[{"kid":"did:dyne:sandbox.genericissuer:'
assert_output --partial 'es256_public_key","crv":"P-256","alg":"ES256","kty":"EC"}]},"credential_configurations_supported":[{"format":"vc+sd-jwt","cryptographic_binding_methods_supported":["jwk","did:dyne:sandbox.signroom"],"credential_signing_alg_values_supported":["ES256"],"proof_types_supported":{"jwt":{"proof_signing_alg_values_supported":["ES256"]}},"display":[{"name":"Tested Credential","locale":"en-US","logo":{"url":"https://www.connetweb.com/wp-content/uploads/2021/06/canstockphoto22402523-arcos-creator.com_-1024x1024-1.jpg","alt_text":"Test Logo"},"background_color":"#12107c","text_color":"#FFFFFF"}],"credential_definition":{"type":["test_credential"],"credentialSubject":{"tested":{"mandatory":true,"display":[{"name":"Is tested","locale":"en-US"}]}}}}]}'
authorization_server=$(jq_extract_raw "authorization_servers" credential_issuer_well-known.output.json| jq -r '.[0]')
assert_output --partial 'es256_public_key","crv":"P-256","alg":"ES256","kty":"EC"}]},"credential_configurations_supported":{"test_credential":{"format":"vc+sd-jwt","cryptographic_binding_methods_supported":["jwk","did:dyne:sandbox.signroom"],"credential_signing_alg_values_supported":["ES256"],"proof_types_supported":{"jwt":{"proof_signing_alg_values_supported":["ES256"]}},"display":[{"name":"Tested Credential","locale":"en-US","logo":{"uri":"https://www.connetweb.com/wp-content/uploads/2021/06/canstockphoto22402523-arcos-creator.com_-1024x1024-1.jpg","alt_text":"Test Logo"},"description":"a description","background_color":"#12107c","text_color":"#FFFFFF"}],"credential_definition":{"type":["test_credential"],"credentialSubject":{"tested":{"mandatory":true,"display":[{"name":"Is tested","locale":"en-US"}]}}}}}}'
authorization_server=$(jq_extract_raw "authorization_servers" credential_issuer_well-known.output.json | jq -r '.[0]')
jq_insert "authorization_server" $authorization_server read_credential_issuer.output.json
credential_configurations_supported=$(jq_extract_raw "credential_configurations_supported" credential_issuer_well-known.output.json | jq -c '.')
echo $credential_configurations_supported >$TMP/out
Expand Down Expand Up @@ -41,7 +41,7 @@ load ./bats_utils
zexe $WALLET/holder_qr_to_well-known.zen $WALLET/holder_qr_to_well-known.keys.json holder_qr_to_well-known.data.json
save_tmp_output holder_qr_to_well-known.output.json
assert_output --partial '{"credential_issuer_information":{"authorization_servers":["http://localhost:3000/authz_server"],"credential_endpoint":"http://localhost:3001/credential_issuer/credential","credential_issuer":"http://localhost:3001/credential_issuer","display":[{"locale":"en-US","name":"DIDroom_Test_Issuer"}],"jwks":{"keys":[{"alg":"ES256","crv":"P-256","kid":"did:dyne:sandbox.genericissuer:'
assert_output --partial 'es256_public_key","kty":"EC"}]}},"credential_parameters":{"authorization_endpoint":"http://localhost:3000/authz_server/authorize","authorization_server_endpoint_par":"http://localhost:3000/authz_server/par","code_challenge_method":"S256","credential_endpoint":"http://localhost:3001/credential_issuer/credential","credential_issuer":"http://localhost:3001/credential_issuer","format":"vc+sd-jwt","grant_type":"authorization_code","response_type":"code","token_endpoint":"http://localhost:3000/authz_server/token","vct":"test_credential"},"credential_requested":{"credential_definition":{"credentialSubject":{"tested":{"display":[{"locale":"en-US","name":"Is tested"}],"mandatory":true}},"type":["test_credential"]},"credential_signing_alg_values_supported":["ES256"],"cryptographic_binding_methods_supported":["jwk","did:dyne:sandbox.signroom"],"display":[{"background_color":"#12107c","locale":"en-US","logo":{"alt_text":"Test Logo","url":"https://www.connetweb.com/wp-content/uploads/2021/06/canstockphoto22402523-arcos-creator.com_-1024x1024-1.jpg"},"name":"Tested Credential","text_color":"#FFFFFF"}],"format":"vc+sd-jwt","proof_types_supported":{"jwt":{"proof_signing_alg_values_supported":["ES256"]}}}}'
assert_output --partial 'es256_public_key","kty":"EC"}]}},"credential_parameters":{"authorization_endpoint":"http://localhost:3000/authz_server/authorize","authorization_server_endpoint_par":"http://localhost:3000/authz_server/par","code_challenge_method":"S256","credential_endpoint":"http://localhost:3001/credential_issuer/credential","credential_issuer":"http://localhost:3001/credential_issuer","format":"vc+sd-jwt","grant_type":"authorization_code","response_type":"code","token_endpoint":"http://localhost:3000/authz_server/token","vct":"test_credential"},"credential_requested":{"credential_definition":{"credentialSubject":{"tested":{"display":[{"locale":"en-US","name":"Is tested"}],"mandatory":true}},"type":["test_credential"]},"credential_signing_alg_values_supported":["ES256"],"cryptographic_binding_methods_supported":["jwk","did:dyne:sandbox.signroom"],"display":[{"background_color":"#12107c","description":"a description","locale":"en-US","logo":{"alt_text":"Test Logo","uri":"https://www.connetweb.com/wp-content/uploads/2021/06/canstockphoto22402523-arcos-creator.com_-1024x1024-1.jpg"},"name":"Tested Credential","text_color":"#FFFFFF"}],"format":"vc+sd-jwt","proof_types_supported":{"jwt":{"proof_signing_alg_values_supported":["ES256"]}}}}'
}

@test "Holder post to authz_server/par [call_par.zen]" {
Expand Down
2 changes: 1 addition & 1 deletion wallet/holder_qr_to_well-known.keys.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"data_2": {},
"!external-qr-code-content_path": "!external-qr-code-content",
"zen_1": "Rule unknown ignore\n\nGiven I have a 'string dictionary' named '!external-qr-code-content'\nGiven I have a 'string' named 'credential_issuer' inside '!external-qr-code-content'\nGiven I have a 'string array' named 'credential_configuration_ids' inside '!external-qr-code-content'\n\nWhen I create copy of element '1' from array 'credential_configuration_ids'\nWhen I rename the 'copy' to 'credential_configuration_id'\n\nWhen I append the string '/.well-known/openid-credential-issuer' to 'credential_issuer'\n\nThen print the 'credential_configuration_id'\nThen print the 'credential_issuer'\n",
"zen_2": "Rule unknown ignore\n\nGiven I have a 'string array' named 'credential_configurations_supported'\nGiven I have a 'string' named 'credential_configuration_id'\nGiven I have a 'string' named 'authorization_server'\n\nForeach 'credential' in 'credential_configurations_supported'\n When I pickup from path 'credential.credential_definition.type'\n If I verify 'credential_configuration_id' is found in 'type'\n When I rename the 'credential' to 'credential_requested'\n Endif\n When I remove the 'type'\nEndforeach\n\nWhen I copy 'credential_configuration_id' to 'vct'\nWhen I append the string '/.well-known/oauth-authorization-server' to 'authorization_server'\nWhen I pickup from path 'credential_requested.format'\n\nThen print the 'authorization_server'\nThen print the 'credential_requested'\nThen print the 'format'\nThen print the 'vct'\n",
"zen_2": "Rule unknown ignore\n\nGiven I have a 'string dictionary' named 'credential_configurations_supported'\nGiven I have a 'string' named 'credential_configuration_id'\nGiven I have a 'string' named 'authorization_server'\n\nWhen I create copy of object named by 'credential_configuration_id' from dictionary 'credential_configurations_supported'\nand I rename 'copy' to 'credential_requested'\n\nWhen I copy 'credential_configuration_id' to 'vct'\nWhen I append the string '/.well-known/oauth-authorization-server' to 'authorization_server'\nWhen I pickup from path 'credential_requested.format'\n\nThen print the 'authorization_server'\nThen print the 'credential_requested'\nThen print the 'format'\nThen print the 'vct'\n",
"r.authorization_servers_path": "result.authorization_servers",
"authorization_server_path": "authorization_server",
"authz_server_path": "0",
Expand Down
1 change: 0 additions & 1 deletion wallet/holder_qr_to_well-known.zen
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Given I connect to 'authorization_server' and do get and output into 'authorizat
Given I have a 'string dictionary' named 'credential_issuer_well-known'
Given I have a 'string' in path 'credential_issuer_well-known.result.credential_endpoint'
Given I have a 'string' in path 'credential_issuer_well-known.result.credential_issuer'
Given I have a 'string array' in path 'credential_issuer_well-known.result.credential_configurations_supported'

# authz_server well-known
Given I have a 'string' in path 'authorization_server_well-known.result.token_endpoint'
Expand Down
11 changes: 3 additions & 8 deletions wallet/read_authz_server.zen
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
Rule unknown ignore

Given I have a 'string array' named 'credential_configurations_supported'
Given I have a 'string dictionary' named 'credential_configurations_supported'
Given I have a 'string' named 'credential_configuration_id'
Given I have a 'string' named 'authorization_server'

Foreach 'credential' in 'credential_configurations_supported'
When I pickup from path 'credential.credential_definition.type'
If I verify 'credential_configuration_id' is found in 'type'
When I rename the 'credential' to 'credential_requested'
Endif
When I remove the 'type'
Endforeach
When I create copy of object named by 'credential_configuration_id' from dictionary 'credential_configurations_supported'
and I rename 'copy' to 'credential_requested'

When I copy 'credential_configuration_id' to 'vct'
When I append the string '/.well-known/oauth-authorization-server' to 'authorization_server'
Expand Down

0 comments on commit 3231540

Please sign in to comment.