@velocitycareerlabs/vcl-react-native 1.5.0 → 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.
@@ -130,6 +130,6 @@ dependencies {
130
130
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
131
131
 
132
132
  // VCL:
133
- implementation "com.nimbusds:nimbus-jose-jwt:9.25.6"
134
- implementation "io.velocitycareerlabs:vcl:1.5.0"
133
+ implementation "com.nimbusds:nimbus-jose-jwt:9.29"
134
+ implementation "io.velocitycareerlabs:vcl:1.5.2"
135
135
  }
@@ -135,6 +135,10 @@ object Converter {
135
135
  fun mapTopPresentationRequestDescriptor(presentationRequestDescriptorLinkMap: ReadableMap) =
136
136
  VCLPresentationRequestDescriptor(
137
137
  deepLink = mapToDeepLink(presentationRequestDescriptorLinkMap.getMapOpt("deepLink")),
138
+ serviceType = mapToServiceType(
139
+ presentationRequestDescriptorLinkMap,
140
+ VCLServiceType.Inspector
141
+ ),
138
142
  pushDelegate = mapToPushDelegate(presentationRequestDescriptorLinkMap.getMapOpt("pushDelegate"))
139
143
  )
140
144
 
@@ -147,6 +151,14 @@ object Converter {
147
151
  return retVal
148
152
  }
149
153
 
154
+ fun mapToServiceType(
155
+ serviceTypeMap: ReadableMap,
156
+ defaultServiceType: VCLServiceType
157
+ ) =
158
+ serviceTypeMap.getStringOpt("serviceType")?.let { serviceType ->
159
+ VCLServiceType.fromString(serviceType)
160
+ } ?: defaultServiceType
161
+
150
162
  fun mapToToken(tokenMap: ReadableMap?) =
151
163
  VCLToken(tokenMap?.getStringOpt("value") ?: "")
152
164
 
@@ -377,7 +389,11 @@ object Converter {
377
389
  credentialManifestDescriptorByDeepLinkMap: ReadableMap
378
390
  ): VCLCredentialManifestDescriptorByDeepLink {
379
391
  return VCLCredentialManifestDescriptorByDeepLink(
380
- mapToDeepLink(credentialManifestDescriptorByDeepLinkMap.getMapOpt("deepLink"))
392
+ mapToDeepLink(credentialManifestDescriptorByDeepLinkMap.getMapOpt("deepLink")),
393
+ mapToServiceType(
394
+ credentialManifestDescriptorByDeepLinkMap,
395
+ VCLServiceType.Issuer
396
+ )
381
397
  )
382
398
  }
383
399
 
@@ -390,6 +406,10 @@ object Converter {
390
406
  service = mapToServiceCredentialAgentIssuer(
391
407
  credentialManifestDescriptorByServiceMap.getMapOpt("service")
392
408
  ),
409
+ serviceType = mapToServiceType(
410
+ credentialManifestDescriptorByServiceMap,
411
+ VCLServiceType.Issuer
412
+ ),
393
413
  credentialTypes =
394
414
  (credentialManifestDescriptorByServiceMap.getArrayOpt("credentialTypes")?.toArrayList()
395
415
  ?.toList() as? List<String>),
@@ -404,6 +424,10 @@ object Converter {
404
424
  service = mapToServiceCredentialAgentIssuer(
405
425
  credentialManifestDescriptorRefreshMap.getMapOpt("service")
406
426
  ),
427
+ serviceType = mapToServiceType(
428
+ credentialManifestDescriptorRefreshMap,
429
+ VCLServiceType.Issuer
430
+ ),
407
431
  credentialIds = credentialManifestDescriptorRefreshMap.getArrayOpt("credentialIds")
408
432
  ?.toArrayList()?.toList() as? List<String> ?: listOf()
409
433
  )
@@ -133,6 +133,10 @@ func dictionaryTopPresentationRequestDescriptor(
133
133
  ) -> VCLPresentationRequestDescriptor {
134
134
  return VCLPresentationRequestDescriptor(
135
135
  deepLink: dictionaryToDeepLink(presentationRequestDescriptorLinkDictionary["deepLink"] as? [String: Any]),
136
+ serviceType: dictionaryToServiceType(
137
+ serviceTypeDictionary: presentationRequestDescriptorLinkDictionary,
138
+ defaultServiceType: VCLServiceType.Inspector
139
+ ),
136
140
  pushDelegate: dictionaryToPushDelegate(presentationRequestDescriptorLinkDictionary["pushDelegate"] as? [String: Any])
137
141
  )
138
142
  }
@@ -153,6 +157,16 @@ func tokenToDictionary(_ token: VCLToken) -> [String: Any] {
153
157
  return ["value": token.value]
154
158
  }
155
159
 
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
168
+ }
169
+
156
170
  func dictionaryToPresentationRequest(
157
171
  _ presentationRequestDictionary: [String: Any]?
158
172
  ) -> VCLPresentationRequest {
@@ -349,6 +363,10 @@ func dictionaryToCredentialManifestDescriptorByDeepLink(
349
363
  return VCLCredentialManifestDescriptorByDeepLink(
350
364
  deepLink: dictionaryToDeepLink(
351
365
  credentialManifestDescriptorByDeepLinkDictionary["deepLink"] as? [String : Any]
366
+ ),
367
+ serviceType: dictionaryToServiceType(
368
+ serviceTypeDictionary: credentialManifestDescriptorByDeepLinkDictionary,
369
+ defaultServiceType: VCLServiceType.Issuer
352
370
  )
353
371
  )
354
372
  }
@@ -362,6 +380,10 @@ func dictionaryToCredentialManifestDescriptorByService(
362
380
  service: dictionaryToServiceCredentialAgentIssuer(
363
381
  credentialManifestDescriptorByServiceDictionary["service"] as? [String : Any]
364
382
  ),
383
+ serviceType: dictionaryToServiceType(
384
+ serviceTypeDictionary: credentialManifestDescriptorByServiceDictionary,
385
+ defaultServiceType: VCLServiceType.Issuer
386
+ ),
365
387
  credentialTypes: credentialManifestDescriptorByServiceDictionary["credentialTypes"] as? [String],
366
388
  pushDelegate: pushDelegate
367
389
  )
@@ -374,6 +396,10 @@ func dictionaryToCredentialManifestDescriptorRefresh(
374
396
  service: dictionaryToServiceCredentialAgentIssuer(
375
397
  credentialManifestDescriptorRefreshDictionary["service"] as? [String : Any]
376
398
  ),
399
+ serviceType: dictionaryToServiceType(
400
+ serviceTypeDictionary: credentialManifestDescriptorRefreshDictionary,
401
+ defaultServiceType: VCLServiceType.Issuer
402
+ ),
377
403
  credentialIds: credentialManifestDescriptorRefreshDictionary["credentialIds"] as? [String] ?? [String]()
378
404
  )
379
405
  }
@@ -25,7 +25,9 @@ class VCLError extends Error {
25
25
  const errorJson = JSON.parse(error.message);
26
26
  this.description = errorJson.description;
27
27
  this.code = parseInt(errorJson.code, 10);
28
- } catch (e) {}
28
+ } catch (e) {
29
+ this.description = JSON.stringify(error);
30
+ }
29
31
  }
