Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
/example/ios/VclReactNativeExample.xcworkspace

# Android/IJ
#
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath "com.android.tools.build:gradle:7.2.2"
classpath "com.android.tools.build:gradle:8.8.2"
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand Down Expand Up @@ -92,9 +92,9 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

//--------- Must: be added:
implementation "io.velocitycareerlabs:vcl:2.7.3"
implementation 'com.nimbusds:nimbus-jose-jwt:10.0.1'
implementation "androidx.security:security-crypto:1.1.0-alpha07"
implementation "io.velocitycareerlabs:vcl:2.7.5"
implementation 'com.nimbusds:nimbus-jose-jwt:10.3.1'
implementation "androidx.security:security-crypto:1.1.0-beta01"
//-------------------------
}

2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VclReactNative_kotlinVersion=1.9.24
VclReactNative_kotlinVersion=1.9.25
VclReactNative_minSdkVersion=24
VclReactNative_targetSdkVersion=34
VclReactNative_compileSdkVersion=34
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ object Converter {
serviceCredentialAgentIssuersArr.pushMap(serviceCredentialAgentIssuerMap)
}
organizationMap.putArray("serviceCredentialAgentIssuers", serviceCredentialAgentIssuersArr)
organizationMap.putString("did", organization.did)
organizationMap.putMap("payload", organization.payload.toReadableMap())
organizationsWritableArray.pushMap(organizationMap)
}
Expand All @@ -430,14 +431,17 @@ object Converter {
fun mapToCredentialManifestDescriptor(
credentialManifestDescriptorMap: ReadableMap
): VCLCredentialManifestDescriptor? {
credentialManifestDescriptorMap.getMapOpt("deepLink")?.let {
return mapToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorMap)
} ?: credentialManifestDescriptorMap.getMapOpt("service")?.let {
credentialManifestDescriptorMap.getArrayOpt("credentialIds")?.let {
return mapToCredentialManifestDescriptorRefresh(credentialManifestDescriptorMap)
} ?: return mapToCredentialManifestDescriptorByService(credentialManifestDescriptorMap)

val hasDeepLink = credentialManifestDescriptorMap.getMapOpt("deepLink") != null
val hasService = credentialManifestDescriptorMap.getMapOpt("service") != null
val hasCredentialIds = credentialManifestDescriptorMap.getArrayOpt("credentialIds") != null

return when {
hasDeepLink -> mapToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorMap)
hasService && hasCredentialIds -> mapToCredentialManifestDescriptorRefresh(credentialManifestDescriptorMap)
hasService -> mapToCredentialManifestDescriptorByService(credentialManifestDescriptorMap)
else -> null
}
return null
}

