Skip to content

Commit 819bc62

Browse files
committed
WIP
1 parent ba04a70 commit 819bc62

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Controllers/VerifiableCredentials/CredentialIssuerCredentialController.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff 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(),

0 commit comments

Comments
 (0)