File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/Controllers/VerifiableCredentials Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -257,11 +257,17 @@ public function credential(Request $request): Response
257257 continue ;
258258 }
259259
260+ // Normalize to string for single array values.
261+ $ attributeValue = is_array ($ userAttributes [$ userAttributeName ]) &&
262+ count ($ userAttributes [$ userAttributeName ]) === 1 ?
263+ reset ($ userAttributes [$ userAttributeName ]) :
264+ $ userAttributes [$ userAttributeName ];
265+
260266 if ($ credentialFormatId === CredentialFormatIdentifiersEnum::JwtVcJson->value ) {
261- $ this ->setCredentialClaimValue (
267+ $ this ->verifiableCredentials -> helpers ()-> arr ()-> setNestedValue (
262268 $ credentialSubject ,
263- $ credentialClaimPath ,
264- $ userAttributes [ $ userAttributeName ] ,
269+ $ attributeValue ,
270+ ... $ credentialClaimPath ,
265271 );
266272 }
267273
@@ -280,7 +286,7 @@ public function credential(Request $request): Response
280286 }
281287
282288 $ disclosure = $ this ->verifiableCredentials ->disclosureFactory ()->build (
283- value: $ userAttributes [ $ userAttributeName ] ,
289+ value: $ attributeValue ,
284290 name: $ claimName ,
285291 path: is_array ($ credentialClaimPath ) ? $ credentialClaimPath : [],
286292 saltBlacklist: $ disclosureBag ->salts (),
You can’t perform that action at this time.
0 commit comments