Skip to content

Commit a1c952b

Browse files
committed
chore: (VL-8777) fix did retrieve v2.7.5
1 parent 7c45298 commit a1c952b

File tree

13 files changed

+56
-37
lines changed

13 files changed

+56
-37
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ DerivedData
2828
*.ipa
2929
*.xcuserstate
3030
project.xcworkspace
31+
/example/ios/VclReactNativeExample.xcworkspace
3132

3233
# Android/IJ
3334
#

android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath "com.android.tools.build:gradle:7.2.2"
11+
classpath "com.android.tools.build:gradle:8.8.2"
1212
// noinspection DifferentKotlinGradleVersion
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
@@ -92,9 +92,9 @@ dependencies {
9292
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
9393

9494
//--------- Must: be added:
95-
implementation "io.velocitycareerlabs:vcl:2.7.3"
96-
implementation 'com.nimbusds:nimbus-jose-jwt:10.0.1'
97-
implementation "androidx.security:security-crypto:1.1.0-alpha07"
95+
implementation "io.velocitycareerlabs:vcl:2.7.5"
96+
implementation 'com.nimbusds:nimbus-jose-jwt:10.3.1'
97+
implementation "androidx.security:security-crypto:1.1.0-beta01"
9898
//-------------------------
9999
}
100100

android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VclReactNative_kotlinVersion=1.9.24
1+
VclReactNative_kotlinVersion=1.9.25
22
VclReactNative_minSdkVersion=24
33
VclReactNative_targetSdkVersion=34
44
VclReactNative_compileSdkVersion=34

android/src/main/java/io/velocitycareerlabs/reactnative/utlis/Converter.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ object Converter {
410410
serviceCredentialAgentIssuersArr.pushMap(serviceCredentialAgentIssuerMap)
411411
}
412412
organizationMap.putArray("serviceCredentialAgentIssuers", serviceCredentialAgentIssuersArr)
413+
organizationMap.putString("did", organization.did)
413414
organizationMap.putMap("payload", organization.payload.toReadableMap())
414415
organizationsWritableArray.pushMap(organizationMap)
415416
}
@@ -430,14 +431,17 @@ object Converter {
430431
fun mapToCredentialManifestDescriptor(
431432
credentialManifestDescriptorMap: ReadableMap
432433
): VCLCredentialManifestDescriptor? {
433-
credentialManifestDescriptorMap.getMapOpt("deepLink")?.let {
434-
return mapToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorMap)
435-
} ?: credentialManifestDescriptorMap.getMapOpt("service")?.let {
436-
credentialManifestDescriptorMap.getArrayOpt("credentialIds")?.let {
437-
return mapToCredentialManifestDescriptorRefresh(credentialManifestDescriptorMap)
438-
} ?: return mapToCredentialManifestDescriptorByService(credentialManifestDescriptorMap)
434+
435+
val hasDeepLink = credentialManifestDescriptorMap.getMapOpt("deepLink") != null
436+
val hasService = credentialManifestDescriptorMap.getMapOpt("service") != null
437+
val hasCredentialIds = credentialManifestDescriptorMap.getArrayOpt("credentialIds") != null
438+
439+
return when {
440+
hasDeepLink -> mapToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorMap)
441+
hasService && hasCredentialIds -> mapToCredentialManifestDescriptorRefresh(credentialManifestDescriptorMap)
442+
hasService -> mapToCredentialManifestDescriptorByService(credentialManifestDescriptorMap)
443+
else -> null
439444
}
440-
return null
441445
}
442446

