@procivis/react-native-one-core 1.26730.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/LICENSE +201 -0
- package/README.md +202 -0
- package/android/build.gradle +96 -0
- package/android/proguard-rules.pro +4 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/ch/procivis/one/core/Deserialize.kt +118 -0
- package/android/src/main/java/ch/procivis/one/core/DeserializeSpecific.kt +94 -0
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +444 -0
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCorePackage.kt +19 -0
- package/android/src/main/java/ch/procivis/one/core/Serialize.kt +115 -0
- package/android/src/main/java/ch/procivis/one/core/SerializeSpecific.kt +121 -0
- package/android/src/main/java/ch/procivis/one/core/Util.kt +23 -0
- package/bin/postinstall +12 -0
- package/core-sdk.json +16 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +59 -0
- package/dist/src/backup.d.ts +22 -0
- package/dist/src/backup.js +1 -0
- package/dist/src/config.d.ts +100 -0
- package/dist/src/config.js +25 -0
- package/dist/src/core.d.ts +109 -0
- package/dist/src/core.js +11 -0
- package/dist/src/credential.d.ts +115 -0
- package/dist/src/credential.js +39 -0
- package/dist/src/credentialSchema.d.ts +130 -0
- package/dist/src/credentialSchema.js +37 -0
- package/dist/src/did.d.ts +59 -0
- package/dist/src/did.js +27 -0
- package/dist/src/error.d.ts +23 -0
- package/dist/src/error.js +25 -0
- package/dist/src/history.d.ts +66 -0
- package/dist/src/history.js +42 -0
- package/dist/src/key.d.ts +17 -0
- package/dist/src/key.js +1 -0
- package/dist/src/list.d.ts +14 -0
- package/dist/src/list.js +5 -0
- package/dist/src/proof.d.ts +137 -0
- package/dist/src/proof.js +30 -0
- package/dist/src/proofSchema.d.ts +106 -0
- package/dist/src/proofSchema.js +9 -0
- package/dist/src/trust.d.ts +46 -0
- package/dist/src/trust.js +18 -0
- package/ios/Deserialize.swift +655 -0
- package/ios/ProcivisOneCoreModule.m +216 -0
- package/ios/ProcivisOneCoreModule.swift +600 -0
- package/ios/ProcivisRNOneCore.xcodeproj/project.pbxproj +318 -0
- package/ios/Serialize.swift +607 -0
- package/ios/Util.swift +47 -0
- package/ios/react-native-one-core-Bridging-Header.h +1 -0
- package/package.json +40 -0
- package/react-native-one-core.podspec +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2024 Procivis AG
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+
|
|
4
|
+
# One Core React Native SDK
|
|
5
|
+
|
|
6
|
+
A React Native library for decentralized digital identities and credentials.
|
|
7
|
+
Use it to hold or verify credentials via a multitude of technologies and protocols.
|
|
8
|
+
|
|
9
|
+
The SDK's SSI functionality is powered by the [Procivis One Core][core], a complete
|
|
10
|
+
solution capable of powering every element of the digital identity credential lifecycle.
|
|
11
|
+
See the [key features][key] and complete solution [architecture][archi].
|
|
12
|
+
|
|
13
|
+
## Table of Contents
|
|
14
|
+
|
|
15
|
+
- [How to use the One Core SDK](#how-to-use-the-one-core-react-native-sdk)
|
|
16
|
+
- [Getting started](#getting-started)
|
|
17
|
+
- [Background](#background)
|
|
18
|
+
- [eIDAS 2.0](#eidas-20)
|
|
19
|
+
- [Interoperability and conformance](#interoperability-and-conformance)
|
|
20
|
+
- [Supported standards](#supported-standards)
|
|
21
|
+
- [Support](#support)
|
|
22
|
+
- [License](#license)
|
|
23
|
+
|
|
24
|
+
## How to use the One Core React Native SDK
|
|
25
|
+
|
|
26
|
+
- Use this SDK to embed wallet capabilities into an existing app
|
|
27
|
+
- Use the [Procivis One Wallet][pow] for a free-standing solution that can be white-labeled
|
|
28
|
+
- Use the [One Core React Components][comp] library for UI elements for your digital wallet app
|
|
29
|
+
|
|
30
|
+
## Getting started
|
|
31
|
+
|
|
32
|
+
### Trial
|
|
33
|
+
|
|
34
|
+
The fastest way to get started with the *Procivis One Wallet* is to download the app
|
|
35
|
+
from the iOS or Android app stores and [join our Trial Environment][trial].
|
|
36
|
+
In the trial environment, you are given control of an organization on our server
|
|
37
|
+
solution, the *Procivis One Desk*, and can quickly begin issuing and verifying credentials.
|
|
38
|
+
|
|
39
|
+
### Documentation
|
|
40
|
+
|
|
41
|
+
See our documentation:
|
|
42
|
+
|
|
43
|
+
- [SDK Reference][sdkref]
|
|
44
|
+
- [Docs home][docs]
|
|
45
|
+
|
|
46
|
+
### Installation
|
|
47
|
+
|
|
48
|
+
`$ yarn add react-native-one-core`
|
|
49
|
+
|
|
50
|
+
Add following to your app `android/build.gradle`:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
...
|
|
54
|
+
allprojects {
|
|
55
|
+
repositories {
|
|
56
|
+
...
|
|
57
|
+
|
|
58
|
+
flatDir { dirs "$rootDir/../node_modules/react-native-one-core/android/libs" }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Add following to your app `android/app/build.gradle` to remove unsupported architectures:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
...
|
|
67
|
+
android {
|
|
68
|
+
defaultConfig {
|
|
69
|
+
...
|
|
70
|
+
|
|
71
|
+
ndk {
|
|
72
|
+
abiFilters "armeabi-v7a", "arm64-v8a", "x86"
|
|
73
|
+
}
|
|
74
|
+
packagingOptions {
|
|
75
|
+
exclude 'lib/mips/**'
|
|
76
|
+
exclude 'lib/mips64/**'
|
|
77
|
+
exclude 'lib/armeabi/**'
|
|
78
|
+
exclude 'lib/x86_64/**'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Usage
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
import ONE from "react-native-one-core";
|
|
88
|
+
...
|
|
89
|
+
await ONE.getVersion();
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Background
|
|
93
|
+
|
|
94
|
+
Decentralized digital identities and credentials is an approach to identity that relocates
|
|
95
|
+
digital credentials from the possession and control of centralized authorities to the
|
|
96
|
+
digital wallet of the credentials holder. This architecture eliminates the need for the
|
|
97
|
+
user to "phone home" to use their credentials as well as the verifier to communicate to
|
|
98
|
+
the issuer via back-channels, keeping the wallet holder's interactions private between only
|
|
99
|
+
those parties directly involved in each interaction. This model of digital identity is
|
|
100
|
+
often referred to as Self-Sovereign Identity, or SSI.
|
|
101
|
+
|
|
102
|
+
## eIDAS 2.0
|
|
103
|
+
|
|
104
|
+
If you want to provide an **EUDI Wallet**, *Procivis One* provides production grade open
|
|
105
|
+
source components to get certified and connect your organization to the eIDAS 2.0 ecosystem.
|
|
106
|
+
|
|
107
|
+

|
|
108
|
+
|
|
109
|
+
For an EUDI Wallet, use the [One Core React Native SDK][rncore] for embedding into
|
|
110
|
+
an existing app, or use the [Procivis One Wallet][pow] with adaptations to fit your
|
|
111
|
+
needs.
|
|
112
|
+
|
|
113
|
+
If you want to issue into an EUDI Wallet or offer services to an EUDI Wallet holder,
|
|
114
|
+
use the [Procivis One Core][core].
|
|
115
|
+
|
|
116
|
+
## Interoperability and conformance
|
|
117
|
+
|
|
118
|
+
*Procivis One* is built using [open standards](#supported-standards) and tested to ensure
|
|
119
|
+
interoperability with different software vendors and across different international
|
|
120
|
+
regulatory ecosystems.
|
|
121
|
+
|
|
122
|
+
- W3C standards
|
|
123
|
+
- The W3C offers several test suites for standards conformance. See
|
|
124
|
+
the latest test results for *Procivis One* at [canivc.com][canivc].
|
|
125
|
+
- ISO/IEC 18013-5 mDL
|
|
126
|
+
- *Procivis One*'s implementation of the ISO mDL standard is compatible with the
|
|
127
|
+
OpenWallet Foundation's verifier: *Procivis One* can successfully issue mDL
|
|
128
|
+
credentials to a *Procivis One Wallet*, and these credentials can successfully
|
|
129
|
+
be verified by the OpenWallet Foundation's verifier. See the [OpenWallet Foundation libraries][owf].
|
|
130
|
+
- eIDAS 2.0; EUDI Wallet
|
|
131
|
+
- The EU Digital Wallet is developing [issuer][eudiwi] and [verifier][eudiwv] testing for
|
|
132
|
+
interoperability in mdoc and SD-JWT formats using OID4VC protocols. We follow the ongoing
|
|
133
|
+
development of the testing platform and regularly test against it.
|
|
134
|
+
|
|
135
|
+
We continue to look for more opportunities for interoperability testing as the standards
|
|
136
|
+
and regulations mature and harden.
|
|
137
|
+
|
|
138
|
+
## Supported standards
|
|
139
|
+
|
|
140
|
+
### Credential data models
|
|
141
|
+
|
|
142
|
+
- [Verifiable Credentials][vcdm] (VCs)
|
|
143
|
+
- JSON-LD
|
|
144
|
+
- SD-JWT
|
|
145
|
+
- JWT
|
|
146
|
+
- [ISO/IEC 18013-5:2021][iso]
|
|
147
|
+
- mdoc
|
|
148
|
+
|
|
149
|
+
### Exchange and transport
|
|
150
|
+
|
|
151
|
+
- OpenID for Verifiable Credentials
|
|
152
|
+
- [OID4VCI][vci]; ID-1
|
|
153
|
+
- [OID4VP][vp]; ID-2
|
|
154
|
+
- [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
|
|
158
|
+
|
|
159
|
+
### Key storage
|
|
160
|
+
|
|
161
|
+
- Secure Enclave (iOS) and Android Keystore (TEE or Strongbox)
|
|
162
|
+
- Internal encrypted database
|
|
163
|
+
|
|
164
|
+
### Revocation methods
|
|
165
|
+
|
|
166
|
+
- [Bitstring Status List v1.0][sl]
|
|
167
|
+
- [Linked Validity Verifiable Credentials (LVVC)][lvvc]
|
|
168
|
+
|
|
169
|
+
## Support
|
|
170
|
+
|
|
171
|
+
Need support or have feedback? [Contact us](https://www.procivis.ch/en/contact).
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
Some rights reserved. This library is published under the [Apache License
|
|
176
|
+
Version 2.0](./LICENSE).
|
|
177
|
+
|
|
178
|
+

|
|
179
|
+

|
|
180
|
+
|
|
181
|
+
© Procivis AG, [https://www.procivis.ch](https://www.procivis.ch).
|
|
182
|
+
|
|
183
|
+
[archi]: https://github.com/procivis#architecture
|
|
184
|
+
[ble]: https://openid.net/specs/openid-4-verifiable-presentations-over-ble-1_0.html
|
|
185
|
+
[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
|
|
188
|
+
[docs]: https://docs.procivis.ch/
|
|
189
|
+
[eudiwi]: https://issuer.eudiw.dev/
|
|
190
|
+
[eudiwv]: https://verifier.eudiw.dev/home
|
|
191
|
+
[iso]: https://www.iso.org/standard/69084.html
|
|
192
|
+
[key]: https://github.com/procivis#key-features
|
|
193
|
+
[lvvc]: https://eprint.iacr.org/2022/1658.pdf
|
|
194
|
+
[owf]: https://github.com/openwallet-foundation-labs/identity-credential
|
|
195
|
+
[pow]: https://github.com/procivis/one-wallet
|
|
196
|
+
[rncore]: https://github.com/procivis/react-native-one-core
|
|
197
|
+
[sdkref]: https://docs.procivis.ch/sdk/overview
|
|
198
|
+
[sl]: https://www.w3.org/TR/vc-bitstring-status-list/
|
|
199
|
+
[trial]: https://docs.procivis.ch/trial/intro
|
|
200
|
+
[vcdm]: https://www.w3.org/TR/vc-data-model-2.0/
|
|
201
|
+
[vci]: https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-ID1.html
|
|
202
|
+
[vp]: https://openid.net/specs/openid-4-verifiable-presentations-1_0-ID2.html
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import java.security.MessageDigest
|
|
2
|
+
class Checksum {
|
|
3
|
+
static getChecksum(file, type) {
|
|
4
|
+
def digest = MessageDigest.getInstance(type)
|
|
5
|
+
def inputStream = file.newInputStream()
|
|
6
|
+
def buffer = new byte[16384]
|
|
7
|
+
def len
|
|
8
|
+
|
|
9
|
+
while((len=inputStream.read(buffer)) > 0) {
|
|
10
|
+
digest.update(buffer, 0, len)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
def result = ""
|
|
14
|
+
for(byte b : digest.digest()) {
|
|
15
|
+
result += toHex(b)
|
|
16
|
+
}
|
|
17
|
+
return result
|
|
18
|
+
}
|
|
19
|
+
private static hexChr(int b) {
|
|
20
|
+
return Integer.toHexString(b & 0xF)
|
|
21
|
+
}
|
|
22
|
+
private static toHex(int b) {
|
|
23
|
+
return hexChr((b & 0xF0) >> 4) + hexChr(b & 0x0F)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
apply plugin: 'com.android.library'
|
|
28
|
+
apply plugin: 'kotlin-android'
|
|
29
|
+
|
|
30
|
+
def safeExtGet(prop, fallback) {
|
|
31
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
android {
|
|
35
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 33)
|
|
36
|
+
buildToolsVersion = "30.0.2"
|
|
37
|
+
|
|
38
|
+
defaultConfig {
|
|
39
|
+
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
40
|
+
targetSdkVersion safeExtGet('targetSdkVersion', 33)
|
|
41
|
+
versionCode 1
|
|
42
|
+
versionName "1.0.0"
|
|
43
|
+
|
|
44
|
+
consumerProguardFiles 'proguard-rules.pro'
|
|
45
|
+
}
|
|
46
|
+
lintOptions {
|
|
47
|
+
abortOnError false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
repositories {
|
|
52
|
+
mavenCentral()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
dependencies {
|
|
56
|
+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.8.0')}")
|
|
57
|
+
implementation 'com.facebook.react:react-native:+'
|
|
58
|
+
|
|
59
|
+
releaseImplementation(name: 'onecore-release', ext: 'aar')
|
|
60
|
+
debugImplementation(name: 'onecore-debug', ext: 'aar')
|
|
61
|
+
implementation 'net.java.dev.jna:jna:5.13.0@aar'
|
|
62
|
+
implementation("org.jetbrains.kotlin:kotlin-reflect:${safeExtGet('kotlinVersion', '1.8.0')}")
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
def coreUrlAAR = { buildType ->
|
|
66
|
+
def name = "onecore-${buildType}"
|
|
67
|
+
def coreSdkJsonFile = file("$projectDir/../core-sdk.json")
|
|
68
|
+
def coreSdkJson = new groovy.json.JsonSlurper().parseText(coreSdkJsonFile.text)
|
|
69
|
+
def sdk = coreSdkJson.android[buildType]
|
|
70
|
+
|
|
71
|
+
def url = sdk.url
|
|
72
|
+
File file = new File("$projectDir/libs/${name}.aar")
|
|
73
|
+
file.parentFile.mkdirs()
|
|
74
|
+
if (!file.exists()) {
|
|
75
|
+
new URL(url).withInputStream { downloadStream ->
|
|
76
|
+
file.withOutputStream { fileOut ->
|
|
77
|
+
fileOut << downloadStream
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
def sha1sum = Checksum.getChecksum(file, "SHA1")
|
|
83
|
+
def sha1Expected = sdk.sha1
|
|
84
|
+
if (sha1sum != sha1Expected) {
|
|
85
|
+
file.delete()
|
|
86
|
+
println "URL($name): $url"
|
|
87
|
+
println "sha1 expected: $sha1Expected"
|
|
88
|
+
println "sha1 actual: $sha1sum"
|
|
89
|
+
throw new Error("AAR file SHA1 mismatch: " + name)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
afterEvaluate {
|
|
94
|
+
coreUrlAAR('debug')
|
|
95
|
+
coreUrlAAR('release')
|
|
96
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
package ch.procivis.one.core
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReadableArray
|
|
4
|
+
import com.facebook.react.bridge.ReadableMap
|
|
5
|
+
import kotlin.reflect.KClass
|
|
6
|
+
import kotlin.reflect.KParameter
|
|
7
|
+
import kotlin.reflect.KType
|
|
8
|
+
|
|
9
|
+
object Deserialize {
|
|
10
|
+
inline fun <reified T> construct(data: ReadableMap): T {
|
|
11
|
+
return constructObjectWithMembers(T::class, data) as T
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
private fun extractArrayItem(kType: KType, data: ReadableArray, index: Int): Any {
|
|
15
|
+
val kClass = kType.classifier as KClass<*>
|
|
16
|
+
|
|
17
|
+
if (kClass.java.isEnum) {
|
|
18
|
+
return constructEnumValue(kClass, data.getString(index))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return when (kClass) {
|
|
22
|
+
Boolean::class -> data.getBoolean(index)
|
|
23
|
+
String::class -> data.getString(index)
|
|
24
|
+
UInt::class -> data.getInt(index).toUInt()
|
|
25
|
+
Long::class -> data.getInt(index).toLong()
|
|
26
|
+
List::class -> {
|
|
27
|
+
val itemType = kType.arguments.first().type
|
|
28
|
+
val values = data.getArray(index)
|
|
29
|
+
return extractArrayItems(itemType!!, values)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Map::class -> {
|
|
33
|
+
val values = data.getMap(index)
|
|
34
|
+
return extractMapItems(kType, values)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
else -> constructObjectWithMembers(kClass, data.getMap(index))
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private fun extractArrayItems(type: KType, data: ReadableArray): List<Any?> {
|
|
42
|
+
val result = mutableListOf<Any?>()
|
|
43
|
+
for (i in 0 until data.size()) {
|
|
44
|
+
result.add(extractArrayItem(type, data, i))
|
|
45
|
+
}
|
|
46
|
+
return result
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private fun extractMapItems(type: KType, data: ReadableMap): Map<String, Any?> {
|
|
50
|
+
val valueType = type.arguments[1].type
|
|
51
|
+
val iterator = data.keySetIterator()
|
|
52
|
+
val result = mutableMapOf<String, Any?>()
|
|
53
|
+
while (iterator.hasNextKey()) {
|
|
54
|
+
val key = iterator.nextKey()
|
|
55
|
+
result[key] = extractObjectItem(valueType!!, data, key)
|
|
56
|
+
}
|
|
57
|
+
return result
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private fun extractObjectItem(type: KType, data: ReadableMap, name: String): Any? {
|
|
61
|
+
if (!data.hasKey(name) || (type.isMarkedNullable && data.isNull(name))) {
|
|
62
|
+
return null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
val kClass = type.classifier as KClass<*>
|
|
66
|
+
|
|
67
|
+
// exceptional types
|
|
68
|
+
if (DeserializeSpecific.Obj.isCustomConversionType(kClass)) {
|
|
69
|
+
return DeserializeSpecific.Obj.convertCustom(kClass, data, name)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (kClass.java.isEnum) {
|
|
73
|
+
return constructEnumValue(kClass, data.getString(name)!!)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return when (kClass) {
|
|
77
|
+
Boolean::class -> data.getBoolean(name)
|
|
78
|
+
String::class -> data.getString(name)
|
|
79
|
+
UInt::class -> data.getInt(name).toUInt()
|
|
80
|
+
Long::class -> data.getInt(name).toLong()
|
|
81
|
+
List::class -> {
|
|
82
|
+
val values = data.getArray(name)!!
|
|
83
|
+
val itemType = type.arguments.first().type
|
|
84
|
+
return extractArrayItems(itemType!!, values)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
Map::class -> {
|
|
88
|
+
val values = data.getMap(name)!!
|
|
89
|
+
return extractMapItems(type, values)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
else -> {
|
|
93
|
+
val value = data.getMap(name)!!
|
|
94
|
+
return constructObjectWithMembers(kClass, value)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private fun constructEnumValue(c: KClass<*>, value: String): Any {
|
|
100
|
+
val enumEntry = c.java.enumConstants.firstOrNull { entry ->
|
|
101
|
+
val enumValue = entry as Enum<*>
|
|
102
|
+
enumValue.name == value
|
|
103
|
+
}
|
|
104
|
+
if (enumEntry == null) {
|
|
105
|
+
throw NoSuchElementException("Enum ${c.simpleName} value `$value` invalid")
|
|
106
|
+
}
|
|
107
|
+
return enumEntry
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
fun constructObjectWithMembers(c: KClass<*>, data: ReadableMap): Any {
|
|
111
|
+
val constructor = c.constructors.first()
|
|
112
|
+
val constructorParams = mutableMapOf<KParameter, Any?>()
|
|
113
|
+
constructor.parameters.forEach { parameter ->
|
|
114
|
+
constructorParams[parameter] = extractObjectItem(parameter.type, data, parameter.name!!)
|
|
115
|
+
}
|
|
116
|
+
return constructor.callBy(constructorParams)
|
|
117
|
+
}
|
|
118
|
+
}
|