Description
On the server side we already have CredentialScopeModel which is a wrapper for ClientScopeModel
The client side, especially in test setup would benefit from CredentialScopeRepresentation as a wrapper for ClientScopeRepresentation
This is important because ...
- many properties are accessed in a generic way via string attributes
- some attributes are comma separated values that must be parsed on every access
Value Proposition
Code like this can be greatly simplified
ClientScopeRepresentation clientScope = new ClientScopeRepresentation();
clientScope.setName(scopeName);
clientScope.setProtocol(OID4VCIConstants.OID4VC_PROTOCOL);
Map<String, String> attributes =
new HashMap<>(Map.of(ClientScopeModel.INCLUDE_IN_TOKEN_SCOPE, "true",
CredentialScopeModel.EXPIRY_IN_SECONDS, "15"));
BiConsumer<String, String> addAttribute = (attributeName, value) -> {
if (value != null) {
attributes.put(attributeName, value);
}
};
addAttribute.accept(CredentialScopeModel.ISSUER_DID, issuerDid);
addAttribute.accept(CredentialScopeModel.CONFIGURATION_ID, credentialConfigurationId);
addAttribute.accept(CredentialScopeModel.CREDENTIAL_IDENTIFIER, credentialIdentifier);
addAttribute.accept(CredentialScopeModel.FORMAT, format);
addAttribute.accept(CredentialScopeModel.VCT, Optional.ofNullable(vct).orElse(credentialIdentifier));
if (credentialConfigurationId != null) {
String vcDisplay;
try {
vcDisplay = JsonSerialization.writeValueAsString(List.of(new DisplayObject().setName(credentialConfigurationId)
.setLocale("en-EN"),
new DisplayObject().setName(credentialConfigurationId)
.setLocale("de-DE")));
} catch (IOException e) {
throw new RuntimeException(e);
}
addAttribute.accept(CredentialScopeModel.VC_DISPLAY, vcDisplay);
}
if (acceptedKeyAttestationValues != null) {
attributes.put(CredentialScopeModel.KEY_ATTESTATION_REQUIRED, "true");
if (!acceptedKeyAttestationValues.isEmpty()) {
attributes.put(CredentialScopeModel.KEY_ATTESTATION_REQUIRED_KEY_STORAGE,
String.join(",", acceptedKeyAttestationValues));
attributes.put(CredentialScopeModel.KEY_ATTESTATION_REQUIRED_USER_AUTH,
String.join(",", acceptedKeyAttestationValues));
}
}
clientScope.setAttributes(attributes);
List<ProtocolMapperRepresentation> protocolMappers;
if (protocolMapperReferenceFile == null) {
protocolMappers = getProtocolMappers(scopeName);
} else {
protocolMappers = resolveProtocolMappers(protocolMapperReferenceFile);
protocolMappers.add(getStaticClaimMapper(scopeName));
}
clientScope.setProtocolMappers(protocolMappers);
Goals
Improve (client side) handling of ClientScopeRepresentations that represent credential definitions
Non-Goals
--
Discussion
No response
Notes
No response
Description
On the server side we already have CredentialScopeModel which is a wrapper for
ClientScopeModelThe client side, especially in test setup would benefit from
CredentialScopeRepresentationas a wrapper forClientScopeRepresentationThis is important because ...
Value Proposition
Code like this can be greatly simplified
Goals
Improve (client side) handling of
ClientScopeRepresentationsthat represent credential definitionsNon-Goals
--
Discussion
No response
Notes
No response