@velocitycareerlabs/vcl-react-native 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -131,5 +131,5 @@ dependencies {
131
131
 
132
132
  // VCL:
133
133
  implementation "com.nimbusds:nimbus-jose-jwt:9.29"
134
- implementation "io.velocitycareerlabs:vcl:1.5.1"
134
+ implementation "io.velocitycareerlabs:vcl:1.5.2"
135
135
  }
@@ -135,7 +135,10 @@ object Converter {
135
135
  fun mapTopPresentationRequestDescriptor(presentationRequestDescriptorLinkMap: ReadableMap) =
136
136
  VCLPresentationRequestDescriptor(
137
137
  deepLink = mapToDeepLink(presentationRequestDescriptorLinkMap.getMapOpt("deepLink")),
138
- serviceType = mapToServiceType(presentationRequestDescriptorLinkMap),
138
+ serviceType = mapToServiceType(
139
+ presentationRequestDescriptorLinkMap,
140
+ VCLServiceType.Inspector
141
+ ),
139
142
  pushDelegate = mapToPushDelegate(presentationRequestDescriptorLinkMap.getMapOpt("pushDelegate"))
140
143
  )
141
144
 
@@ -148,8 +151,13 @@ object Converter {
148
151
  return retVal
149
152
  }
150
153
 
151
- fun mapToServiceType(serviceTypeMap: ReadableMap) =
152
- VCLServiceType.fromString(serviceTypeMap.getStringOpt("serviceType") ?: "")
154
+ fun mapToServiceType(
155
+ serviceTypeMap: ReadableMap,
156
+ defaultServiceType: VCLServiceType
157
+ ) =
158
+ serviceTypeMap.getStringOpt("serviceType")?.let { serviceType ->
159
+ VCLServiceType.fromString(serviceType)
160
+ } ?: defaultServiceType
153
161
 
154
162
  fun mapToToken(tokenMap: ReadableMap?) =
155
163
  VCLToken(tokenMap?.getStringOpt("value") ?: "")
@@ -382,7 +390,10 @@ object Converter {
382
390
  ): VCLCredentialManifestDescriptorByDeepLink {
383
391
  return VCLCredentialManifestDescriptorByDeepLink(
384
392
  mapToDeepLink(credentialManifestDescriptorByDeepLinkMap.getMapOpt("deepLink")),
385
- mapToServiceType(credentialManifestDescriptorByDeepLinkMap)
393
+ mapToServiceType(
394
+ credentialManifestDescriptorByDeepLinkMap,
395
+ VCLServiceType.Issuer
396
+ )
386
397
  )
387
398
  }
388
399
 
@@ -395,7 +406,10 @@ object Converter {
395
406
  service = mapToServiceCredentialAgentIssuer(
396
407
  credentialManifestDescriptorByServiceMap.getMapOpt("service")
397
408
  ),
398
- serviceType = mapToServiceType(credentialManifestDescriptorByServiceMap),
409
+ serviceType = mapToServiceType(
410
+ credentialManifestDescriptorByServiceMap,
411
+ VCLServiceType.Issuer
412
+ ),
399
413
  credentialTypes =
400
414
  (credentialManifestDescriptorByServiceMap.getArrayOpt("credentialTypes")?.toArrayList()
401
415
  ?.toList() as? List<String>),
@@ -410,7 +424,10 @@ object Converter {
410
424
  service = mapToServiceCredentialAgentIssuer(
411
425
  credentialManifestDescriptorRefreshMap.getMapOpt("service")
412
426
  ),
413
- serviceType = mapToServiceType(credentialManifestDescriptorRefreshMap),
427
+ serviceType = mapToServiceType(
428
+ credentialManifestDescriptorRefreshMap,
429
+ VCLServiceType.Issuer
430
+ ),
414
431
  credentialIds = credentialManifestDescriptorRefreshMap.getArrayOpt("credentialIds")
415
432
  ?.toArrayList()?.toList() as? List<String> ?: listOf()
416
433
  )
@@ -133,7 +133,10 @@ func dictionaryTopPresentationRequestDescriptor(
133
133
  ) -> VCLPresentationRequestDescriptor {
134
134
  return VCLPresentationRequestDescriptor(
135
135
  deepLink: dictionaryToDeepLink(presentationRequestDescriptorLinkDictionary["deepLink"] as? [String: Any]),
136
- serviceType: dictionaryToServiceType(serviceTypeDictionary: presentationRequestDescriptorLinkDictionary),
136
+ serviceType: dictionaryToServiceType(
137
+ serviceTypeDictionary: presentationRequestDescriptorLinkDictionary,
138
+ defaultServiceType: VCLServiceType.Inspector
139
+ ),
137
140
  pushDelegate: dictionaryToPushDelegate(presentationRequestDescriptorLinkDictionary["pushDelegate"] as? [String: Any])
138
141
  )
139
142
  }
@@ -154,8 +157,14 @@ func tokenToDictionary(_ token: VCLToken) -> [String: Any] {
154
157
  return ["value": token.value]
155
158
  }
156
159
 
157
- func dictionaryToServiceType(serviceTypeDictionary: [String: Any]) -> VCLServiceType {
158
- return VCLServiceType.fromString(value: serviceTypeDictionary["serviceType"] as? String ?? "")
160
+ func dictionaryToServiceType(
161
+ serviceTypeDictionary: [String: Any],
162
+ defaultServiceType: VCLServiceType
163
+ ) -> VCLServiceType {
164
+ if let serviceType = serviceTypeDictionary["serviceType"] as? String {
165
+ return VCLServiceType.fromString(value: serviceType)
166
+ }
167
+ return defaultServiceType
159
168
  }
160
169
 
161
170
  func dictionaryToPresentationRequest(
@@ -355,7 +364,10 @@ func dictionaryToCredentialManifestDescriptorByDeepLink(
355
364
  deepLink: dictionaryToDeepLink(
356
365
  credentialManifestDescriptorByDeepLinkDictionary["deepLink"] as? [String : Any]
357
366
  ),
358
- serviceType: dictionaryToServiceType(serviceTypeDictionary: credentialManifestDescriptorByDeepLinkDictionary)
367
+ serviceType: dictionaryToServiceType(
368
+ serviceTypeDictionary: credentialManifestDescriptorByDeepLinkDictionary,
369
+ defaultServiceType: VCLServiceType.Issuer
370
+ )
359
371
  )
360
372
  }
361
373
 
@@ -368,7 +380,10 @@ func dictionaryToCredentialManifestDescriptorByService(
368
380
  service: dictionaryToServiceCredentialAgentIssuer(
369
381
  credentialManifestDescriptorByServiceDictionary["service"] as? [String : Any]
370
382
  ),
371
- serviceType: dictionaryToServiceType(serviceTypeDictionary: credentialManifestDescriptorByServiceDictionary),
383
+ serviceType: dictionaryToServiceType(
384
+ serviceTypeDictionary: credentialManifestDescriptorByServiceDictionary,
385
+ defaultServiceType: VCLServiceType.Issuer
386
+ ),
372
387
  credentialTypes: credentialManifestDescriptorByServiceDictionary["credentialTypes"] as? [String],
373
388
  pushDelegate: pushDelegate
374
389
  )
@@ -381,7 +396,10 @@ func dictionaryToCredentialManifestDescriptorRefresh(
381
396
  service: dictionaryToServiceCredentialAgentIssuer(
382
397
  credentialManifestDescriptorRefreshDictionary["service"] as? [String : Any]
383
398
  ),
384
- serviceType: dictionaryToServiceType(serviceTypeDictionary: credentialManifestDescriptorRefreshDictionary),
399
+ serviceType: dictionaryToServiceType(
400
+ serviceTypeDictionary: credentialManifestDescriptorRefreshDictionary,
401
+ defaultServiceType: VCLServiceType.Issuer
402
+ ),
385
403
  credentialIds: credentialManifestDescriptorRefreshDictionary["credentialIds"] as? [String] ?? [String]()
386
404
  )
387
405
  }
@@ -7,7 +7,7 @@
7
7
  import type { VCLPushDelegate } from './VCLPushDelegate';
8
8
  import type { VCLServiceType } from './VCLServiceType';
9
9
  export interface VCLCredentialManifestDescriptor {
10
- serviceType: VCLServiceType;
10
+ serviceType?: VCLServiceType;
11
11
  credentialTypes?: string[];
12
12
  pushDelegate?: VCLPushDelegate;
13
13
  }
@@ -9,6 +9,6 @@ import type { VCLPushDelegate } from './VCLPushDelegate';
9
9
  import type { VCLServiceType } from './VCLServiceType';
10
10
  export interface VCLPresentationRequestDescriptor {
11
11
  deepLink: VCLDeepLink;
12
- serviceType: VCLServiceType;
12
+ serviceType?: VCLServiceType;
13
13
  pushDelegate?: VCLPushDelegate;
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velocitycareerlabs/vcl-react-native",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Velocity Career Labs React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -9,7 +9,7 @@ import type { VCLPushDelegate } from './VCLPushDelegate';
9
9
  import type { VCLServiceType } from './VCLServiceType';
10
10
 
11
11
  export interface VCLCredentialManifestDescriptor {
12
- serviceType: VCLServiceType;
12
+ serviceType?: VCLServiceType;
13
13
  credentialTypes?: string[];
14
14
  pushDelegate?: VCLPushDelegate;
15
15
  }
@@ -11,6 +11,6 @@ import type { VCLServiceType } from './VCLServiceType';
11
11
 
12
12
  export interface VCLPresentationRequestDescriptor {
13
13
  deepLink: VCLDeepLink;
14
- serviceType: VCLServiceType;
14
+ serviceType?: VCLServiceType;
15
15
  pushDelegate?: VCLPushDelegate;
16
16
  }
@@ -18,5 +18,5 @@ Pod::Spec.new do |s|
18
18
  s.swift_version = "5.0"
19
19
 
20
20
  s.dependency "React"
21
- s.dependency "VCL", "1.5.1"
21
+ s.dependency "VCL", "1.5.2"
22
22
  end