Skip to content

Commit 6b350ff

Browse files
committed
VCI updates
1 parent be280d6 commit 6b350ff

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed
23.9 KB
Binary file not shown.

app/src/main/java/com/credman/cmwallet/CmWalletApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class CmWalletApplication : Application() {
179179
icon = iconBuffer.toByteArray(),
180180
title = resources.getString(R.string.app_name),
181181
subtitle = "Save your document to CMWallet",
182-
issuerAllowlist = listOf("https://digital-credentials.dev", "http://localhost:8080")
182+
issuerAllowlist = null
183183
)
184184

185185
return data.toRegistryDatabase()

app/src/main/java/com/credman/cmwallet/createcred/CreateCredentialViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class CreateCredentialViewModel : ViewModel() {
208208
require(digitalCredentialCreateRequest.has("protocol")) { "request json missing required field protocol" }
209209
require(digitalCredentialCreateRequest.has("data")) { "request json missing required field data" }
210210

211-
if (setOf("openid4vci1.0", "openid4vci").contains(digitalCredentialCreateRequest.getString("protocol"))) {
211+
if (setOf("openid4vci1.0", "openid4vci", "openid4vci-v1").contains(digitalCredentialCreateRequest.getString("protocol"))) {
212212
openId4VCI =
213213
OpenId4VCI(digitalCredentialCreateRequest.getJSONObject("data").toString())
214214
// Figure out auth server

app/src/main/java/com/credman/cmwallet/data/repository/CredentialRepository.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class CredentialRepository {
119119
val icon: ByteArray, // Entry icon for display
120120
val title: String, // Entry subtitle for display
121121
val subtitle: String?, // Entry subtitle for display
122-
val issuerAllowlist: List<String>,
122+
val issuerAllowlist: List<String>?,
123123
) {
124124
fun toRegistryDatabase(): ByteArray {
125125
val out = ByteArrayOutputStream()
@@ -144,11 +144,13 @@ class CredentialRepository {
144144
} // Hardcoded for now
145145
put(ICON, iconJson)
146146
})
147-
val capabilities = JSONObject()
148-
for (iss in issuerAllowlist) {
149-
capabilities.put(iss, JSONObject())
147+
if (issuerAllowlist != null) {
148+
val capabilities = JSONObject()
149+
for (iss in issuerAllowlist) {
150+
capabilities.put(iss, JSONObject())
151+
}
152+
put("capabilities", capabilities)
150153
}
151-
put("capabilities", capabilities)
152154
}
153155
out.write(json.toString().toByteArray())
154156
return out.toByteArray()

app/src/main/java/com/credman/cmwallet/openid4vci/data/CredentialOfferEndpoint.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,6 @@ data class CredentialOffer(
177177
@SerialName("credential_issuer") val credentialIssuer: String,
178178
@SerialName("credential_configuration_ids") val credentialConfigurationIds: List<String>,
179179
@SerialName("grants") val grants: Grants?,
180-
@SerialName("issuer_metadata") val issuerMetadata: CredentialIssuerMetadata,
180+
@SerialName("credential_issuer_metadata") val issuerMetadata: CredentialIssuerMetadata,
181181
@SerialName("authorization_server_metadata") val authorizationServerMetadata: OauthAuthorizationServer?
182182
)

matcher/issuance/provision.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "launcher_icon.h"
1111

1212
#define PROTOCOL_OPENID4VCI "openid4vci1.0"
13+
#define PROTOCOL_OPENID4VCI_V1 "openid4vci-v1"
1314

1415
cJSON* GetDCRequestJson() {
1516
uint32_t request_size;
@@ -60,13 +61,13 @@ int main() {uint32_t credentials_size;
6061
for(int i=0; i<requests_size; i++) {
6162
cJSON* request = cJSON_GetArrayItem(requests, i);
6263
char* protocol = cJSON_GetStringValue(cJSON_GetObjectItem(request, "protocol"));
63-
if (strcmp(protocol, PROTOCOL_OPENID4VCI) == 0) {
64+
if (strcmp(protocol, PROTOCOL_OPENID4VCI) == 0 || strcmp(protocol, PROTOCOL_OPENID4VCI_V1) == 0) {
6465
// We have an OpenID4VCI request
6566
cJSON* cred_offer = cJSON_GetObjectItem(request, "data");
6667
cJSON* credential_issuer = cJSON_GetObjectItem(cred_offer, "credential_issuer");
6768

6869
cJSON* capabilities = cJSON_GetObjectItem(creds, "capabilities");
69-
if(cJSON_HasObjectItem(capabilities, cJSON_GetStringValue(credential_issuer))) {
70+
if(capabilities == NULL || cJSON_HasObjectItem(capabilities, cJSON_GetStringValue(credential_issuer))) {
7071
cJSON* display = cJSON_GetObjectItem(creds, "display");
7172
cJSON* icon = cJSON_GetObjectItem(display, "icon");
7273
int icon_start_int = 0;

0 commit comments

Comments
 (0)