@procivis/react-native-one-core 1.26999.0 → 1.33398.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/README.md CHANGED
@@ -1,5 +1,8 @@
1
- ![Procivis One](https://assets.procivis-one.com/static/logo/logo_dark_Procivis_One.png#gh-light-mode-only)
2
- ![Procivis One](https://assets.procivis-one.com/static/logo/logo_light_Procivis_One.png#gh-dark-mode-only)
1
+ <picture>
2
+ <source media="(prefers-color-scheme: dark)" srcset="https://assets.procivis-one.com/static/logo/logo_dark_Procivis_One.png">
3
+ <source media="(prefers-color-scheme: light)" srcset="https://assets.procivis-one.com/static/logo/logo_light_Procivis_One.png">
4
+ <img alt="Shows a Procivis One black logo in light color mode and a white one in dark color mode." src="https://assets.procivis-one.com/static/logo/logo_light_Procivis_One.png">
5
+ </picture>
3
6
 
4
7
  # One Core React Native SDK
5
8
 
@@ -137,14 +140,37 @@ and regulations mature and harden.
137
140
 
138
141
  ## Supported standards
139
142
 
140
- ### Credential data models
143
+ ### Credential models
141
144
 
142
- - [Verifiable Credentials][vcdm] (VCs)
143
- - JSON-LD
144
- - SD-JWT
145
- - JWT
146
- - [ISO/IEC 18013-5:2021][iso]
147
- - mdoc
145
+ #### W3C VC
146
+
147
+ - [W3C Verifiable Credentials Data Model 2.0][vcdm] in the following variations:
148
+
149
+ | Securing mechanism | Supported representations | Supported proof/signature types |
150
+ | -------------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------ |
151
+ | [W3C Data Integrity Proofs][vcdi] (embedded) | [JSON-LD][jld] in Compacted Document Form | <ul><li>[W3C Data Integrity ECDSA Cryptosuites v1.0][ecd] / [ecdsa-rdfc-2019][ecd2019]</li><li>[W3C Data Integrity EdDSA Cryptosuites v1.0][edd] / [eddsa-rdfc-2022][edd2022]</li><li>[W3C Data Integrity BBS Cryptosuites v1.0][bbs] / [bbs-2023][bbs2023]</li></ul> |
152
+ | [W3C VC-JOSE-COSE][jose] (enveloping) | <ul><li>[SD-JWT][sdjwt]</li><li>[JWT][jw]</li></ul> | <ul><li>JOSE / ECDSA [ES256][es2]</li><li>JOSE / EdDSA [Ed25519][ed255]</li><li>JOSE / CRYSTALS-DILITHIUM 3 [CRYDI3][crydi3]* |
153
+
154
+ \* CRYSTALS-DILITHIUM is a post-quantum resistant signature scheme, selected by NIST for [Post-Quantum Cryptography Standardization][pqc].
155
+ Support for the recently published [FIPS-204][fips] is planned for the near future.
156
+
157
+ #### ISO mdoc
158
+
159
+ - [ISO/IEC 18013-5:2021][iso] standard for mdoc credentials.
160
+ - [COSE][cose] proofs
161
+ - ECDSA [ES256][es2]
162
+ - EdDSA [Ed25519][ed255]
163
+
164
+ #### IETF SD-JWT VC
165
+
166
+ - [IETF SD-JWT-based Verifiable Credentials][sdjwtvc]:
167
+
168
+ | Standard | Supported representations | Supported proof/signature types |
169
+ | -------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
170
+ | IETF SD-JWT VC | SD-JWT | <ul><li>JOSE / ECDSA [ES256][es2]</li><li>JOSE / EdDSA [Ed25519][ed255]</li><li>JOSE / CRYSTALS-DILITHIUM 3 [CRYDI3][crydi3]\*</li></ul> |
171
+
172
+ \* CRYSTALS-DILITHIUM is a post-quantum resistant signature scheme, selected by NIST for [Post-Quantum Cryptography Standardization][pqc].
173
+ Support for the recently published [FIPS-204][fips] is planned for the near future.
148
174
 
149
175
  ### Exchange and transport
150
176
 
@@ -152,9 +178,10 @@ and regulations mature and harden.
152
178
  - [OID4VCI][vci]; ID-1
153
179
  - [OID4VP][vp]; ID-2
154
180
  - [OID4VP over BLE][ble]; optimized version of Draft 00
155
- - OID4VP over MQTT; proprietary adaptation of OID4VP over BLE via MQTT channel
156
- - [ISO/IEC 18013-5][iso]
157
- - QR-code engagement and offline device retrieval over BLE
181
+ - OID4VP over MQTT; proprietary adaptation of "OID4VP over BLE" via MQTT channel
182
+ - ISO/IEC 18013
183
+ - [18013-5][iso5]: QR code engagement and offline device retrieval over BLE
184
+ - [18013-7][iso7]: Online data retrieval via OID4VP
158
185
 
159
186
  ### Key storage
160
187
 
@@ -165,6 +192,7 @@ and regulations mature and harden.
165
192
 
166
193
  - [Bitstring Status List v1.0][sl]
167
194
  - [Linked Validity Verifiable Credentials (LVVC)][lvvc]
195
+ - [Token Status List - Draft 03][tsl]
168
196
 
169
197
  ## Support
170
198
 
@@ -175,28 +203,49 @@ Need support or have feedback? [Contact us](https://www.procivis.ch/en/contact).
175
203
  Some rights reserved. This library is published under the [Apache License
176
204
  Version 2.0](./LICENSE).
177
205
 
178
- ![Procivis AG](https://assets.procivis-one.com/static/logo/logo_light_mode_Procivis.svg#gh-light-mode-only)
179
- ![Procivis AG](https://assets.procivis-one.com/static/logo/logo_dark_mode_Procivis.svg#gh-dark-mode-only)
206
+ <picture>
207
+ <source media="(prefers-color-scheme: dark)" srcset="https://assets.procivis-one.com/static/logo/logo_dark_mode_Procivis.svg">
208
+ <source media="(prefers-color-scheme: light)" srcset="https://assets.procivis-one.com/static/logo/logo_light_mode_Procivis.svg">
209
+ <img alt="Shows a Procivis black logo in light color mode and a white one in dark color mode." src="https://assets.procivis-one.com/static/logo/logo_dark_mode_Procivis.svg">
210
+ </picture>
180
211
 
181
212
  © Procivis AG, [https://www.procivis.ch](https://www.procivis.ch).
182
213
 
183
214
  [archi]: https://github.com/procivis#architecture
215
+ [bbs]: https://www.w3.org/TR/vc-di-bbs/
216
+ [bbs2023]: https://www.w3.org/TR/vc-di-bbs/#bbs-2023
184
217
  [ble]: https://openid.net/specs/openid-4-verifiable-presentations-over-ble-1_0.html
185
218
  [canivc]: https://canivc.com/implementations/procivis-one-core/
186
- [comp]: https://github.com/procivis/one-react-native-components
187
- [core]: https://github.com/procivis/one-core
219
+ [cose]: https://www.rfc-editor.org/rfc/rfc9052
220
+ [crydi3]: https://datatracker.ietf.org/doc/html/draft-ietf-cose-dilithium-01
188
221
  [docs]: https://docs.procivis.ch/
222
+ [ecd]: https://www.w3.org/TR/vc-di-ecdsa/
223
+ [ecd2019]: https://www.w3.org/TR/vc-di-ecdsa/#ecdsa-rdfc-2019
224
+ [edd]: https://www.w3.org/TR/vc-di-eddsa/
225
+ [edd2022]: https://www.w3.org/TR/vc-di-eddsa/#eddsa-rdfc-2022
226
+ [ed255]: https://datatracker.ietf.org/doc/html/rfc8037
227
+ [es2]: https://datatracker.ietf.org/doc/html/rfc7518
189
228
  [eudiwi]: https://issuer.eudiw.dev/
190
229
  [eudiwv]: https://verifier.eudiw.dev/home
191
- [iso]: https://www.iso.org/standard/69084.html
230
+ [fips]: https://csrc.nist.gov/pubs/fips/204/final
231
+ [iso5]: https://www.iso.org/standard/69084.html
232
+ [iso7]: https://www.iso.org/standard/82772.html
233
+ [jld]: https://www.w3.org/TR/json-ld11/
234
+ [jose]: https://w3c.github.io/vc-jose-cose/
235
+ [jw]: https://datatracker.ietf.org/doc/html/rfc7519
192
236
  [key]: https://github.com/procivis#key-features
193
237
  [lvvc]: https://eprint.iacr.org/2022/1658.pdf
194
238
  [owf]: https://github.com/openwallet-foundation-labs/identity-credential
195
239
  [pow]: https://github.com/procivis/one-wallet
240
+ [pqc]: https://csrc.nist.gov/pqc-standardization
196
241
  [rncore]: https://github.com/procivis/react-native-one-core
242
+ [sdjwt]: https://www.ietf.org/archive/id/draft-ietf-oauth-selective-disclosure-jwt-12.html
243
+ [sdjwtvc]: https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-05.html
197
244
  [sdkref]: https://docs.procivis.ch/sdk/overview
198
245
  [sl]: https://www.w3.org/TR/vc-bitstring-status-list/
199
246
  [trial]: https://docs.procivis.ch/trial/intro
247
+ [tsl]: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-status-list-03
248
+ [vcdi]: https://www.w3.org/TR/vc-data-integrity/
200
249
  [vcdm]: https://www.w3.org/TR/vc-data-model-2.0/
201
250
  [vci]: https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-ID1.html
202
251
  [vp]: https://openid.net/specs/openid-4-verifiable-presentations-1_0-ID2.html
@@ -54,6 +54,7 @@ repositories {
54
54
 
55
55
  dependencies {
56
56
  implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.8.0')}")
57
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
57
58
  implementation 'com.facebook.react:react-native:+'
58
59
 
59
60
  releaseImplementation(name: 'onecore-release', ext: 'aar')
@@ -62,6 +63,14 @@ dependencies {
62
63
  implementation("org.jetbrains.kotlin:kotlin-reflect:${safeExtGet('kotlinVersion', '1.8.0')}")
63
64
  }
64
65
 
66
+ def downloadFile = { url, file ->
67
+ new URL(url).withInputStream { downloadStream ->
68
+ file.withOutputStream { fileOut ->
69
+ fileOut << downloadStream
70
+ }
71
+ }
72
+ }
73
+
65
74
  def coreUrlAAR = { buildType ->
66
75
  def name = "onecore-${buildType}"
67
76
  def coreSdkJsonFile = file("$projectDir/../core-sdk.json")
@@ -71,18 +80,21 @@ def coreUrlAAR = { buildType ->
71
80
  def url = sdk.url
72
81
  File file = new File("$projectDir/libs/${name}.aar")
73
82
  file.parentFile.mkdirs()
74
- if (!file.exists()) {
75
- new URL(url).withInputStream { downloadStream ->
76
- file.withOutputStream { fileOut ->
77
- fileOut << downloadStream
78
- }
83
+
84
+ def sha1Expected = sdk.sha1
85
+ if (file.exists()) {
86
+ if (Checksum.getChecksum(file, "SHA1") == sha1Expected) {
87
+ // all good
88
+ return
79
89
  }
90
+ // The file is most likely just stale -> delete and download again
91
+ file.delete()
80
92
  }
81
93
 
94
+ downloadFile(url, file)
82
95
  def sha1sum = Checksum.getChecksum(file, "SHA1")
83
- def sha1Expected = sdk.sha1
84
96
  if (sha1sum != sha1Expected) {
85
- file.delete()
97
+ // if the file hash still does not match then something is off
86
98
  println "URL($name): $url"
87
99
  println "sha1 expected: $sha1Expected"
88
100
  println "sha1 actual: $sha1sum"
@@ -58,7 +58,7 @@ object Deserialize {
58
58
  }
59
59
 
60
60
  private fun extractObjectItem(type: KType, data: ReadableMap, name: String): Any? {
61
- if (!data.hasKey(name) || (type.isMarkedNullable && data.isNull(name))) {
61
+ if (!data.hasKey(name)) {
62
62
  return null
63
63
  }
64
64
 
@@ -69,6 +69,10 @@ object Deserialize {
69
69
  return DeserializeSpecific.Obj.convertCustom(kClass, data, name)
70
70
  }
71
71
 
72
+ if (type.isMarkedNullable && data.isNull(name)) {
73
+ return null
74
+ }
75
+
72
76
  if (kClass.java.isEnum) {
73
77
  return constructEnumValue(kClass, data.getString(name)!!)
74
78
  }
@@ -6,7 +6,7 @@ import kotlin.reflect.KClass
6
6
 
7
7
  object DeserializeSpecific {
8
8
  object Obj {
9
- private val CustomConversionTypes = arrayOf(CredentialSchemaTypeBindingEnum::class)
9
+ private val CustomConversionTypes = arrayOf(CredentialSchemaTypeBindingEnum::class, OptionalString::class)
10
10
 
11
11
  fun isCustomConversionType(type: KClass<*>): Boolean {
12
12
  return CustomConversionTypes.contains(type)
@@ -16,7 +16,14 @@ object DeserializeSpecific {
16
16
  return when (type) {
17
17
  CredentialSchemaTypeBindingEnum::class -> input.getString(field)
18
18
  ?.let { credentialSchemaType(it) }
19
-
19
+ OptionalString::class -> {
20
+ val value = input.getString(field)
21
+ if (value == null) {
22
+ OptionalString.None
23
+ } else {
24
+ OptionalString.Some(value)
25
+ }
26
+ }
20
27
  else -> {
21
28
  throw IllegalArgumentException("Invalid map conversion: $input")
22
29
  }
@@ -84,7 +91,7 @@ object DeserializeSpecific {
84
91
  return fn(input)
85
92
  }
86
93
 
87
- private fun <T> enumList(entries: ReadableArray, fn: (String) -> T): List<T> {
94
+ fun <T> enumList(entries: ReadableArray, fn: (String) -> T): List<T> {
88
95
  val result = mutableListOf<T>()
89
96
  for (n in 0 until entries.size()) {
90
97
  result.add(fn(entries.getString(n)))