@velocitycareerlabs/vcl-react-native 1.8.0 → 1.9.0

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.
Files changed (44) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/io/velocitycareerlabs/reactnative/VclReactNativeModule.kt +23 -23
  3. package/android/src/main/java/io/velocitycareerlabs/reactnative/extensions/VCLErrorExtensions.kt +2 -6
  4. package/ios/VclReactNative.swift +20 -20
  5. package/lib/commonjs/api/VCLApi.js +18 -18
  6. package/lib/commonjs/api/VCLApi.js.map +1 -1
  7. package/lib/commonjs/api/entities/VCLCredentialManifestDescriptor.js.map +1 -1
  8. package/lib/commonjs/api/entities/VCLError.js +11 -10
  9. package/lib/commonjs/api/entities/VCLError.js.map +1 -1
  10. package/lib/commonjs/api/entities/VCLIssuingType.js +9 -9
  11. package/lib/commonjs/api/entities/VCLIssuingType.js.map +1 -1
  12. package/lib/commonjs/api/entities/VCLPresentationRequestDescriptor.js.map +1 -1
  13. package/lib/commonjs/api/entities/VCLVerifiedProfileDescriptor.js +0 -4
  14. package/lib/commonjs/api/entities/VCLVerifiedProfileDescriptor.js.map +1 -1
  15. package/lib/commonjs/index.js +7 -0
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/module/api/VCLApi.js +18 -18
  18. package/lib/module/api/VCLApi.js.map +1 -1
  19. package/lib/module/api/entities/VCLCredentialManifestDescriptor.js.map +1 -1
  20. package/lib/module/api/entities/VCLError.js +10 -8
  21. package/lib/module/api/entities/VCLError.js.map +1 -1
  22. package/lib/module/api/entities/VCLIssuingType.js +7 -7
  23. package/lib/module/api/entities/VCLIssuingType.js.map +1 -1
  24. package/lib/module/api/entities/VCLPresentationRequestDescriptor.js.map +1 -1
  25. package/lib/module/api/entities/VCLVerifiedProfileDescriptor.js +1 -1
  26. package/lib/module/api/entities/VCLVerifiedProfileDescriptor.js.map +1 -1
  27. package/lib/module/index.js +2 -1
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/typescript/api/entities/VCLCredentialManifestDescriptor.d.ts +2 -2
  30. package/lib/typescript/api/entities/VCLError.d.ts +4 -3
  31. package/lib/typescript/api/entities/VCLIssuingType.d.ts +1 -1
  32. package/lib/typescript/api/entities/VCLPresentationRequestDescriptor.d.ts +0 -2
  33. package/lib/typescript/api/entities/VCLVerifiedProfileDescriptor.d.ts +0 -2
  34. package/lib/typescript/index.d.ts +4 -2
  35. package/package.json +1 -1
  36. package/src/api/VCLApi.ts +18 -18
  37. package/src/api/entities/VCLCredentialManifestDescriptor.ts +2 -2
  38. package/src/api/entities/VCLError.ts +10 -9
  39. package/src/api/entities/VCLIssuingType.ts +1 -1
  40. package/src/api/entities/VCLPresentationRequestDescriptor.ts +0 -2
  41. package/src/api/entities/VCLVerifiedProfileDescriptor.ts +0 -3
  42. package/src/index.tsx +5 -2
  43. package/vcl-react-native.podspec +1 -1
  44. package/ios/Extensions/VCLErrorExtensions.swift +0 -21
package/src/api/VCLApi.ts CHANGED
@@ -31,10 +31,10 @@ import type { VCLSubmissionResult } from './entities/VCLSubmissionResult';
31
31
  import type { VCLPresentationRequestDescriptor } from './entities/VCLPresentationRequestDescriptor';
32
32
  import type { VCLJwtDescriptor } from './entities/VCLJwtDescriptor';
33
33
  import type { VCLDidJwk } from './entities/VCLDidJwk';
34
- import { toVclError } from './entities/VCLError';
35
34
  import type { VCLCredentialTypes } from './entities/VCLCredentialTypes';
36
35
 
37
36
  import { NativeModules } from 'react-native';
37
+ import { VCLError } from './entities/VCLError';
38
38
  const { VclReactNative } = NativeModules;
39
39
 