fun mapToCredentialManifestDescriptorByDeepLink(
Expand Down Expand Up @@ -478,6 +482,7 @@ object Converter {
credentialManifestDescriptorByServiceMap.getMapOpt("pushDelegate")
),
didJwk = mapToDidJwk(credentialManifestDescriptorByServiceMap.getMapOpt("didJwk")),
did = credentialManifestDescriptorByServiceMap.getStringOpt("did") ?: "",
remoteCryptoServicesToken = mapToToken(
credentialManifestDescriptorByServiceMap.getMapOpt("remoteCryptoServicesToken")
)
Expand All @@ -494,6 +499,7 @@ object Converter {
credentialIds = credentialManifestDescriptorRefreshMap.getArrayOpt("credentialIds")
?.toArrayList()?.toList() as? List<String> ?: listOf(),
didJwk = mapToDidJwk(credentialManifestDescriptorRefreshMap.getMapOpt("didJwk")),
did = credentialManifestDescriptorRefreshMap.getStringOpt("did") ?: "",
remoteCryptoServicesToken = mapToToken(
credentialManifestDescriptorRefreshMap.getMapOpt("remoteCryptoServicesToken")
)
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1498,8 +1498,8 @@ PODS:
- React-perflogger (= 0.75.5)
- React-utils (= 0.75.5)
- SocketRocket (0.7.0)
- VCL (2.7.3)
- velocitycareerlabs-vcl-react-native (2.7.3):
- VCL (2.7.5)
- velocitycareerlabs-vcl-react-native (2.7.5):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1519,7 +1519,7 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- VCL (= 2.7.3)
- VCL (= 2.7.5)
- Yoga
- Yoga (0.0.0)

Expand Down Expand Up @@ -1788,8 +1788,8 @@ SPEC CHECKSUMS:
ReactCodegen: 43d3ebb0cb9c6ffc92a254d31749fd29d69844a2
ReactCommon: ee80ae3d276a9f1daa059169405b97c600dcba45
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
VCL: e98d7108c62081906d3e408e4125085a0fedd039
velocitycareerlabs-vcl-react-native: cae0bae509d79df5ee24891c23d1e835a8c957ce
VCL: b3360eb175c61ad2c978f15cd6e948b6758bd005
velocitycareerlabs-vcl-react-native: e4947e18225aafd02df0de890530983dc3b37583
Yoga: 1dd9dabb9df8fe08f12cd522eae04a2da0e252eb

PODFILE CHECKSUM: dda665d1488c2a02df92eccd852bd6de0cd38761
Expand Down
18 changes: 10 additions & 8 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import vcl, {
type VCLGenerateOffersDescriptor,
type VCLInitializationDescriptor,
type VCLOffers,
type VCLOrganization,
type VCLPresentationRequest,
type VCLPresentationRequestDescriptor,
type VCLPresentationSubmission,
Expand Down Expand Up @@ -252,21 +253,20 @@ export default () => {
'VCL Organizations received:',
JSON.stringify(organizations)
);

const serviceCredentialAgentIssuer: VCLService = {
payload:
organizations.all[0]?.serviceCredentialAgentIssuers[0]?.payload ??
{},
};
await getCredentialManifestByService(serviceCredentialAgentIssuer);
await getCredentialManifestByService(organizations.all[0]!);
} catch (error: any) {
console.log('VCL Organizations search failed: ', JSON.stringify(error));
}
}

const getCredentialManifestByService = async (
serviceCredentialAgentIssuer: VCLService
organization: VCLOrganization
) => {
const serviceCredentialAgentIssuer: VCLService = {
payload:
organization?.serviceCredentialAgentIssuers[0]?.payload ??
{},
};
const credentialManifestDescriptorByOrganization: VCLCredentialManifestDescriptorByService =
{
service: serviceCredentialAgentIssuer,
Expand All @@ -276,6 +276,7 @@ export default () => {
'EducationDegreeRegistrationV1.0',
],
didJwk: didJwkRef.current,
did: organization.did,
};

try {
Expand Down Expand Up @@ -345,6 +346,7 @@ export default () => {
{
service,
credentialIds: Constants.getCredentialIdsToRefresh(environment),
did: 'some did',
didJwk: didJwkRef.current,
};

Expand Down
25 changes: 16 additions & 9 deletions ios/Utils/Converter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ func organizationsToDictionary(
serviceCredentialAgentIssuersArr.append(serviceCredentialAgentIssuerMap)
}
organizationMap["serviceCredentialAgentIssuers"] = serviceCredentialAgentIssuersArr
organizationMap["did"] = organization.did
organizationMap["payload"] = organization.payload
organizationsArr.append(organizationMap)
}
Expand All @@ -393,16 +394,20 @@ func dictionaryToPushDelegate(_ pushDelegateMap: [String: Any]?) -> VCLPushDeleg
func dictionaryToCredentialManifestDescriptor(
_ credentialManifestDescriptorDictionary: [String: Any]
) -> VCLCredentialManifestDescriptor? {
if (credentialManifestDescriptorDictionary["deepLink"] != nil) {
return dictionaryToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorDictionary)
} else if (credentialManifestDescriptorDictionary["service"] != nil) {
if(credentialManifestDescriptorDictionary["credentialIds"] != nil) {
return dictionaryToCredentialManifestDescriptorRefresh(credentialManifestDescriptorDictionary)
} else {
return dictionaryToCredentialManifestDescriptorByService(credentialManifestDescriptorDictionary)
let hasDeepLink = credentialManifestDescriptorDictionary["deepLink"] != nil
let hasService = credentialManifestDescriptorDictionary["service"] != nil
let hasCredentialIds = credentialManifestDescriptorDictionary["credentialIds"] != nil

switch (hasDeepLink, hasService, hasCredentialIds) {
case (true, _, _):
return dictionaryToCredentialManifestDescriptorByDeepLink(credentialManifestDescriptorDictionary)
case (false, true, true):
return dictionaryToCredentialManifestDescriptorRefresh(credentialManifestDescriptorDictionary)
case (false, true, false):
return dictionaryToCredentialManifestDescriptorByService(credentialManifestDescriptorDictionary)
default:
return nil
}
}
return nil
}

func dictionaryToCredentialManifestDescriptorByDeepLink(
Expand Down Expand Up @@ -440,6 +445,7 @@ func dictionaryToCredentialManifestDescriptorByService(
credentialManifestDescriptorByServiceDictionary["pushDelegate"] as? [String: Any]
),
didJwk: dictionaryToDidJwk(credentialManifestDescriptorByServiceDictionary["didJwk"] as? [String: Any]),
did: credentialManifestDescriptorByServiceDictionary["did"] as? String ?? "",
remoteCryptoServicesToken: dictionaryToToken(
credentialManifestDescriptorByServiceDictionary["remoteCryptoServicesToken"] as? [String: Any]
)
Expand All @@ -455,6 +461,7 @@ func dictionaryToCredentialManifestDescriptorRefresh(
),
credentialIds: credentialManifestDescriptorRefreshDictionary["credentialIds"] as? [String] ?? [],
didJwk: dictionaryToDidJwk(credentialManifestDescriptorRefreshDictionary["didJwk"] as? [String: Any]),
did: credentialManifestDescriptorRefreshDictionary["did"] as? String ?? "",
remoteCryptoServicesToken: dictionaryToToken(
credentialManifestDescriptorRefreshDictionary["remoteCryptoServicesToken"] as? [String: Any]
)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@velocitycareerlabs/vcl-react-native",
"version": "2.7.3",
"version": "2.7.5",
"description": "Velocity Career Labs React Native SDK",
"license": "Apache-2.0",
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ import type { VCLService } from './VCLService';
export interface VCLCredentialManifestDescriptorByService
extends VCLCredentialManifestDescriptor {
service: VCLService;
did: string;
}
1 change: 1 addition & 0 deletions src/api/entities/VCLCredentialManifestDescriptorRefresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ import type { VCLService } from './VCLService';
export interface VCLCredentialManifestDescriptorRefresh
extends VCLCredentialManifestDescriptor {
service: VCLService;
did: string;
credentialIds: string[];
}
1 change: 1 addition & 0 deletions src/api/entities/VCLOrganization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ import type { VCLService } from './VCLService';
export interface VCLOrganization {
payload: Dictionary<any>;
serviceCredentialAgentIssuers: VCLService[];
did: string;
}
2 changes: 1 addition & 1 deletion velocitycareerlabs-vcl-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pod::Spec.new do |s|

s.source_files = "ios/**/*.{h,m,mm,swift}"

s.dependency "VCL", "2.7.3"
s.dependency "VCL", "2.7.5"

# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
Expand Down