Skip to content

Commit 957ba54

Browse files
[spec] SD-JWT VC / Renaming "type" to "vct"
1 parent 31ef253 commit 957ba54

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/main/java/com/authlete/jaxrs/server/vc/SdJwtOrderProcessor.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class SdJwtOrderProcessor extends AbstractOrderProcessor
2828
private static final String KEY_CREDENTIAL_DEFINITION = "credential_definition";
2929
private static final String KEY_FORMAT = "format";
3030
private static final String KEY_SUB = "sub";
31-
private static final String KEY_TYPE = "type";
31+
private static final String KEY_VCT = "vct";
3232

3333

3434
@SuppressWarnings("unchecked")
@@ -59,8 +59,8 @@ protected void checkPermissions(
5959
Map<String, Object> credentialDefinition =
6060
extractCredentialDefinition(requestedCredential);
6161

62-
// The "credential_definition" object must contain "type".
63-
String type = extractType(credentialDefinition);
62+
// The "credential_definition" object must contain "vct".
63+
String vct = extractVct(credentialDefinition);
6464

6565
// For each issuable credential.
6666
for (Map<String, Object> issuableCredential : issuableCredentials)
@@ -84,8 +84,8 @@ protected void checkPermissions(
8484
continue;
8585
}
8686

87-
// The "type" in the "credential_definition" object of the issuable credential.
88-
value = ((Map<String, Object>)value).get(KEY_TYPE);
87+
// The "vct" in the "credential_definition" object of the issuable credential.
88+
value = ((Map<String, Object>)value).get(KEY_VCT);
8989

9090
// If the "type" property is not available as a string.
9191
if (!(value instanceof String))
@@ -94,11 +94,11 @@ protected void checkPermissions(
9494
}
9595

9696
// This implementation of the checkPermissions method is simple.
97-
// If "credential_definition.type" of the requested credential
98-
// matches "credential_definition.type" of any of the issuable
97+
// If "credential_definition.vct" of the requested credential
98+
// matches "credential_definition.vct" of any of the issuable
9999
// credentials, it is regarded that the credential request is
100100
// permitted.
101-
if (type.equals(value))
101+
if (vct.equals(value))
102102
{
103103
// The credential request is permitted.
104104
return;
@@ -135,24 +135,24 @@ private Map<String, Object> extractCredentialDefinition(
135135
}
136136

137137

138-
private String extractType(
138+
private String extractVct(
139139
Map<String, Object> credentialDefinition) throws InvalidCredentialRequestException
140140
{
141-
// If the "credential_definition" does not contain "type".
142-
if (!credentialDefinition.containsKey(KEY_TYPE))
141+
// If the "credential_definition" does not contain "vct".
142+
if (!credentialDefinition.containsKey(KEY_VCT))
143143
{
144144
throw new InvalidCredentialRequestException(
145-
"The 'credential_definition' object does not contain 'type'.");
145+
"The 'credential_definition' object does not contain 'vct'.");
146146
}
147147

148-
// The value of the "type" property.
149-
Object value = credentialDefinition.get(KEY_TYPE);
148+
// The value of the "vct" property.
149+
Object value = credentialDefinition.get(KEY_VCT);
150150

151-
// If the value of the "type" property is not a string.
151+
// If the value of the "vct" property is not a string.
152152
if (!(value instanceof String))
153153
{
154154
throw new InvalidCredentialRequestException(
155-
"The value of the 'type' property in the 'credential_definition' object is not a string.");
155+
"The value of the 'vct' property in the 'credential_definition' object is not a string.");
156156
}
157157

158158
return (String)value;
@@ -164,18 +164,18 @@ protected Map<String, Object> collectClaims(
164164
OrderContext context, User user, String format,
165165
Map<String, Object> requestedCredential) throws VerifiableCredentialException
166166
{
167-
// The "credential_definition.type" in the requested credential.
167+
// The "credential_definition.vct" in the requested credential.
168168
@SuppressWarnings("unchecked")
169-
String type = (String)((Map<String, Object>)requestedCredential.get(KEY_CREDENTIAL_DEFINITION)).get(KEY_TYPE);
169+
String vct = (String)((Map<String, Object>)requestedCredential.get(KEY_CREDENTIAL_DEFINITION)).get(KEY_VCT);
170170

171-
// Find a CredentialDefinitionType having the type.
172-
CredentialDefinitionType cdType = CredentialDefinitionType.byId(type);
171+
// Find a CredentialDefinitionType having the vct.
172+
CredentialDefinitionType cdType = CredentialDefinitionType.byId(vct);
173173

174174
if (cdType == null)
175175
{
176176
// The credential type is not supported.
177177
throw new UnsupportedCredentialTypeException(String.format(
178-
"The credential type '%s' is not supported.", type));
178+
"The credential type '%s' is not supported.", vct));
179179
}
180180

181181
// For testing purposes, the credential issuance for a certain user
@@ -190,8 +190,8 @@ protected Map<String, Object> collectClaims(
190190
// Claims.
191191
Map<String, Object> claims = new LinkedHashMap<>();
192192

193-
// "type"
194-
claims.put(KEY_TYPE, type);
193+
// "vct"
194+
claims.put(KEY_VCT, vct);
195195

196196
// "sub"
197197
claims.put(KEY_SUB, user.getSubject());

0 commit comments

Comments
 (0)