40
40
  export const VclApi = {
@@ -44,7 +44,7 @@ export const VclApi = {
44
44
  try {
45
45
  return await VclReactNative.initialize(initializationDescriptor);
46
46
  } catch (e) {
47
- throw toVclError(e);
47
+ throw new VCLError(e);
48
48
  }
49
49
  },
50
50
 
@@ -52,7 +52,7 @@ export const VclApi = {
52
52
  try {
53
53
  return await VclReactNative.getCountries();
54
54
  } catch (e) {
55
- throw toVclError(e);
55
+ throw new VCLError(e);
56
56
  }
57
57
  },
58
58
 
@@ -60,7 +60,7 @@ export const VclApi = {
60
60
  try {
61
61
  return await VclReactNative.getCredentialTypes();
62
62
  } catch (e) {
63
- throw toVclError(e);
63
+ throw new VCLError(e);
64
64
  }
65
65
  },
66
66
 
@@ -68,7 +68,7 @@ export const VclApi = {
68
68
  try {
69
69
  return await VclReactNative.getCredentialTypeSchemas();
70
70
  } catch (e) {
71
- throw toVclError(e);
71
+ throw new VCLError(e);
72
72
  }
73
73
  },
74
74
 
@@ -80,7 +80,7 @@ export const VclApi = {
80
80
  presentationRequestDescriptor
81
81
  );
82
82
  } catch (e) {
83
- throw toVclError(e);
83
+ throw new VCLError(e);
84
84
  }
85
85
  },
86
86
 
@@ -90,7 +90,7 @@ export const VclApi = {
90
90
  try {
91
91
  return await VclReactNative.submitPresentation(presentationSubmission);
92
92
  } catch (e) {
93
- throw toVclError(e);
93
+ throw new VCLError(e);
94
94
  }
95
95
  },
96
96
 
@@ -100,7 +100,7 @@ export const VclApi = {
100
100
  try {
101
101
  return await VclReactNative.getExchangeProgress(exchangeDescriptor);
102
102
  } catch (e) {
103
- throw toVclError(e);
103
+ throw new VCLError(e);
104
104
  }
105
105
  },
106
106
 
@@ -112,7 +112,7 @@ export const VclApi = {
112
112
  organizationsSearchDescriptor
113
113
  );
114
114
  } catch (e) {
115
- throw toVclError(e);
115
+ throw new VCLError(e);
116
116
  }
117
117
  },
118
118
 
@@ -124,7 +124,7 @@ export const VclApi = {
124
124
  credentialManifestDescriptor
125
125
  );
126
126
  } catch (e) {
127
- throw toVclError(e);
127
+ throw new VCLError(e);
128
128
  }
129
129
  },
130
130
 
@@ -134,7 +134,7 @@ export const VclApi = {
134
134
  try {
135
135
  return await VclReactNative.generateOffers(generateOffersDescriptor);
136
136
  } catch (e) {
137
- throw toVclError(e);
137
+ throw new VCLError(e);
138
138
  }
139
139
  },
140
140
 
@@ -148,7 +148,7 @@ export const VclApi = {
148
148
  token
149
149
  );
150
150
  } catch (e) {
151
- throw toVclError(e);
151
+ throw new VCLError(e);
152
152
  }
153
153
  },
154
154
 
@@ -162,7 +162,7 @@ export const VclApi = {
162
162
  token
163
163
  );
164
164
  } catch (e) {
165
- throw toVclError(e);
165
+ throw new VCLError(e);
166
166
  }
167
167
  },
168
168
 
@@ -174,7 +174,7 @@ export const VclApi = {
174
174
  credentialTypesUIFormSchemaDescriptor
175
175
  );
176
176
  } catch (e) {
177
- throw toVclError(e);
177
+ throw new VCLError(e);
178
178
  }
179
179
  },
180
180
 
@@ -184,7 +184,7 @@ export const VclApi = {
184
184
  try {
185
185
  return await VclReactNative.getVerifiedProfile(verifiedProfileDescriptor);
186
186
  } catch (e) {
187
- throw toVclError(e);
187
+ throw new VCLError(e);
188
188
  }
189
189
  },
190
190
 
@@ -192,7 +192,7 @@ export const VclApi = {
192
192
  try {
193
193
  return await VclReactNative.verifyJwt(jwt, jwkPublic);
194
194
  } catch (e) {
195
- throw toVclError(e);
195
+ throw new VCLError(e);
196
196
  }
197
197
  },
198
198
 
@@ -202,7 +202,7 @@ export const VclApi = {
202
202
  try {
203
203
  return await VclReactNative.generateSignedJwt(jwtDescriptor);
204
204
  } catch (e) {
205
- throw toVclError(e);
205
+ throw new VCLError(e);
206
206
  }
207
207
  },
208
208
 
@@ -210,7 +210,7 @@ export const VclApi = {
210
210
  try {
211
211
  return await VclReactNative.generateDidJwk();
212
212
  } catch (e) {
213
- throw toVclError(e);
213
+ throw new VCLError(e);
214
214
  }
215
215
  },
216
216
  };
@@ -6,10 +6,10 @@
6
6
  */
7
7
 
8
8
  import type { VCLPushDelegate } from './VCLPushDelegate';
9
- import type { VCLServiceType } from './VCLServiceType';
9
+ import type { VCLIssuingType } from './VCLIssuingType';
10
10
 
11
11
  export interface VCLCredentialManifestDescriptor {
12
- serviceType?: VCLServiceType;
12
+ issuingType?: VCLIssuingType;
13
13
  credentialTypes?: string[];
14
14
  pushDelegate?: VCLPushDelegate;
15
15
  }
