@procivis/react-native-one-core 1.67952.1 → 1.75488.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 +2 -0
- package/android/src/main/java/ch/procivis/one/core/ProcivisOneCoreModule.kt +8 -22
- package/core-sdk.json +6 -6
- package/dist/src/cache.d.ts +4 -1
- package/dist/src/cache.js +3 -0
- package/dist/src/core.d.ts +8 -8
- package/dist/src/core.js +2 -2
- package/dist/src/credential.d.ts +17 -5
- package/dist/src/credentialSchema.d.ts +7 -17
- package/dist/src/credentialSchema.js +7 -14
- package/dist/src/history.d.ts +12 -4
- package/dist/src/history.js +9 -1
- package/dist/src/proof.d.ts +0 -1
- package/dist/src/proofSchema.d.ts +2 -3
- package/dist/src/walletUnit.d.ts +10 -21
- package/dist/src/walletUnit.js +7 -7
- package/ios/ProcivisOneCoreModule.m +3 -10
- package/ios/ProcivisOneCoreModule.swift +15 -32
- package/ios/RSEKeyStorage.swift +67 -51
- package/ios/Serialize.swift +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -154,6 +154,7 @@ Support for the recently published [FIPS-204][fips] is planned for the near futu
|
|
|
154
154
|
### Exchange and transport
|
|
155
155
|
|
|
156
156
|
- OpenID4VCI (Issuance)
|
|
157
|
+
- [v1.0][vci1]
|
|
157
158
|
- [ID-1][vci]
|
|
158
159
|
- OpenID4VP (Verification)
|
|
159
160
|
- [v1.0][vp1.0]
|
|
@@ -232,6 +233,7 @@ Version 2.0](./LICENSE).
|
|
|
232
233
|
[vcdi]: https://www.w3.org/TR/vc-data-integrity/
|
|
233
234
|
[vcdm]: https://www.w3.org/TR/vc-data-model-2.0/
|
|
234
235
|
[vci]: https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-ID1.html
|
|
236
|
+
[vci1]: https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html
|
|
235
237
|
[vp1.0]: https://openid.net/specs/openid-4-verifiable-presentations-1_0-final.html
|
|
236
238
|
[vp20]: https://openid.net/specs/openid-4-verifiable-presentations-1_0-20.html
|
|
237
239
|
[vp25]: https://openid.net/specs/openid-4-verifiable-presentations-1_0-25.html
|
|
@@ -197,15 +197,11 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
|
|
|
197
197
|
|
|
198
198
|
@ReactMethod
|
|
199
199
|
fun holderAcceptCredential(
|
|
200
|
-
|
|
201
|
-
didId: String?,
|
|
202
|
-
identifierId: String?,
|
|
203
|
-
keyId: String?,
|
|
204
|
-
txCode: String?,
|
|
200
|
+
request: ReadableMap,
|
|
205
201
|
promise: Promise
|
|
206
202
|
) {
|
|
207
203
|
asyncCall(promise, scope) {
|
|
208
|
-
return@asyncCall getCore().holderAcceptCredential(
|
|
204
|
+
return@asyncCall getCore().holderAcceptCredential(construct(request))
|
|
209
205
|
}
|
|
210
206
|
}
|
|
211
207
|
|
|
@@ -261,9 +257,6 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
|
|
|
261
257
|
fun holderSubmitProof(
|
|
262
258
|
interactionId: String,
|
|
263
259
|
credentials: ReadableMap,
|
|
264
|
-
didId: String?,
|
|
265
|
-
identifierId: String?,
|
|
266
|
-
keyId: String?,
|
|
267
260
|
promise: Promise
|
|
268
261
|
) {
|
|
269
262
|
asyncCall(promise, scope) {
|
|
@@ -287,13 +280,7 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
|
|
|
287
280
|
}
|
|
288
281
|
submitCredentials[entry.key] = credentialList
|
|
289
282
|
}
|
|
290
|
-
getCore().holderSubmitProof(
|
|
291
|
-
interactionId,
|
|
292
|
-
submitCredentials,
|
|
293
|
-
didId,
|
|
294
|
-
identifierId,
|
|
295
|
-
keyId
|
|
296
|
-
)
|
|
283
|
+
getCore().holderSubmitProof(interactionId, submitCredentials)
|
|
297
284
|
return@asyncCall null
|
|
298
285
|
}
|
|
299
286
|
}
|
|
@@ -666,23 +653,22 @@ class ProcivisOneCoreModule(reactContext: ReactApplicationContext) :
|
|
|
666
653
|
@ReactMethod
|
|
667
654
|
fun holderRegisterWalletUnit(request: ReadableMap, promise: Promise) {
|
|
668
655
|
asyncCall(promise, scope) {
|
|
669
|
-
|
|
670
|
-
return@asyncCall convertToRN(result)
|
|
656
|
+
return@asyncCall getCore().holderRegisterWalletUnit(construct(request))
|
|
671
657
|
}
|
|
672
658
|
}
|
|
673
659
|
|
|
674
660
|
@ReactMethod
|
|
675
|
-
fun
|
|
661
|
+
fun holderWalletUnitStatus(walletUnitId: String, promise: Promise) {
|
|
676
662
|
asyncCall(promise, scope) {
|
|
677
|
-
getCore().
|
|
663
|
+
getCore().holderWalletUnitStatus(walletUnitId)
|
|
678
664
|
return@asyncCall null
|
|
679
665
|
}
|
|
680
666
|
}
|
|
681
667
|
|
|
682
668
|
@ReactMethod
|
|
683
|
-
fun
|
|
669
|
+
fun holderGetWalletUnit(walletUnitId: String, promise: Promise) {
|
|
684
670
|
asyncCall(promise, scope) {
|
|
685
|
-
val result = getCore().
|
|
671
|
+
val result = getCore().holderGetWalletUnit(walletUnitId)
|
|
686
672
|
return@asyncCall convertToRN(result)
|
|
687
673
|
}
|
|
688
674
|
}
|
package/core-sdk.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"android": {
|
|
3
3
|
"debug": {
|
|
4
|
-
"url": "https://onesdk.blob.core.windows.net/core-sdk/
|
|
5
|
-
"sha1": "
|
|
4
|
+
"url": "https://onesdk.blob.core.windows.net/core-sdk/75488/android/onecore-debug.aar",
|
|
5
|
+
"sha1": "82090e020b12f7dd20ee474659fb195016db809e"
|
|
6
6
|
},
|
|
7
7
|
"release": {
|
|
8
|
-
"url": "https://onesdk.blob.core.windows.net/core-sdk/
|
|
9
|
-
"sha1": "
|
|
8
|
+
"url": "https://onesdk.blob.core.windows.net/core-sdk/75488/android/onecore-release.aar",
|
|
9
|
+
"sha1": "1dc1697ac7f869476111fb5eb82cc59efa4fd671"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"ios": {
|
|
13
|
-
"url": "https://onesdk.blob.core.windows.net/core-sdk/
|
|
14
|
-
"sha1": "
|
|
13
|
+
"url": "https://onesdk.blob.core.windows.net/core-sdk/75488/ios/deploy.zip",
|
|
14
|
+
"sha1": "c54194bbcc1c6907324360121b079af3c406a455"
|
|
15
15
|
}
|
|
16
16
|
}
|
package/dist/src/cache.d.ts
CHANGED
|
@@ -4,5 +4,8 @@ export declare enum CacheType {
|
|
|
4
4
|
STATUS_LIST_CREDENTIAL = "STATUS_LIST_CREDENTIAL",
|
|
5
5
|
VCT_METADATA = "VCT_METADATA",
|
|
6
6
|
JSON_SCHEMA = "JSON_SCHEMA",
|
|
7
|
-
TRUST_LIST = "TRUST_LIST"
|
|
7
|
+
TRUST_LIST = "TRUST_LIST",
|
|
8
|
+
X509_CRL = "X509_CRL",
|
|
9
|
+
ANDROID_ATTESTATION_CRL = "ANDROID_ATTESTATION_CRL",
|
|
10
|
+
OPEN_ID_METADATA = "OPEN_ID_METADATA"
|
|
8
11
|
}
|
package/dist/src/cache.js
CHANGED
|
@@ -6,4 +6,7 @@ export var CacheType;
|
|
|
6
6
|
CacheType["VCT_METADATA"] = "VCT_METADATA";
|
|
7
7
|
CacheType["JSON_SCHEMA"] = "JSON_SCHEMA";
|
|
8
8
|
CacheType["TRUST_LIST"] = "TRUST_LIST";
|
|
9
|
+
CacheType["X509_CRL"] = "X509_CRL";
|
|
10
|
+
CacheType["ANDROID_ATTESTATION_CRL"] = "ANDROID_ATTESTATION_CRL";
|
|
11
|
+
CacheType["OPEN_ID_METADATA"] = "OPEN_ID_METADATA";
|
|
9
12
|
})(CacheType || (CacheType = {}));
|
package/dist/src/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BackupCreate, ImportBackupMetadata, UnexportableEntities } from "./backup";
|
|
2
2
|
import { Config } from "./config";
|
|
3
|
-
import { AuthorizationCodeFlow, ContinueIssuanceResponse, CredentialDetail, CredentialListItem, CredentialListQuery, CredentialRevocationCheckResponse, InitiateIssuanceRequest, InitiateIssuanceResponse, InvitationResultCredentialIssuance } from "./credential";
|
|
3
|
+
import { AuthorizationCodeFlow, ContinueIssuanceResponse, CredentialDetail, CredentialListItem, CredentialListQuery, CredentialRevocationCheckResponse, HolderAcceptCredentialRequest, InitiateIssuanceRequest, InitiateIssuanceResponse, InvitationResultCredentialIssuance } from "./credential";
|
|
4
4
|
import { CredentialSchema, CredentialSchemaDetail, CredentialSchemaListQuery, ImportCredentialSchemaRequest, ShareCredentialSchemaResponse } from "./credentialSchema";
|
|
5
5
|
import { DidListItem, DidListQuery, DidRequest } from "./did";
|
|
6
6
|
import { HistoryListItem, HistoryListQuery } from "./history";
|
|
@@ -12,7 +12,7 @@ import { CreateRemoteTrustEntityRequest, CreateTrustAnchorRequest, CreateTrustEn
|
|
|
12
12
|
import { CacheType } from "./cache";
|
|
13
13
|
import { CreateOrganisationRequest, UpsertOrganisationRequest } from "./organisation";
|
|
14
14
|
import { CreateIdentifierRequest, IdentifierDetail, IdentifierListItem, IdentifierListQuery } from "./identifier";
|
|
15
|
-
import {
|
|
15
|
+
import { HolderRegisterWalletUnitRequest, HolderWalletUnitDetail } from "./walletUnit";
|
|
16
16
|
import { NfcScanRequest } from "./nfc";
|
|
17
17
|
export * from "./backup";
|
|
18
18
|
export * from "./cache";
|
|
@@ -76,7 +76,7 @@ export interface ONECore {
|
|
|
76
76
|
* request for proof).
|
|
77
77
|
*/
|
|
78
78
|
handleInvitation(request: HandleInvitationRequest): Promise<InvitationResult>;
|
|
79
|
-
holderAcceptCredential(
|
|
79
|
+
holderAcceptCredential(request: HolderAcceptCredentialRequest): Promise<CredentialDetail["id"]>;
|
|
80
80
|
holderRejectCredential(interactionId: InvitationResultCredentialIssuance["interactionId"]): Promise<void>;
|
|
81
81
|
/** For wallets, starts the OID4VCI Authorization Code Flow. */
|
|
82
82
|
initiateIssuance(request: InitiateIssuanceRequest): Promise<InitiateIssuanceResponse>;
|
|
@@ -91,7 +91,7 @@ export interface ONECore {
|
|
|
91
91
|
getPresentationDefinition(proofId: ProofDetail["id"]): Promise<PresentationDefinition>;
|
|
92
92
|
getPresentationDefinitionV2(proofId: ProofDetail["id"]): Promise<PresentationDefinitionV2>;
|
|
93
93
|
holderRejectProof(interactionId: InvitationResultProofRequest["interactionId"]): Promise<void>;
|
|
94
|
-
holderSubmitProof(interactionId: InvitationResultProofRequest["interactionId"], credentials: Record<PresentationDefinitionRequestedCredential["id"], PresentationSubmitCredentialRequest | PresentationSubmitCredentialRequest[]
|
|
94
|
+
holderSubmitProof(interactionId: InvitationResultProofRequest["interactionId"], credentials: Record<PresentationDefinitionRequestedCredential["id"], PresentationSubmitCredentialRequest | PresentationSubmitCredentialRequest[]>): Promise<void>;
|
|
95
95
|
holderSubmitProofV2(interactionId: InvitationResultProofRequest["interactionId"], credentials: Record<string, PresentationSubmitV2CredentialRequest | PresentationSubmitV2CredentialRequest[]>): Promise<void>;
|
|
96
96
|
getCredentials(query: CredentialListQuery): Promise<ItemList<CredentialListItem>>;
|
|
97
97
|
runTask(task: string): Promise<string>;
|
|
@@ -160,9 +160,9 @@ export interface ONECore {
|
|
|
160
160
|
*/
|
|
161
161
|
rollbackImport(): Promise<void>;
|
|
162
162
|
resolveJsonldContext(url: string): Promise<ResolveJsonLdContextResponse>;
|
|
163
|
-
holderRegisterWalletUnit(request: HolderRegisterWalletUnitRequest): Promise<
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
holderRegisterWalletUnit(request: HolderRegisterWalletUnitRequest): Promise<HolderWalletUnitDetail["id"]>;
|
|
164
|
+
holderWalletUnitStatus(walletUnitId: HolderWalletUnitDetail["id"]): Promise<void>;
|
|
165
|
+
holderGetWalletUnit(walletUnitId: HolderWalletUnitDetail["id"]): Promise<HolderWalletUnitDetail>;
|
|
166
166
|
/**
|
|
167
167
|
* Start scanning for ISO 18013-5 NFC engagement
|
|
168
168
|
*
|
|
@@ -183,4 +183,4 @@ export interface ONECore {
|
|
|
183
183
|
*/
|
|
184
184
|
uninitialize(deleteData: boolean): Promise<void>;
|
|
185
185
|
}
|
|
186
|
-
export declare const interfaceMethodNames: readonly ["getVersion", "getConfig", "createOrganisation", "upsertOrganisation", "generateKey", "createDid", "getDids", "createIdentifier", "getIdentifier", "getIdentifiers", "deleteIdentifier", "handleInvitation", "holderAcceptCredential", "holderRejectCredential", "initiateIssuance", "continueIssuance", "getPresentationDefinition", "getPresentationDefinitionV2", "holderRejectProof", "holderSubmitProof", "holderSubmitProofV2", "getCredentials", "runTask", "deleteProofClaims", "getCredential", "deleteCredential", "importCredentialSchema", "getCredentialSchema", "getCredentialSchemas", "deleteCredentialSchema", "createProof", "shareProof", "shareProofSchema", "shareCredentialSchema", "getProof", "getProofs", "deleteProof", "proposeProof", "createProofSchema", "getProofSchemas", "getProofSchema", "deleteProofSchema", "importProofSchema", "checkRevocation", "createTrustAnchor", "deleteTrustAnchor", "getTrustAnchor", "getTrustAnchors", "createTrustEntity", "getTrustEntity", "getTrustEntities", "getTrustEntityByDid", "resolveTrustEntityByIdentifier", "createRemoteTrustEntity", "getRemoteTrustEntity", "updateRemoteTrustEntity", "getHistory", "getHistoryEntry", "createBackup", "backupInfo", "deleteCache", "unpackBackup", "finalizeImport", "rollbackImport", "resolveJsonldContext", "holderRegisterWalletUnit", "
|
|
186
|
+
export declare const interfaceMethodNames: readonly ["getVersion", "getConfig", "createOrganisation", "upsertOrganisation", "generateKey", "createDid", "getDids", "createIdentifier", "getIdentifier", "getIdentifiers", "deleteIdentifier", "handleInvitation", "holderAcceptCredential", "holderRejectCredential", "initiateIssuance", "continueIssuance", "getPresentationDefinition", "getPresentationDefinitionV2", "holderRejectProof", "holderSubmitProof", "holderSubmitProofV2", "getCredentials", "runTask", "deleteProofClaims", "getCredential", "deleteCredential", "importCredentialSchema", "getCredentialSchema", "getCredentialSchemas", "deleteCredentialSchema", "createProof", "shareProof", "shareProofSchema", "shareCredentialSchema", "getProof", "getProofs", "deleteProof", "proposeProof", "createProofSchema", "getProofSchemas", "getProofSchema", "deleteProofSchema", "importProofSchema", "checkRevocation", "createTrustAnchor", "deleteTrustAnchor", "getTrustAnchor", "getTrustAnchors", "createTrustEntity", "getTrustEntity", "getTrustEntities", "getTrustEntityByDid", "resolveTrustEntityByIdentifier", "createRemoteTrustEntity", "getRemoteTrustEntity", "updateRemoteTrustEntity", "getHistory", "getHistoryEntry", "createBackup", "backupInfo", "deleteCache", "unpackBackup", "finalizeImport", "rollbackImport", "resolveJsonldContext", "holderRegisterWalletUnit", "holderWalletUnitStatus", "holderGetWalletUnit", "nfcReadIsoMdlEngagement", "nfcStopIsoMdlEngagement", "uninitialize"];
|
package/dist/src/core.js
CHANGED
|
@@ -82,8 +82,8 @@ export const interfaceMethodNames = [
|
|
|
82
82
|
"rollbackImport",
|
|
83
83
|
"resolveJsonldContext",
|
|
84
84
|
"holderRegisterWalletUnit",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
85
|
+
"holderWalletUnitStatus",
|
|
86
|
+
"holderGetWalletUnit",
|
|
87
87
|
"nfcReadIsoMdlEngagement",
|
|
88
88
|
"nfcStopIsoMdlEngagement",
|
|
89
89
|
"uninitialize",
|
package/dist/src/credential.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataTypeEnum } from "./config";
|
|
2
|
-
import { CredentialSchema,
|
|
2
|
+
import { CredentialSchema, KeyStorageSecurity } from "./credentialSchema";
|
|
3
3
|
import { ListQuery, SortDirection } from "./list";
|
|
4
4
|
import { IdentifierListItem } from "./identifier";
|
|
5
5
|
export declare enum CredentialStateEnum {
|
|
@@ -141,8 +141,10 @@ export interface InvitationResultCredentialIssuance {
|
|
|
141
141
|
* is typically sent through a separate channel such as SMS or email.
|
|
142
142
|
*/
|
|
143
143
|
txCode?: OpenID4VCITxCode;
|
|
144
|
-
/**
|
|
145
|
-
|
|
144
|
+
/** Accepted storage security levels for holder binding key */
|
|
145
|
+
keyStorageSecurityLevels?: KeyStorageSecurity[];
|
|
146
|
+
/** Accepted algorithms for holder binding key */
|
|
147
|
+
keyAlgorithms?: string[];
|
|
146
148
|
}
|
|
147
149
|
export interface OpenID4VCITxCode {
|
|
148
150
|
inputMode?: OpenID4VCITxCodeInputMode;
|
|
@@ -174,8 +176,10 @@ export interface InitiateIssuanceResponse {
|
|
|
174
176
|
export interface ContinueIssuanceResponse {
|
|
175
177
|
/** For reference. */
|
|
176
178
|
interactionId: string;
|
|
177
|
-
/**
|
|
178
|
-
|
|
179
|
+
/** Accepted storage security levels for holder binding key */
|
|
180
|
+
keyStorageSecurityLevels?: KeyStorageSecurity[];
|
|
181
|
+
/** Accepted algorithms for holder binding key */
|
|
182
|
+
keyAlgorithms?: string[];
|
|
179
183
|
}
|
|
180
184
|
export interface OpenID4VCIProofTypeSupported {
|
|
181
185
|
proofSigningAlgValuesSupported: string[];
|
|
@@ -187,3 +191,11 @@ export interface AuthorizationCodeFlow {
|
|
|
187
191
|
* the authorization process with the authorization server. */
|
|
188
192
|
authorizationCodeFlowUrl: string;
|
|
189
193
|
}
|
|
194
|
+
export interface HolderAcceptCredentialRequest {
|
|
195
|
+
interactionId: string;
|
|
196
|
+
didId?: string;
|
|
197
|
+
identifierId?: string;
|
|
198
|
+
keyId?: string;
|
|
199
|
+
txCode?: string;
|
|
200
|
+
holderWalletUnitId?: string;
|
|
201
|
+
}
|
|
@@ -13,13 +13,11 @@ export interface ImportCredentialSchemaRequestSchema {
|
|
|
13
13
|
organisationId: string;
|
|
14
14
|
importedSourceUrl: string;
|
|
15
15
|
claims: ImportCredentialSchemaClaimSchema[];
|
|
16
|
-
|
|
16
|
+
keyStorageSecurity?: KeyStorageSecurity;
|
|
17
17
|
schemaId: string;
|
|
18
|
-
schemaType: CredentialSchemaType;
|
|
19
18
|
layoutType?: LayoutType;
|
|
20
19
|
layoutProperties?: ImportCredentialSchemaLayoutProperties;
|
|
21
20
|
allowSuspension?: boolean;
|
|
22
|
-
externalSchema: boolean;
|
|
23
21
|
}
|
|
24
22
|
export interface ImportCredentialSchemaClaimSchema {
|
|
25
23
|
id: string;
|
|
@@ -72,19 +70,12 @@ export interface CredentialSchemaListQuery extends ListQuery {
|
|
|
72
70
|
/** accepts the RFC3339 format, e.g. use the {@link Date.toISOString} */
|
|
73
71
|
lastModifiedBefore?: string;
|
|
74
72
|
}
|
|
75
|
-
export declare enum
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
export declare enum KeyStorageSecurity {
|
|
74
|
+
HIGH = "HIGH",
|
|
75
|
+
MODERATE = "MODERATE",
|
|
76
|
+
ENHANCED_BASIC = "ENHANCED_BASIC",
|
|
77
|
+
BASIC = "BASIC"
|
|
80
78
|
}
|
|
81
|
-
export declare enum KnownCredentialSchemaType {
|
|
82
|
-
PROCIVIS_ONE_SCHEMA2024 = "PROCIVIS_ONE_SCHEMA2024",
|
|
83
|
-
FALLBACK_SCHEMA2024 = "FALLBACK_SCHEMA2024",
|
|
84
|
-
MDOC = "MDOC",
|
|
85
|
-
SD_JWT_VC = "SD_JWT_VC"
|
|
86
|
-
}
|
|
87
|
-
export type CredentialSchemaType = KnownCredentialSchemaType | string;
|
|
88
79
|
export declare enum LayoutType {
|
|
89
80
|
CARD = "CARD",
|
|
90
81
|
DOCUMENT = "DOCUMENT",
|
|
@@ -97,10 +88,9 @@ export interface CredentialSchema {
|
|
|
97
88
|
name: string;
|
|
98
89
|
format: string;
|
|
99
90
|
revocationMethod: string;
|
|
100
|
-
|
|
91
|
+
keyStorageSecurity?: KeyStorageSecurity;
|
|
101
92
|
schemaId: string;
|
|
102
93
|
importedSourceUrl: string;
|
|
103
|
-
schemaType: CredentialSchemaType;
|
|
104
94
|
layoutType?: LayoutType;
|
|
105
95
|
layoutProperties?: CredentialSchemaLayoutProperties;
|
|
106
96
|
}
|
|
@@ -13,20 +13,13 @@ export var ExactCredentialSchemaFilterColumnEnum;
|
|
|
13
13
|
ExactCredentialSchemaFilterColumnEnum["NAME"] = "NAME";
|
|
14
14
|
ExactCredentialSchemaFilterColumnEnum["SCHEMA_ID"] = "SCHEMA_ID";
|
|
15
15
|
})(ExactCredentialSchemaFilterColumnEnum || (ExactCredentialSchemaFilterColumnEnum = {}));
|
|
16
|
-
export var
|
|
17
|
-
(function (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})(
|
|
23
|
-
export var KnownCredentialSchemaType;
|
|
24
|
-
(function (KnownCredentialSchemaType) {
|
|
25
|
-
KnownCredentialSchemaType["PROCIVIS_ONE_SCHEMA2024"] = "PROCIVIS_ONE_SCHEMA2024";
|
|
26
|
-
KnownCredentialSchemaType["FALLBACK_SCHEMA2024"] = "FALLBACK_SCHEMA2024";
|
|
27
|
-
KnownCredentialSchemaType["MDOC"] = "MDOC";
|
|
28
|
-
KnownCredentialSchemaType["SD_JWT_VC"] = "SD_JWT_VC";
|
|
29
|
-
})(KnownCredentialSchemaType || (KnownCredentialSchemaType = {}));
|
|
16
|
+
export var KeyStorageSecurity;
|
|
17
|
+
(function (KeyStorageSecurity) {
|
|
18
|
+
KeyStorageSecurity["HIGH"] = "HIGH";
|
|
19
|
+
KeyStorageSecurity["MODERATE"] = "MODERATE";
|
|
20
|
+
KeyStorageSecurity["ENHANCED_BASIC"] = "ENHANCED_BASIC";
|
|
21
|
+
KeyStorageSecurity["BASIC"] = "BASIC";
|
|
22
|
+
})(KeyStorageSecurity || (KeyStorageSecurity = {}));
|
|
30
23
|
export var LayoutType;
|
|
31
24
|
(function (LayoutType) {
|
|
32
25
|
LayoutType["CARD"] = "CARD";
|
package/dist/src/history.d.ts
CHANGED
|
@@ -24,7 +24,9 @@ export declare enum HistoryActionEnum {
|
|
|
24
24
|
UPDATED = "UPDATED",
|
|
25
25
|
REACTIVATED = "REACTIVATED",
|
|
26
26
|
CSR_GENERATED = "CSR_GENERATED",
|
|
27
|
-
EXPIRED = "EXPIRED"
|
|
27
|
+
EXPIRED = "EXPIRED",
|
|
28
|
+
INTERACTION_CREATED = "INTERACTION_CREATED",
|
|
29
|
+
INTERACTION_ERRORED = "INTERACTION_ERRORED"
|
|
28
30
|
}
|
|
29
31
|
export declare enum HistoryEntityTypeEnum {
|
|
30
32
|
KEY = "KEY",
|
|
@@ -40,7 +42,13 @@ export declare enum HistoryEntityTypeEnum {
|
|
|
40
42
|
TRUST_ANCHOR = "TRUST_ANCHOR",
|
|
41
43
|
TRUST_ENTITY = "TRUST_ENTITY",
|
|
42
44
|
WALLET_UNIT = "WALLET_UNIT",
|
|
43
|
-
|
|
45
|
+
USER = "USER",
|
|
46
|
+
PROVIDER = "PROVIDER",
|
|
47
|
+
WALLET_RELYING_PARTY = "WALLET_RELYING_PARTY",
|
|
48
|
+
STS_ROLE = "STS_ROLE",
|
|
49
|
+
STS_ORGANISATION = "STS_ORGANISATION",
|
|
50
|
+
STS_IAM_ROLE = "STS_IAM_ROLE",
|
|
51
|
+
STS_TOKEN = "STS_TOKEN"
|
|
44
52
|
}
|
|
45
53
|
export declare enum HistorySearchTypeEnum {
|
|
46
54
|
CLAIM_NAME = "CLAIM_NAME",
|
|
@@ -53,7 +61,7 @@ export declare enum HistorySearchTypeEnum {
|
|
|
53
61
|
PROOF_SCHEMA_NAME = "PROOF_SCHEMA_NAME"
|
|
54
62
|
}
|
|
55
63
|
export interface HistoryListQuery extends ListQuery {
|
|
56
|
-
|
|
64
|
+
entityIds?: string[];
|
|
57
65
|
actions?: HistoryActionEnum[];
|
|
58
66
|
entityTypes?: HistoryEntityTypeEnum[];
|
|
59
67
|
/** accepts the RFC3339 format, e.g. use the {@link Date.toISOString} */
|
|
@@ -65,7 +73,7 @@ export interface HistoryListQuery extends ListQuery {
|
|
|
65
73
|
credentialSchemaId?: string;
|
|
66
74
|
proofSchemaId?: string;
|
|
67
75
|
search?: HistoryListSearch;
|
|
68
|
-
|
|
76
|
+
users?: string[];
|
|
69
77
|
}
|
|
70
78
|
export interface HistoryListSearch {
|
|
71
79
|
text: string;
|
package/dist/src/history.js
CHANGED
|
@@ -24,6 +24,8 @@ export var HistoryActionEnum;
|
|
|
24
24
|
HistoryActionEnum["REACTIVATED"] = "REACTIVATED";
|
|
25
25
|
HistoryActionEnum["CSR_GENERATED"] = "CSR_GENERATED";
|
|
26
26
|
HistoryActionEnum["EXPIRED"] = "EXPIRED";
|
|
27
|
+
HistoryActionEnum["INTERACTION_CREATED"] = "INTERACTION_CREATED";
|
|
28
|
+
HistoryActionEnum["INTERACTION_ERRORED"] = "INTERACTION_ERRORED";
|
|
27
29
|
})(HistoryActionEnum || (HistoryActionEnum = {}));
|
|
28
30
|
export var HistoryEntityTypeEnum;
|
|
29
31
|
(function (HistoryEntityTypeEnum) {
|
|
@@ -40,7 +42,13 @@ export var HistoryEntityTypeEnum;
|
|
|
40
42
|
HistoryEntityTypeEnum["TRUST_ANCHOR"] = "TRUST_ANCHOR";
|
|
41
43
|
HistoryEntityTypeEnum["TRUST_ENTITY"] = "TRUST_ENTITY";
|
|
42
44
|
HistoryEntityTypeEnum["WALLET_UNIT"] = "WALLET_UNIT";
|
|
43
|
-
HistoryEntityTypeEnum["
|
|
45
|
+
HistoryEntityTypeEnum["USER"] = "USER";
|
|
46
|
+
HistoryEntityTypeEnum["PROVIDER"] = "PROVIDER";
|
|
47
|
+
HistoryEntityTypeEnum["WALLET_RELYING_PARTY"] = "WALLET_RELYING_PARTY";
|
|
48
|
+
HistoryEntityTypeEnum["STS_ROLE"] = "STS_ROLE";
|
|
49
|
+
HistoryEntityTypeEnum["STS_ORGANISATION"] = "STS_ORGANISATION";
|
|
50
|
+
HistoryEntityTypeEnum["STS_IAM_ROLE"] = "STS_IAM_ROLE";
|
|
51
|
+
HistoryEntityTypeEnum["STS_TOKEN"] = "STS_TOKEN";
|
|
44
52
|
})(HistoryEntityTypeEnum || (HistoryEntityTypeEnum = {}));
|
|
45
53
|
export var HistorySearchTypeEnum;
|
|
46
54
|
(function (HistorySearchTypeEnum) {
|
package/dist/src/proof.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CredentialSchema, CredentialSchemaLayoutProperties,
|
|
1
|
+
import { CredentialSchema, CredentialSchemaLayoutProperties, LayoutType, KeyStorageSecurity } from "./credentialSchema";
|
|
2
2
|
import { ListQuery, SortDirection } from "./list";
|
|
3
3
|
export interface ProofInputClaimSchema {
|
|
4
4
|
id: string;
|
|
@@ -93,10 +93,9 @@ export interface ImportProofSchemaCredentialSchema {
|
|
|
93
93
|
name: string;
|
|
94
94
|
format: string;
|
|
95
95
|
revocationMethod: string;
|
|
96
|
-
|
|
96
|
+
keyStorageSecurity?: KeyStorageSecurity;
|
|
97
97
|
schemaId: string;
|
|
98
98
|
importedSourceUrl: string;
|
|
99
|
-
schemaType: CredentialSchemaType;
|
|
100
99
|
layoutType?: LayoutType;
|
|
101
100
|
layoutProperties?: CredentialSchemaLayoutProperties;
|
|
102
101
|
}
|
package/dist/src/walletUnit.d.ts
CHANGED
|
@@ -2,40 +2,29 @@ import { KeyListItem } from "./key";
|
|
|
2
2
|
export declare enum WalletProviderTypeEnum {
|
|
3
3
|
PROCIVIS_ONE = "PROCIVIS_ONE"
|
|
4
4
|
}
|
|
5
|
-
export declare enum WalletUnitStatusEnum {
|
|
6
|
-
PENDING = "PENDING",
|
|
7
|
-
ACTIVE = "ACTIVE",
|
|
8
|
-
REVOKED = "REVOKED",
|
|
9
|
-
ERROR = "ERROR"
|
|
10
|
-
}
|
|
11
5
|
export interface WalletProvider {
|
|
12
6
|
url: string;
|
|
13
7
|
type: WalletProviderTypeEnum;
|
|
14
|
-
name: string;
|
|
15
|
-
appIntegrityCheckRequired: boolean;
|
|
16
8
|
}
|
|
17
9
|
export interface HolderRegisterWalletUnitRequest {
|
|
18
10
|
organisationId: string;
|
|
19
11
|
walletProvider: WalletProvider;
|
|
20
12
|
keyType: KeyListItem["keyType"];
|
|
21
13
|
}
|
|
22
|
-
export interface
|
|
23
|
-
id: string;
|
|
24
|
-
keyId: KeyListItem["id"];
|
|
25
|
-
}
|
|
26
|
-
export interface HolderRefreshWalletUnitRequest {
|
|
27
|
-
organisationId: string;
|
|
28
|
-
appIntegrityCheckRequired: boolean;
|
|
29
|
-
}
|
|
30
|
-
export interface HolderAttestationWalletUnitResponse {
|
|
14
|
+
export interface HolderWalletUnitDetail {
|
|
31
15
|
id: string;
|
|
32
16
|
createdDate: string;
|
|
33
17
|
lastModified: string;
|
|
34
|
-
|
|
35
|
-
status: WalletUnitStatusEnum;
|
|
36
|
-
attestation: string;
|
|
37
|
-
walletUnitId: string;
|
|
18
|
+
providerWalletUnitId: string;
|
|
38
19
|
walletProviderUrl: string;
|
|
39
20
|
walletProviderType: WalletProviderTypeEnum;
|
|
40
21
|
walletProviderName: string;
|
|
22
|
+
status: WalletUnitStatus;
|
|
23
|
+
authenticationKey: KeyListItem;
|
|
24
|
+
}
|
|
25
|
+
export declare enum WalletUnitStatus {
|
|
26
|
+
PENDING = "PENDING",
|
|
27
|
+
ACTIVE = "ACTIVE",
|
|
28
|
+
REVOKED = "REVOKED",
|
|
29
|
+
ERROR = "ERROR"
|
|
41
30
|
}
|
package/dist/src/walletUnit.js
CHANGED
|
@@ -2,10 +2,10 @@ export var WalletProviderTypeEnum;
|
|
|
2
2
|
(function (WalletProviderTypeEnum) {
|
|
3
3
|
WalletProviderTypeEnum["PROCIVIS_ONE"] = "PROCIVIS_ONE";
|
|
4
4
|
})(WalletProviderTypeEnum || (WalletProviderTypeEnum = {}));
|
|
5
|
-
export var
|
|
6
|
-
(function (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})(
|
|
5
|
+
export var WalletUnitStatus;
|
|
6
|
+
(function (WalletUnitStatus) {
|
|
7
|
+
WalletUnitStatus["PENDING"] = "PENDING";
|
|
8
|
+
WalletUnitStatus["ACTIVE"] = "ACTIVE";
|
|
9
|
+
WalletUnitStatus["REVOKED"] = "REVOKED";
|
|
10
|
+
WalletUnitStatus["ERROR"] = "ERROR";
|
|
11
|
+
})(WalletUnitStatus || (WalletUnitStatus = {}));
|
|
@@ -67,11 +67,7 @@ RCT_EXTERN_METHOD(handleInvitation:(NSDictionary *)request
|
|
|
67
67
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
68
68
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
69
69
|
|
|
70
|
-
RCT_EXTERN_METHOD(holderAcceptCredential:(
|
|
71
|
-
didId:(NSString *)didId
|
|
72
|
-
identifierId:(NSString *)identifierId
|
|
73
|
-
keyId:(NSString *)keyId
|
|
74
|
-
txCode:(NSString *)txCode
|
|
70
|
+
RCT_EXTERN_METHOD(holderAcceptCredential:(NSDictionary *)request
|
|
75
71
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
76
72
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
77
73
|
|
|
@@ -101,9 +97,6 @@ RCT_EXTERN_METHOD(holderRejectProof:(NSString *)interactionId
|
|
|
101
97
|
|
|
102
98
|
RCT_EXTERN_METHOD(holderSubmitProof:(NSString *)interactionId
|
|
103
99
|
credentials:(NSDictionary *)credentials
|
|
104
|
-
didId:(NSString *)didId
|
|
105
|
-
identifierId:(NSString *)identifierId
|
|
106
|
-
keyId:(NSString *)keyId
|
|
107
100
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
108
101
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
109
102
|
|
|
@@ -289,11 +282,11 @@ RCT_EXTERN_METHOD(holderRegisterWalletUnit:(NSDictionary *)request
|
|
|
289
282
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
290
283
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
291
284
|
|
|
292
|
-
RCT_EXTERN_METHOD(
|
|
285
|
+
RCT_EXTERN_METHOD(holderWalletUnitStatus:(NSString *)walletUnitId
|
|
293
286
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
294
287
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
295
288
|
|
|
296
|
-
RCT_EXTERN_METHOD(
|
|
289
|
+
RCT_EXTERN_METHOD(holderGetWalletUnit:(NSString *)walletUnitId
|
|
297
290
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
298
291
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
299
292
|
|
|
@@ -233,24 +233,14 @@ class ProcivisOneCoreModule: RCTEventEmitter {
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
@objc(holderAcceptCredential:
|
|
236
|
+
@objc(holderAcceptCredential:resolver:rejecter:)
|
|
237
237
|
func holderAcceptCredential(
|
|
238
|
-
|
|
239
|
-
didId: String?,
|
|
240
|
-
identifierId: String?,
|
|
241
|
-
keyId: String?,
|
|
242
|
-
txCode: String?,
|
|
238
|
+
request: NSDictionary,
|
|
243
239
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
244
240
|
reject: @escaping RCTPromiseRejectBlock
|
|
245
241
|
) {
|
|
246
242
|
asyncCall(resolve, reject) {
|
|
247
|
-
return try await self.getCore().holderAcceptCredential(
|
|
248
|
-
interactionId: interactionId,
|
|
249
|
-
didId: didId,
|
|
250
|
-
identifierId: identifierId,
|
|
251
|
-
keyId: keyId,
|
|
252
|
-
txCode: txCode
|
|
253
|
-
)
|
|
243
|
+
return try await self.getCore().holderAcceptCredential(request: try deserialize(request))
|
|
254
244
|
}
|
|
255
245
|
}
|
|
256
246
|
|
|
@@ -326,23 +316,17 @@ class ProcivisOneCoreModule: RCTEventEmitter {
|
|
|
326
316
|
}
|
|
327
317
|
}
|
|
328
318
|
|
|
329
|
-
@objc(holderSubmitProof:credentials:
|
|
319
|
+
@objc(holderSubmitProof:credentials:resolver:rejecter:)
|
|
330
320
|
func submitProof(
|
|
331
321
|
interactionId: String,
|
|
332
322
|
credentials: NSDictionary,
|
|
333
|
-
didId: String?,
|
|
334
|
-
identifierId: String?,
|
|
335
|
-
keyId: String?,
|
|
336
323
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
337
324
|
reject: @escaping RCTPromiseRejectBlock
|
|
338
325
|
) {
|
|
339
326
|
asyncCall(resolve, reject) {
|
|
340
327
|
try await self.getCore().holderSubmitProof(
|
|
341
328
|
interactionId: interactionId,
|
|
342
|
-
submitCredentials: try deserialize(credentials)
|
|
343
|
-
didId: didId,
|
|
344
|
-
identifierId: identifierId,
|
|
345
|
-
keyId: keyId
|
|
329
|
+
submitCredentials: try deserialize(credentials)
|
|
346
330
|
)
|
|
347
331
|
return nil as NSDictionary?
|
|
348
332
|
}
|
|
@@ -358,7 +342,7 @@ class ProcivisOneCoreModule: RCTEventEmitter {
|
|
|
358
342
|
asyncCall(resolve, reject) {
|
|
359
343
|
try await self.getCore().holderSubmitProofV2(
|
|
360
344
|
interactionId: interactionId,
|
|
361
|
-
submission: try deserialize(submission)
|
|
345
|
+
submission: try deserialize(submission)
|
|
362
346
|
)
|
|
363
347
|
return nil as NSDictionary?
|
|
364
348
|
}
|
|
@@ -901,31 +885,30 @@ class ProcivisOneCoreModule: RCTEventEmitter {
|
|
|
901
885
|
reject: @escaping RCTPromiseRejectBlock
|
|
902
886
|
) {
|
|
903
887
|
asyncCall(resolve, reject) {
|
|
904
|
-
|
|
905
|
-
return try serializeAny(result)
|
|
888
|
+
return try await self.getCore().holderRegisterWalletUnit(request: try deserialize(request))
|
|
906
889
|
}
|
|
907
890
|
}
|
|
908
891
|
|
|
909
|
-
@objc(
|
|
910
|
-
func
|
|
911
|
-
|
|
892
|
+
@objc(holderWalletUnitStatus:resolver:rejecter:)
|
|
893
|
+
func holderWalletUnitStatus(
|
|
894
|
+
walletUnitId: String,
|
|
912
895
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
913
896
|
reject: @escaping RCTPromiseRejectBlock
|
|
914
897
|
) {
|
|
915
898
|
asyncCall(resolve, reject) {
|
|
916
|
-
try await self.getCore().
|
|
899
|
+
try await self.getCore().holderWalletUnitStatus(id: walletUnitId)
|
|
917
900
|
return nil as NSDictionary?
|
|
918
901
|
}
|
|
919
902
|
}
|
|
920
903
|
|
|
921
|
-
@objc(
|
|
922
|
-
func
|
|
923
|
-
|
|
904
|
+
@objc(holderGetWalletUnit:resolver:rejecter:)
|
|
905
|
+
func holderGetWalletUnit(
|
|
906
|
+
walletUnitId: String,
|
|
924
907
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
925
908
|
reject: @escaping RCTPromiseRejectBlock
|
|
926
909
|
) {
|
|
927
910
|
asyncCall(resolve, reject) {
|
|
928
|
-
let result = try await self.getCore().
|
|
911
|
+
let result = try await self.getCore().holderGetWalletUnit(id: walletUnitId)
|
|
929
912
|
return try serializeAny(result)
|
|
930
913
|
}
|
|
931
914
|
}
|
package/ios/RSEKeyStorage.swift
CHANGED
|
@@ -48,65 +48,34 @@ class RSEKeyStorage: NativeKeyStorage {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
func generateKey(keyAlias: String) async throws -> GeneratedKeyBindingDto {
|
|
51
|
+
// Check if main asset exists and handle its state
|
|
51
52
|
if let asset = UbqSdk.assets.first {
|
|
52
|
-
if
|
|
53
|
-
throw NativeKeyStorageError.KeyGenerationFailure(reason: "Already created")
|
|
54
|
-
} else {
|
|
53
|
+
if asset.state != .normal {
|
|
55
54
|
// an asset can be left locked after an unfinished generation earlier (e.g. app forcefully closed during PIN setup)
|
|
56
55
|
try await delete()
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
|
-
|
|
58
|
+
|
|
60
59
|
do {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
let identityUrl = URL(string: "\(identity_service_url)/organisation/\(organisation_id)/identity/")!
|
|
71
|
-
var identityRequest = URLRequest(url: identityUrl)
|
|
72
|
-
identityRequest.httpMethod = "POST"
|
|
73
|
-
identityRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
74
|
-
identityRequest.setValue("bearer \(accessToken)", forHTTPHeaderField: "Authorization")
|
|
75
|
-
identityRequest.httpBody = try JSONEncoder().encode(CreateIdentityPayload(sub: "ios-rse-example-\(generateRandomString(length: 16))"))
|
|
76
|
-
let (identityData, _) = try await URLSession.shared.data(for: identityRequest)
|
|
77
|
-
|
|
78
|
-
let identityResponse = try JSONDecoder().decode(CreateIdentityResponse.self, from: identityData)
|
|
79
|
-
let subject = identityResponse.sub
|
|
80
|
-
|
|
81
|
-
let rseUrl = URL(string: "\(identity_service_url)/organisation/\(organisation_id)/identity/\(subject)/register_rse/")!
|
|
82
|
-
var rseRequest = URLRequest(url: rseUrl)
|
|
83
|
-
rseRequest.httpMethod = "POST"
|
|
84
|
-
identityRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
85
|
-
rseRequest.setValue("bearer \(accessToken)", forHTTPHeaderField: "Authorization")
|
|
86
|
-
rseRequest.httpBody = try JSONEncoder().encode(CreateIdentityPayload(sub: "ios-rse-example- \(generateRandomString(length: 16))"))
|
|
87
|
-
let (rseData, _) = try await URLSession.shared.data(for: rseRequest)
|
|
88
|
-
|
|
89
|
-
let rseResponse = try JSONDecoder().decode(RegisterRseResponse.self, from: rseData)
|
|
90
|
-
|
|
91
|
-
let subscribeTransaction = try await withCheckedThrowingContinuation { continuation in
|
|
92
|
-
UbqSdk.subscribe(rseResponse.nonce, rseResponse.puk) { flow in
|
|
93
|
-
continuation.resume(returning: flow)
|
|
94
|
-
} onStartFailure: { error in
|
|
95
|
-
continuation.resume(throwing: error)
|
|
96
|
-
}
|
|
60
|
+
// Get or create the main asset
|
|
61
|
+
let mainAsset: UbqAsset
|
|
62
|
+
if let existingAsset = UbqSdk.assets.first, existingAsset.state == .normal {
|
|
63
|
+
// Main asset already exists and is ready - reuse it
|
|
64
|
+
mainAsset = existingAsset
|
|
65
|
+
} else {
|
|
66
|
+
// Need to create the main asset
|
|
67
|
+
mainAsset = try await createMainAsset()
|
|
97
68
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
self.subscriber = nil
|
|
101
|
-
|
|
69
|
+
|
|
70
|
+
// Create a new derived asset from the main asset
|
|
102
71
|
let derivedAsset = try await withCheckedThrowingContinuation { continuation in
|
|
103
|
-
|
|
72
|
+
mainAsset.createDa(cryptoTypes: .EdDSA_25519) { derivedAsset in
|
|
104
73
|
continuation.resume(returning: derivedAsset)
|
|
105
74
|
} failure: { error in
|
|
106
75
|
continuation.resume(throwing: error)
|
|
107
76
|
}
|
|
108
77
|
}
|
|
109
|
-
|
|
78
|
+
|
|
110
79
|
guard let keyReference = derivedAsset.uuid.uuidString.data(using: .utf8),
|
|
111
80
|
let pemString = derivedAsset.publicKey,
|
|
112
81
|
let publicKeyPrefixed = parsePEMPublicKeyContent(pemString) else {
|
|
@@ -120,11 +89,58 @@ class RSEKeyStorage: NativeKeyStorage {
|
|
|
120
89
|
} catch {
|
|
121
90
|
self.subscriber = nil
|
|
122
91
|
ProcivisOneCoreEventEmitter.shared.sendHidePinEvent()
|
|
123
|
-
// delete
|
|
124
|
-
|
|
92
|
+
// delete partially generated asset only if we were creating a new one
|
|
93
|
+
if UbqSdk.assets.isEmpty || UbqSdk.assets.first?.state != .normal {
|
|
94
|
+
try? await delete()
|
|
95
|
+
}
|
|
125
96
|
throw NativeKeyStorageError.KeyGenerationFailure(reason: error.localizedDescription)
|
|
126
97
|
}
|
|
127
98
|
}
|
|
99
|
+
|
|
100
|
+
private func createMainAsset() async throws -> UbqAsset {
|
|
101
|
+
let tokenUrl = URL(string: "\(token_generator_url)/ubiqu/")!
|
|
102
|
+
var tokenRequest = URLRequest(url: tokenUrl)
|
|
103
|
+
tokenRequest.httpMethod = "GET"
|
|
104
|
+
tokenRequest.setValue("bearer \(api_key)", forHTTPHeaderField: "Authorization")
|
|
105
|
+
let (tokenData, _) = try await URLSession.shared.data(for: tokenRequest)
|
|
106
|
+
|
|
107
|
+
let tokenResponse = try JSONDecoder().decode(TokenResponse.self, from: tokenData)
|
|
108
|
+
let accessToken = tokenResponse.accessToken
|
|
109
|
+
|
|
110
|
+
let identityUrl = URL(string: "\(identity_service_url)/organisation/\(organisation_id)/identity/")!
|
|
111
|
+
var identityRequest = URLRequest(url: identityUrl)
|
|
112
|
+
identityRequest.httpMethod = "POST"
|
|
113
|
+
identityRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
114
|
+
identityRequest.setValue("bearer \(accessToken)", forHTTPHeaderField: "Authorization")
|
|
115
|
+
identityRequest.httpBody = try JSONEncoder().encode(CreateIdentityPayload(sub: "ios-rse-example-\(generateRandomString(length: 16))"))
|
|
116
|
+
let (identityData, _) = try await URLSession.shared.data(for: identityRequest)
|
|
117
|
+
|
|
118
|
+
let identityResponse = try JSONDecoder().decode(CreateIdentityResponse.self, from: identityData)
|
|
119
|
+
let subject = identityResponse.sub
|
|
120
|
+
|
|
121
|
+
let rseUrl = URL(string: "\(identity_service_url)/organisation/\(organisation_id)/identity/\(subject)/register_rse/")!
|
|
122
|
+
var rseRequest = URLRequest(url: rseUrl)
|
|
123
|
+
rseRequest.httpMethod = "POST"
|
|
124
|
+
rseRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
125
|
+
rseRequest.setValue("bearer \(accessToken)", forHTTPHeaderField: "Authorization")
|
|
126
|
+
rseRequest.httpBody = try JSONEncoder().encode(CreateIdentityPayload(sub: "ios-rse-example-\(generateRandomString(length: 16))"))
|
|
127
|
+
let (rseData, _) = try await URLSession.shared.data(for: rseRequest)
|
|
128
|
+
|
|
129
|
+
let rseResponse = try JSONDecoder().decode(RegisterRseResponse.self, from: rseData)
|
|
130
|
+
|
|
131
|
+
let subscribeTransaction = try await withCheckedThrowingContinuation { continuation in
|
|
132
|
+
UbqSdk.subscribe(rseResponse.nonce, rseResponse.puk) { flow in
|
|
133
|
+
continuation.resume(returning: flow)
|
|
134
|
+
} onStartFailure: { error in
|
|
135
|
+
continuation.resume(throwing: error)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
self.subscriber = await RSESubscriber(pinPad: RSEPinPad.self.sharedPinPad, transaction: subscribeTransaction)
|
|
139
|
+
let asset = try await self.subscriber!.perform()
|
|
140
|
+
self.subscriber = nil
|
|
141
|
+
|
|
142
|
+
return asset
|
|
143
|
+
}
|
|
128
144
|
|
|
129
145
|
func sign(keyReference: Data, message: Data) async throws -> Data {
|
|
130
146
|
guard let asset = UbqSdk.assets.first else {
|
|
@@ -137,9 +153,9 @@ class RSEKeyStorage: NativeKeyStorage {
|
|
|
137
153
|
continuation.resume(throwing: error)
|
|
138
154
|
}
|
|
139
155
|
}
|
|
140
|
-
guard let
|
|
141
|
-
let
|
|
142
|
-
derivedAsset.uuid ==
|
|
156
|
+
guard let keyReferenceUUIDString = String(data: keyReference, encoding: .utf8),
|
|
157
|
+
let keyReferenceUUID = UUID(uuidString: keyReferenceUUIDString),
|
|
158
|
+
let derivedAsset = asset.derivedAssets.first(where: { $0.uuid == keyReferenceUUID }) else {
|
|
143
159
|
throw NativeKeyStorageError.SignatureFailure(reason: "Key does not exist")
|
|
144
160
|
}
|
|
145
161
|
|
package/ios/Serialize.swift
CHANGED
|
@@ -101,12 +101,15 @@ private func serialize(proofRequestClaimValue: ProofRequestClaimValueBindingDto)
|
|
|
101
101
|
|
|
102
102
|
private func serialize(invitationResponse: HandleInvitationResponseBindingEnum) throws -> NSDictionary {
|
|
103
103
|
switch (invitationResponse) {
|
|
104
|
-
case let .credentialIssuance(interactionId,
|
|
104
|
+
case let .credentialIssuance(interactionId, keyStorageSecurityLevels, keyAlgorithms, txCode):
|
|
105
105
|
var result: [String: Any] = [
|
|
106
106
|
"interactionId": interactionId
|
|
107
107
|
];
|
|
108
|
-
if let
|
|
109
|
-
result["
|
|
108
|
+
if let keyStorageSecurityLevels = keyStorageSecurityLevels {
|
|
109
|
+
result["keyStorageSecurityLevels"] = keyStorageSecurityLevels.map { serializeEnumValue(value: $0) }
|
|
110
|
+
}
|
|
111
|
+
if let keyAlgorithms = keyAlgorithms {
|
|
112
|
+
result["keyAlgorithms"] = try serializeAny(keyAlgorithms)
|
|
110
113
|
}
|
|
111
114
|
if let txCode = txCode {
|
|
112
115
|
result["txCode"] = try serializeAny(txCode)
|