30
32
 
31
33
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["VCLError.ts"],"names":["VCLError","Error","constructor","error","errorJson","JSON","parse","message","description","code","parseInt","e","toVclError"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAMA,QAAN,SAAuBC,KAAvB,CAA6B;AAIlCC,EAAAA,WAAW,CAACC,KAAD,EAAa;AACtB,UAAMA,KAAN;;AADsB;;AAAA;;AAEtB,QAAI;AACF,YAAMC,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWH,KAAK,CAACI,OAAjB,CAAlB;AACA,WAAKC,WAAL,GAAmBJ,SAAS,CAACI,WAA7B;AACA,WAAKC,IAAL,GAAYC,QAAQ,CAACN,SAAS,CAACK,IAAX,EAAiB,EAAjB,CAApB;AACD,KAJD,CAIE,OAAOE,CAAP,EAAU,CAAE;AACf;;AAXiC;;;;AAc7B,MAAMC,UAAU,GAAIT,KAAD,IAAgB;AACxC,SAAO,IAAIH,QAAJ,CAAaG,KAAb,CAAP;AACD,CAFM","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport class VCLError extends Error {\n description?: string;\n code?: number;\n\n constructor(error: any) {\n super(error);\n try {\n const errorJson = JSON.parse(error.message);\n this.description = errorJson.description;\n this.code = parseInt(errorJson.code, 10);\n } catch (e) {}\n }\n}\n\nexport const toVclError = (error: any) => {\n return new VCLError(error);\n};\n"]}
1
+ {"version":3,"sources":["VCLError.ts"],"names":["VCLError","Error","constructor","error","errorJson","JSON","parse","message","description","code","parseInt","e","stringify","toVclError"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAMA,QAAN,SAAuBC,KAAvB,CAA6B;AAIlCC,EAAAA,WAAW,CAACC,KAAD,EAAa;AACtB,UAAMA,KAAN;;AADsB;;AAAA;;AAEtB,QAAI;AACF,YAAMC,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWH,KAAK,CAACI,OAAjB,CAAlB;AACA,WAAKC,WAAL,GAAmBJ,SAAS,CAACI,WAA7B;AACA,WAAKC,IAAL,GAAYC,QAAQ,CAACN,SAAS,CAACK,IAAX,EAAiB,EAAjB,CAApB;AACD,KAJD,CAIE,OAAOE,CAAP,EAAU;AACV,WAAKH,WAAL,GAAmBH,IAAI,CAACO,SAAL,CAAeT,KAAf,CAAnB;AACD;AACF;;AAbiC;;;;AAgB7B,MAAMU,UAAU,GAAIV,KAAD,IAAgB;AACxC,SAAO,IAAIH,QAAJ,CAAaG,KAAb,CAAP;AACD,CAFM","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport class VCLError extends Error {\n description?: string;\n code?: number;\n\n constructor(error: any) {\n super(error);\n try {\n const errorJson = JSON.parse(error.message);\n this.description = errorJson.description;\n this.code = parseInt(errorJson.code, 10);\n } catch (e) {\n this.description = JSON.stringify(error);\n }\n }\n}\n\nexport const toVclError = (error: any) => {\n return new VCLError(error);\n};\n"]}
@@ -18,7 +18,9 @@ export class VCLError extends Error {
18
18
  const errorJson = JSON.parse(error.message);
19
19
  this.description = errorJson.description;
20
20
  this.code = parseInt(errorJson.code, 10);
21
- } catch (e) {}
21
+ } catch (e) {
22
+ this.description = JSON.stringify(error);
23
+ }
22
24
  }
23
25
 
24
26
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["VCLError.ts"],"names":["VCLError","Error","constructor","error","errorJson","JSON","parse","message","description","code","parseInt","e","toVclError"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,MAAMA,QAAN,SAAuBC,KAAvB,CAA6B;AAIlCC,EAAAA,WAAW,CAACC,KAAD,EAAa;AACtB,UAAMA,KAAN;;AADsB;;AAAA;;AAEtB,QAAI;AACF,YAAMC,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWH,KAAK,CAACI,OAAjB,CAAlB;AACA,WAAKC,WAAL,GAAmBJ,SAAS,CAACI,WAA7B;AACA,WAAKC,IAAL,GAAYC,QAAQ,CAACN,SAAS,CAACK,IAAX,EAAiB,EAAjB,CAApB;AACD,KAJD,CAIE,OAAOE,CAAP,EAAU,CAAE;AACf;;AAXiC;AAcpC,OAAO,MAAMC,UAAU,GAAIT,KAAD,IAAgB;AACxC,SAAO,IAAIH,QAAJ,CAAaG,KAAb,CAAP;AACD,CAFM","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport class VCLError extends Error {\n description?: string;\n code?: number;\n\n constructor(error: any) {\n super(error);\n try {\n const errorJson = JSON.parse(error.message);\n this.description = errorJson.description;\n this.code = parseInt(errorJson.code, 10);\n } catch (e) {}\n }\n}\n\nexport const toVclError = (error: any) => {\n return new VCLError(error);\n};\n"]}
1
+ {"version":3,"sources":["VCLError.ts"],"names":["VCLError","Error","constructor","error","errorJson","JSON","parse","message","description","code","parseInt","e","stringify","toVclError"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,MAAMA,QAAN,SAAuBC,KAAvB,CAA6B;AAIlCC,EAAAA,WAAW,CAACC,KAAD,EAAa;AACtB,UAAMA,KAAN;;AADsB;;AAAA;;AAEtB,QAAI;AACF,YAAMC,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWH,KAAK,CAACI,OAAjB,CAAlB;AACA,WAAKC,WAAL,GAAmBJ,SAAS,CAACI,WAA7B;AACA,WAAKC,IAAL,GAAYC,QAAQ,CAACN,SAAS,CAACK,IAAX,EAAiB,EAAjB,CAApB;AACD,KAJD,CAIE,OAAOE,CAAP,EAAU;AACV,WAAKH,WAAL,GAAmBH,IAAI,CAACO,SAAL,CAAeT,KAAf,CAAnB;AACD;AACF;;AAbiC;AAgBpC,OAAO,MAAMU,UAAU,GAAIV,KAAD,IAAgB;AACxC,SAAO,IAAIH,QAAJ,CAAaG,KAAb,CAAP;AACD,CAFM","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport class VCLError extends Error {\n description?: string;\n code?: number;\n\n constructor(error: any) {\n super(error);\n try {\n const errorJson = JSON.parse(error.message);\n this.description = errorJson.description;\n this.code = parseInt(errorJson.code, 10);\n } catch (e) {\n this.description = JSON.stringify(error);\n }\n }\n}\n\nexport const toVclError = (error: any) => {\n return new VCLError(error);\n};\n"]}
@@ -5,7 +5,9 @@
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
7
  import type { VCLPushDelegate } from './VCLPushDelegate';
8
+ import type { VCLServiceType } from './VCLServiceType';
8
9
  export interface VCLCredentialManifestDescriptor {
10
+ serviceType?: VCLServiceType;
9
11
  credentialTypes?: string[];
10
12
  pushDelegate?: VCLPushDelegate;
11
13
  }
@@ -6,7 +6,9 @@
6
6
  */
7
7
  import type { VCLDeepLink } from './VCLDeepLink';
8
8
  import type { VCLPushDelegate } from './VCLPushDelegate';
9
+ import type { VCLServiceType } from './VCLServiceType';
9
10
  export interface VCLPresentationRequestDescriptor {
10
11
  deepLink: VCLDeepLink;
12
+ serviceType?: VCLServiceType;
11
13
  pushDelegate?: VCLPushDelegate;
12
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velocitycareerlabs/vcl-react-native",
3
- "version": "1.5.0",
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",
@@ -6,8 +6,10 @@
6
6
  */
7
7
 
8
8
  import type { VCLPushDelegate } from './VCLPushDelegate';
9
+ import type { VCLServiceType } from './VCLServiceType';
9
10
 
10
11
  export interface VCLCredentialManifestDescriptor {
12
+ serviceType?: VCLServiceType;
11
13
  credentialTypes?: string[];
12
14
  pushDelegate?: VCLPushDelegate;
13
15
  }
@@ -15,7 +15,9 @@ export class VCLError extends Error {
15
15
  const errorJson = JSON.parse(error.message);
16
16
  this.description = errorJson.description;
17
17
  this.code = parseInt(errorJson.code, 10);
18
- } catch (e) {}
18
+ } catch (e) {
19
+ this.description = JSON.stringify(error);
20
+ }
19
21
  }
20
22
  }
21
23
 
@@ -7,8 +7,10 @@
7
7
 
8
8
  import type { VCLDeepLink } from './VCLDeepLink';
9
9
  import type { VCLPushDelegate } from './VCLPushDelegate';
10
+ import type { VCLServiceType } from './VCLServiceType';
10
11
 
11
12
  export interface VCLPresentationRequestDescriptor {
12
13
  deepLink: VCLDeepLink;
14
+ serviceType?: VCLServiceType;
13
15
  pushDelegate?: VCLPushDelegate;
14
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.0"
21
+ s.dependency "VCL", "1.5.2"
22
22
  end