@@ -6,21 +6,22 @@
6
6
  */
7
7
 
8
8
  export class VCLError extends Error {
9
- description?: string;
10
- code?: number;
9
+ payload?: string;
10
+ error?: string;
11
+ errorCode?: string;
12
+ statusCode?: number;
11
13
 
12
14
  constructor(error: any) {
13
15
  super(error);
14
16
  try {
15
17
  const errorJson = JSON.parse(error.message);
16
- this.description = errorJson.description;
17
- this.code = parseInt(errorJson.code, 10);
18
+ this.payload = errorJson.payload;
19
+ this.error = errorJson.error;
20
+ this.errorCode = errorJson.errorCode;
21
+ this.message = errorJson.message;
22
+ this.statusCode = parseInt(errorJson.statusCode, 10);
18
23
  } catch (e) {
19
- this.description = JSON.stringify(error);
24
+ this.message = JSON.stringify(error);
20
25
  }
21
26
  }
22
27
  }
23
-
24
- export const toVclError = (error: any) => {
25
- return new VCLError(error);
26
- };
@@ -5,7 +5,7 @@
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
7
 
8
- export enum VCLServiceType {
8
+ export enum VCLIssuingType {
9
9
  Career = 'Career',
10
10
  Identity = 'Identity',
11
11
  Refresh = 'Refresh',
@@ -7,10 +7,8 @@
7
7
 
8
8
  import type { VCLDeepLink } from './VCLDeepLink';
9
9
  import type { VCLPushDelegate } from './VCLPushDelegate';
10
- import type { VCLServiceType } from './VCLServiceType';
11
10
 
12
11
  export interface VCLPresentationRequestDescriptor {
13
12
  deepLink: VCLDeepLink;
14
- serviceType?: VCLServiceType;
15
13
  pushDelegate?: VCLPushDelegate;
16
14
  }
@@ -5,9 +5,6 @@
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
7
 
8
- import type { VCLServiceType } from './VCLServiceType';
9
-
10
8
  export interface VCLVerifiedProfileDescriptor {
11
9
  did: string;
12
- serviceType?: VCLServiceType;
13
10
  }
package/src/index.tsx CHANGED
@@ -44,6 +44,8 @@ import type { VCLPushDelegate } from './api/entities/VCLPushDelegate';
44
44
  import type { VCLService } from './api/entities/VCLService';
45
45
  import type { VCLServiceCredentialAgentIssuer } from './api/entities/VCLServiceCredentialAgentIssuer';
46
46
  import { VCLServiceType } from './api/entities/VCLServiceType';
47
+ import type { VCLServiceTypes } from './api/entities/VCLServiceTypes';
48
+ import { VCLIssuingType } from './api/entities/VCLIssuingType';
47
49
  import type { VCLSubmissionResult } from './api/entities/VCLSubmissionResult';
48
50
  import type { VCLToken } from './api/entities/VCLToken';
49
51
  import type { VCLVerifiableCredential } from './api/entities/VCLVerifiableCredential';
@@ -55,7 +57,7 @@ import type { VCLPresentationRequestDescriptor } from './api/entities/VCLPresent
55
57
  import type { VCLJwtDescriptor } from './api/entities/VCLJwtDescriptor';
56
58
  import type { VCLDidJwk } from './api/entities/VCLDidJwk';
57
59
  import { VCLErrorCode } from './api/entities/VCLErrorCode';
58
- import type { VCLError, toVclError } from './api/entities/VCLError';
60
+ import type { VCLError } from './api/entities/VCLError';
59
61
 
60
62
  export default VclApi;
61
63
  export {
@@ -98,6 +100,8 @@ export {
98
100
  VCLService,
99
101
  VCLServiceCredentialAgentIssuer,
100
102
  VCLServiceType,
103
+ VCLServiceTypes,
104
+ VCLIssuingType,
101
105
  VCLSubmissionResult,
102
106
  VCLToken,
103
107
  VCLVerifiableCredential,
@@ -109,5 +113,4 @@ export {
109
113
  VCLDidJwk,
110
114
  VCLErrorCode,
111
115
  VCLError,
112
- toVclError,
113
116
  };
@@ -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.8.0"
21
+ s.dependency "VCL", "1.9.0"
22
22
  end
@@ -1,21 +0,0 @@
1
- //
2
- // VCLErrorExtensions.swift
3
- // vcl-react-native
4
- //
5
- // Created by Michael Avoyan on 20/12/2022.
6
- //
7
-
8
- import Foundation
9
- import VCL
10
-
11
- extension VCLError {
12
- func toJsonDictionary() -> [String: String] {
13
- var msg = [String: String]()
14
- msg["description"] = self.description
15
- msg["code"] = "\(self.code ?? 0)"
16
- return msg
17
- }
18
- func toJsonString() -> String {
19
- return self.toJsonDictionary().toJsonString() ?? ""
20
- }
21
- }