@velocitycareerlabs/vcl-react-native 1.4.0 → 1.4.1
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.
- package/lib/commonjs/api/VCLApi.js +137 -0
- package/lib/commonjs/api/VCLApi.js.map +1 -1
- package/lib/commonjs/api/entities/VCLError.js +40 -0
- package/lib/commonjs/api/entities/VCLError.js.map +1 -0
- package/lib/commonjs/api/entities/VCLJwt.js +2 -0
- package/lib/commonjs/api/entities/{VCLJWT.js.map → VCLJwt.js.map} +0 -0
- package/lib/commonjs/index.js +10 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/api/VCLApi.js +132 -1
- package/lib/module/api/VCLApi.js.map +1 -1
- package/lib/module/api/entities/VCLError.js +28 -0
- package/lib/module/api/entities/VCLError.js.map +1 -0
- package/lib/module/api/entities/VCLJwt.js +2 -0
- package/lib/module/api/entities/{VCLJWT.js.map → VCLJwt.js.map} +0 -0
- package/lib/module/index.js +4 -6
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/api/VCLApi.d.ts +21 -21
- package/lib/typescript/api/entities/VCLCredentialManifest.d.ts +2 -2
- package/lib/typescript/api/entities/VCLError.d.ts +12 -0
- package/lib/typescript/api/entities/{VCLJWT.d.ts → VCLJwt.d.ts} +1 -1
- package/lib/typescript/api/entities/VCLJwtVerifiableCredentials.d.ts +2 -2
- package/lib/typescript/api/entities/VCLPresentationRequest.d.ts +2 -2
- package/lib/typescript/index.d.ts +7 -6
- package/package.json +1 -1
- package/src/api/VCLApi.ts +170 -46
- package/src/api/entities/VCLCredentialManifest.ts +2 -2
- package/src/api/entities/VCLError.ts +24 -0
- package/src/api/entities/{VCLJWT.ts → VCLJwt.ts} +1 -1
- package/src/api/entities/VCLJwtVerifiableCredentials.ts +2 -2
- package/src/api/entities/VCLPresentationRequest.ts +2 -2
- package/src/index.tsx +10 -8
- package/lib/commonjs/api/entities/VCLJWT.js +0 -2
- package/lib/module/api/entities/VCLJWT.js +0 -2
|
@@ -3,4 +3,141 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.VclApi = void 0;
|
|
7
|
+
|
|
8
|
+
var _VCLError = require("./entities/VCLError");
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Created by Michael Avoyan.
|
|
14
|
+
*
|
|
15
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
16
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
*/
|
|
18
|
+
const {
|
|
19
|
+
VclReactNative
|
|
20
|
+
} = _reactNative.NativeModules;
|
|
21
|
+
const VclApi = {
|
|
22
|
+
initialize: async initializationDescriptor => {
|
|
23
|
+
try {
|
|
24
|
+
return await VclReactNative.initialize(initializationDescriptor);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
throw (0, _VCLError.toVclError)(e);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
getCountries: async () => {
|
|
30
|
+
try {
|
|
31
|
+
return await VclReactNative.getCountries();
|
|
32
|
+
} catch (e) {
|
|
33
|
+
throw (0, _VCLError.toVclError)(e);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
getCredentialTypes: async () => {
|
|
37
|
+
try {
|
|
38
|
+
return await VclReactNative.getCredentialTypes();
|
|
39
|
+
} catch (e) {
|
|
40
|
+
throw (0, _VCLError.toVclError)(e);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
getCredentialTypeSchemas: async () => {
|
|
44
|
+
try {
|
|
45
|
+
return await VclReactNative.getCredentialTypeSchemas();
|
|
46
|
+
} catch (e) {
|
|
47
|
+
throw (0, _VCLError.toVclError)(e);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
getPresentationRequest: async presentationRequestDescriptor => {
|
|
51
|
+
try {
|
|
52
|
+
return await VclReactNative.getPresentationRequest(presentationRequestDescriptor);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
throw (0, _VCLError.toVclError)(e);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
submitPresentation: async presentationSubmission => {
|
|
58
|
+
try {
|
|
59
|
+
return await VclReactNative.submitPresentation(presentationSubmission);
|
|
60
|
+
} catch (e) {
|
|
61
|
+
throw (0, _VCLError.toVclError)(e);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
getExchangeProgress: async exchangeDescriptor => {
|
|
65
|
+
try {
|
|
66
|
+
return await VclReactNative.getExchangeProgress(exchangeDescriptor);
|
|
67
|
+
} catch (e) {
|
|
68
|
+
throw (0, _VCLError.toVclError)(e);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
searchForOrganizations: async organizationsSearchDescriptor => {
|
|
72
|
+
try {
|
|
73
|
+
return await VclReactNative.searchForOrganizations(organizationsSearchDescriptor);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
throw (0, _VCLError.toVclError)(e);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
getCredentialManifest: async credentialManifestDescriptor => {
|
|
79
|
+
try {
|
|
80
|
+
return await VclReactNative.getCredentialManifest(credentialManifestDescriptor);
|
|
81
|
+
} catch (e) {
|
|
82
|
+
throw (0, _VCLError.toVclError)(e);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
generateOffers: async generateOffersDescriptor => {
|
|
86
|
+
try {
|
|
87
|
+
return await VclReactNative.generateOffers(generateOffersDescriptor);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
throw (0, _VCLError.toVclError)(e);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
checkForOffers: async (generateOffersDescriptor, token) => {
|
|
93
|
+
try {
|
|
94
|
+
return await VclReactNative.checkForOffers(generateOffersDescriptor, token);
|
|
95
|
+
} catch (e) {
|
|
96
|
+
throw (0, _VCLError.toVclError)(e);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
finalizeOffers: async (finalizeOffersDescriptor, token) => {
|
|
100
|
+
try {
|
|
101
|
+
return await VclReactNative.finalizeOffers(finalizeOffersDescriptor, token);
|
|
102
|
+
} catch (e) {
|
|
103
|
+
throw (0, _VCLError.toVclError)(e);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
getCredentialTypesUIFormSchema: async credentialTypesUIFormSchemaDescriptor => {
|
|
107
|
+
try {
|
|
108
|
+
return await VclReactNative.getCredentialTypesUIFormSchema(credentialTypesUIFormSchemaDescriptor);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
throw (0, _VCLError.toVclError)(e);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
getVerifiedProfile: async verifiedProfileDescriptor => {
|
|
114
|
+
try {
|
|
115
|
+
return await VclReactNative.getVerifiedProfile(verifiedProfileDescriptor);
|
|
116
|
+
} catch (e) {
|
|
117
|
+
throw (0, _VCLError.toVclError)(e);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
verifyJwt: async (jwt, jwkPublic) => {
|
|
121
|
+
try {
|
|
122
|
+
return await VclReactNative.verifyJwt(jwt, jwkPublic);
|
|
123
|
+
} catch (e) {
|
|
124
|
+
throw (0, _VCLError.toVclError)(e);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
generateSignedJwt: async jwtDescriptor => {
|
|
128
|
+
try {
|
|
129
|
+
return await VclReactNative.generateSignedJwt(jwtDescriptor);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
throw (0, _VCLError.toVclError)(e);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
generateDidJwk: async () => {
|
|
135
|
+
try {
|
|
136
|
+
return await VclReactNative.generateDidJwk();
|
|
137
|
+
} catch (e) {
|
|
138
|
+
throw (0, _VCLError.toVclError)(e);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
exports.VclApi = VclApi;
|
|
6
143
|
//# sourceMappingURL=VCLApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
1
|
+
{"version":3,"sources":["VCLApi.ts"],"names":["VclReactNative","NativeModules","VclApi","initialize","initializationDescriptor","e","getCountries","getCredentialTypes","getCredentialTypeSchemas","getPresentationRequest","presentationRequestDescriptor","submitPresentation","presentationSubmission","getExchangeProgress","exchangeDescriptor","searchForOrganizations","organizationsSearchDescriptor","getCredentialManifest","credentialManifestDescriptor","generateOffers","generateOffersDescriptor","checkForOffers","token","finalizeOffers","finalizeOffersDescriptor","getCredentialTypesUIFormSchema","credentialTypesUIFormSchemaDescriptor","getVerifiedProfile","verifiedProfileDescriptor","verifyJwt","jwt","jwkPublic","generateSignedJwt","jwtDescriptor","generateDidJwk"],"mappings":";;;;;;;AAiCA;;AAGA;;AApCA;AACA;AACA;AACA;AACA;AACA;AAgCA,MAAM;AAAEA,EAAAA;AAAF,IAAqBC,0BAA3B;AAEO,MAAMC,MAAM,GAAG;AACpBC,EAAAA,UAAU,EAAE,MACVC,wBADU,IAEQ;AAClB,QAAI;AACF,aAAO,MAAMJ,cAAc,CAACG,UAAf,CAA0BC,wBAA1B,CAAb;AACD,KAFD,CAEE,OAAOC,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GATmB;AAWpBC,EAAAA,YAAY,EAAE,YAAmC;AAC/C,QAAI;AACF,aAAO,MAAMN,cAAc,CAACM,YAAf,EAAb;AACD,KAFD,CAEE,OAAOD,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GAjBmB;AAmBpBE,EAAAA,kBAAkB,EAAE,YAAyC;AAC3D,QAAI;AACF,aAAO,MAAMP,cAAc,CAACO,kBAAf,EAAb;AACD,KAFD,CAEE,OAAOF,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GAzBmB;AA2BpBG,EAAAA,wBAAwB,EAAE,YAA+C;AACvE,QAAI;AACF,aAAO,MAAMR,cAAc,CAACQ,wBAAf,EAAb;AACD,KAFD,CAEE,OAAOH,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GAjCmB;AAmCpBI,EAAAA,sBAAsB,EAAE,MACtBC,6BADsB,IAEc;AACpC,QAAI;AACF,aAAO,MAAMV,cAAc,CAACS,sBAAf,CACXC,6BADW,CAAb;AAGD,KAJD,CAIE,OAAOL,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GA7CmB;AA+CpBM,EAAAA,kBAAkB,EAAE,MAClBC,sBADkB,IAEe;AACjC,QAAI;AACF,aAAO,MAAMZ,cAAc,CAACW,kBAAf,CAAkCC,sBAAlC,CAAb;AACD,KAFD,CAEE,OAAOP,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GAvDmB;AAyDpBQ,EAAAA,mBAAmB,EAAE,MACnBC,kBADmB,IAEM;AACzB,QAAI;AACF,aAAO,MAAMd,cAAc,CAACa,mBAAf,CAAmCC,kBAAnC,CAAb;AACD,KAFD,CAEE,OAAOT,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GAjEmB;AAmEpBU,EAAAA,sBAAsB,EAAE,MACtBC,6BADsB,IAEQ;AAC9B,QAAI;AACF,aAAO,MAAMhB,cAAc,CAACe,sBAAf,CACXC,6BADW,CAAb;AAGD,KAJD,CAIE,OAAOX,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GA7EmB;AA+EpBY,EAAAA,qBAAqB,EAAE,MACrBC,4BADqB,IAEc;AACnC,QAAI;AACF,aAAO,MAAMlB,cAAc,CAACiB,qBAAf,CACXC,4BADW,CAAb;AAGD,KAJD,CAIE,OAAOb,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GAzFmB;AA2FpBc,EAAAA,cAAc,EAAE,MACdC,wBADc,IAES;AACvB,QAAI;AACF,aAAO,MAAMpB,cAAc,CAACmB,cAAf,CAA8BC,wBAA9B,CAAb;AACD,KAFD,CAEE,OAAOf,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GAnGmB;AAqGpBgB,EAAAA,cAAc,EAAE,OACdD,wBADc,EAEdE,KAFc,KAGS;AACvB,QAAI;AACF,aAAO,MAAMtB,cAAc,CAACqB,cAAf,CACXD,wBADW,EAEXE,KAFW,CAAb;AAID,KALD,CAKE,OAAOjB,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GAjHmB;AAmHpBkB,EAAAA,cAAc,EAAE,OACdC,wBADc,EAEdF,KAFc,KAG2B;AACzC,QAAI;AACF,aAAO,MAAMtB,cAAc,CAACuB,cAAf,CACXC,wBADW,EAEXF,KAFW,CAAb;AAID,KALD,CAKE,OAAOjB,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GA/HmB;AAiIpBoB,EAAAA,8BAA8B,EAAE,MAC9BC,qCAD8B,IAEc;AAC5C,QAAI;AACF,aAAO,MAAM1B,cAAc,CAACyB,8BAAf,CACXC,qCADW,CAAb;AAGD,KAJD,CAIE,OAAOrB,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GA3ImB;AA6IpBsB,EAAAA,kBAAkB,EAAE,MAClBC,yBADkB,IAEc;AAChC,QAAI;AACF,aAAO,MAAM5B,cAAc,CAAC2B,kBAAf,CAAkCC,yBAAlC,CAAb;AACD,KAFD,CAEE,OAAOvB,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GArJmB;AAuJpBwB,EAAAA,SAAS,EAAE,OAAOC,GAAP,EAAoBC,SAApB,KAAkE;AAC3E,QAAI;AACF,aAAO,MAAM/B,cAAc,CAAC6B,SAAf,CAAyBC,GAAzB,EAA8BC,SAA9B,CAAb;AACD,KAFD,CAEE,OAAO1B,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GA7JmB;AA+JpB2B,EAAAA,iBAAiB,EAAE,MACjBC,aADiB,IAEG;AACpB,QAAI;AACF,aAAO,MAAMjC,cAAc,CAACgC,iBAAf,CAAiCC,aAAjC,CAAb;AACD,KAFD,CAEE,OAAO5B,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF,GAvKmB;AAyKpB6B,EAAAA,cAAc,EAAE,YAAgC;AAC9C,QAAI;AACF,aAAO,MAAMlC,cAAc,CAACkC,cAAf,EAAb;AACD,KAFD,CAEE,OAAO7B,CAAP,EAAU;AACV,YAAM,0BAAWA,CAAX,CAAN;AACD;AACF;AA/KmB,CAAf","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { VCLCredentialManifest } from './entities/VCLCredentialManifest';\nimport type { VCLCredentialManifestDescriptor } from './entities/VCLCredentialManifestDescriptor';\nimport type { VCLCredentialTypeSchemas } from './entities/VCLCredentialTypeSchemas';\nimport type { VCLCredentialTypesUIFormSchema } from './entities/VCLCredentialTypesUIFormSchema';\nimport type { VCLCredentialTypesUIFormSchemaDescriptor } from './entities/VCLCredentialTypesUIFormSchemaDescriptor';\nimport type { VCLExchange } from './entities/VCLExchange';\nimport type { VCLExchangeDescriptor } from './entities/VCLExchangeDescriptor';\nimport type { VCLFinalizeOffersDescriptor } from './entities/VCLFinalizeOffersDescriptor';\nimport type { VCLGenerateOffersDescriptor } from './entities/VCLGenerateOffersDescriptor';\nimport type { VCLJwt } from './entities/VCLJwt';\nimport type { VCLJwtVerifiableCredentials } from './entities/VCLJwtVerifiableCredentials';\nimport type { VCLOffers } from './entities/VCLOffers';\nimport type { VCLOrganizations } from './entities/VCLOrganizations';\nimport type { VCLOrganizationsSearchDescriptor } from './entities/VCLOrganizationsSearchDescriptor';\nimport type { VCLPresentationRequest } from './entities/VCLPresentationRequest';\nimport type { VCLPresentationSubmission } from './entities/VCLPresentationSubmission';\nimport type { VCLJwkPublic } from './entities/VCLJwkPublic';\nimport type { VCLToken } from './entities/VCLToken';\nimport type { VCLVerifiedProfile } from './entities/VCLVerifiedProfile';\nimport type { VCLVerifiedProfileDescriptor } from './entities/VCLVerifiedProfileDescriptor';\nimport type { VCLCountries } from './entities/VCLCountries';\nimport type { VCLInitializationDescriptor } from './entities/VCLInitializationDescriptor';\nimport type { VCLSubmissionResult } from './entities/VCLSubmissionResult';\nimport type { VCLPresentationRequestDescriptor } from './entities/VCLPresentationRequestDescriptor';\nimport type { VCLJwtDescriptor } from './entities/VCLJwtDescriptor';\nimport type { VCLDidJwk } from './entities/VCLDidJwk';\nimport { toVclError } from './entities/VCLError';\nimport type { VCLCredentialTypes } from './entities/VCLCredentialTypes';\n\nimport { NativeModules } from 'react-native';\nconst { VclReactNative } = NativeModules;\n\nexport const VclApi = {\n initialize: async (\n initializationDescriptor: VCLInitializationDescriptor\n ): Promise<void> => {\n try {\n return await VclReactNative.initialize(initializationDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCountries: async (): Promise<VCLCountries> => {\n try {\n return await VclReactNative.getCountries();\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCredentialTypes: async (): Promise<VCLCredentialTypes> => {\n try {\n return await VclReactNative.getCredentialTypes();\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCredentialTypeSchemas: async (): Promise<VCLCredentialTypeSchemas> => {\n try {\n return await VclReactNative.getCredentialTypeSchemas();\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getPresentationRequest: async (\n presentationRequestDescriptor: VCLPresentationRequestDescriptor\n ): Promise<VCLPresentationRequest> => {\n try {\n return await VclReactNative.getPresentationRequest(\n presentationRequestDescriptor\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n submitPresentation: async (\n presentationSubmission: VCLPresentationSubmission\n ): Promise<VCLSubmissionResult> => {\n try {\n return await VclReactNative.submitPresentation(presentationSubmission);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getExchangeProgress: async (\n exchangeDescriptor: VCLExchangeDescriptor\n ): Promise<VCLExchange> => {\n try {\n return await VclReactNative.getExchangeProgress(exchangeDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n searchForOrganizations: async (\n organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor\n ): Promise<VCLOrganizations> => {\n try {\n return await VclReactNative.searchForOrganizations(\n organizationsSearchDescriptor\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCredentialManifest: async (\n credentialManifestDescriptor: VCLCredentialManifestDescriptor\n ): Promise<VCLCredentialManifest> => {\n try {\n return await VclReactNative.getCredentialManifest(\n credentialManifestDescriptor\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n generateOffers: async (\n generateOffersDescriptor: VCLGenerateOffersDescriptor\n ): Promise<VCLOffers> => {\n try {\n return await VclReactNative.generateOffers(generateOffersDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n checkForOffers: async (\n generateOffersDescriptor: VCLGenerateOffersDescriptor,\n token: VCLToken\n ): Promise<VCLOffers> => {\n try {\n return await VclReactNative.checkForOffers(\n generateOffersDescriptor,\n token\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n finalizeOffers: async (\n finalizeOffersDescriptor: VCLFinalizeOffersDescriptor,\n token: VCLToken\n ): Promise<VCLJwtVerifiableCredentials> => {\n try {\n return await VclReactNative.finalizeOffers(\n finalizeOffersDescriptor,\n token\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCredentialTypesUIFormSchema: async (\n credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor\n ): Promise<VCLCredentialTypesUIFormSchema> => {\n try {\n return await VclReactNative.getCredentialTypesUIFormSchema(\n credentialTypesUIFormSchemaDescriptor\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getVerifiedProfile: async (\n verifiedProfileDescriptor: VCLVerifiedProfileDescriptor\n ): Promise<VCLVerifiedProfile> => {\n try {\n return await VclReactNative.getVerifiedProfile(verifiedProfileDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n verifyJwt: async (jwt: VCLJwt, jwkPublic: VCLJwkPublic): Promise<boolean> => {\n try {\n return await VclReactNative.verifyJwt(jwt, jwkPublic);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n generateSignedJwt: async (\n jwtDescriptor: VCLJwtDescriptor\n ): Promise<VCLJwt> => {\n try {\n return await VclReactNative.generateSignedJwt(jwtDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n generateDidJwk: async (): Promise<VCLDidJwk> => {\n try {\n return await VclReactNative.generateDidJwk();\n } catch (e) {\n throw toVclError(e);\n }\n },\n};\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toVclError = exports.VCLError = void 0;
|
|
7
|
+
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Created by Michael Avoyan.
|
|
12
|
+
*
|
|
13
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
14
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
15
|
+
*/
|
|
16
|
+
class VCLError extends Error {
|
|
17
|
+
constructor(error) {
|
|
18
|
+
super(error);
|
|
19
|
+
|
|
20
|
+
_defineProperty(this, "description", void 0);
|
|
21
|
+
|
|
22
|
+
_defineProperty(this, "code", void 0);
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const errorJson = JSON.parse(error.message);
|
|
26
|
+
this.description = errorJson.description;
|
|
27
|
+
this.code = parseInt(errorJson.code, 10);
|
|
28
|
+
} catch (e) {}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
exports.VCLError = VCLError;
|
|
34
|
+
|
|
35
|
+
const toVclError = error => {
|
|
36
|
+
return new VCLError(error);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.toVclError = toVclError;
|
|
40
|
+
//# sourceMappingURL=VCLError.js.map
|
|
@@ -0,0 +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"]}
|
|
File without changes
|
package/lib/commonjs/index.js
CHANGED
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "VCLEnvTypes", {
|
|
|
15
15
|
return _VCLEnvironment.VCLEnvTypes;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "VCLErrorCode", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _VCLErrorCode.VCLErrorCode;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "VCLServiceType", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function () {
|
|
@@ -23,7 +29,7 @@ Object.defineProperty(exports, "VCLServiceType", {
|
|
|
23
29
|
});
|
|
24
30
|
exports.default = void 0;
|
|
25
31
|
|
|
26
|
-
var
|
|
32
|
+
var _VCLApi = require("./api/VCLApi");
|
|
27
33
|
|
|
28
34
|
var _VCLEnvironment = require("./api/VCLEnvironment");
|
|
29
35
|
|
|
@@ -31,15 +37,14 @@ var _VCLCountries = require("./api/entities/VCLCountries");
|
|
|
31
37
|
|
|
32
38
|
var _VCLServiceType = require("./api/entities/VCLServiceType");
|
|
33
39
|
|
|
40
|
+
var _VCLErrorCode = require("./api/entities/VCLErrorCode");
|
|
41
|
+
|
|
34
42
|
/**
|
|
35
43
|
* Created by Michael Avoyan.
|
|
36
44
|
*
|
|
37
45
|
* Copyright 2022 Velocity Career Labs inc.
|
|
38
46
|
* SPDX-License-Identifier: Apache-2.0
|
|
39
47
|
*/
|
|
40
|
-
|
|
41
|
-
VclReactNative
|
|
42
|
-
} = _reactNative.NativeModules;
|
|
43
|
-
var _default = VclReactNative;
|
|
48
|
+
var _default = _VCLApi.VclApi;
|
|
44
49
|
exports.default = _default;
|
|
45
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["VclApi"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;;AAEA;;AAGA;;AAiCA;;AAWA;;AAxDA;AACA;AACA;AACA;AACA;AACA;eAsDeA,c","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { VclApi } from './api/VCLApi';\nimport type { VCLEnvironment } from './api/VCLEnvironment';\nimport { VCLEnvTypes } from './api/VCLEnvironment';\nimport type { VCLCountry } from './api/entities/VCLCountry';\nimport type { VCLCountries } from './api/entities/VCLCountries';\nimport { VCLCountryCodes } from './api/entities/VCLCountries';\nimport type { VCLRegion } from './api/entities/VCLRegion';\nimport type { VCLRegions } from './api/entities/VCLRegions';\nimport type { VCLCredentialManifest } from './api/entities/VCLCredentialManifest';\nimport type { VCLCredentialManifestDescriptor } from './api/entities/VCLCredentialManifestDescriptor';\nimport type { VCLCredentialManifestDescriptorByDeepLink } from './api/entities/VCLCredentialManifestDescriptorByDeepLink';\nimport type { VCLCredentialManifestDescriptorByService } from './api/entities/VCLCredentialManifestDescriptorByService';\nimport type { VCLCredentialManifestDescriptorRefresh } from './api/entities/VCLCredentialManifestDescriptorRefresh';\nimport type { VCLCredentialType } from './api/entities/VCLCredentialType';\nimport type { VCLCredentialTypes } from './api/entities/VCLCredentialTypes';\nimport type { VCLCredentialTypeSchema } from './api/entities/VCLCredentialTypeSchema';\nimport type { VCLCredentialTypeSchemas } from './api/entities/VCLCredentialTypeSchemas';\nimport type { VCLCredentialTypesUIFormSchemaDescriptor } from './api/entities/VCLCredentialTypesUIFormSchemaDescriptor';\nimport type { VCLCredentialTypesUIFormSchema } from './api/entities/VCLCredentialTypesUIFormSchema';\nimport type { VCLDeepLink } from './api/entities/VCLDeepLink';\nimport type { VCLExchange } from './api/entities/VCLExchange';\nimport type { VCLExchangeDescriptor } from './api/entities/VCLExchangeDescriptor';\nimport type { VCLFilter } from './api/entities/VCLFilter';\nimport type { VCLFinalizeOffersDescriptor } from './api/entities/VCLFinalizeOffersDescriptor';\nimport type { VCLGenerateOffersDescriptor } from './api/entities/VCLGenerateOffersDescriptor';\nimport type { VCLJwt } from './api/entities/VCLJwt';\nimport type { VCLJwtVerifiableCredentials } from './api/entities/VCLJwtVerifiableCredentials';\nimport type { VCLOffers } from './api/entities/VCLOffers';\nimport type { VCLOrganization } from './api/entities/VCLOrganization';\nimport type { VCLOrganizations } from './api/entities/VCLOrganizations';\nimport type { VCLOrganizationsSearchDescriptor } from './api/entities/VCLOrganizationsSearchDescriptor';\nimport type { VCLPage } from './api/entities/VCLPage';\nimport type { VCLPresentationRequest } from './api/entities/VCLPresentationRequest';\nimport type { VCLPresentationSubmission } from './api/entities/VCLPresentationSubmission';\nimport type { VCLJwkPublic } from './api/entities/VCLJwkPublic';\nimport type { VCLPushDelegate } from './api/entities/VCLPushDelegate';\nimport type { VCLService } from './api/entities/VCLService';\nimport type { VCLServiceCredentialAgentIssuer } from './api/entities/VCLServiceCredentialAgentIssuer';\nimport { VCLServiceType } from './api/entities/VCLServiceType';\nimport type { VCLSubmissionResult } from './api/entities/VCLSubmissionResult';\nimport type { VCLToken } from './api/entities/VCLToken';\nimport type { VCLVerifiableCredential } from './api/entities/VCLVerifiableCredential';\nimport type { VCLVerifiedProfile } from './api/entities/VCLVerifiedProfile';\nimport type { VCLVerifiedProfileDescriptor } from './api/entities/VCLVerifiedProfileDescriptor';\nimport type { Dictionary } from './api/Dictionary';\nimport type { VCLInitializationDescriptor } from './api/entities/VCLInitializationDescriptor';\nimport type { VCLPresentationRequestDescriptor } from './api/entities/VCLPresentationRequestDescriptor';\nimport type { VCLJwtDescriptor } from './api/entities/VCLJwtDescriptor';\nimport type { VCLDidJwk } from './api/entities/VCLDidJwk';\nimport { VCLErrorCode } from './api/entities/VCLErrorCode';\nimport type { VCLError, toVclError } from './api/entities/VCLError';\n\nexport default VclApi;\nexport {\n Dictionary,\n VCLEnvironment,\n VCLEnvTypes,\n VCLCountry,\n VCLCountries,\n VCLCountryCodes,\n VCLRegion,\n VCLRegions,\n VCLCredentialManifest,\n VCLCredentialManifestDescriptor,\n VCLCredentialManifestDescriptorByDeepLink,\n VCLCredentialManifestDescriptorByService,\n VCLCredentialType,\n VCLCredentialTypes,\n VCLCredentialTypeSchema,\n VCLCredentialTypeSchemas,\n VCLCredentialTypesUIFormSchema,\n VCLCredentialTypesUIFormSchemaDescriptor,\n VCLCredentialManifestDescriptorRefresh,\n VCLDeepLink,\n VCLExchange,\n VCLExchangeDescriptor,\n VCLFilter,\n VCLFinalizeOffersDescriptor,\n VCLGenerateOffersDescriptor,\n VCLJwt,\n VCLJwtVerifiableCredentials,\n VCLOffers,\n VCLOrganization,\n VCLOrganizations,\n VCLOrganizationsSearchDescriptor,\n VCLPage,\n VCLPresentationRequest,\n VCLPresentationSubmission,\n VCLJwkPublic,\n VCLPushDelegate,\n VCLService,\n VCLServiceCredentialAgentIssuer,\n VCLServiceType,\n VCLSubmissionResult,\n VCLToken,\n VCLVerifiableCredential,\n VCLVerifiedProfile,\n VCLVerifiedProfileDescriptor,\n VCLInitializationDescriptor,\n VCLPresentationRequestDescriptor,\n VCLJwtDescriptor,\n VCLDidJwk,\n VCLErrorCode,\n VCLError,\n toVclError,\n};\n"]}
|
package/lib/module/api/VCLApi.js
CHANGED
|
@@ -1,2 +1,133 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Created by Michael Avoyan.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
import { toVclError } from './entities/VCLError';
|
|
8
|
+
import { NativeModules } from 'react-native';
|
|
9
|
+
const {
|
|
10
|
+
VclReactNative
|
|
11
|
+
} = NativeModules;
|
|
12
|
+
export const VclApi = {
|
|
13
|
+
initialize: async initializationDescriptor => {
|
|
14
|
+
try {
|
|
15
|
+
return await VclReactNative.initialize(initializationDescriptor);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
throw toVclError(e);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
getCountries: async () => {
|
|
21
|
+
try {
|
|
22
|
+
return await VclReactNative.getCountries();
|
|
23
|
+
} catch (e) {
|
|
24
|
+
throw toVclError(e);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
getCredentialTypes: async () => {
|
|
28
|
+
try {
|
|
29
|
+
return await VclReactNative.getCredentialTypes();
|
|
30
|
+
} catch (e) {
|
|
31
|
+
throw toVclError(e);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
getCredentialTypeSchemas: async () => {
|
|
35
|
+
try {
|
|
36
|
+
return await VclReactNative.getCredentialTypeSchemas();
|
|
37
|
+
} catch (e) {
|
|
38
|
+
throw toVclError(e);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
getPresentationRequest: async presentationRequestDescriptor => {
|
|
42
|
+
try {
|
|
43
|
+
return await VclReactNative.getPresentationRequest(presentationRequestDescriptor);
|
|
44
|
+
} catch (e) {
|
|
45
|
+
throw toVclError(e);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
submitPresentation: async presentationSubmission => {
|
|
49
|
+
try {
|
|
50
|
+
return await VclReactNative.submitPresentation(presentationSubmission);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
throw toVclError(e);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
getExchangeProgress: async exchangeDescriptor => {
|
|
56
|
+
try {
|
|
57
|
+
return await VclReactNative.getExchangeProgress(exchangeDescriptor);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
throw toVclError(e);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
searchForOrganizations: async organizationsSearchDescriptor => {
|
|
63
|
+
try {
|
|
64
|
+
return await VclReactNative.searchForOrganizations(organizationsSearchDescriptor);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
throw toVclError(e);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
getCredentialManifest: async credentialManifestDescriptor => {
|
|
70
|
+
try {
|
|
71
|
+
return await VclReactNative.getCredentialManifest(credentialManifestDescriptor);
|
|
72
|
+
} catch (e) {
|
|
73
|
+
throw toVclError(e);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
generateOffers: async generateOffersDescriptor => {
|
|
77
|
+
try {
|
|
78
|
+
return await VclReactNative.generateOffers(generateOffersDescriptor);
|
|
79
|
+
} catch (e) {
|
|
80
|
+
throw toVclError(e);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
checkForOffers: async (generateOffersDescriptor, token) => {
|
|
84
|
+
try {
|
|
85
|
+
return await VclReactNative.checkForOffers(generateOffersDescriptor, token);
|
|
86
|
+
} catch (e) {
|
|
87
|
+
throw toVclError(e);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
finalizeOffers: async (finalizeOffersDescriptor, token) => {
|
|
91
|
+
try {
|
|
92
|
+
return await VclReactNative.finalizeOffers(finalizeOffersDescriptor, token);
|
|
93
|
+
} catch (e) {
|
|
94
|
+
throw toVclError(e);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
getCredentialTypesUIFormSchema: async credentialTypesUIFormSchemaDescriptor => {
|
|
98
|
+
try {
|
|
99
|
+
return await VclReactNative.getCredentialTypesUIFormSchema(credentialTypesUIFormSchemaDescriptor);
|
|
100
|
+
} catch (e) {
|
|
101
|
+
throw toVclError(e);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
getVerifiedProfile: async verifiedProfileDescriptor => {
|
|
105
|
+
try {
|
|
106
|
+
return await VclReactNative.getVerifiedProfile(verifiedProfileDescriptor);
|
|
107
|
+
} catch (e) {
|
|
108
|
+
throw toVclError(e);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
verifyJwt: async (jwt, jwkPublic) => {
|
|
112
|
+
try {
|
|
113
|
+
return await VclReactNative.verifyJwt(jwt, jwkPublic);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
throw toVclError(e);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
generateSignedJwt: async jwtDescriptor => {
|
|
119
|
+
try {
|
|
120
|
+
return await VclReactNative.generateSignedJwt(jwtDescriptor);
|
|
121
|
+
} catch (e) {
|
|
122
|
+
throw toVclError(e);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
generateDidJwk: async () => {
|
|
126
|
+
try {
|
|
127
|
+
return await VclReactNative.generateDidJwk();
|
|
128
|
+
} catch (e) {
|
|
129
|
+
throw toVclError(e);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
2
133
|
//# sourceMappingURL=VCLApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
1
|
+
{"version":3,"sources":["VCLApi.ts"],"names":["toVclError","NativeModules","VclReactNative","VclApi","initialize","initializationDescriptor","e","getCountries","getCredentialTypes","getCredentialTypeSchemas","getPresentationRequest","presentationRequestDescriptor","submitPresentation","presentationSubmission","getExchangeProgress","exchangeDescriptor","searchForOrganizations","organizationsSearchDescriptor","getCredentialManifest","credentialManifestDescriptor","generateOffers","generateOffersDescriptor","checkForOffers","token","finalizeOffers","finalizeOffersDescriptor","getCredentialTypesUIFormSchema","credentialTypesUIFormSchemaDescriptor","getVerifiedProfile","verifiedProfileDescriptor","verifyJwt","jwt","jwkPublic","generateSignedJwt","jwtDescriptor","generateDidJwk"],"mappings":"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","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { VCLCredentialManifest } from './entities/VCLCredentialManifest';\nimport type { VCLCredentialManifestDescriptor } from './entities/VCLCredentialManifestDescriptor';\nimport type { VCLCredentialTypeSchemas } from './entities/VCLCredentialTypeSchemas';\nimport type { VCLCredentialTypesUIFormSchema } from './entities/VCLCredentialTypesUIFormSchema';\nimport type { VCLCredentialTypesUIFormSchemaDescriptor } from './entities/VCLCredentialTypesUIFormSchemaDescriptor';\nimport type { VCLExchange } from './entities/VCLExchange';\nimport type { VCLExchangeDescriptor } from './entities/VCLExchangeDescriptor';\nimport type { VCLFinalizeOffersDescriptor } from './entities/VCLFinalizeOffersDescriptor';\nimport type { VCLGenerateOffersDescriptor } from './entities/VCLGenerateOffersDescriptor';\nimport type { VCLJwt } from './entities/VCLJwt';\nimport type { VCLJwtVerifiableCredentials } from './entities/VCLJwtVerifiableCredentials';\nimport type { VCLOffers } from './entities/VCLOffers';\nimport type { VCLOrganizations } from './entities/VCLOrganizations';\nimport type { VCLOrganizationsSearchDescriptor } from './entities/VCLOrganizationsSearchDescriptor';\nimport type { VCLPresentationRequest } from './entities/VCLPresentationRequest';\nimport type { VCLPresentationSubmission } from './entities/VCLPresentationSubmission';\nimport type { VCLJwkPublic } from './entities/VCLJwkPublic';\nimport type { VCLToken } from './entities/VCLToken';\nimport type { VCLVerifiedProfile } from './entities/VCLVerifiedProfile';\nimport type { VCLVerifiedProfileDescriptor } from './entities/VCLVerifiedProfileDescriptor';\nimport type { VCLCountries } from './entities/VCLCountries';\nimport type { VCLInitializationDescriptor } from './entities/VCLInitializationDescriptor';\nimport type { VCLSubmissionResult } from './entities/VCLSubmissionResult';\nimport type { VCLPresentationRequestDescriptor } from './entities/VCLPresentationRequestDescriptor';\nimport type { VCLJwtDescriptor } from './entities/VCLJwtDescriptor';\nimport type { VCLDidJwk } from './entities/VCLDidJwk';\nimport { toVclError } from './entities/VCLError';\nimport type { VCLCredentialTypes } from './entities/VCLCredentialTypes';\n\nimport { NativeModules } from 'react-native';\nconst { VclReactNative } = NativeModules;\n\nexport const VclApi = {\n initialize: async (\n initializationDescriptor: VCLInitializationDescriptor\n ): Promise<void> => {\n try {\n return await VclReactNative.initialize(initializationDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCountries: async (): Promise<VCLCountries> => {\n try {\n return await VclReactNative.getCountries();\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCredentialTypes: async (): Promise<VCLCredentialTypes> => {\n try {\n return await VclReactNative.getCredentialTypes();\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCredentialTypeSchemas: async (): Promise<VCLCredentialTypeSchemas> => {\n try {\n return await VclReactNative.getCredentialTypeSchemas();\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getPresentationRequest: async (\n presentationRequestDescriptor: VCLPresentationRequestDescriptor\n ): Promise<VCLPresentationRequest> => {\n try {\n return await VclReactNative.getPresentationRequest(\n presentationRequestDescriptor\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n submitPresentation: async (\n presentationSubmission: VCLPresentationSubmission\n ): Promise<VCLSubmissionResult> => {\n try {\n return await VclReactNative.submitPresentation(presentationSubmission);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getExchangeProgress: async (\n exchangeDescriptor: VCLExchangeDescriptor\n ): Promise<VCLExchange> => {\n try {\n return await VclReactNative.getExchangeProgress(exchangeDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n searchForOrganizations: async (\n organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor\n ): Promise<VCLOrganizations> => {\n try {\n return await VclReactNative.searchForOrganizations(\n organizationsSearchDescriptor\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCredentialManifest: async (\n credentialManifestDescriptor: VCLCredentialManifestDescriptor\n ): Promise<VCLCredentialManifest> => {\n try {\n return await VclReactNative.getCredentialManifest(\n credentialManifestDescriptor\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n generateOffers: async (\n generateOffersDescriptor: VCLGenerateOffersDescriptor\n ): Promise<VCLOffers> => {\n try {\n return await VclReactNative.generateOffers(generateOffersDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n checkForOffers: async (\n generateOffersDescriptor: VCLGenerateOffersDescriptor,\n token: VCLToken\n ): Promise<VCLOffers> => {\n try {\n return await VclReactNative.checkForOffers(\n generateOffersDescriptor,\n token\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n finalizeOffers: async (\n finalizeOffersDescriptor: VCLFinalizeOffersDescriptor,\n token: VCLToken\n ): Promise<VCLJwtVerifiableCredentials> => {\n try {\n return await VclReactNative.finalizeOffers(\n finalizeOffersDescriptor,\n token\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getCredentialTypesUIFormSchema: async (\n credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor\n ): Promise<VCLCredentialTypesUIFormSchema> => {\n try {\n return await VclReactNative.getCredentialTypesUIFormSchema(\n credentialTypesUIFormSchemaDescriptor\n );\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n getVerifiedProfile: async (\n verifiedProfileDescriptor: VCLVerifiedProfileDescriptor\n ): Promise<VCLVerifiedProfile> => {\n try {\n return await VclReactNative.getVerifiedProfile(verifiedProfileDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n verifyJwt: async (jwt: VCLJwt, jwkPublic: VCLJwkPublic): Promise<boolean> => {\n try {\n return await VclReactNative.verifyJwt(jwt, jwkPublic);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n generateSignedJwt: async (\n jwtDescriptor: VCLJwtDescriptor\n ): Promise<VCLJwt> => {\n try {\n return await VclReactNative.generateSignedJwt(jwtDescriptor);\n } catch (e) {\n throw toVclError(e);\n }\n },\n\n generateDidJwk: async (): Promise<VCLDidJwk> => {\n try {\n return await VclReactNative.generateDidJwk();\n } catch (e) {\n throw toVclError(e);\n }\n },\n};\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Created by Michael Avoyan.
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
export class VCLError extends Error {
|
|
10
|
+
constructor(error) {
|
|
11
|
+
super(error);
|
|
12
|
+
|
|
13
|
+
_defineProperty(this, "description", void 0);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "code", void 0);
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const errorJson = JSON.parse(error.message);
|
|
19
|
+
this.description = errorJson.description;
|
|
20
|
+
this.code = parseInt(errorJson.code, 10);
|
|
21
|
+
} catch (e) {}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
export const toVclError = error => {
|
|
26
|
+
return new VCLError(error);
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=VCLError.js.map
|
|
@@ -0,0 +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"]}
|
|
File without changes
|
package/lib/module/index.js
CHANGED
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
* Copyright 2022 Velocity Career Labs inc.
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { VclApi } from './api/VCLApi';
|
|
8
8
|
import { VCLEnvTypes } from './api/VCLEnvironment';
|
|
9
9
|
import { VCLCountryCodes } from './api/entities/VCLCountries';
|
|
10
10
|
import { VCLServiceType } from './api/entities/VCLServiceType';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export default VclReactNative;
|
|
15
|
-
export { VCLEnvTypes, VCLCountryCodes, VCLServiceType };
|
|
11
|
+
import { VCLErrorCode } from './api/entities/VCLErrorCode';
|
|
12
|
+
export default VclApi;
|
|
13
|
+
export { VCLEnvTypes, VCLCountryCodes, VCLServiceType, VCLErrorCode };
|
|
16
14
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["VclApi","VCLEnvTypes","VCLCountryCodes","VCLServiceType","VCLErrorCode"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,MAAT,QAAuB,cAAvB;AAEA,SAASC,WAAT,QAA4B,sBAA5B;AAGA,SAASC,eAAT,QAAgC,6BAAhC;AAiCA,SAASC,cAAT,QAA+B,+BAA/B;AAWA,SAASC,YAAT,QAA6B,6BAA7B;AAGA,eAAeJ,MAAf;AACA,SAGEC,WAHF,EAMEC,eANF,EAuCEC,cAvCF,EAiDEC,YAjDF","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { VclApi } from './api/VCLApi';\nimport type { VCLEnvironment } from './api/VCLEnvironment';\nimport { VCLEnvTypes } from './api/VCLEnvironment';\nimport type { VCLCountry } from './api/entities/VCLCountry';\nimport type { VCLCountries } from './api/entities/VCLCountries';\nimport { VCLCountryCodes } from './api/entities/VCLCountries';\nimport type { VCLRegion } from './api/entities/VCLRegion';\nimport type { VCLRegions } from './api/entities/VCLRegions';\nimport type { VCLCredentialManifest } from './api/entities/VCLCredentialManifest';\nimport type { VCLCredentialManifestDescriptor } from './api/entities/VCLCredentialManifestDescriptor';\nimport type { VCLCredentialManifestDescriptorByDeepLink } from './api/entities/VCLCredentialManifestDescriptorByDeepLink';\nimport type { VCLCredentialManifestDescriptorByService } from './api/entities/VCLCredentialManifestDescriptorByService';\nimport type { VCLCredentialManifestDescriptorRefresh } from './api/entities/VCLCredentialManifestDescriptorRefresh';\nimport type { VCLCredentialType } from './api/entities/VCLCredentialType';\nimport type { VCLCredentialTypes } from './api/entities/VCLCredentialTypes';\nimport type { VCLCredentialTypeSchema } from './api/entities/VCLCredentialTypeSchema';\nimport type { VCLCredentialTypeSchemas } from './api/entities/VCLCredentialTypeSchemas';\nimport type { VCLCredentialTypesUIFormSchemaDescriptor } from './api/entities/VCLCredentialTypesUIFormSchemaDescriptor';\nimport type { VCLCredentialTypesUIFormSchema } from './api/entities/VCLCredentialTypesUIFormSchema';\nimport type { VCLDeepLink } from './api/entities/VCLDeepLink';\nimport type { VCLExchange } from './api/entities/VCLExchange';\nimport type { VCLExchangeDescriptor } from './api/entities/VCLExchangeDescriptor';\nimport type { VCLFilter } from './api/entities/VCLFilter';\nimport type { VCLFinalizeOffersDescriptor } from './api/entities/VCLFinalizeOffersDescriptor';\nimport type { VCLGenerateOffersDescriptor } from './api/entities/VCLGenerateOffersDescriptor';\nimport type { VCLJwt } from './api/entities/VCLJwt';\nimport type { VCLJwtVerifiableCredentials } from './api/entities/VCLJwtVerifiableCredentials';\nimport type { VCLOffers } from './api/entities/VCLOffers';\nimport type { VCLOrganization } from './api/entities/VCLOrganization';\nimport type { VCLOrganizations } from './api/entities/VCLOrganizations';\nimport type { VCLOrganizationsSearchDescriptor } from './api/entities/VCLOrganizationsSearchDescriptor';\nimport type { VCLPage } from './api/entities/VCLPage';\nimport type { VCLPresentationRequest } from './api/entities/VCLPresentationRequest';\nimport type { VCLPresentationSubmission } from './api/entities/VCLPresentationSubmission';\nimport type { VCLJwkPublic } from './api/entities/VCLJwkPublic';\nimport type { VCLPushDelegate } from './api/entities/VCLPushDelegate';\nimport type { VCLService } from './api/entities/VCLService';\nimport type { VCLServiceCredentialAgentIssuer } from './api/entities/VCLServiceCredentialAgentIssuer';\nimport { VCLServiceType } from './api/entities/VCLServiceType';\nimport type { VCLSubmissionResult } from './api/entities/VCLSubmissionResult';\nimport type { VCLToken } from './api/entities/VCLToken';\nimport type { VCLVerifiableCredential } from './api/entities/VCLVerifiableCredential';\nimport type { VCLVerifiedProfile } from './api/entities/VCLVerifiedProfile';\nimport type { VCLVerifiedProfileDescriptor } from './api/entities/VCLVerifiedProfileDescriptor';\nimport type { Dictionary } from './api/Dictionary';\nimport type { VCLInitializationDescriptor } from './api/entities/VCLInitializationDescriptor';\nimport type { VCLPresentationRequestDescriptor } from './api/entities/VCLPresentationRequestDescriptor';\nimport type { VCLJwtDescriptor } from './api/entities/VCLJwtDescriptor';\nimport type { VCLDidJwk } from './api/entities/VCLDidJwk';\nimport { VCLErrorCode } from './api/entities/VCLErrorCode';\nimport type { VCLError, toVclError } from './api/entities/VCLError';\n\nexport default VclApi;\nexport {\n Dictionary,\n VCLEnvironment,\n VCLEnvTypes,\n VCLCountry,\n VCLCountries,\n VCLCountryCodes,\n VCLRegion,\n VCLRegions,\n VCLCredentialManifest,\n VCLCredentialManifestDescriptor,\n VCLCredentialManifestDescriptorByDeepLink,\n VCLCredentialManifestDescriptorByService,\n VCLCredentialType,\n VCLCredentialTypes,\n VCLCredentialTypeSchema,\n VCLCredentialTypeSchemas,\n VCLCredentialTypesUIFormSchema,\n VCLCredentialTypesUIFormSchemaDescriptor,\n VCLCredentialManifestDescriptorRefresh,\n VCLDeepLink,\n VCLExchange,\n VCLExchangeDescriptor,\n VCLFilter,\n VCLFinalizeOffersDescriptor,\n VCLGenerateOffersDescriptor,\n VCLJwt,\n VCLJwtVerifiableCredentials,\n VCLOffers,\n VCLOrganization,\n VCLOrganizations,\n VCLOrganizationsSearchDescriptor,\n VCLPage,\n VCLPresentationRequest,\n VCLPresentationSubmission,\n VCLJwkPublic,\n VCLPushDelegate,\n VCLService,\n VCLServiceCredentialAgentIssuer,\n VCLServiceType,\n VCLSubmissionResult,\n VCLToken,\n VCLVerifiableCredential,\n VCLVerifiedProfile,\n VCLVerifiedProfileDescriptor,\n VCLInitializationDescriptor,\n VCLPresentationRequestDescriptor,\n VCLJwtDescriptor,\n VCLDidJwk,\n VCLErrorCode,\n VCLError,\n toVclError,\n};\n"]}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { VCLCredentialManifest } from './entities/VCLCredentialManifest';
|
|
8
8
|
import type { VCLCredentialManifestDescriptor } from './entities/VCLCredentialManifestDescriptor';
|
|
9
|
-
import type { VCLCredentialType } from './entities/VCLCredentialType';
|
|
10
9
|
import type { VCLCredentialTypeSchemas } from './entities/VCLCredentialTypeSchemas';
|
|
11
10
|
import type { VCLCredentialTypesUIFormSchema } from './entities/VCLCredentialTypesUIFormSchema';
|
|
12
11
|
import type { VCLCredentialTypesUIFormSchemaDescriptor } from './entities/VCLCredentialTypesUIFormSchemaDescriptor';
|
|
@@ -14,7 +13,7 @@ import type { VCLExchange } from './entities/VCLExchange';
|
|
|
14
13
|
import type { VCLExchangeDescriptor } from './entities/VCLExchangeDescriptor';
|
|
15
14
|
import type { VCLFinalizeOffersDescriptor } from './entities/VCLFinalizeOffersDescriptor';
|
|
16
15
|
import type { VCLGenerateOffersDescriptor } from './entities/VCLGenerateOffersDescriptor';
|
|
17
|
-
import type {
|
|
16
|
+
import type { VCLJwt } from './entities/VCLJwt';
|
|
18
17
|
import type { VCLJwtVerifiableCredentials } from './entities/VCLJwtVerifiableCredentials';
|
|
19
18
|
import type { VCLOffers } from './entities/VCLOffers';
|
|
20
19
|
import type { VCLOrganizations } from './entities/VCLOrganizations';
|
|
@@ -30,23 +29,24 @@ import type { VCLInitializationDescriptor } from './entities/VCLInitializationDe
|
|
|
30
29
|
import type { VCLSubmissionResult } from './entities/VCLSubmissionResult';
|
|
31
30
|
import type { VCLPresentationRequestDescriptor } from './entities/VCLPresentationRequestDescriptor';
|
|
32
31
|
import type { VCLJwtDescriptor } from './entities/VCLJwtDescriptor';
|
|
33
|
-
import type { VCLDidJwk } from '
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
getCredentialTypes()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
import type { VCLDidJwk } from './entities/VCLDidJwk';
|
|
33
|
+
import type { VCLCredentialTypes } from './entities/VCLCredentialTypes';
|
|
34
|
+
export declare const VclApi: {
|
|
35
|
+
initialize: (initializationDescriptor: VCLInitializationDescriptor) => Promise<void>;
|
|
36
|
+
getCountries: () => Promise<VCLCountries>;
|
|
37
|
+
getCredentialTypes: () => Promise<VCLCredentialTypes>;
|
|
38
|
+
getCredentialTypeSchemas: () => Promise<VCLCredentialTypeSchemas>;
|
|
39
|
+
getPresentationRequest: (presentationRequestDescriptor: VCLPresentationRequestDescriptor) => Promise<VCLPresentationRequest>;
|
|
40
|
+
submitPresentation: (presentationSubmission: VCLPresentationSubmission) => Promise<VCLSubmissionResult>;
|
|
41
|
+
getExchangeProgress: (exchangeDescriptor: VCLExchangeDescriptor) => Promise<VCLExchange>;
|
|
42
|
+
searchForOrganizations: (organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor) => Promise<VCLOrganizations>;
|
|
43
|
+
getCredentialManifest: (credentialManifestDescriptor: VCLCredentialManifestDescriptor) => Promise<VCLCredentialManifest>;
|
|
44
|
+
generateOffers: (generateOffersDescriptor: VCLGenerateOffersDescriptor) => Promise<VCLOffers>;
|
|
45
|
+
checkForOffers: (generateOffersDescriptor: VCLGenerateOffersDescriptor, token: VCLToken) => Promise<VCLOffers>;
|
|
46
|
+
finalizeOffers: (finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, token: VCLToken) => Promise<VCLJwtVerifiableCredentials>;
|
|
47
|
+
getCredentialTypesUIFormSchema: (credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor) => Promise<VCLCredentialTypesUIFormSchema>;
|
|
48
|
+
getVerifiedProfile: (verifiedProfileDescriptor: VCLVerifiedProfileDescriptor) => Promise<VCLVerifiedProfile>;
|
|
49
|
+
verifyJwt: (jwt: VCLJwt, jwkPublic: VCLJwkPublic) => Promise<boolean>;
|
|
50
|
+
generateSignedJwt: (jwtDescriptor: VCLJwtDescriptor) => Promise<VCLJwt>;
|
|
51
|
+
generateDidJwk: () => Promise<VCLDidJwk>;
|
|
52
52
|
};
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Copyright 2022 Velocity Career Labs inc.
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { VCLJwt } from './VCLJwt';
|
|
8
8
|
export interface VCLCredentialManifest {
|
|
9
|
-
jwt:
|
|
9
|
+
jwt: VCLJwt;
|
|
10
10
|
iss: string;
|
|
11
11
|
did: string;
|
|
12
12
|
exchangeId: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Michael Avoyan.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
export declare class VCLError extends Error {
|
|
8
|
+
description?: string;
|
|
9
|
+
code?: number;
|
|
10
|
+
constructor(error: any);
|
|
11
|
+
}
|
|
12
|
+
export declare const toVclError: (error: any) => VCLError;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Copyright 2022 Velocity Career Labs inc.
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { VCLJwt } from './VCLJwt';
|
|
8
8
|
import type { VCLJwkPublic } from './VCLJwkPublic';
|
|
9
9
|
export interface VCLPresentationRequest {
|
|
10
10
|
exchangeId: string;
|
|
11
|
-
jwt:
|
|
11
|
+
jwt: VCLJwt;
|
|
12
12
|
jwkPublic: VCLJwkPublic;
|
|
13
13
|
keyID: string;
|
|
14
14
|
presentationDefinitionId: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright 2022 Velocity Career Labs inc.
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { VclApi } from './api/VCLApi';
|
|
8
8
|
import type { VCLEnvironment } from './api/VCLEnvironment';
|
|
9
9
|
import { VCLEnvTypes } from './api/VCLEnvironment';
|
|
10
10
|
import type { VCLCountry } from './api/entities/VCLCountry';
|
|
@@ -18,6 +18,7 @@ import type { VCLCredentialManifestDescriptorByDeepLink } from './api/entities/V
|
|
|
18
18
|
import type { VCLCredentialManifestDescriptorByService } from './api/entities/VCLCredentialManifestDescriptorByService';
|
|
19
19
|
import type { VCLCredentialManifestDescriptorRefresh } from './api/entities/VCLCredentialManifestDescriptorRefresh';
|
|
20
20
|
import type { VCLCredentialType } from './api/entities/VCLCredentialType';
|
|
21
|
+
import type { VCLCredentialTypes } from './api/entities/VCLCredentialTypes';
|
|
21
22
|
import type { VCLCredentialTypeSchema } from './api/entities/VCLCredentialTypeSchema';
|
|
22
23
|
import type { VCLCredentialTypeSchemas } from './api/entities/VCLCredentialTypeSchemas';
|
|
23
24
|
import type { VCLCredentialTypesUIFormSchemaDescriptor } from './api/entities/VCLCredentialTypesUIFormSchemaDescriptor';
|
|
@@ -28,7 +29,7 @@ import type { VCLExchangeDescriptor } from './api/entities/VCLExchangeDescriptor
|
|
|
28
29
|
import type { VCLFilter } from './api/entities/VCLFilter';
|
|
29
30
|
import type { VCLFinalizeOffersDescriptor } from './api/entities/VCLFinalizeOffersDescriptor';
|
|
30
31
|
import type { VCLGenerateOffersDescriptor } from './api/entities/VCLGenerateOffersDescriptor';
|
|
31
|
-
import type {
|
|
32
|
+
import type { VCLJwt } from './api/entities/VCLJwt';
|
|
32
33
|
import type { VCLJwtVerifiableCredentials } from './api/entities/VCLJwtVerifiableCredentials';
|
|
33
34
|
import type { VCLOffers } from './api/entities/VCLOffers';
|
|
34
35
|
import type { VCLOrganization } from './api/entities/VCLOrganization';
|
|
@@ -52,7 +53,7 @@ import type { VCLInitializationDescriptor } from './api/entities/VCLInitializati
|
|
|
52
53
|
import type { VCLPresentationRequestDescriptor } from './api/entities/VCLPresentationRequestDescriptor';
|
|
53
54
|
import type { VCLJwtDescriptor } from './api/entities/VCLJwtDescriptor';
|
|
54
55
|
import type { VCLDidJwk } from './api/entities/VCLDidJwk';
|
|
55
|
-
import
|
|
56
|
-
|
|
57
|
-
export default
|
|
58
|
-
export { Dictionary, VCLEnvironment, VCLEnvTypes, VCLCountry, VCLCountries, VCLCountryCodes, VCLRegion, VCLRegions, VCLCredentialManifest, VCLCredentialManifestDescriptor, VCLCredentialManifestDescriptorByDeepLink, VCLCredentialManifestDescriptorByService, VCLCredentialType, VCLCredentialTypeSchema, VCLCredentialTypeSchemas, VCLCredentialTypesUIFormSchema, VCLCredentialTypesUIFormSchemaDescriptor, VCLCredentialManifestDescriptorRefresh, VCLDeepLink, VCLExchange, VCLExchangeDescriptor, VCLFilter, VCLFinalizeOffersDescriptor, VCLGenerateOffersDescriptor,
|
|
56
|
+
import { VCLErrorCode } from './api/entities/VCLErrorCode';
|
|
57
|
+
import type { VCLError, toVclError } from './api/entities/VCLError';
|
|
58
|
+
export default VclApi;
|
|
59
|
+
export { Dictionary, VCLEnvironment, VCLEnvTypes, VCLCountry, VCLCountries, VCLCountryCodes, VCLRegion, VCLRegions, VCLCredentialManifest, VCLCredentialManifestDescriptor, VCLCredentialManifestDescriptorByDeepLink, VCLCredentialManifestDescriptorByService, VCLCredentialType, VCLCredentialTypes, VCLCredentialTypeSchema, VCLCredentialTypeSchemas, VCLCredentialTypesUIFormSchema, VCLCredentialTypesUIFormSchemaDescriptor, VCLCredentialManifestDescriptorRefresh, VCLDeepLink, VCLExchange, VCLExchangeDescriptor, VCLFilter, VCLFinalizeOffersDescriptor, VCLGenerateOffersDescriptor, VCLJwt, VCLJwtVerifiableCredentials, VCLOffers, VCLOrganization, VCLOrganizations, VCLOrganizationsSearchDescriptor, VCLPage, VCLPresentationRequest, VCLPresentationSubmission, VCLJwkPublic, VCLPushDelegate, VCLService, VCLServiceCredentialAgentIssuer, VCLServiceType, VCLSubmissionResult, VCLToken, VCLVerifiableCredential, VCLVerifiedProfile, VCLVerifiedProfileDescriptor, VCLInitializationDescriptor, VCLPresentationRequestDescriptor, VCLJwtDescriptor, VCLDidJwk, VCLErrorCode, VCLError, toVclError, };
|
package/package.json
CHANGED
package/src/api/VCLApi.ts
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
import type { VCLCredentialManifest } from './entities/VCLCredentialManifest';
|
|
9
9
|
import type { VCLCredentialManifestDescriptor } from './entities/VCLCredentialManifestDescriptor';
|
|
10
|
-
import type { VCLCredentialType } from './entities/VCLCredentialType';
|
|
11
10
|
import type { VCLCredentialTypeSchemas } from './entities/VCLCredentialTypeSchemas';
|
|
12
11
|
import type { VCLCredentialTypesUIFormSchema } from './entities/VCLCredentialTypesUIFormSchema';
|
|
13
12
|
import type { VCLCredentialTypesUIFormSchemaDescriptor } from './entities/VCLCredentialTypesUIFormSchemaDescriptor';
|
|
@@ -15,7 +14,7 @@ import type { VCLExchange } from './entities/VCLExchange';
|
|
|
15
14
|
import type { VCLExchangeDescriptor } from './entities/VCLExchangeDescriptor';
|
|
16
15
|
import type { VCLFinalizeOffersDescriptor } from './entities/VCLFinalizeOffersDescriptor';
|
|
17
16
|
import type { VCLGenerateOffersDescriptor } from './entities/VCLGenerateOffersDescriptor';
|
|
18
|
-
import type {
|
|
17
|
+
import type { VCLJwt } from './entities/VCLJwt';
|
|
19
18
|
import type { VCLJwtVerifiableCredentials } from './entities/VCLJwtVerifiableCredentials';
|
|
20
19
|
import type { VCLOffers } from './entities/VCLOffers';
|
|
21
20
|
import type { VCLOrganizations } from './entities/VCLOrganizations';
|
|
@@ -31,62 +30,187 @@ import type { VCLInitializationDescriptor } from './entities/VCLInitializationDe
|
|
|
31
30
|
import type { VCLSubmissionResult } from './entities/VCLSubmissionResult';
|
|
32
31
|
import type { VCLPresentationRequestDescriptor } from './entities/VCLPresentationRequestDescriptor';
|
|
33
32
|
import type { VCLJwtDescriptor } from './entities/VCLJwtDescriptor';
|
|
34
|
-
import type { VCLDidJwk } from '
|
|
33
|
+
import type { VCLDidJwk } from './entities/VCLDidJwk';
|
|
34
|
+
import { toVclError } from './entities/VCLError';
|
|
35
|
+
import type { VCLCredentialTypes } from './entities/VCLCredentialTypes';
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
initializationDescriptor: VCLInitializationDescriptor
|
|
39
|
-
): Promise<void>;
|
|
40
|
-
|
|
41
|
-
getCountries(): Promise<VCLCountries>;
|
|
42
|
-
getCredentialTypeSchemas(): Promise<VCLCredentialTypeSchemas>;
|
|
43
|
-
getCredentialTypes(): Promise<Array<VCLCredentialType>>;
|
|
37
|
+
import { NativeModules } from 'react-native';
|
|
38
|
+
const { VclReactNative } = NativeModules;
|
|
44
39
|
|
|
45
|
-
|
|
40
|
+
export const VclApi = {
|
|
41
|
+
initialize: async (
|
|
42
|
+
initializationDescriptor: VCLInitializationDescriptor
|
|
43
|
+
): Promise<void> => {
|
|
44
|
+
try {
|
|
45
|
+
return await VclReactNative.initialize(initializationDescriptor);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
throw toVclError(e);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
getCountries: async (): Promise<VCLCountries> => {
|
|
52
|
+
try {
|
|
53
|
+
return await VclReactNative.getCountries();
|
|
54
|
+
} catch (e) {
|
|
55
|
+
throw toVclError(e);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
getCredentialTypes: async (): Promise<VCLCredentialTypes> => {
|
|
60
|
+
try {
|
|
61
|
+
return await VclReactNative.getCredentialTypes();
|
|
62
|
+
} catch (e) {
|
|
63
|
+
throw toVclError(e);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
getCredentialTypeSchemas: async (): Promise<VCLCredentialTypeSchemas> => {
|
|
68
|
+
try {
|
|
69
|
+
return await VclReactNative.getCredentialTypeSchemas();
|
|
70
|
+
} catch (e) {
|
|
71
|
+
throw toVclError(e);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
getPresentationRequest: async (
|
|
46
76
|
presentationRequestDescriptor: VCLPresentationRequestDescriptor
|
|
47
|
-
): Promise<VCLPresentationRequest
|
|
48
|
-
|
|
49
|
-
|
|
77
|
+
): Promise<VCLPresentationRequest> => {
|
|
78
|
+
try {
|
|
79
|
+
return await VclReactNative.getPresentationRequest(
|
|
80
|
+
presentationRequestDescriptor
|
|
81
|
+
);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
throw toVclError(e);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
submitPresentation: async (
|
|
50
88
|
presentationSubmission: VCLPresentationSubmission
|
|
51
|
-
): Promise<VCLSubmissionResult
|
|
52
|
-
|
|
53
|
-
|
|
89
|
+
): Promise<VCLSubmissionResult> => {
|
|
90
|
+
try {
|
|
91
|
+
return await VclReactNative.submitPresentation(presentationSubmission);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
throw toVclError(e);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
getExchangeProgress: async (
|
|
54
98
|
exchangeDescriptor: VCLExchangeDescriptor
|
|
55
|
-
): Promise<VCLExchange
|
|
56
|
-
|
|
57
|
-
|
|
99
|
+
): Promise<VCLExchange> => {
|
|
100
|
+
try {
|
|
101
|
+
return await VclReactNative.getExchangeProgress(exchangeDescriptor);
|
|
102
|
+
} catch (e) {
|
|
103
|
+
throw toVclError(e);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
searchForOrganizations: async (
|
|
58
108
|
organizationsSearchDescriptor: VCLOrganizationsSearchDescriptor
|
|
59
|
-
): Promise<VCLOrganizations
|
|
60
|
-
|
|
61
|
-
|
|
109
|
+
): Promise<VCLOrganizations> => {
|
|
110
|
+
try {
|
|
111
|
+
return await VclReactNative.searchForOrganizations(
|
|
112
|
+
organizationsSearchDescriptor
|
|
113
|
+
);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
throw toVclError(e);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
getCredentialManifest: async (
|
|
62
120
|
credentialManifestDescriptor: VCLCredentialManifestDescriptor
|
|
63
|
-
): Promise<VCLCredentialManifest
|
|
64
|
-
|
|
65
|
-
|
|
121
|
+
): Promise<VCLCredentialManifest> => {
|
|
122
|
+
try {
|
|
123
|
+
return await VclReactNative.getCredentialManifest(
|
|
124
|
+
credentialManifestDescriptor
|
|
125
|
+
);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
throw toVclError(e);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
generateOffers: async (
|
|
66
132
|
generateOffersDescriptor: VCLGenerateOffersDescriptor
|
|
67
|
-
): Promise<VCLOffers
|
|
68
|
-
|
|
69
|
-
|
|
133
|
+
): Promise<VCLOffers> => {
|
|
134
|
+
try {
|
|
135
|
+
return await VclReactNative.generateOffers(generateOffersDescriptor);
|
|
136
|
+
} catch (e) {
|
|
137
|
+
throw toVclError(e);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
checkForOffers: async (
|
|
70
142
|
generateOffersDescriptor: VCLGenerateOffersDescriptor,
|
|
71
143
|
token: VCLToken
|
|
72
|
-
): Promise<VCLOffers
|
|
73
|
-
|
|
74
|
-
|
|
144
|
+
): Promise<VCLOffers> => {
|
|
145
|
+
try {
|
|
146
|
+
return await VclReactNative.checkForOffers(
|
|
147
|
+
generateOffersDescriptor,
|
|
148
|
+
token
|
|
149
|
+
);
|
|
150
|
+
} catch (e) {
|
|
151
|
+
throw toVclError(e);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
finalizeOffers: async (
|
|
75
156
|
finalizeOffersDescriptor: VCLFinalizeOffersDescriptor,
|
|
76
157
|
token: VCLToken
|
|
77
|
-
): Promise<VCLJwtVerifiableCredentials
|
|
78
|
-
|
|
79
|
-
|
|
158
|
+
): Promise<VCLJwtVerifiableCredentials> => {
|
|
159
|
+
try {
|
|
160
|
+
return await VclReactNative.finalizeOffers(
|
|
161
|
+
finalizeOffersDescriptor,
|
|
162
|
+
token
|
|
163
|
+
);
|
|
164
|
+
} catch (e) {
|
|
165
|
+
throw toVclError(e);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
getCredentialTypesUIFormSchema: async (
|
|
80
170
|
credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor
|
|
81
|
-
): Promise<VCLCredentialTypesUIFormSchema
|
|
82
|
-
|
|
83
|
-
|
|
171
|
+
): Promise<VCLCredentialTypesUIFormSchema> => {
|
|
172
|
+
try {
|
|
173
|
+
return await VclReactNative.getCredentialTypesUIFormSchema(
|
|
174
|
+
credentialTypesUIFormSchemaDescriptor
|
|
175
|
+
);
|
|
176
|
+
} catch (e) {
|
|
177
|
+
throw toVclError(e);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
getVerifiedProfile: async (
|
|
84
182
|
verifiedProfileDescriptor: VCLVerifiedProfileDescriptor
|
|
85
|
-
): Promise<VCLVerifiedProfile
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
183
|
+
): Promise<VCLVerifiedProfile> => {
|
|
184
|
+
try {
|
|
185
|
+
return await VclReactNative.getVerifiedProfile(verifiedProfileDescriptor);
|
|
186
|
+
} catch (e) {
|
|
187
|
+
throw toVclError(e);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
verifyJwt: async (jwt: VCLJwt, jwkPublic: VCLJwkPublic): Promise<boolean> => {
|
|
192
|
+
try {
|
|
193
|
+
return await VclReactNative.verifyJwt(jwt, jwkPublic);
|
|
194
|
+
} catch (e) {
|
|
195
|
+
throw toVclError(e);
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
generateSignedJwt: async (
|
|
200
|
+
jwtDescriptor: VCLJwtDescriptor
|
|
201
|
+
): Promise<VCLJwt> => {
|
|
202
|
+
try {
|
|
203
|
+
return await VclReactNative.generateSignedJwt(jwtDescriptor);
|
|
204
|
+
} catch (e) {
|
|
205
|
+
throw toVclError(e);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
generateDidJwk: async (): Promise<VCLDidJwk> => {
|
|
210
|
+
try {
|
|
211
|
+
return await VclReactNative.generateDidJwk();
|
|
212
|
+
} catch (e) {
|
|
213
|
+
throw toVclError(e);
|
|
214
|
+
}
|
|
215
|
+
},
|
|
92
216
|
};
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { VCLJwt } from './VCLJwt';
|
|
9
9
|
|
|
10
10
|
export interface VCLCredentialManifest {
|
|
11
|
-
jwt:
|
|
11
|
+
jwt: VCLJwt;
|
|
12
12
|
iss: string;
|
|
13
13
|
did: string;
|
|
14
14
|
exchangeId: string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Michael Avoyan.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export class VCLError extends Error {
|
|
9
|
+
description?: string;
|
|
10
|
+
code?: number;
|
|
11
|
+
|
|
12
|
+
constructor(error: any) {
|
|
13
|
+
super(error);
|
|
14
|
+
try {
|
|
15
|
+
const errorJson = JSON.parse(error.message);
|
|
16
|
+
this.description = errorJson.description;
|
|
17
|
+
this.code = parseInt(errorJson.code, 10);
|
|
18
|
+
} catch (e) {}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const toVclError = (error: any) => {
|
|
23
|
+
return new VCLError(error);
|
|
24
|
+
};
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { VCLJwt } from './VCLJwt';
|
|
9
9
|
import type { VCLJwkPublic } from './VCLJwkPublic';
|
|
10
10
|
|
|
11
11
|
export interface VCLPresentationRequest {
|
|
12
12
|
exchangeId: string;
|
|
13
|
-
jwt:
|
|
13
|
+
jwt: VCLJwt;
|
|
14
14
|
jwkPublic: VCLJwkPublic;
|
|
15
15
|
keyID: string;
|
|
16
16
|
presentationDefinitionId: string;
|
package/src/index.tsx
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import type { VclApi } from './api/VCLApi';
|
|
8
|
+
import { VclApi } from './api/VCLApi';
|
|
10
9
|
import type { VCLEnvironment } from './api/VCLEnvironment';
|
|
11
10
|
import { VCLEnvTypes } from './api/VCLEnvironment';
|
|
12
11
|
import type { VCLCountry } from './api/entities/VCLCountry';
|
|
@@ -20,6 +19,7 @@ import type { VCLCredentialManifestDescriptorByDeepLink } from './api/entities/V
|
|
|
20
19
|
import type { VCLCredentialManifestDescriptorByService } from './api/entities/VCLCredentialManifestDescriptorByService';
|
|
21
20
|
import type { VCLCredentialManifestDescriptorRefresh } from './api/entities/VCLCredentialManifestDescriptorRefresh';
|
|
22
21
|
import type { VCLCredentialType } from './api/entities/VCLCredentialType';
|
|
22
|
+
import type { VCLCredentialTypes } from './api/entities/VCLCredentialTypes';
|
|
23
23
|
import type { VCLCredentialTypeSchema } from './api/entities/VCLCredentialTypeSchema';
|
|
24
24
|
import type { VCLCredentialTypeSchemas } from './api/entities/VCLCredentialTypeSchemas';
|
|
25
25
|
import type { VCLCredentialTypesUIFormSchemaDescriptor } from './api/entities/VCLCredentialTypesUIFormSchemaDescriptor';
|
|
@@ -30,7 +30,7 @@ import type { VCLExchangeDescriptor } from './api/entities/VCLExchangeDescriptor
|
|
|
30
30
|
import type { VCLFilter } from './api/entities/VCLFilter';
|
|
31
31
|
import type { VCLFinalizeOffersDescriptor } from './api/entities/VCLFinalizeOffersDescriptor';
|
|
32
32
|
import type { VCLGenerateOffersDescriptor } from './api/entities/VCLGenerateOffersDescriptor';
|
|
33
|
-
import type {
|
|
33
|
+
import type { VCLJwt } from './api/entities/VCLJwt';
|
|
34
34
|
import type { VCLJwtVerifiableCredentials } from './api/entities/VCLJwtVerifiableCredentials';
|
|
35
35
|
import type { VCLOffers } from './api/entities/VCLOffers';
|
|
36
36
|
import type { VCLOrganization } from './api/entities/VCLOrganization';
|
|
@@ -54,11 +54,10 @@ import type { VCLInitializationDescriptor } from './api/entities/VCLInitializati
|
|
|
54
54
|
import type { VCLPresentationRequestDescriptor } from './api/entities/VCLPresentationRequestDescriptor';
|
|
55
55
|
import type { VCLJwtDescriptor } from './api/entities/VCLJwtDescriptor';
|
|
56
56
|
import type { VCLDidJwk } from './api/entities/VCLDidJwk';
|
|
57
|
-
import
|
|
57
|
+
import { VCLErrorCode } from './api/entities/VCLErrorCode';
|
|
58
|
+
import type { VCLError, toVclError } from './api/entities/VCLError';
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export default VclReactNative as VclApi;
|
|
60
|
+
export default VclApi;
|
|
62
61
|
export {
|
|
63
62
|
Dictionary,
|
|
64
63
|
VCLEnvironment,
|
|
@@ -73,6 +72,7 @@ export {
|
|
|
73
72
|
VCLCredentialManifestDescriptorByDeepLink,
|
|
74
73
|
VCLCredentialManifestDescriptorByService,
|
|
75
74
|
VCLCredentialType,
|
|
75
|
+
VCLCredentialTypes,
|
|
76
76
|
VCLCredentialTypeSchema,
|
|
77
77
|
VCLCredentialTypeSchemas,
|
|
78
78
|
VCLCredentialTypesUIFormSchema,
|
|
@@ -84,7 +84,7 @@ export {
|
|
|
84
84
|
VCLFilter,
|
|
85
85
|
VCLFinalizeOffersDescriptor,
|
|
86
86
|
VCLGenerateOffersDescriptor,
|
|
87
|
-
|
|
87
|
+
VCLJwt,
|
|
88
88
|
VCLJwtVerifiableCredentials,
|
|
89
89
|
VCLOffers,
|
|
90
90
|
VCLOrganization,
|
|
@@ -108,4 +108,6 @@ export {
|
|
|
108
108
|
VCLJwtDescriptor,
|
|
109
109
|
VCLDidJwk,
|
|
110
110
|
VCLErrorCode,
|
|
111
|
+
VCLError,
|
|
112
|
+
toVclError,
|
|
111
113
|
};
|