443447
fun mapToCredentialManifestDescriptorByDeepLink(
@@ -478,6 +482,7 @@ object Converter {
478482
credentialManifestDescriptorByServiceMap.getMapOpt("pushDelegate")
479483
),
480484
didJwk = mapToDidJwk(credentialManifestDescriptorByServiceMap.getMapOpt("didJwk")),
485+
did = credentialManifestDescriptorByServiceMap.getStringOpt("did") ?: "",
481486
remoteCryptoServicesToken = mapToToken(
482487
credentialManifestDescriptorByServiceMap.getMapOpt("remoteCryptoServicesToken")
483488
)
@@ -494,6 +499,7 @@ object Converter {
494499
credentialIds = credentialManifestDescriptorRefreshMap.getArrayOpt("credentialIds")
495500
?.toArrayList()?.toList() as? List<String> ?: listOf(),
496501
didJwk = mapToDidJwk(credentialManifestDescriptorRefreshMap.getMapOpt("didJwk")),
502+
did = credentialManifestDescriptorRefreshMap.getStringOpt("did") ?: "",
497503
remoteCryptoServicesToken = mapToToken(
498504
credentialManifestDescriptorRefreshMap.getMapOpt("remoteCryptoServicesToken")
499505
)

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

example/ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,8 +1498,8 @@ PODS:
14981498
- React-perflogger (= 0.75.5)
14991499
- React-utils (= 0.75.5)
15001500
- SocketRocket (0.7.0)
1501-
- VCL (2.7.3)
1502-
- velocitycareerlabs-vcl-react-native (2.7.3):
1501+
- VCL (2.7.5)
1502+
- velocitycareerlabs-vcl-react-native (2.7.5):
15031503
- DoubleConversion
15041504
- glog
15051505
- hermes-engine
@@ -1519,7 +1519,7 @@ PODS:
15191519
- ReactCodegen
15201520
- ReactCommon/turbomodule/bridging
15211521
- ReactCommon/turbomodule/core
1522-
- VCL (= 2.7.3)
1522+
- VCL (= 2.7.5)
15231523
- Yoga
15241524
- Yoga (0.0.0)
15251525

@@ -1788,8 +1788,8 @@ SPEC CHECKSUMS:
17881788
ReactCodegen: 43d3ebb0cb9c6ffc92a254d31749fd29d69844a2
17891789
ReactCommon: ee80ae3d276a9f1daa059169405b97c600dcba45
17901790
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
1791-
VCL: e98d7108c62081906d3e408e4125085a0fedd039
1792-
velocitycareerlabs-vcl-react-native: cae0bae509d79df5ee24891c23d1e835a8c957ce
1791+
VCL: b3360eb175c61ad2c978f15cd6e948b6758bd005
1792+
velocitycareerlabs-vcl-react-native: e4947e18225aafd02df0de890530983dc3b37583
17931793
Yoga: 1dd9dabb9df8fe08f12cd522eae04a2da0e252eb
17941794

17951795
PODFILE CHECKSUM: dda665d1488c2a02df92eccd852bd6de0cd38761

example/src/App.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import vcl, {
3030
type VCLGenerateOffersDescriptor,
3131
type VCLInitializationDescriptor,
3232
type VCLOffers,
33+
type VCLOrganization,
3334
type VCLPresentationRequest,
3435
type VCLPresentationRequestDescriptor,
3536
type VCLPresentationSubmission,
@@ -252,21 +253,20 @@ export default () => {
252253
'VCL Organizations received:',
253254
JSON.stringify(organizations)
254255
);
255-
256-
const serviceCredentialAgentIssuer: VCLService = {
257-
payload:
258-
organizations.all[0]?.serviceCredentialAgentIssuers[0]?.payload ??
259-
{},
260-
};
261-
await getCredentialManifestByService(serviceCredentialAgentIssuer);
256+
await getCredentialManifestByService(organizations.all[0]!);
262257
} catch (error: any) {
263258
console.log('VCL Organizations search failed: ', JSON.stringify(error));
264259
}
265260
}
266261

267262
const getCredentialManifestByService = async (
268-
serviceCredentialAgentIssuer: VCLService
263+
organization: VCLOrganization
269264
) => {
265+
const serviceCredentialAgentIssuer: VCLService = {
266+
payload:
267+
organization?.serviceCredentialAgentIssuers[0]?.payload ??
268+
{},
269+
};
270270
const credentialManifestDescriptorByOrganization: VCLCredentialManifestDescriptorByService =
271271
{
272272
service: serviceCredentialAgentIssuer,
@@ -276,6 +276,7 @@ export default () => {
276276
'EducationDegreeRegistrationV1.0',
277277
],
278278
didJwk: didJwkRef.current,
279+
did: organization.did,
279280
};
280281

281282
try {
@@ -345,6 +346,7 @@ export default () => {
345346
{
346347
service,
347348
credentialIds: Constants.getCredentialIdsToRefresh(environment),
349+
did: 'some did',
348350
didJwk: didJwkRef.current,
349351
};
350352

ios/Utils/Converter.swift

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ func organizationsToDictionary(
371371
serviceCredentialAgentIssuersArr.append(serviceCredentialAgentIssuerMap)
372372
}
373373
organizationMap["serviceCredentialAgentIssuers"] = serviceCredentialAgentIssuersArr
374+
organizationMap["did"] = organization.did
374375
organizationMap["payload"] = organization.payload
375376
organizationsArr.append(organizationMap)
376377
}
@@ -393,16 +394,20 @@ func dictionaryToPushDelegate(_ pushDelegateMap: [String: Any]?) -> VCLPushDeleg
393394
func dictionaryToCredentialManifestDescriptor(
394395
_ credentialManifestDescriptorDictionary: [String: Any]
395396
) -> VCLCredentialManifestDescriptor? {
396-
if (credentialManifestDescriptorDictionary["deepLink"] != nil) {
397-
return dictionaryToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorDictionary)
398-
} else if (credentialManifestDescriptorDictionary["service"] != nil) {
399-
if(credentialManifestDescriptorDictionary["credentialIds"] != nil) {
400-
return dictionaryToCredentialManifestDescriptorRefresh(credentialManifestDescriptorDictionary)
401-
} else {
402-
return dictionaryToCredentialManifestDescriptorByService(credentialManifestDescriptorDictionary)
397+
let hasDeepLink = credentialManifestDescriptorDictionary["deepLink"] != nil
398+
let hasService = credentialManifestDescriptorDictionary["service"] != nil
399+
let hasCredentialIds = credentialManifestDescriptorDictionary["credentialIds"] != nil
400+
401+
switch (hasDeepLink, hasService, hasCredentialIds) {
402+
case (true, _, _):
403+
return dictionaryToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorDictionary)
404+
case (false, true, true):
405+
return dictionaryToCredentialManifestDescriptorRefresh(credentialManifestDescriptorDictionary)
406+
case (false, true, false):
407+
return dictionaryToCredentialManifestDescriptorByService(credentialManifestDescriptorDictionary)
408+
default:
409+
return nil
403410
}
404-
}
405-
return nil
406411
}
407412

408413
func dictionaryToCredentialManifestDescriptorByDeepLink(
@@ -440,6 +445,7 @@ func dictionaryToCredentialManifestDescriptorByService(
440445
credentialManifestDescriptorByServiceDictionary["pushDelegate"] as? [String: Any]
441446
),
442447
didJwk: dictionaryToDidJwk(credentialManifestDescriptorByServiceDictionary["didJwk"] as? [String: Any]),
448+
did: credentialManifestDescriptorByServiceDictionary["did"] as? String ?? "",
443449
remoteCryptoServicesToken: dictionaryToToken(
444450
credentialManifestDescriptorByServiceDictionary["remoteCryptoServicesToken"] as? [String: Any]
445451
)
@@ -455,6 +461,7 @@ func dictionaryToCredentialManifestDescriptorRefresh(
455461
),
456462
credentialIds: credentialManifestDescriptorRefreshDictionary["credentialIds"] as? [String] ?? [],
457463
didJwk: dictionaryToDidJwk(credentialManifestDescriptorRefreshDictionary["didJwk"] as? [String: Any]),
464+
did: credentialManifestDescriptorRefreshDictionary["did"] as? String ?? "",
458465
remoteCryptoServicesToken: dictionaryToToken(
459466
credentialManifestDescriptorRefreshDictionary["remoteCryptoServicesToken"] as? [String: Any]
460467
)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@velocitycareerlabs/vcl-react-native",
3-
"version": "2.7.3",
3+
"version": "2.7.5",
44
"description": "Velocity Career Labs React Native SDK",
55
"license": "Apache-2.0",
66
"publishConfig": {

src/api/entities/VCLCredentialManifestDescriptorByService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ import type { VCLService } from './VCLService';
1111
export interface VCLCredentialManifestDescriptorByService
1212
extends VCLCredentialManifestDescriptor {
1313
service: VCLService;
14+
did: string;
1415
}

0 commit comments

Comments
 (0)