You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A protocol that defines the requirements for credentials that can be exported.
5
+
6
+
This protocol ensures that any credential conforming to it can be serialized into a data format suitable for export and specifies the type of restoration that will be required when the credential is imported back. This is particularly useful for scenarios where credentials need to be securely backed up, transferred, or shared between different systems or platforms.
7
+
8
+
- Properties:
9
+
- exporting: A `Data` representation of the credential that can be serialized and securely stored or transferred. This data should encapsulate all necessary information to recreate the credential upon import.
10
+
- restorationType: A `String` that indicates the method or requirements for restoring the credential from the exported data. This could relate to specific security measures, encryption standards, or data formats that are necessary for the credential's reconstruction.
11
+
12
+
Implementers of this protocol must ensure that the `exporting` property effectively captures the credential's state and that the `restorationType` accurately describes the requirements for its restoration.
13
+
*/
14
+
publicprotocolExportableCredential{
15
+
varexporting:Data{get}
16
+
varrestorationType:String{get}
17
+
}
18
+
19
+
/**
20
+
A protocol that defines the functionality required to import credentials from a serialized data format.
21
+
22
+
This interface is crucial for scenarios where credentials, previously exported using the `ExportableCredential` protocol, need to be reconstructed or imported back into the system. It allows for the implementation of a customizable import process that can handle various types of credentials and their respective restoration requirements.
23
+
24
+
- Method `importCredential`:
25
+
- Parameters:
26
+
- credentialData: The serialized `Data` representation of the credential to be imported. This data should have been generated by the `exporting` property of an `ExportableCredential`.
27
+
- restorationType: A `String` indicating the method or requirements for restoring the credential. This should match the `restorationType` provided during the export process.
28
+
- options: An array of `CredentialOperationsOptions` that may modify or provide additional context for the import process, allowing for more flexibility in handling different credential types and scenarios.
29
+
- Returns: An asynchronous operation that, upon completion, returns the imported `Credential` object, reconstructed from the provided data.
30
+
- Throws: An error if the import process encounters issues, such as data corruption, incompatible restoration types, or if the provided options are not supported.
31
+
32
+
Implementers should ensure robust error handling and validation to securely and accurately restore credentials from their exported state.
33
+
*/
34
+
publicprotocolCredentialImporter{
35
+
func importCredential(
36
+
credentialData:Data,
37
+
restorationType:String,
38
+
options:[CredentialOperationsOptions]
39
+
)asyncthrows->Credential
40
+
}
41
+
42
+
/**
43
+
Extension to the `Credential` class or struct, providing convenience properties related to the exportability of credentials.
44
+
45
+
This extension adds functionality to easily determine whether a credential conforms to the `ExportableCredential` protocol and, if so, obtain its exportable form. This simplifies the process of exporting credentials by abstracting the type checking and casting logic.
46
+
47
+
- Properties:
48
+
- isExportable: A Boolean value that indicates whether the `Credential` instance conforms to the `ExportableCredential` protocol, thereby supporting export operations.
49
+
- exportable: An optional `ExportableCredential` that returns the instance cast to `ExportableCredential` if it conforms to the protocol, or `nil` if it does not. This allows for direct access to the exporting capabilities of the credential without manual type checking or casting.
50
+
51
+
These properties enhance the usability of credentials by providing straightforward mechanisms to interact with export-related functionality.
52
+
*/
53
+
publicextensionCredential{
54
+
/// A Boolean value indicating whether the credential is exportable.
55
+
varisExportable:Bool{self is ExportableCredential}
56
+
57
+
/// Returns the exportable representation of the credential.
Copy file name to clipboardExpand all lines: EdgeAgentSDK/Domain/Sources/Models/Message.swift
+1-1
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ import Foundation
3
3
/// The `Message` struct represents a DIDComm message, which is used for secure, decentralized communication in the Atala PRISM architecture. A `Message` object includes information about the sender, recipient, message body, and other metadata. `Message` objects are typically exchanged between DID controllers using the `Mercury` building block.
4
4
publicstructMessage:Identifiable,Hashable{
5
5
/// The direction of the message (sent or received).
0 commit comments