@velocitycareerlabs/vcl-react-native 1.3.1 → 1.4.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.
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/velocitycareerlabs/reactnative/VclReactNativeModule.kt +27 -12
- package/android/src/main/java/io/velocitycareerlabs/reactnative/extensions/MapExtensions.kt +15 -1
- package/android/src/main/java/io/velocitycareerlabs/reactnative/utlis/Converter.kt +28 -10
- package/ios/Utils/Converter.swift +30 -12
- package/ios/VclReactNative.m +5 -4
- package/ios/VclReactNative.swift +19 -10
- package/lib/commonjs/api/entities/VCLDidJwk.js +2 -0
- package/lib/commonjs/api/entities/{VCLPublicKey.js.map → VCLDidJwk.js.map} +0 -0
- package/lib/commonjs/api/entities/VCLErrorCode.js +21 -0
- package/lib/commonjs/api/entities/VCLErrorCode.js.map +1 -0
- package/lib/commonjs/api/entities/VCLJwkPublic.js +2 -0
- package/lib/{module/api/entities/VCLPublicKey.js.map → commonjs/api/entities/VCLJwkPublic.js.map} +0 -0
- package/lib/commonjs/api/entities/VCLJwtDescriptor.js +6 -0
- package/lib/commonjs/api/entities/VCLJwtDescriptor.js.map +1 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/api/entities/VCLDidJwk.js +2 -0
- package/lib/module/api/entities/VCLDidJwk.js.map +1 -0
- package/lib/module/api/entities/VCLErrorCode.js +13 -0
- package/lib/module/api/entities/VCLErrorCode.js.map +1 -0
- package/lib/module/api/entities/VCLJwkPublic.js +2 -0
- package/lib/module/api/entities/VCLJwkPublic.js.map +1 -0
- package/lib/module/api/entities/VCLJwtDescriptor.js +2 -0
- package/lib/module/api/entities/VCLJwtDescriptor.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/api/VCLApi.d.ts +6 -4
- package/lib/typescript/api/entities/{VCLPublicKey.d.ts → VCLDidJwk.d.ts} +2 -2
- package/lib/typescript/api/entities/VCLErrorCode.d.ts +10 -0
- package/lib/typescript/api/entities/VCLJwkPublic.d.ts +9 -0
- package/lib/typescript/api/entities/VCLJwtDescriptor.d.ts +12 -0
- package/lib/typescript/api/entities/VCLPresentationRequest.d.ts +2 -2
- package/lib/typescript/index.d.ts +5 -2
- package/package.json +1 -1
- package/src/api/VCLApi.ts +7 -8
- package/src/api/entities/{VCLPublicKey.ts → VCLDidJwk.ts} +2 -2
- package/src/api/entities/VCLErrorCode.ts +11 -0
- package/src/api/entities/VCLJwkPublic.ts +10 -0
- package/src/api/entities/VCLJwtDescriptor.ts +14 -0
- package/src/api/entities/VCLPresentationRequest.ts +2 -2
- package/src/index.tsx +8 -2
- package/vcl-react-native.podspec +1 -1
- package/lib/commonjs/api/entities/VCLPublicKey.js +0 -2
- package/lib/module/api/entities/VCLPublicKey.js +0 -2
package/android/build.gradle
CHANGED
|
@@ -29,15 +29,16 @@ import io.velocitycareerlabs.reactnative.utlis.Converter.mapToFinalizedOffersDes
|
|
|
29
29
|
import io.velocitycareerlabs.reactnative.utlis.Converter.mapToGenerateOffersDescriptor
|
|
30
30
|
import io.velocitycareerlabs.reactnative.utlis.Converter.mapToJwt
|
|
31
31
|
import io.velocitycareerlabs.reactnative.utlis.Converter.mapToOrganizationsSearchDescriptor
|
|
32
|
-
import io.velocitycareerlabs.reactnative.utlis.Converter.
|
|
32
|
+
import io.velocitycareerlabs.reactnative.utlis.Converter.mapToJwkPublic
|
|
33
33
|
import io.velocitycareerlabs.reactnative.utlis.Converter.mapToToken
|
|
34
34
|
import io.velocitycareerlabs.reactnative.utlis.Converter.mapToVerifiedProfileDescriptor
|
|
35
35
|
import io.velocitycareerlabs.reactnative.utlis.Converter.verifiedProfileToMap
|
|
36
36
|
import io.velocitycareerlabs.api.VCLProvider
|
|
37
37
|
import io.velocitycareerlabs.api.entities.VCLError
|
|
38
38
|
import io.velocitycareerlabs.reactnative.extensions.toThrowable
|
|
39
|
+
import io.velocitycareerlabs.reactnative.utlis.Converter.didJwkToMap
|
|
39
40
|
import io.velocitycareerlabs.reactnative.utlis.Converter.mapToInitializationDescriptor
|
|
40
|
-
import
|
|
41
|
+
import io.velocitycareerlabs.reactnative.utlis.Converter.mapToJwtDescriptor
|
|
41
42
|
import java.lang.Exception
|
|
42
43
|
|
|
43
44
|
/**
|
|
@@ -188,7 +189,7 @@ class VclReactNativeModule(private val reactContext: ReactApplicationContext) :
|
|
|
188
189
|
promise: Promise
|
|
189
190
|
) {
|
|
190
191
|
try {
|
|
191
|
-
mapToCredentialManifestDescriptor(credentialManifestDescriptorMap)?.let{ credentialManifestDescriptor ->
|
|
192
|
+
mapToCredentialManifestDescriptor(credentialManifestDescriptorMap)?.let { credentialManifestDescriptor ->
|
|
192
193
|
vcl.getCredentialManifest(credentialManifestDescriptor,
|
|
193
194
|
{
|
|
194
195
|
promise.resolve(credentialManifestToMap(it))
|
|
@@ -196,7 +197,8 @@ class VclReactNativeModule(private val reactContext: ReactApplicationContext) :
|
|
|
196
197
|
{
|
|
197
198
|
promise.reject(it.toThrowable())
|
|
198
199
|
})
|
|
199
|
-
}
|
|
200
|
+
}
|
|
201
|
+
?: promise.reject(VCLError("Unexpected Credential Credential Manifest Descriptor: $credentialManifestDescriptorMap"))
|
|
200
202
|
} catch (ex: Exception) {
|
|
201
203
|
promise.reject(VCLError(ex.message))
|
|
202
204
|
}
|
|
@@ -304,11 +306,11 @@ class VclReactNativeModule(private val reactContext: ReactApplicationContext) :
|
|
|
304
306
|
@ReactMethod
|
|
305
307
|
fun verifyJwt(
|
|
306
308
|
jwtMap: ReadableMap,
|
|
307
|
-
|
|
309
|
+
jwkPublicMap: ReadableMap,
|
|
308
310
|
promise: Promise
|
|
309
311
|
) {
|
|
310
312
|
try {
|
|
311
|
-
vcl.verifyJwt(mapToJwt(jwtMap),
|
|
313
|
+
vcl.verifyJwt(mapToJwt(jwtMap), mapToJwkPublic(jwkPublicMap),
|
|
312
314
|
{
|
|
313
315
|
promise.resolve(it)
|
|
314
316
|
},
|
|
@@ -322,15 +324,11 @@ class VclReactNativeModule(private val reactContext: ReactApplicationContext) :
|
|
|
322
324
|
|
|
323
325
|
@ReactMethod
|
|
324
326
|
fun generateSignedJwt(
|
|
325
|
-
|
|
326
|
-
iss: String,
|
|
327
|
-
jti: String,
|
|
327
|
+
jwtDescriptorMap: ReadableMap,
|
|
328
328
|
promise: Promise
|
|
329
329
|
) {
|
|
330
|
-
var json: JSONObject? = null
|
|
331
330
|
try {
|
|
332
|
-
|
|
333
|
-
vcl.generateSignedJwt(json, iss, jti,
|
|
331
|
+
vcl.generateSignedJwt(mapToJwtDescriptor(jwtDescriptorMap),
|
|
334
332
|
{
|
|
335
333
|
promise.resolve(Converter.jwtToMap(it))
|
|
336
334
|
},
|
|
@@ -341,5 +339,22 @@ class VclReactNativeModule(private val reactContext: ReactApplicationContext) :
|
|
|
341
339
|
promise.reject(VCLError(e.message))
|
|
342
340
|
}
|
|
343
341
|
}
|
|
342
|
+
|
|
343
|
+
@ReactMethod
|
|
344
|
+
fun generateDidJwk(
|
|
345
|
+
promise: Promise
|
|
346
|
+
) {
|
|
347
|
+
try {
|
|
348
|
+
vcl.generateDidJwk(
|
|
349
|
+
{
|
|
350
|
+
promise.resolve(didJwkToMap(it))
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
promise.reject(it.toThrowable())
|
|
354
|
+
})
|
|
355
|
+
} catch (e: Exception) {
|
|
356
|
+
promise.reject(VCLError(e.message))
|
|
357
|
+
}
|
|
358
|
+
}
|
|
344
359
|
}
|
|
345
360
|
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* Copyright 2022 Velocity Career Labs inc.
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
package io.velocitycareerlabs.reactnative.extensions
|
|
9
9
|
|
|
10
10
|
import com.facebook.react.bridge.ReadableArray
|
|
11
11
|
import com.facebook.react.bridge.ReadableMap
|
|
12
12
|
import com.facebook.react.bridge.WritableMap
|
|
13
|
+
import org.json.JSONObject
|
|
13
14
|
import java.lang.Exception
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -94,3 +95,16 @@ fun WritableMap.getMapOpt(key: String): ReadableMap? {
|
|
|
94
95
|
return (this as ReadableMap).getMapOpt(key)
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
fun ReadableMap.toJsonObject(): JSONObject {
|
|
99
|
+
return try {
|
|
100
|
+
JSONObject(this.toHashMap())
|
|
101
|
+
} catch (e: Exception) {
|
|
102
|
+
e.printStackTrace()
|
|
103
|
+
JSONObject("{}")
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
fun WritableMap.toJsonObject(): JSONObject {
|
|
108
|
+
return (this as ReadableMap).toJsonObject()
|
|
109
|
+
}
|
|
110
|
+
|
|
@@ -160,7 +160,7 @@ object Converter {
|
|
|
160
160
|
presentationRequestMap: ReadableMap?
|
|
161
161
|
) = VCLPresentationRequest(
|
|
162
162
|
mapToJwt(presentationRequestMap?.getMapOpt("jwt")),
|
|
163
|
-
|
|
163
|
+
mapToJwkPublic(presentationRequestMap?.getMapOpt("jwkPublic")),
|
|
164
164
|
mapToDeepLink(presentationRequestMap?.getMapOpt("deepLink"))
|
|
165
165
|
)
|
|
166
166
|
|
|
@@ -172,8 +172,8 @@ object Converter {
|
|
|
172
172
|
jwtMap.putString("encodedJwt", presentationRequest.jwt.signedJwt.serialize())
|
|
173
173
|
presentationRequestMap.putMap("jwt", jwtMap)
|
|
174
174
|
val jwkMap = Arguments.createMap()
|
|
175
|
-
jwkMap.putString("
|
|
176
|
-
presentationRequestMap.putMap("
|
|
175
|
+
jwkMap.putString("valueStr", presentationRequest.jwkPublic.valueStr)
|
|
176
|
+
presentationRequestMap.putMap("jwkPublic", jwkMap)
|
|
177
177
|
presentationRequestMap.putString("iss", presentationRequest.iss)
|
|
178
178
|
presentationRequestMap.putString("exchangeId", presentationRequest.exchangeId)
|
|
179
179
|
presentationRequestMap.putString(
|
|
@@ -215,7 +215,8 @@ object Converter {
|
|
|
215
215
|
VCLIdentificationSubmissionResult.KeyToken, tokenToMap(presentationSubmissionResult.token)
|
|
216
216
|
)
|
|
217
217
|
presentationSubmissionResultMap.putMap(
|
|
218
|
-
VCLIdentificationSubmissionResult.KeyExchange,
|
|
218
|
+
VCLIdentificationSubmissionResult.KeyExchange,
|
|
219
|
+
exchangeToMap(presentationSubmissionResult.exchange)
|
|
219
220
|
)
|
|
220
221
|
presentationSubmissionResultMap.putString(
|
|
221
222
|
VCLIdentificationSubmissionResult.KeyJti, presentationSubmissionResult.jti
|
|
@@ -383,7 +384,8 @@ object Converter {
|
|
|
383
384
|
fun mapToCredentialManifestDescriptorByService(
|
|
384
385
|
credentialManifestDescriptorByServiceMap: ReadableMap
|
|
385
386
|
): VCLCredentialManifestDescriptorByService {
|
|
386
|
-
val pushDelegate =
|
|
387
|
+
val pushDelegate =
|
|
388
|
+
mapToPushDelegate(credentialManifestDescriptorByServiceMap.getMapOpt("pushDelegate"))
|
|
387
389
|
return VCLCredentialManifestDescriptorByService(
|
|
388
390
|
service = mapToServiceCredentialAgentIssuer(
|
|
389
391
|
credentialManifestDescriptorByServiceMap.getMapOpt("service")
|
|
@@ -437,7 +439,7 @@ object Converter {
|
|
|
437
439
|
credentialManifestMap: ReadableMap?
|
|
438
440
|
): VCLCredentialManifest {
|
|
439
441
|
val jwt =
|
|
440
|
-
|
|
442
|
+
VCLJwt(encodedJwt = credentialManifestMap?.getMapOpt("jwt")?.getStringOpt("encodedJwt") ?: "")
|
|
441
443
|
val vendorOriginContext: String? = credentialManifestMap?.getStringOpt("vendorOriginContext")
|
|
442
444
|
return VCLCredentialManifest(jwt = jwt, vendorOriginContext = vendorOriginContext)
|
|
443
445
|
}
|
|
@@ -491,10 +493,10 @@ object Converter {
|
|
|
491
493
|
}
|
|
492
494
|
|
|
493
495
|
fun mapToJwt(jwtMap: ReadableMap?) =
|
|
494
|
-
|
|
496
|
+
VCLJwt(encodedJwt = jwtMap?.getStringOpt("encodedJwt") ?: "")
|
|
495
497
|
|
|
496
|
-
fun
|
|
497
|
-
|
|
498
|
+
fun mapToJwkPublic(jwkPublicMap: ReadableMap?) =
|
|
499
|
+
VCLJwkPublic(valueStr = jwkPublicMap?.getStringOpt("valueStr") ?: "")
|
|
498
500
|
|
|
499
501
|
fun mapToFinalizedOffersDescriptor(
|
|
500
502
|
finalizedOffersDescriptorMap: ReadableMap
|
|
@@ -518,7 +520,7 @@ object Converter {
|
|
|
518
520
|
return jwtVerifiableCredentialsMap
|
|
519
521
|
}
|
|
520
522
|
|
|
521
|
-
fun jwtToMap(jwt:
|
|
523
|
+
fun jwtToMap(jwt: VCLJwt): ReadableMap {
|
|
522
524
|
val jwtReadableMap = Arguments.createMap()
|
|
523
525
|
jwtReadableMap.putString("encodedJwt", jwt.signedJwt.serialize())
|
|
524
526
|
return jwtReadableMap
|
|
@@ -548,5 +550,21 @@ object Converter {
|
|
|
548
550
|
verifiedProfileMap.putString("name", verifiedProfile.name)
|
|
549
551
|
return verifiedProfileMap
|
|
550
552
|
}
|
|
553
|
+
|
|
554
|
+
fun mapToJwtDescriptor(
|
|
555
|
+
jwtDescriptorDictionary: ReadableMap
|
|
556
|
+
) = VCLJwtDescriptor(
|
|
557
|
+
payload = jwtDescriptorDictionary.getMapOpt("payload")?.toJsonObject() ?: JSONObject("{}"),
|
|
558
|
+
iss = jwtDescriptorDictionary.getStringOpt("iss") ?: "",
|
|
559
|
+
jti = jwtDescriptorDictionary.getStringOpt("jti") ?: ""
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
fun didJwkToMap(
|
|
563
|
+
didJwk: VCLDidJwk
|
|
564
|
+
): ReadableMap {
|
|
565
|
+
val didJwkMap = Arguments.createMap()
|
|
566
|
+
didJwkMap.putString("value", didJwk.value)
|
|
567
|
+
return didJwkMap
|
|
568
|
+
}
|
|
551
569
|
}
|
|
552
570
|
|
|
@@ -158,7 +158,7 @@ func dictionaryToPresentationRequest(
|
|
|
158
158
|
) -> VCLPresentationRequest {
|
|
159
159
|
return VCLPresentationRequest(
|
|
160
160
|
jwt: dictionaryToJwt(presentationRequestDictionary?["jwt"] as? [String : Any]),
|
|
161
|
-
|
|
161
|
+
jwkPublic: dictionaryToPJwkPublic(presentationRequestDictionary?["jwkPublic"] as? [String: Any]),
|
|
162
162
|
deepLink: dictionaryToDeepLink(presentationRequestDictionary?["deepLink"] as? [String : Any])
|
|
163
163
|
)
|
|
164
164
|
}
|
|
@@ -168,9 +168,9 @@ func presentationRequestToDictionary(
|
|
|
168
168
|
) -> [String: Any] {
|
|
169
169
|
var presentationRequestDictionary = [String: Any]()
|
|
170
170
|
presentationRequestDictionary["jwt"] = ["encodedJwt": presentationRequest.jwt.encodedJwt]
|
|
171
|
-
var
|
|
172
|
-
|
|
173
|
-
presentationRequestDictionary["
|
|
171
|
+
var jwkPublicDictionary = [String: Any]()
|
|
172
|
+
jwkPublicDictionary["valueStr"] = presentationRequest.jwkPublic.valueStr
|
|
173
|
+
presentationRequestDictionary["jwkPublic"] = jwkPublicDictionary
|
|
174
174
|
presentationRequestDictionary["iss"] = presentationRequest.iss
|
|
175
175
|
presentationRequestDictionary["exchangeId"] = presentationRequest.exchangeId
|
|
176
176
|
presentationRequestDictionary["presentationDefinitionId"] = presentationRequest.presentationDefinitionId
|
|
@@ -399,7 +399,7 @@ func credentialManifestToDictionary(
|
|
|
399
399
|
func dictionaryToCredentialManifest(
|
|
400
400
|
_ credentialMAnifestDictionary: [String: Any]?
|
|
401
401
|
) -> VCLCredentialManifest {
|
|
402
|
-
let jwt:
|
|
402
|
+
let jwt: VCLJwt = VCLJwt(encodedJwt: (credentialMAnifestDictionary?["jwt"] as? [String: Any])?["encodedJwt"] as? String ?? "")
|
|
403
403
|
let vendorOriginContext: String? = credentialMAnifestDictionary?["vendorOriginContext"] as? String
|
|
404
404
|
return VCLCredentialManifest(jwt: jwt, vendorOriginContext: vendorOriginContext)
|
|
405
405
|
}
|
|
@@ -448,14 +448,14 @@ func credentialTypesFormSchemaToDictionary(
|
|
|
448
448
|
|
|
449
449
|
func dictionaryToJwt(
|
|
450
450
|
_ jwtDictionary: [String: Any]?
|
|
451
|
-
) ->
|
|
452
|
-
return
|
|
451
|
+
) -> VCLJwt {
|
|
452
|
+
return VCLJwt(encodedJwt: jwtDictionary?["encodedJwt"] as? String ?? "")
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
-
func
|
|
456
|
-
_
|
|
457
|
-
) ->
|
|
458
|
-
return
|
|
455
|
+
func dictionaryToPJwkPublic(
|
|
456
|
+
_ jwkPublicDictionary: [String: Any]?
|
|
457
|
+
) -> VCLJwkPublic {
|
|
458
|
+
return VCLJwkPublic(valueStr: (jwkPublicDictionary?["valueStr"] as? String ?? ""))
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
func dictionaryToFinalizedOffersDescriptor(
|
|
@@ -479,7 +479,7 @@ func jwtVerifiableCredentialsToDictionary(
|
|
|
479
479
|
return jwtVerifiableCredentialsDictionary
|
|
480
480
|
}
|
|
481
481
|
|
|
482
|
-
func jwtToReadableMap(_ jwt:
|
|
482
|
+
func jwtToReadableMap(_ jwt: VCLJwt) -> [String: Any] {
|
|
483
483
|
return ["encodedJwt": jwt.encodedJwt]
|
|
484
484
|
}
|
|
485
485
|
|
|
@@ -514,3 +514,21 @@ func verifiedProfileToDictionary(
|
|
|
514
514
|
verifiedProfileDictionary["name"] = verifiedProfile.name
|
|
515
515
|
return verifiedProfileDictionary
|
|
516
516
|
}
|
|
517
|
+
|
|
518
|
+
func dictionaryToJwtDescriptor(
|
|
519
|
+
_ jwtDescriptorDictionary: [String: Any]
|
|
520
|
+
) -> VCLJwtDescriptor {
|
|
521
|
+
return VCLJwtDescriptor(
|
|
522
|
+
payload: jwtDescriptorDictionary["payload"] as? [String: Any] ?? [String: Any](),
|
|
523
|
+
iss: jwtDescriptorDictionary["iss"] as? String ?? "",
|
|
524
|
+
jti: jwtDescriptorDictionary["jti"] as? String ?? ""
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
func didJwkToDictionary(
|
|
529
|
+
_ didJwk: VCLDidJwk
|
|
530
|
+
) -> [String: Any] {
|
|
531
|
+
var didJwkDictionary = [String: Any]()
|
|
532
|
+
didJwkDictionary["value"] = didJwk.value
|
|
533
|
+
return didJwkDictionary
|
|
534
|
+
}
|
package/ios/VclReactNative.m
CHANGED
|
@@ -64,14 +64,15 @@ RCT_EXTERN_METHOD(getVerifiedProfile:(NSDictionary*)verifiedProfileDescriptorDic
|
|
|
64
64
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
65
65
|
|
|
66
66
|
RCT_EXTERN_METHOD(verifyJwt:(NSDictionary*)jwtDictionary
|
|
67
|
-
|
|
67
|
+
withJwkPublicDictionary:(NSDictionary*)jwkPublicDictionary
|
|
68
68
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
69
69
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
70
70
|
|
|
71
|
-
RCT_EXTERN_METHOD(generateSignedJwt:(NSDictionary*)
|
|
72
|
-
withIss:(NSString*)iss
|
|
73
|
-
withJti:(NSString*)jti
|
|
71
|
+
RCT_EXTERN_METHOD(generateSignedJwt:(NSDictionary*)jwtDescriptorDictionary
|
|
74
72
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
75
73
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
76
74
|
|
|
75
|
+
RCT_EXTERN_METHOD(generateDidJwk:(RCTPromiseResolveBlock)resolve
|
|
76
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
77
|
+
|
|
77
78
|
@end
|
package/ios/VclReactNative.swift
CHANGED
|
@@ -222,15 +222,15 @@ class VclReactNative: NSObject {
|
|
|
222
222
|
})
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
@objc(verifyJwt:
|
|
225
|
+
@objc(verifyJwt:withJwkPublicDictionary:withResolver:withRejecter:)
|
|
226
226
|
func verifyJwt(
|
|
227
227
|
jwtDictionary: [String: Any],
|
|
228
|
-
|
|
228
|
+
jwkPublicDictionary: [String: Any],
|
|
229
229
|
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
230
230
|
) {
|
|
231
231
|
vcl.verifyJwt(
|
|
232
232
|
jwt: dictionaryToJwt(jwtDictionary),
|
|
233
|
-
|
|
233
|
+
jwkPublic: dictionaryToPJwkPublic(jwkPublicDictionary),
|
|
234
234
|
successHandler: {
|
|
235
235
|
resolve($0)
|
|
236
236
|
},
|
|
@@ -239,17 +239,13 @@ class VclReactNative: NSObject {
|
|
|
239
239
|
})
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
@objc(generateSignedJwt:
|
|
242
|
+
@objc(generateSignedJwt:withResolver:withRejecter:)
|
|
243
243
|
func generateSignedJwt(
|
|
244
|
-
|
|
245
|
-
iss: String,
|
|
246
|
-
jti: String,
|
|
244
|
+
jwtDescriptorDictionary: [String: Any],
|
|
247
245
|
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
248
246
|
) {
|
|
249
247
|
vcl.generateSignedJwt(
|
|
250
|
-
|
|
251
|
-
iss: iss,
|
|
252
|
-
jti: jti,
|
|
248
|
+
jwtDescriptor: dictionaryToJwtDescriptor(jwtDescriptorDictionary),
|
|
253
249
|
successHandler: {
|
|
254
250
|
resolve(jwtToReadableMap($0))
|
|
255
251
|
},
|
|
@@ -257,4 +253,17 @@ class VclReactNative: NSObject {
|
|
|
257
253
|
reject(nil, "\($0.toJsonString())", $0)
|
|
258
254
|
})
|
|
259
255
|
}
|
|
256
|
+
|
|
257
|
+
@objc(generateDidJwk:withRejecter:)
|
|
258
|
+
func generateDidJwk(
|
|
259
|
+
resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock
|
|
260
|
+
) {
|
|
261
|
+
vcl.generateDidJwk(
|
|
262
|
+
successHandler: {
|
|
263
|
+
resolve(didJwkToDictionary($0))
|
|
264
|
+
},
|
|
265
|
+
errorHandler: {
|
|
266
|
+
reject(nil, "\($0.toJsonString())", $0)
|
|
267
|
+
})
|
|
268
|
+
}
|
|
260
269
|
}
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VCLErrorCode = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Created by Michael Avoyan.
|
|
10
|
+
*
|
|
11
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
12
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
13
|
+
*/
|
|
14
|
+
let VCLErrorCode;
|
|
15
|
+
exports.VCLErrorCode = VCLErrorCode;
|
|
16
|
+
|
|
17
|
+
(function (VCLErrorCode) {
|
|
18
|
+
VCLErrorCode[VCLErrorCode["NetworkError"] = 1] = "NetworkError";
|
|
19
|
+
VCLErrorCode[VCLErrorCode["VerificationError"] = 403] = "VerificationError";
|
|
20
|
+
})(VCLErrorCode || (exports.VCLErrorCode = VCLErrorCode = {}));
|
|
21
|
+
//# sourceMappingURL=VCLErrorCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VCLErrorCode.ts"],"names":["VCLErrorCode"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;IAEYA,Y;;;WAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;GAAAA,Y,4BAAAA,Y","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport enum VCLErrorCode {\n NetworkError = 1,\n VerificationError = 403,\n}\n"]}
|
package/lib/{module/api/entities/VCLPublicKey.js.map → commonjs/api/entities/VCLJwkPublic.js.map}
RENAMED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["VclReactNative","NativeModules"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOA;;AAGA;;AAGA;;AAgCA;;AA7CA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["VclReactNative","NativeModules"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAOA;;AAGA;;AAGA;;AAgCA;;AA7CA;AACA;AACA;AACA;AACA;AACA;AAqDA,MAAM;AAAEA,EAAAA;AAAF,IAAqBC,0BAA3B;eAEeD,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 { NativeModules } from 'react-native';\nimport type { 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 { 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 type { VCLErrorCode } from './api/entities/VCLErrorCode';\n\nconst { VclReactNative } = NativeModules;\n\nexport default VclReactNative as 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 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};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Michael Avoyan.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
export let VCLErrorCode;
|
|
8
|
+
|
|
9
|
+
(function (VCLErrorCode) {
|
|
10
|
+
VCLErrorCode[VCLErrorCode["NetworkError"] = 1] = "NetworkError";
|
|
11
|
+
VCLErrorCode[VCLErrorCode["VerificationError"] = 403] = "VerificationError";
|
|
12
|
+
})(VCLErrorCode || (VCLErrorCode = {}));
|
|
13
|
+
//# sourceMappingURL=VCLErrorCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["VCLErrorCode.ts"],"names":["VCLErrorCode"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,WAAYA,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;GAAAA,Y,KAAAA,Y","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport enum VCLErrorCode {\n NetworkError = 1,\n VerificationError = 403,\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["NativeModules","VCLEnvTypes","VCLCountryCodes","VCLServiceType","VclReactNative"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,QAA8B,cAA9B;AAGA,SAASC,WAAT,QAA4B,sBAA5B;AAGA,SAASC,eAAT,QAAgC,6BAAhC;AAgCA,SAASC,cAAT,QAA+B,+BAA/B;
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["NativeModules","VCLEnvTypes","VCLCountryCodes","VCLServiceType","VclReactNative"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,QAA8B,cAA9B;AAGA,SAASC,WAAT,QAA4B,sBAA5B;AAGA,SAASC,eAAT,QAAgC,6BAAhC;AAgCA,SAASC,cAAT,QAA+B,+BAA/B;AAaA,MAAM;AAAEC,EAAAA;AAAF,IAAqBJ,aAA3B;AAEA,eAAeI,cAAf;AACA,SAGEH,WAHF,EAMEC,eANF,EAsCEC,cAtCF","sourcesContent":["/**\n * Created by Michael Avoyan.\n *\n * Copyright 2022 Velocity Career Labs inc.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { NativeModules } from 'react-native';\nimport type { 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 { 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 type { VCLErrorCode } from './api/entities/VCLErrorCode';\n\nconst { VclReactNative } = NativeModules;\n\nexport default VclReactNative as 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 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};\n"]}
|
|
@@ -21,15 +21,16 @@ import type { VCLOrganizations } from './entities/VCLOrganizations';
|
|
|
21
21
|
import type { VCLOrganizationsSearchDescriptor } from './entities/VCLOrganizationsSearchDescriptor';
|
|
22
22
|
import type { VCLPresentationRequest } from './entities/VCLPresentationRequest';
|
|
23
23
|
import type { VCLPresentationSubmission } from './entities/VCLPresentationSubmission';
|
|
24
|
-
import type {
|
|
24
|
+
import type { VCLJwkPublic } from './entities/VCLJwkPublic';
|
|
25
25
|
import type { VCLToken } from './entities/VCLToken';
|
|
26
26
|
import type { VCLVerifiedProfile } from './entities/VCLVerifiedProfile';
|
|
27
27
|
import type { VCLVerifiedProfileDescriptor } from './entities/VCLVerifiedProfileDescriptor';
|
|
28
28
|
import type { VCLCountries } from './entities/VCLCountries';
|
|
29
|
-
import type { Dictionary } from './Dictionary';
|
|
30
29
|
import type { VCLInitializationDescriptor } from './entities/VCLInitializationDescriptor';
|
|
31
30
|
import type { VCLSubmissionResult } from './entities/VCLSubmissionResult';
|
|
32
31
|
import type { VCLPresentationRequestDescriptor } from './entities/VCLPresentationRequestDescriptor';
|
|
32
|
+
import type { VCLJwtDescriptor } from './entities/VCLJwtDescriptor';
|
|
33
|
+
import type { VCLDidJwk } from 'src/api/entities/VCLDidJwk';
|
|
33
34
|
export declare type VclApi = {
|
|
34
35
|
initialize(initializationDescriptor: VCLInitializationDescriptor): Promise<void>;
|
|
35
36
|
getCountries(): Promise<VCLCountries>;
|
|
@@ -45,6 +46,7 @@ export declare type VclApi = {
|
|
|
45
46
|
finalizeOffers(finalizeOffersDescriptor: VCLFinalizeOffersDescriptor, token: VCLToken): Promise<VCLJwtVerifiableCredentials>;
|
|
46
47
|
getCredentialTypesUIFormSchema(credentialTypesUIFormSchemaDescriptor: VCLCredentialTypesUIFormSchemaDescriptor): Promise<VCLCredentialTypesUIFormSchema>;
|
|
47
48
|
getVerifiedProfile(verifiedProfileDescriptor: VCLVerifiedProfileDescriptor): Promise<VCLVerifiedProfile>;
|
|
48
|
-
verifyJwt(jwt: VCLJWT,
|
|
49
|
-
generateSignedJwt(
|
|
49
|
+
verifyJwt(jwt: VCLJWT, jwkPublic: VCLJwkPublic): Promise<boolean>;
|
|
50
|
+
generateSignedJwt(jwtDescriptor: VCLJwtDescriptor): Promise<VCLJWT>;
|
|
51
|
+
generateDidJwk(): Promise<VCLDidJwk>;
|
|
50
52
|
};
|
|
@@ -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
|
+
import type { Dictionary } from '../Dictionary';
|
|
8
|
+
export interface VCLJwtDescriptor {
|
|
9
|
+
payload: Dictionary<any>;
|
|
10
|
+
iss: string;
|
|
11
|
+
jti: string;
|
|
12
|
+
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
*/
|
|
7
7
|
import type { VCLJWT } from './VCLJWT';
|
|
8
|
-
import type {
|
|
8
|
+
import type { VCLJwkPublic } from './VCLJwkPublic';
|
|
9
9
|
export interface VCLPresentationRequest {
|
|
10
10
|
exchangeId: string;
|
|
11
11
|
jwt: VCLJWT;
|
|
12
|
-
|
|
12
|
+
jwkPublic: VCLJwkPublic;
|
|
13
13
|
keyID: string;
|
|
14
14
|
presentationDefinitionId: string;
|
|
15
15
|
iss: string;
|
|
@@ -37,7 +37,7 @@ import type { VCLOrganizationsSearchDescriptor } from './api/entities/VCLOrganiz
|
|
|
37
37
|
import type { VCLPage } from './api/entities/VCLPage';
|
|
38
38
|
import type { VCLPresentationRequest } from './api/entities/VCLPresentationRequest';
|
|
39
39
|
import type { VCLPresentationSubmission } from './api/entities/VCLPresentationSubmission';
|
|
40
|
-
import type {
|
|
40
|
+
import type { VCLJwkPublic } from './api/entities/VCLJwkPublic';
|
|
41
41
|
import type { VCLPushDelegate } from './api/entities/VCLPushDelegate';
|
|
42
42
|
import type { VCLService } from './api/entities/VCLService';
|
|
43
43
|
import type { VCLServiceCredentialAgentIssuer } from './api/entities/VCLServiceCredentialAgentIssuer';
|
|
@@ -50,6 +50,9 @@ import type { VCLVerifiedProfileDescriptor } from './api/entities/VCLVerifiedPro
|
|
|
50
50
|
import type { Dictionary } from './api/Dictionary';
|
|
51
51
|
import type { VCLInitializationDescriptor } from './api/entities/VCLInitializationDescriptor';
|
|
52
52
|
import type { VCLPresentationRequestDescriptor } from './api/entities/VCLPresentationRequestDescriptor';
|
|
53
|
+
import type { VCLJwtDescriptor } from './api/entities/VCLJwtDescriptor';
|
|
54
|
+
import type { VCLDidJwk } from './api/entities/VCLDidJwk';
|
|
55
|
+
import type { VCLErrorCode } from './api/entities/VCLErrorCode';
|
|
53
56
|
declare const _default: VclApi;
|
|
54
57
|
export default _default;
|
|
55
|
-
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, VCLJWT, VCLJwtVerifiableCredentials, VCLOffers, VCLOrganization, VCLOrganizations, VCLOrganizationsSearchDescriptor, VCLPage, VCLPresentationRequest, VCLPresentationSubmission,
|
|
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, VCLJWT, VCLJwtVerifiableCredentials, VCLOffers, VCLOrganization, VCLOrganizations, VCLOrganizationsSearchDescriptor, VCLPage, VCLPresentationRequest, VCLPresentationSubmission, VCLJwkPublic, VCLPushDelegate, VCLService, VCLServiceCredentialAgentIssuer, VCLServiceType, VCLSubmissionResult, VCLToken, VCLVerifiableCredential, VCLVerifiedProfile, VCLVerifiedProfileDescriptor, VCLInitializationDescriptor, VCLPresentationRequestDescriptor, VCLJwtDescriptor, VCLDidJwk, VCLErrorCode, };
|
package/package.json
CHANGED
package/src/api/VCLApi.ts
CHANGED
|
@@ -22,15 +22,16 @@ import type { VCLOrganizations } from './entities/VCLOrganizations';
|
|
|
22
22
|
import type { VCLOrganizationsSearchDescriptor } from './entities/VCLOrganizationsSearchDescriptor';
|
|
23
23
|
import type { VCLPresentationRequest } from './entities/VCLPresentationRequest';
|
|
24
24
|
import type { VCLPresentationSubmission } from './entities/VCLPresentationSubmission';
|
|
25
|
-
import type {
|
|
25
|
+
import type { VCLJwkPublic } from './entities/VCLJwkPublic';
|
|
26
26
|
import type { VCLToken } from './entities/VCLToken';
|
|
27
27
|
import type { VCLVerifiedProfile } from './entities/VCLVerifiedProfile';
|
|
28
28
|
import type { VCLVerifiedProfileDescriptor } from './entities/VCLVerifiedProfileDescriptor';
|
|
29
29
|
import type { VCLCountries } from './entities/VCLCountries';
|
|
30
|
-
import type { Dictionary } from './Dictionary';
|
|
31
30
|
import type { VCLInitializationDescriptor } from './entities/VCLInitializationDescriptor';
|
|
32
31
|
import type { VCLSubmissionResult } from './entities/VCLSubmissionResult';
|
|
33
32
|
import type { VCLPresentationRequestDescriptor } from './entities/VCLPresentationRequestDescriptor';
|
|
33
|
+
import type { VCLJwtDescriptor } from './entities/VCLJwtDescriptor';
|
|
34
|
+
import type { VCLDidJwk } from 'src/api/entities/VCLDidJwk';
|
|
34
35
|
|
|
35
36
|
export type VclApi = {
|
|
36
37
|
initialize(
|
|
@@ -83,11 +84,9 @@ export type VclApi = {
|
|
|
83
84
|
verifiedProfileDescriptor: VCLVerifiedProfileDescriptor
|
|
84
85
|
): Promise<VCLVerifiedProfile>;
|
|
85
86
|
|
|
86
|
-
verifyJwt(jwt: VCLJWT,
|
|
87
|
+
verifyJwt(jwt: VCLJWT, jwkPublic: VCLJwkPublic): Promise<boolean>;
|
|
87
88
|
|
|
88
|
-
generateSignedJwt(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
jti: string
|
|
92
|
-
): Promise<VCLJWT>;
|
|
89
|
+
generateSignedJwt(jwtDescriptor: VCLJwtDescriptor): Promise<VCLJWT>;
|
|
90
|
+
|
|
91
|
+
generateDidJwk(): Promise<VCLDidJwk>;
|
|
93
92
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Michael Avoyan.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022 Velocity Career Labs inc.
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Dictionary } from '../Dictionary';
|
|
9
|
+
|
|
10
|
+
export interface VCLJwtDescriptor {
|
|
11
|
+
payload: Dictionary<any>;
|
|
12
|
+
iss: string;
|
|
13
|
+
jti: string;
|
|
14
|
+
}
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { VCLJWT } from './VCLJWT';
|
|
9
|
-
import type {
|
|
9
|
+
import type { VCLJwkPublic } from './VCLJwkPublic';
|
|
10
10
|
|
|
11
11
|
export interface VCLPresentationRequest {
|
|
12
12
|
exchangeId: string;
|
|
13
13
|
jwt: VCLJWT;
|
|
14
|
-
|
|
14
|
+
jwkPublic: VCLJwkPublic;
|
|
15
15
|
keyID: string;
|
|
16
16
|
presentationDefinitionId: string;
|
|
17
17
|
iss: string;
|
package/src/index.tsx
CHANGED
|
@@ -39,7 +39,7 @@ import type { VCLOrganizationsSearchDescriptor } from './api/entities/VCLOrganiz
|
|
|
39
39
|
import type { VCLPage } from './api/entities/VCLPage';
|
|
40
40
|
import type { VCLPresentationRequest } from './api/entities/VCLPresentationRequest';
|
|
41
41
|
import type { VCLPresentationSubmission } from './api/entities/VCLPresentationSubmission';
|
|
42
|
-
import type {
|
|
42
|
+
import type { VCLJwkPublic } from './api/entities/VCLJwkPublic';
|
|
43
43
|
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';
|
|
@@ -52,6 +52,9 @@ import type { VCLVerifiedProfileDescriptor } from './api/entities/VCLVerifiedPro
|
|
|
52
52
|
import type { Dictionary } from './api/Dictionary';
|
|
53
53
|
import type { VCLInitializationDescriptor } from './api/entities/VCLInitializationDescriptor';
|
|
54
54
|
import type { VCLPresentationRequestDescriptor } from './api/entities/VCLPresentationRequestDescriptor';
|
|
55
|
+
import type { VCLJwtDescriptor } from './api/entities/VCLJwtDescriptor';
|
|
56
|
+
import type { VCLDidJwk } from './api/entities/VCLDidJwk';
|
|
57
|
+
import type { VCLErrorCode } from './api/entities/VCLErrorCode';
|
|
55
58
|
|
|
56
59
|
const { VclReactNative } = NativeModules;
|
|
57
60
|
|
|
@@ -90,7 +93,7 @@ export {
|
|
|
90
93
|
VCLPage,
|
|
91
94
|
VCLPresentationRequest,
|
|
92
95
|
VCLPresentationSubmission,
|
|
93
|
-
|
|
96
|
+
VCLJwkPublic,
|
|
94
97
|
VCLPushDelegate,
|
|
95
98
|
VCLService,
|
|
96
99
|
VCLServiceCredentialAgentIssuer,
|
|
@@ -102,4 +105,7 @@ export {
|
|
|
102
105
|
VCLVerifiedProfileDescriptor,
|
|
103
106
|
VCLInitializationDescriptor,
|
|
104
107
|
VCLPresentationRequestDescriptor,
|
|
108
|
+
VCLJwtDescriptor,
|
|
109
|
+
VCLDidJwk,
|
|
110
|
+
VCLErrorCode,
|
|
105
111
|
};
|
package/vcl-react-native.podspec
CHANGED