@velocitycareerlabs/vcl-react-native 2.5.4 → 2.5.6

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.
@@ -92,7 +92,7 @@ dependencies {
92
92
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
93
93
 
94
94
  //--------- Must: be added:
95
- implementation "io.velocitycareerlabs:vcl:2.5.4"
95
+ implementation "io.velocitycareerlabs:vcl:2.5.5"
96
96
  implementation 'com.nimbusds:nimbus-jose-jwt:9.40'
97
97
  implementation "androidx.security:security-crypto:1.1.0-alpha06"
98
98
  //-------------------------
@@ -22,6 +22,7 @@ fun Map<String, Any>.toWritableMap(): WritableMap {
22
22
  when (value) {
23
23
  is Boolean -> writableMap.putBoolean(key, value)
24
24
  is Double -> writableMap.putDouble(key, value)
25
+ is Long -> writableMap.putDouble(key, value.toDouble())
25
26
  is Int -> writableMap.putInt(key, value)
26
27
  is String -> writableMap.putString(key, value)
27
28
  is WritableMap -> writableMap.putMap(key, value)
@@ -631,9 +631,6 @@ object Converter {
631
631
  return credentialTypesFormSchemaMap
632
632
  }
633
633
 
634
- fun mapToJwt(jwtMap: ReadableMap?) =
635
- VCLJwt(encodedJwt = jwtMap?.getStringOpt("encodedJwt") ?: "")
636
-
637
634
  fun mapToPublicJwk(publicJwkMap: ReadableMap?) =
638
635
  VCLPublicJwk(valueStr = publicJwkMap?.getStringOpt("valueStr") ?: "")
639
636
 
@@ -674,9 +671,15 @@ object Converter {
674
671
  fun jwtToMap(jwt: VCLJwt): ReadableMap {
675
672
  val jwtReadableMap = Arguments.createMap()
676
673
  jwtReadableMap.putString("encodedJwt", jwt.encodedJwt)
674
+ jwtReadableMap.putMap("header", jwt.header?.toJSONObject()?.toReadableMap())
675
+ jwtReadableMap.putMap("payload", jwt.payload?.toJSONObject()?.toReadableMap())
676
+ jwtReadableMap.putString("signature", jwt.signature?.toString())
677
677
  return jwtReadableMap
678
678
  }
679
679
 
680
+ fun mapToJwt(jwtMap: ReadableMap?) =
681
+ VCLJwt(encodedJwt = jwtMap?.getStringOpt("encodedJwt") ?: "")
682
+
680
683
  fun mapToCredentialTypesUIFormSchemaDescriptor(
681
684
  credentialTypesUIFormSchemaDescriptorMap: ReadableMap
682
685
  ) = VCLCredentialTypesUIFormSchemaDescriptor(
@@ -575,6 +575,15 @@ func dictionaryToJwt(
575
575
  return VCLJwt(encodedJwt: jwtDictionary?["encodedJwt"] as? String ?? "")
576
576
  }
577
577
 
578
+ func jwtToDictionary(_ jwt: VCLJwt) -> [String: Any?] {
579
+ return [
580
+ "encodedJwt": jwt.encodedJwt,
581
+ "header": jwt.header,
582
+ "payload": jwt.payload,
583
+ "signature": jwt.signature
584
+ ]
585
+ }
586
+
578
587
  func dictionaryToPublicJwk(
579
588
  _ publicJwkDictionary: [String: Any]?
580
589
  ) -> VCLPublicJwk {
@@ -613,10 +622,6 @@ func jwtVerifiableCredentialsToDictionary(
613
622
  return jwtVerifiableCredentialsDictionary
614
623
  }
615
624
 
616
- func jwtToReadableMap(_ jwt: VCLJwt) -> [String: Any] {
617
- return ["encodedJwt": jwt.encodedJwt]
618
- }
619
-
620
625
  func readableMapToCredentialTypesUIFormSchemaDescriptor(
621
626
  _ credentialTypesUIFormSchemaDescriptorDictionary: [String: Any]
622
627
  ) -> VCLCredentialTypesUIFormSchemaDescriptor {
@@ -266,7 +266,7 @@ class VclReactNative: NSObject {
266
266
  didJwk: dictionaryToDidJwk(didJwkDictionary),
267
267
  remoteCryptoServicesToken: dictionaryToToken(remoteCryptoServicesTokenDictionary),
268
268
  successHandler: {
269
- resolve(jwtToReadableMap($0))
269
+ resolve(jwtToDictionary($0))
270
270
  },
271
271
  errorHandler: {
272
272
  reject(nil, $0.toDictionary().toJsonString(), $0)
@@ -1,2 +1,6 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
2
6
  //# sourceMappingURL=VCLJwt.js.map
@@ -19,6 +19,7 @@ class VCLError extends Error {
19
19
  this.payload = errorJson.payload;
20
20
  this.error = errorJson.error;
21
21
  this.errorCode = errorJson.errorCode;
22
+ this.requestId = errorJson.requestId;
22
23
  this.message = errorJson.message;
23
24
  this.statusCode = parseInt(errorJson.statusCode, 10);
24
25
  } catch (e) {
@@ -1 +1 @@
1
- {"version":3,"names":["VCLError","Error","constructor","error","errorJson","JSON","parse","message","payload","errorCode","statusCode","parseInt","e","stringify","exports"],"sourceRoot":"../../../../../src","sources":["api/entities/error/VCLError.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,QAAQ,SAASC,KAAK,CAAC;EAMlCC,WAAWA,CAACC,KAAU,EAAE;IACtB,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI;MACF,MAAMC,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACH,KAAK,CAACI,OAAO,CAAC;MAC3C,IAAI,CAACC,OAAO,GAAGJ,SAAS,CAACI,OAAO;MAChC,IAAI,CAACL,KAAK,GAAGC,SAAS,CAACD,KAAK;MAC5B,IAAI,CAACM,SAAS,GAAGL,SAAS,CAACK,SAAS;MACpC,IAAI,CAACF,OAAO,GAAGH,SAAS,CAACG,OAAO;MAChC,IAAI,CAACG,UAAU,GAAGC,QAAQ,CAACP,SAAS,CAACM,UAAU,EAAE,EAAE,CAAC;IACtD,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV,IAAI,CAACL,OAAO,GAAGF,IAAI,CAACQ,SAAS,CAACV,KAAK,CAAC;IACtC;EACF;AACF;AAACW,OAAA,CAAAd,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["VCLError","Error","constructor","error","errorJson","JSON","parse","message","payload","errorCode","requestId","statusCode","parseInt","e","stringify","exports"],"sourceRoot":"../../../../../src","sources":["api/entities/error/VCLError.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,QAAQ,SAASC,KAAK,CAAC;EAOlCC,WAAWA,CAACC,KAAU,EAAE;IACtB,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI;MACF,MAAMC,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACH,KAAK,CAACI,OAAO,CAAC;MAC3C,IAAI,CAACC,OAAO,GAAGJ,SAAS,CAACI,OAAO;MAChC,IAAI,CAACL,KAAK,GAAGC,SAAS,CAACD,KAAK;MAC5B,IAAI,CAACM,SAAS,GAAGL,SAAS,CAACK,SAAS;MACpC,IAAI,CAACC,SAAS,GAAGN,SAAS,CAACM,SAAS;MACpC,IAAI,CAACH,OAAO,GAAGH,SAAS,CAACG,OAAO;MAChC,IAAI,CAACI,UAAU,GAAGC,QAAQ,CAACR,SAAS,CAACO,UAAU,EAAE,EAAE,CAAC;IACtD,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV,IAAI,CAACN,OAAO,GAAGF,IAAI,CAACS,SAAS,CAACX,KAAK,CAAC;IACtC;EACF;AACF;AAACY,OAAA,CAAAf,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
-
1
+ export {};
2
2
  //# sourceMappingURL=VCLJwt.js.map
@@ -13,6 +13,7 @@ export class VCLError extends Error {
13
13
  this.payload = errorJson.payload;
14
14
  this.error = errorJson.error;
15
15
  this.errorCode = errorJson.errorCode;
16
+ this.requestId = errorJson.requestId;
16
17
  this.message = errorJson.message;
17
18
  this.statusCode = parseInt(errorJson.statusCode, 10);
18
19
  } catch (e) {
@@ -1 +1 @@
1
- {"version":3,"names":["VCLError","Error","constructor","error","errorJson","JSON","parse","message","payload","errorCode","statusCode","parseInt","e","stringify"],"sourceRoot":"../../../../../src","sources":["api/entities/error/VCLError.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,QAAQ,SAASC,KAAK,CAAC;EAMlCC,WAAWA,CAACC,KAAU,EAAE;IACtB,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI;MACF,MAAMC,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACH,KAAK,CAACI,OAAO,CAAC;MAC3C,IAAI,CAACC,OAAO,GAAGJ,SAAS,CAACI,OAAO;MAChC,IAAI,CAACL,KAAK,GAAGC,SAAS,CAACD,KAAK;MAC5B,IAAI,CAACM,SAAS,GAAGL,SAAS,CAACK,SAAS;MACpC,IAAI,CAACF,OAAO,GAAGH,SAAS,CAACG,OAAO;MAChC,IAAI,CAACG,UAAU,GAAGC,QAAQ,CAACP,SAAS,CAACM,UAAU,EAAE,EAAE,CAAC;IACtD,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV,IAAI,CAACL,OAAO,GAAGF,IAAI,CAACQ,SAAS,CAACV,KAAK,CAAC;IACtC;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["VCLError","Error","constructor","error","errorJson","JSON","parse","message","payload","errorCode","requestId","statusCode","parseInt","e","stringify"],"sourceRoot":"../../../../../src","sources":["api/entities/error/VCLError.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,QAAQ,SAASC,KAAK,CAAC;EAOlCC,WAAWA,CAACC,KAAU,EAAE;IACtB,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI;MACF,MAAMC,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACH,KAAK,CAACI,OAAO,CAAC;MAC3C,IAAI,CAACC,OAAO,GAAGJ,SAAS,CAACI,OAAO;MAChC,IAAI,CAACL,KAAK,GAAGC,SAAS,CAACD,KAAK;MAC5B,IAAI,CAACM,SAAS,GAAGL,SAAS,CAACK,SAAS;MACpC,IAAI,CAACC,SAAS,GAAGN,SAAS,CAACM,SAAS;MACpC,IAAI,CAACH,OAAO,GAAGH,SAAS,CAACG,OAAO;MAChC,IAAI,CAACI,UAAU,GAAGC,QAAQ,CAACR,SAAS,CAACO,UAAU,EAAE,EAAE,CAAC;IACtD,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV,IAAI,CAACN,OAAO,GAAGF,IAAI,CAACS,SAAS,CAACX,KAAK,CAAC;IACtC;EACF;AACF","ignoreList":[]}
@@ -4,7 +4,11 @@
4
4
  * Copyright 2022 Velocity Career Labs inc.
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
+ import type { Dictionary } from '@velocitycareerlabs/vcl-react-native';
7
8
  export interface VCLJwt {
8
9
  encodedJwt: string;
10
+ header?: Dictionary<any>;
11
+ payload?: Dictionary<any>;
12
+ signature?: string;
9
13
  }
10
14
  //# sourceMappingURL=VCLJwt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VCLJwt.d.ts","sourceRoot":"","sources":["../../../../../src/api/entities/VCLJwt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"VCLJwt.d.ts","sourceRoot":"","sources":["../../../../../src/api/entities/VCLJwt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAEvE,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IACzB,OAAO,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
@@ -8,6 +8,7 @@ export declare class VCLError extends Error {
8
8
  payload?: string;
9
9
  error?: string;
10
10
  errorCode?: string;
11
+ requestId?: string;
11
12
  statusCode?: number;
12
13
  constructor(error: any);
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"VCLError.d.ts","sourceRoot":"","sources":["../../../../../../src/api/entities/error/VCLError.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qBAAa,QAAS,SAAQ,KAAK;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAER,KAAK,EAAE,GAAG;CAavB"}
1
+ {"version":3,"file":"VCLError.d.ts","sourceRoot":"","sources":["../../../../../../src/api/entities/error/VCLError.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qBAAa,QAAS,SAAQ,KAAK;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAER,KAAK,EAAE,GAAG;CAcvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velocitycareerlabs/vcl-react-native",
3
- "version": "2.5.4",
3
+ "version": "2.5.6",
4
4
  "description": "Velocity Career Labs React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -4,7 +4,11 @@
4
4
  * Copyright 2022 Velocity Career Labs inc.
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
+ import type { Dictionary } from '@velocitycareerlabs/vcl-react-native';
7
8
 
8
9
  export interface VCLJwt {
9
10
  encodedJwt: string; // 3 base64Url strings splitted by a dot
11
+ header?: Dictionary<any>,
12
+ payload?: Dictionary<any>,
13
+ signature?: string
10
14
  }
@@ -9,6 +9,7 @@ export class VCLError extends Error {
9
9
  payload?: string;
10
10
  error?: string;
11
11
  errorCode?: string;
12
+ requestId?: string;
12
13
  statusCode?: number;
13
14
 
14
15
  constructor(error: any) {
@@ -18,6 +19,7 @@ export class VCLError extends Error {
18
19
  this.payload = errorJson.payload;
19
20
  this.error = errorJson.error;
20
21
  this.errorCode = errorJson.errorCode;
22
+ this.requestId = errorJson.requestId;
21
23
  this.message = errorJson.message;
22
24
  this.statusCode = parseInt(errorJson.statusCode, 10);
23
25
  } catch (e) {
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
19
19
  # https://github.com/CocoaPods/CocoaPods/issues/7234#issuecomment-346136322
20
20
  # s.static_framework = true
21
21
 
22
- s.dependency "VCL", "2.5.4"
22
+ s.dependency "VCL", "2.5.5"
23
23
 
24
24
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
25
25
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.