Dizme SDK iOS Framework Library
DizmeSDK iOS Framework Library
Introduction
Scope and field of document application
This document describes integration specifications and API Description of Dizme SDK library for the iOS version. Within the document, the library will be called simply library, Dizme SDK, Framework, Dizme Wallet SDK, SDK.
Framework Version
The iOS library version is: 0.0.60
Release Note
- 0.0.4 - API Description, first release
-
0.0.5:
- Added descriptions for the methods related to the new features:
- reset
- getCredentialsList
- getNotificationsList
- performActionFromURL
- setAcceptedSchemes
- setAcceptedCredentialDefinitions
- Added NotificationType Enum
- Added descriptions for the methods related to the new features:
-
0.0.6:
- Removed Floating Action Button from the Home page of the SDK
-
0.0.7: Added descriptions for the methods related to the new feature:
- setNotDeletableSchemes
Integration of Dizme SDK into an iOS Application
Prerequisites
The Framework is provided through JFrog InfoCert Artifactory. The framework integration, using JFrog Artifactory, must be done using CocoaPods. Therefore, the following instructions assumes that the Integrating Application already has a Podfile file and then is ready to use Pods. If not, before proceeding further, the necessary configuration to use Pods must be done by the Integrating Application. To perform all the necessary steps, the Integrating Application, can use the following guide: Using CocoaPods In order to use CocoaPods with JFrog Artifactory, the Integrator will need to install the cocoapods-art plugin.
To install cocoapods-art plugin, open the Terminal and run the following command:
gem install cocoapods-art
Cocoapods-art plugin uses authentication to log into Jfrog Artifactory.
Therefore, the Integrator must have added the credentials for the access to the artifactory, in the standard netrc file. Then, in the netrc file of the integrator must be present the following authenitcation infos:
machine infocert.jfrog.io
login <USERNAME>
password <PASSWORD>
Using the Terminal, the integrator must add the Artifcactory Specs Repo for the CocoaPods Frameworks (dizme-native-iOS) as shown below:
pod repo-art add dizme-native-iOS "https://infocert.jfrog.io/artifactory/api/pods/dizme-native-iOS"
To update the added Specs (dizme-native-iOS) the Integrator, through the Terminal, can run:
pod repo-art update dizme-native-iOS
Add Framework's Pod to the integrant Application
To resolve Pods from the Artifactory Specs Repo added above (dizme-native-iOS), the Integrator must add the following snippet of code in the App's Podfile:
plugin 'cocoapods-art', :sources => [
'dizme-native-iOS'
]
If the application uses other Pods, contained within the CocoaPods public repos, it must specify as the source, in addition to the one related to the Pods of the Artifactory, also:
source 'https://github.com/CocoaPods/Specs.git'
To integrate the SDK in to the Integrant Application, the Integrator must add, to the App's Podfile, the following line:
pod 'dizme_sdk_framework', '0.0.60'
An example of the App's Podfile is shown below:
platform :ios, '13.0'
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/hyperledger/indy-sdk.git'
plugin 'cocoapods-art', :sources => [
'dizme-native-iOS'
]
target 'dizme_sdk_framework_test_app' do
use_frameworks!
pod 'dizme_sdk_framework', '0.0.60'
end
Finally, the Integrator can use, for the Pods installation, as usual:
pod install
API Description and I/O Objects
DizmeSDK
The object through which it is possible to perform all the main features offered by the SDK is the object DizmeSDK.
Each method invoked will provide the result through a specific callback.
To receive the latter, it is necessary to adopt the relevant protocols: DizmeSDKCallback and DizmeSDKInitCallback
API Description
Below the description of the DizmeSDK object methods:
-
createWallet(walletPassword: String, dizmeSDKEnvironment: DizmeSDKEnvironment, dizmeSDKLanguage: DizmeSDKLanguage, pushToken: String, domainInvitation: String, domain: String, callback: DizmeSDKInitCallback: This method is useful to perform the first initialization of the SDK. So it will only be called once. Below the description of the parameters:-
StringwalletPassword: A String that represents the Dizme SDK Wallet Password. -
DizmeSDKEnvironmentdizmeSDKEnvironment: The Dizme SDK Wallet environment -
DizmeSDKLanguagedizmeSDKLanguage: An Enum that represents the language to set for the Dizme SDK Wallet. -
StringpushToken: A String that represents the push notifications related token. -
StringdomainInvitation: A String that represents the invitation URL for the connection with the Domain. -
Stringdomain: A String that represents the Domain name. -
DizmeSDKInitCallbackcallback: The callback that will be called at the end of the createWallet operation. Will be called the 'DizmeSDKInitCallback.onCreateWalletCompleted' callback.
-
-
openWallet(walletPassword: String, pushToken: String, callback: DizmeSDKInitCallback): This method is useful to perform the initialization of the SDK at each startup of the Integrant Application. Below the description of the parameters:-
StringwalletPassword: A String that represents the Dizme SDK Wallet Password. -
StringpushToken: A String that represents the push notifications related token. -
DizmeSDKInitCallbackcallback: The callback that will be called at the end of the openWallet operation. Will be called the 'DizmeSDKInitCallback.onOpenWalletCompleted' callback.
-
-
initializeSDKFromBackup(backupFilePath: String, walletPassphrase: String, walletPassword: String, dizmeSDKLanguage: DizmeSDKLanguage, pushToken: String, domain: String, callback: DizmeSDKInitCallback): This method is useful to perform the initialization of the SDK using a backup file. Below the description of the parameters:-
StringbackupFilePath: A String that represents the path of the Dizme SDK Wallet backup file. -
StringwalletPassphrase: A String that represents the Dizme SDK Wallet Passphrase necessary to execute the recovery of the Dizme Wallet. -
StringwalletPassword: A String that represents the Dizme SDK Wallet Password. -
DizmeSDKLanguagedizmeSDKLanguage: An Enum that represents the language to set for the Dizme SDK Wallet. -
StringpushToken: A String that represents the push notifications related token. -
Stringdomain: A String that represents the Domain name. -
DizmeSDKInitCallbackcallback: The callback that will be called at the end of the initializeSDKFromBackup operation. Will be called the 'DizmeSDKInitCallback.onInitializeSDKFromBackup' callback.
-
The methods described above may also be called as DizmeSDK init methods or init methods. The operations that the SDK will perform by invoking them will be defined as init operations
-
startDizme(callback: DizmeSDKInitCallback, dataFromIntent: String?): This method is useful to start the main view of the Dizme SDK. Below the description of the parameters:-
DizmeSDKInitCallbackcallback: The callback that will be called at the end of the startDizme operation. Will be called the 'DizmeSDKInitCallback.onStartCompleted' callback -
StringdataFromIntent (Optional): A String that represents the URI (as String) received by the Integrant App, if it is intended for Dizme.
-
-
analyzeNotify(callback: DizmeSDKCallback, notifyMessageAsDict: [String : Any?]): This method is useful to analyze Integrating App's incoming notifications. If the incoming messages belong to Dizme the output of this method will be true, otherwise false. In the first case, DizmeSDK will execute (on background) the related operations, dependent from the received message. Below the description of the parameters:-
DizmeSDKCallbackcallback: The callback that will be called at the end of the analyzeNotify operation. Will be called the 'DizmeSDKCallback.onAnalyzeNotifyCompleted' callback -
DictionarynotifyMessageAsDict: A notify message, as Dictionary, received by the Integrating Application. For example:["destination":"dizme","owner":"dizme"]
-
-
doBackup(callback: DizmeSDKCallback): This method is useful to ask Dizme SDK to execute the backup of the entire Wallet. Below the description of the parameters:-
DizmeSDKCallbackcallback: The callback that will be called at the end of the doBackup operation. Will be called the 'DizmeSDKCallback.onDoBackupCompleted' callback
-
-
getWalletPassphrase(callback: DizmeSDKCallback): This method is useful to obtain the Dizme SDK Wallet Passphrase useful to execute the Dizme Wallet Recovery (initializeSDKFromBackup). Below the description of the parameters:-
DizmeSDKCallbackcallback: The callback that will be called at the end of the getWalletPassphrase operation. Will be called the 'DizmeSDKCallback.onGetWalletPassphraseCompleted' callback
-
-
getEnvironment(callback: DizmeSDKCallback): This method is useful to obtain the Dizme SDK Wallet Environment. Below the description of the parameters:-
DizmeSDKCallbackcallback: The callback that will be called at the end of the getEnvironment operation. Will be called the 'DizmeSDKCallback.onGetEnvironmentCompleted' callback
-
-
getSDKVersion(callback: DizmeSDKCallback): This method is useful to obtain the Dizme SDK Wallet version. Below the description of the parameters:-
DizmeSDKCallbackcallback: The callback that will be called at the end of the getSDKVersion operation. Will be called the 'DizmeSDKCallback.onGetSDKVersionCompleted' callback
-
-
getStatus(callback: DizmeSDKCallback): This method is useful to obtain the Dizme SDK Wallet status. Below the description of the parameters:-
interfaces.DizmeSDKCallbackcallback: The callback that will called at the end of the getStatus operation. Will be called the 'DizmeSDKCallback.onGetStatusCompleted' callback
-
-
setLanguage(callback: DizmeSDKCallback, dizmeSDKLanguage: DizmeSDKLanguage): This method is useful to set the language of the Dizme SDK. Below the description of the parameters:-
DizmeSDKCallbackcallback: The callback that will be called at the end of the setLanguage operation. Will be called the 'DizmeSDKCallback.onSetLanguageCompleted' callback -
DizmeSDKLanguagedizmeSDKLanguage: The language to set
-
-
getLanguage(callback: DizmeSDKCallback): This method is useful to obtain the language of the Dizme SDK. Below the description of the parameters:-
DizmeSDKCallbackcallback: The callback that will be called at the end of the getLanguage operation. Will be called the 'DizmeSDKCallback.onGetLanguageCompleted' callback
-
-
getMaintenanceInfo(callback: DizmeSDKCallback): This method is useful to obtain info about the Maintenance.-
DizmeSDKCallbackcallback: The callback that will be called at the end of the getMaintenanceInfo operation. Will be called the 'DizmeSDKCallback.onGetMaintenanceInfoCompleted' callback
-
-
openNotify(callback: DizmeSDKCallback, notifyId: String): This method is useful to open a Notify object.-
DizmeSDKCallbackcallback: The callback that will be called at the end of the openNotify operation. Will be called the 'DizmeSDKCallback.onOpenNotifyCompleted' callback -
StringnotifyId: The unique identifier representing the Notify object chosen by the Integrant Application.
-
-
getDizmeViewController() -> UIViewController: This method is useful to obtain the Dizme SDK UIViewController. Within the latter will be displayed all Views of the SDK. AUIViewControllerobject will be returned. -
getMyDomainDid(callback: DizmeSDKCallback): This method is useful to obtain the SDK DID related to the connection with the Domain.-
DizmeSDKCallbackcallback: The callback that will be called at the end of the getMyDomainDid operation. Will be called the 'DizmeSDKCallback.onGetMyDomainDidCompleted' callback
-
-
setNotifyCallback(callback: DizmeSDKCallback): This method is useful to set the callback that will be called when new Notify object was received by the SDK.-
DizmeSDKCallbackcallback: The callback that will be called when new Notify object was received. Will be called the 'DizmeSDKCallback.onNewNotificationReceived' callback.
-
-
reset(callback: DizmeSDKCallback): This method is useful to ask Dizme SDK to reset the entire Dizme Wallet. This method must be invoked only when the DizmeSDK UIViewController, obtained using the methodgetDizmeViewController() -> UIViewController, is not in foreground (not shown). This is because when the reset will be performed, the latter will be restarted. When the callback will be called it will be possible to interact with the DizmeSDK UIViewController again.-
DizmeSDKCallbackcallback: The callback that will be called at the end of the reset operation. Will be called the 'DizmeSDKCallback.onResetCompleted' callback.
-
-
performActionFromURL(callback:DizmeSDKCallback, url:String): This method is useful to provide to Dizme SDK the content of a Dizme QRCode, as an URL (as a String). If the URL is valid (belong to Dizme), the SDK will execute (on background) the related operations. Below the description of the parameters:-
DizmeSDKCallbackcallback: The callback that will be called at the end of the performActionFromURL operation. Will be called the 'DizmeSDKCallback.onActionFromURLPerformed' callback. -
Stringurl: The URL, as a String, extracted from a Dizme QRCode.
-
-
getNotificationsList(callback:DizmeSDKCallback): This method is useful to obtain the list of the incomnig notifications, as a list of dizme_sdk_framework.models.Notify objects.-
DizmeSDKCallbackcallback: The callback that will be called at the end of the getNotificationsList operation. Will be called the 'DizmeSDKCallback.onGetNotificationsListCompleted' callback.
-
-
getCredentialsList(callback:DizmeSDKCallback): This method is useful to obtain the list of the Credentials contained within the Dizme Wallet, as a JSON String.-
DizmeSDKCallbackcallback: The callback that will be called at the end of the getCredentialsList operation. Will be called the 'DizmeSDKCallback.getCredentialsList' callback.
-
-
setAcceptedSchemes(callback:DizmeSDKCallback, schemesList:[String]): This method is useful to set a list of schemes to make the SDK accept all the credentials issued using that specific schema without requiring the user to verify the data contained within the related Credential. Therefore, by setting a Schema Id, the SDK will accept each Credential, which refers to that Schema Id, which can be issued by multiple Issuers.-
DizmeSDKCallbackcallback: The callback that will be called at the end of the setAcceptedSchemes operation. Will be called the 'DizmeSDKCallback.onSetAcceptedSchemesCompleted' callback. -
[String]schemesList: The List of Schemes Identifiers (as String) to set.
-
-
setAcceptedCredentialDefinitions(callback:DizmeSDKCallback, credentialDefinitionsList:[String]): This method is useful to set a list of Credential Definition Id to make the SDK accept all the credentials issued using that Id without requiring the user to verify the data contained within the related Credential. Therefore, by setting a Credential Definition Id, the SDK will accept each Credential with that Id which can be issued by specific Issuer.-
DizmeSDKCallbackcallback: The callback that will be called at the end of the setAcceptedCredentialDefinitions operation. Will be called the 'DizmeSDKCallback.setAcceptedCredentialDefinitions' callback. -
[String]credentialDefinitionsList: The list of Credential Definition Identifiers (as String) to set.
-
-
setNotDeletableSchemes(callback:DizmeSDKCallback, schemesList:[String]): This method is useful to set a list of Schemes Identifiers to make the SDK not allow to delete the credentials having that specific schema identifier. Therefore, by setting a Schema Id, the SDK will not allow to delete Credentials which refer to that Schema Id.-
DizmeSDKCallbackcallback: The callback that will be called at the end of the setNotDeletableSchemes operation. Will be called the 'DizmeSDKCallback.onSetNotDeletableSchemesCompleted' callback. -
[String]schemesList: The List of Schemes Identifiers (as String) to set.
-
DizmeSDKInitCallback
Below the description of the callback methods for the init operations:
-
func onCreateWalletCompleted(dizmeSDKInitResult:DizmeSDKInitResult):This callback will be invoked when the operations performed by the DizmeSDK createWallet method are completed.- The
DizmeSDKInitResultobject contains the result of the createWallet operations.
- The
-
func onOpenWalletCompleted(dizmeSDKInitResult:DizmeSDKInitResult):This callback will be invoked when the operations performed by the DizmeSDK openWallet method are completed.- The
DizmeSDKInitResultobject contains the result of the openWallet operations.
- The
-
func onInitializeSDKFromBackup(dizmeSDKInitResult:DizmeSDKInitResult):This callback will be invoked when the operations performed by the DizmeSDK initializeSDKFromBackup method are completed.- The
DizmeSDKInitResultobject contains the result of the initializeSDKFromBackup operations.
- The
-
func onStartCompleted(startResult:Bool, dizmeSDKInitError:DizmeSDKInitError?):This callback will be invoked when the operations performed by the DizmeSDK startDizme method are completed.- The
Bool startResultrepresents the outcome of the start operation. - (Optional) The
DizmeSDKInitErrorobject describes the errors, if occurred, during the execution of the start operation.
- The
DizmeSDKCallback
Below the description of the callback methods for the SDK operations:
-
func onAnalyzeNotifyCompleted(analyzeResult:Bool, dizmeSDKError:DizmeSDKError?):This callback will be invoked when the operations performed by the DizmeSDK analyzeNotify method are completed.- The
BoolanalyzeResult represents the outcome of the analyzeNotify operation. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the analyzeNotify operation.
- The
-
func onDoBackupCompleted(doBackupResult:Bool, backupFilePath:String?, dizmeSDKError:DizmeSDKError?):This callback will be invoked when the operations performed by the DizmeSDK doBackup method are completed.- The
BooldoBackupResult represents the outcome of the doBackup operation. - (Optional) The
StringbackupFilePath represents the path of the backup file - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the doBackup operation.
- The
-
func onGetWalletPassphraseCompleted(walletPassphrase:String?, dizmeSDKError:DizmeSDKError?):This callback will be invoked when the operations performed by the DizmeSDK getWalletPassphrase method are completed.- (Optional) The
StringwalletPassphrase represents the walletPassphrase. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the getWalletPassphrase operation.
- (Optional) The
-
func onGetEnvironmentCompleted(environment:DizmeSDKEnvironment?, dizmeSDKError:DizmeSDKError?):This callback will be invoked when the operations performed by the DizmeSDK getEnvironment method are completed.- (Optional) The
DizmeSDKEnvironmentenvironment represents the SDK Environment. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the getEnvironment operation.
- (Optional) The
-
func onGetSDKVersionCompleted(sdkVersion:String?, dizmeSDKError:DizmeSDKError?):This callback will be invoked when the operations performed by the DizmeSDK getSDKVersion method are completed.- (Optional) The
StringsdkVersion represents the SDK version name. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the getSDKVersion operation.
- (Optional) The
-
func onGetStatusCompleted(status:DizmeSDKStatus?, dizmeSDKError:DizmeSDKError?):This callback will be invoked when the operations performed by the DizmeSDK getStatus method are completed.- (Optional) The
DizmeSDKStatusstatus represents the actual status of the Dizme SDK. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the getStatus operation.
- (Optional) The
-
func onSetLanguageCompleted(setLanguageResult:Bool, dizmeSDKError:DizmeSDKError?):This callback will be invoked when the operations performed by the DizmeSDK setLanguage method are completed.- The
BoolsetLanguageResult represents the outcome of the setLanguage operation. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the setLanguage operation.
- The
-
onGetLanguageCompleted(language:DizmeSDKLanguage?, dizmeSDKError:DizmeSDKError?):This callback will be invoked when the operations performed by the DizmeSDK getLanguage method are completed.- (Optional) The
DizmeSDKLanguagelanguage represents the outcome of the getLanguage operation. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the getLanguage operation.
- (Optional) The
-
func onGetMaintenanceInfoCompleted(maintenanceInfo:DizmeSDKMaintenanceInfo?, dizmeSDKError:DizmeSDKError?):This callback will be invoked when the operations performed by the DizmeSDK getMaintenanceInfo method are completed.- (Optional) The
DizmeSDKMaintenanceInfomaintenanceInfo represents the outcome of the getMaintenanceInfo operation. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the getMaintenanceInfo operation.
- (Optional) The
-
func onOpenNotifyCompleted(openResult:Bool, dizmeSDKError:DizmeSDKError?): This callback will be invoked when the operations performed by the DizmeSDK openNotify method are completed.- The
BoolopenResult represents the outcome of the openNotify operation. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the openNotify operation.
- The
-
func onGetMyDomainDidCompleted(myDomainDid:String?, dizmeSDKError:DizmeSDKError?): This callback will be invoked when the operations performed by the DizmeSDK getMyDomainDid method are completed.- (Optional) The
StringmyDomainDid represents the SDK DID related to the connection with the Domain. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the onGetMyDomainDidCompleted operation.
- (Optional) The
-
func onNewNotificationReceived(notify:Notify?, dizmeSDKError:DizmeSDKError?): This callback will be invoked when a new Notify was received by the Dizme SDK.- (Optional)
Notifynotify: The Notify object received by the SDK. - (Optional) The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the parsing operation on the incoming notification.
- (Optional)
-
func onResetCompleted(resetResult:Bool, dizmeSDKError:DizmeSDKError?): This callback will be invoked when the operations performed by the DizmeSDK reset method are completed.- The
BoolresetResult represents the outcome of the reset operation. - The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the reset operation.
- The
-
func onActionFromURLPerformed(result:Bool, dizmeSDKError:DizmeSDKError?): This callback will be invoked when the operations performed by the DizmeSDK performActionFromURL method are completed.- The
Boolresult represents the outcome of the performActionFromURL operation. - The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the performActionFromURL operation.
- The
-
func onGetNotificationsListCompleted(notificationsList:[Notify]?, dizmeSDKError:DizmeSDKError?): This callback will be invoked when the operations performed by the DizmeSDK getNotificationsList method are completed.- The
[Notify]notificationsList represents the outcome of the getNotificationsList operation. - The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the getNotificationsList operation.
- The
-
onGetCredentialsListCompleted(credentialsListJSON:String?, dizmeSDKError:DizmeSDKError?): This callback will be invoked when the operations performed by the DizmeSDK getCredentialsList method are completed.- The
StringcredentialsListJSON represents, through a JSON String, the outcome of the getCredentialsList operation. - The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the getCredentialsList operation.
Example:
{"L1":{"schema_id":"TEST:2:L1:1.1","credential_definition_id":"TEST:3:CL:181552:L1#2.0","attributes":[{"name":"name","mime-type":"text/plain","value":"TEST"},{"name":"surname","mime-type":"text/plain","value":"TEST"},{"name":"birthdate","mime-type":"text/plain","value":"1900-1-1"},{"name":"birthplace","mime-type":"text/plain","value":"TEST"},{"name":"citizenship","mime-type":"text/plain","value":"TEST"},{"name":"credentialIssueTimestamp","mime-type":"text/plain","value":"1600000001"}]}} - The
-
func onSetAcceptedSchemesCompleted(setAcceptedSchemesResult:Bool, dizmeSDKError:DizmeSDKError?): This callback will be invoked when the operations performed by the DizmeSDK setAcceptedSchemes method are completed.- The
BoolsetAcceptedSchemesResult represents the outcome of the setAcceptedSchemes operation. - The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the setAcceptedSchemes operation.
- The
-
func onSetAcceptedCredentialDefinitionsCompleted(setAcceptedCredentialDefinitionsResult:Bool, dizmeSDKError:DizmeSDKError?): This callback will be invoked when the operations performed by the DizmeSDK setAcceptedCredentialDefinitions method are completed.- The
BoolsetAcceptedCredentialDefinitionsResult represents the outcome of the setAcceptedCredentialDefinitions operation. - The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the setAcceptedCredentialDefinitions operation.
- The
-
onSetNotDeletableSchemesCompleted(setNotDeletableSchemesResult:Bool, dizmeSDKError:DizmeSDKError?): This callback will be invoked when the operations performed by the DizmeSDK.setNotDeletableSchemes method are completed.- The
BoolsetNotDeletableSchemesResult represents the outcome of the setNotDeletableSchemes operation. - The
DizmeSDKErrordizmeSDKError object describes the errors, if occurred, during the execution of the setNotDeletableSchemes operation.
- The
DizmeSDKLanguage
Enum which represents the possible language that can be used with the SDK.
Values:
-
en: English language. -
it: Italian language. -
fr: French language.
DizmeSDKEnvironment
Enum which represents the possible environment that can be used with the SDK.
Values:
-
MainNet: Production environment. -
StageNet: Staging environment. -
BuilderNet: Development environment.
DizmeSDKMaintenanceInfo
This object is useful to provide to the Integrant App the informations about the maintenance (or planned maintenance) of the Dizme SDK. The information contained therein can be used by the Integrant App to provide information to the user about the maintenance that will be carried out on the Dizme SDK.
Below the description of the DizmeSDKMaintenanceInfo methods:
-
func getType() -> DizmeSDKMaintenanceType?: (Optional) Returns the type of maintenance (DizmeSDKMaintenanceType) if it is present. -
func getTitle()->String?: (Optional) Returns, if it is present, a title String (localized) related to the maintenance, useful to build a message to show to the user. -
func getMessage()->String?: (Optional) Returns, if it is present, a message String (localized) related to the maintenance, useful to build a message to show to the user. -
func getFromDate() -> Date?: (Optional) Returns (if present, otherwise the field is nil) the start Date of the maintenance operations. -
func getToDate()->Date?: (Optional) Returns (if present, otherwise the field is nil) the end Date of the maintenance operations.
DizmeSDKMaintenanceType
Enum which represents the possible type of ongoing maintenance.
Values:
-
MAINTENANCE: SDK is under maintenance. More informations could be retrieved using the getMaintenanceInfo method of the DizmeSDK object. -
INFO: This maintenance type is related to a informations about future maintenance or other important informations about the SDK. More informations could be retrieved using the getMaintenanceInfo method of the DizmeSDK object. -
FUTURE_MAINTENANCE: A future maintenance is planned. More informations could be retrieved using the getMaintenanceInfo method of the DizmeSDK object.
DizmeSDKStatus
Enum which represents the possible status of the Dizme SDK obtained by calling the DizmeSDK getStatus method. Based on the DizmeSDKStatus it will be possible to understand which Dizme SDK init method to invoke, or if an error has occurred.
Values:
-
UNINITIALIZED: Dizme SDK was never initialized before. It is the case of first init of the SDK. Then, if the status is UNINITIALIZED the createWallet method of the DizmeSDK object must be called. -
INITIALIZED: The SDK is already initialized. This is the case of every SDK init following the first one (for example, every execution of the integrant Application). So, if the state is INITIALIZED, the openWallet method of the DizmeSDK object must be called. -
ERROR: Dizme SDK is in Error. A critical error has occurred. The SDK cannot be started.
DizmeSDKInitStatus
Enum which represents the possible status reached as a result of running one of the DizmeSDK init methods (createWallet or openWallet). Each init method invoked will then return the reached status or an error.
Values:
-
INITIALIZED: Status reached if the init operations invoked by the createWallet method of the DizmeSDK object was successful. -
STARTED: Status reached if the init operations invoked by the openWallet method of the DizmeSDK object was successful. -
RECOVERED: Status reached if the init operations invoked by the initializeSDKFromBackup method of the DizmeSDK object was successful. -
ERROR: An error occurred while executing of an init method. Further details will be provided through the DizmeSDKInitResult.
DizmeSDKInitResult
Object useful to handle the result of the init methods of the DizmeSDK object: createWallet, openWallet, initializeSDKFromBackup.
Below the description of the DizmeSDKInitResult methods:
-
func getInitStatus() -> DizmeSDKInitStatus?: (Optional) Returns (if present, otherwise the field is nil) the result status of an init method. -
func getInitError() -> DizmeSDKInitError?: (Optional)Returns (if present, otherwise the field is nil) the type of error that occurred while executing one of the init methods. -
func getErrorDetails() ->String?: (Optional)Returns (if present, otherwise the field is nil) a String (localized) that provides a description of the occurred error while executing one of the init methods. -
func getErrorSpecific()->DizmeSDKInitErrorSpecific?: (Optional) Returns (if present, otherwise the field is nil) more details about the occurred error.
DizmeSDKError
Enum which represents the possible error occurred during the executions of the Dizme SDK methods.
Values:
-
CRITICAL: Critical internal error occurred. -
GENERIC: Generic error occurred. -
BACKUP_ERROR: An error occurred during the wallet backup procedure. -
INVALID_SDK_STATUS: Error, Dizme SDK is it is not in the correct state to be able to perform the required functionality. CheckDizmeSDKStatusvalue. -
NOT_READY: Error, Dizme SDK is still not ready to use. Try to call the getStatus method, of the DizmeSDK object, again and checkDizmeSDKStatusvalue. -
INVALID_INPUT_PARAMETERS: Error, wrong parameters provided to the method. Check input parameters. -
NETWORK_ERROR: Network Error. Check internet connection. -
URL_NOT_VALID_ERROR: The URL provided is not valid for the Dizme SDK.
DizmeSDKInitError
Enum which represents the possible error occurred during the executions of the init methods of the Dizme SDK.
Values:
-
CRITICAL: Critical internal error occurred. -
REGISTRATION_ERROR: Generic error occurred during the Registration phase. -
INITIALIZE_WALLET_ERROR: Generic error occurred during the Initialize Wallet phase. -
RECOVERY_WALLET_ERROR: Generic error occurred during the Recovery Wallet phase. -
NETWORK_ERROR: Network Error. Check internet connection. -
WRONG_PIN_ERROR: Error, a wrong wallet PIN was provided -
INVALID_SDK_STATUS: Error, Dizme SDK is it is not in the correct state to be able to perform the required functionality. CheckDizmeSDKStatusvalue. -
INVALID_INPUT_PARAMETERS: Error, wrong parameters provided to the method. Check input parameters. -
NOT_READY: Error, Dizme SDK is still not ready to use. Try to call the DizmeSDK getStatus method again and checkDizmeSDKStatusvalue. -
LOGIN_ERROR: Login error occurs during the DizmeSDK openWallet phase. -
RESET_NEEDED: An error occurs during the DizmeSDK openWallet or the DizmeSDK initializeSDKFromBackup phase. In this case, the Wallet is already installed on other device and will be deleted on the current device. -
MAINTENANCE: Dizme is under maintenance. The SDK cannot be started. More informations about the maintenance can be retrieved through the getMaintenanceInfo method of the DizmeSDK object. This status was returned in case of maintantenance of type (DizmeSDKMaintenanceType) MAINTENANCE. However, it is convenient to invoke the getMaintenanceInfo method of the DizmeSDK object before each call to the DizmeSDK object's init method (createWallet, openWallet, initializeSDKFromBackup). This is because in addition to blocking maintenance, aDizmeSDKMaintenanceInfoobject could be returned concerning a future planned maintenance (DizmeSDKMaintenanceType.FUTURE_MAINTENANCE) or a maintenance Info message could be returned. The latters is used by the SDK to communicate important information while not blocking the SDK from starting.
DizmeSDKInitErrorSpecific
Enum which represents more informations regarding the possible error occurred during the executions of the init methods of the Dizme SDK.
Values:
-
CRTITICAL_ERROR: Critical internal error occurred. -
NETWORK_ERROR: Network Error. Check internet connection. -
BLOCKCHAIN_UNREACHABLE: Error, Blockchain is unreachable. -
BLOCKCHAIN_UNREACHABLE_TIMEOUT: Error, Blockchain is unreachable for timeout. -
BLOCKCHAIN_UNREACHABLE_VPN: Error, Blockchain is unreachable for presence of Firewall or VPNs. -
WRONG_CREDENTIALS: Error, elements used for the wallet recovery (wallet backup file and/or wallet passphrase) are wrong.
RECOVERY_WALLET_ERROR: Generic error occurred during the Recovery Wallet phase.
-
NETWORK_ERROR: Network Error. Check internet connection. -
WRONG_PIN_ERROR: Error, a wrong wallet PIN was provided -
INVALID_SDK_STATUS: Error, Dizme SDK is it is not in the correct state to be able to perform the required functionality. Checkit.etuitus.dizme_sdk_aar.models.DizmeSDKStatusvalue. -
INVALID_INPUT_PARAMETERS: Error, wrong parameters provided to the method. Check input parameters. -
NOT_READY: Error, Dizme SDK is still not ready to use. Try to call the DizmeSDK.getStatus method again and checkit.etuitus.dizme_sdk_aar.models.DizmeSDKStatusvalue. -
LOGIN_ERROR: Login error occurs during the DizmeSDK.openWallet phase. -
RESET_NEEDED: An error occurs during the DizmeSDK.openWallet or the DizmeSDK.initializeSDKFromBackup phase. In this case, the Wallet is already installed on other device and will be deleted on the current device. -
MAINTENANCE: Dizme is under maintenance. The SDK cannot be started. More informations about the maintenance can be retrieved through the getMaintenanceInfo() method of the DizmeSDK object. This status was returned in case of maintantenance of type (DizmeSDKMaintenanceType) MAINTENANCE. However, it is convenient to invoke the getMaintenanceInfo() method of the DizmeSDK object before each call to the DizmeSDK object's init method (createWallet, openWallet, initializeSDKFromBackup). This is because in addition to blocking maintenance, ait.etuitus.dizme_sdk_aar.models.DizmeSDKMaintenanceInfoobject could be returned concerning a future planned maintenance (DizmeSDKMaintenanceType.FUTURE_MAINTENANCE) or a maintenance Info message could be returned. The latters is used by the SDK to communicate important information while not blocking the SDK from starting.
DizmeSDKInitErrorSpecific
Enum which represents more informations regarding the possible error occurred during the executions of the init methods of the Dizme SDK.
Values:
-
CRTITICAL_ERROR: Critical internal error occurred. -
NETWORK_ERROR: Network Error. Check internet connection. -
BLOCKCHAIN_UNREACHABLE: Error, Blockchain is unreachable. -
BLOCKCHAIN_UNREACHABLE_TIMEOUT: Error, Blockchain is unreachable for timeout. -
BLOCKCHAIN_UNREACHABLE_VPN: Error, Blockchain is unreachable for presence of Firewall or VPNs. -
WRONG_CREDENTIALS: Error, elements used for the wallet recovery (wallet backup file and/or wallet passphrase) are wrong.
Notify
Object useful to describe an incoming notification.
Below the description of the Notify (Notify) getter methods:
-
func getId() -> String?: Returns,through an object of type String, the notify's Id -
func getTitle()-> String?: Returns,through an object of type String, the notify's Title -
fun getMessage()->String?: Returns,through an object of type String, the notify's Message -
func getCreated() -> Date?: Returns,through an object of type Date, the notify's creation Date -
getData() -> [String:Any]?: Returns,through an object of type[String:Any], the notify's (optional) additional Data -
func getType() -> NotificationType?: Returns,through an object of type NotificationType, the notify's Type
Below an example of Notification's List (from toString() -> String method):
[Notify{"title": Optional("A message from Company"), "message": Optional("test"), "created":Optional(2023-05-25 14:31:25 +0000), "id": Optional("d03b24fa-fb08-11ed-a9bb-bed920a82699"), "type": Optional(dizme_sdk_framework.NotificationType.INFO), "data":Optional([:])},Notify{"title": Optional("Issue credential TEST"), "message": Optional("Company offers you the credential TEST"), "created":Optional(2023-05-25 14:31:59 +0000), "id": Optional("2e3fa887-3709-4611-ba0c-54403bda7179"), "type": Optional(dizme_sdk_framework.NotificationType.ISSUE_CREDENTIAL), "data":Optional(["credential_definition_id": TEST:3:CL:43451:L1V02, "schema_id": TEST:2:L1:2.1])}]
NotificationType
An Enum that represents the type of the incoming notification (Notify).
Values:
-
ISSUE_CREDENTIAL: The incoming notification is related to an issue of a Credential. In this case, the Dictionary obtained using thegetData() -> [String:Any]?method described above will contain two Strings related to the Credential, object of the notification. Specifically, therefore, the Credential Definition Id (credential_definition_id) and the Schema Id (schema_id) will be present (see the Example above). -
PROOF_REQUEST: The incoming notification is related to a Proof Request -
INFO: The incoming notification is an info message for the user
Use of DizmeSDK
To use DizmeSDK it is necessary to add the import: import dizme_sdk_framework.
Once the DizmeSDK type object has been instantiated,the getStatus method must be invoked.
Before proceeding further, regarding the output of the getStatus method, available through the callback DizmeSDKCallback.onGetStatusCompleted(status:DizmeSDKStatus?, dizmeSDKError:DizmeSDKError?), the integrating Application must not proceed in calling other methods related to the DizmeSDK object before the DizmeSDKStatus hasn't value different from DizmeSDKError.NOT_READY or if DizmeSDKError hasn't value different from DizmeSDKStatus.ERROR.
Then, later, when the getStatus method ends with values different from that described above, the integrant Application can invoke the init methods of the SDK using the method createWallet or the method openWallet, regarding the value of the DizmeSDKStatus (INITIALIZED, UNINITIALIZED), as described in the sections above.
When on of the two callback methods (onCreateWalletCompleted or onOpenWalletCompleted) will be called, dependently from the init method chosen (createWallet or openWallet), the startDizme method may be invoked. At the end of start operations, the onStartCompleted callback will be invoked.
At this point the Dizme SDK will be ready to be viewed.
Then, using the getDizmeViewController method, can be recovered the UIViewController in which the Dizme SDK will be displayed and can be the positioned the latter in the appropriate View of the Integrant App chosen for viewing Dizme SDK.
Since the operations described above, createWallet/openWallet and startDizme, may take some time, it would be advisable to execute them at the startup of the Integrating App in order to have, at the end of the startup, the UIViewController ready to be displayed (Dizme SDK already initialized and ready). If the Dizme SDK UIViewController should be displayed before the end of the operations described above, a view containing a progress bar will be displayed.
Setting of Auto-Accept and Not Delete Incoming Credentials
If the Integrating Application wants to use one of the setAcceptedSchemes,setAcceptedCredentialDefinitions and/or setNotDeletableSchemes methods listed in the API Description paragraph, it is advisable to invoke the desired method as soon as the SDK status is DizmeSDKInitStatus.INITIALIZED to be sure that these parameters have been set before receive any credential.
Therefore for the first initialization they can be invoked within the callback onCreateWalletCompleted or onInitializeSDKFromBackup (as soon as the SDK state is DizmeSDKInitStatus.RECOVERED) in case of Wallet recovery.
Once the desired values have been set, they remain stored until the App is uninstalled from the device.
In case the integrating Application wants to specify, after the first initialization, different values for the Schema Id or Credential Definition Id, integrating Application can invoke the related methods within the onOpenWalletCompleted callback (as soon as the SDK status is DizmeSDKInitStatus.STARTED). In this way the previously indicated values will be overwritten.
Use of DizmeSDK - Example:
Below, some snippet of code that represents an example (incomplete) of an iOS Demo Application that integrate the SDK.
In particular, the latter, has a UITabBarController (UITabBarViewController) as main UIViewController (as initial ViewController) and within the latter displays two UIViewController.
The first (TabOneViewController) is a empty UIViewController. The second is a UIViewController (ViewController) that will display the Dizme SDK UIViewController
AppDelegate.swift
.......
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let tabBarController = UITabBarViewController()
window.rootViewController = tabBarController
window.makeKeyAndVisible()
return true
}
........
UITabBarViewController.swift
import UIKit
import dizme_sdk_framework
class UITabBarViewController: UITabBarController, UITabBarControllerDelegate {
private var dizmeSDK:DizmeSDK!
override func viewDidLoad() {
super.viewDidLoad()
dizmeSDK = DizmeSDK()
self.delegate = self
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.tabBar.autoresizesSubviews = true
self.tabBar.tintColor = UIColor.red
self.tabBar.backgroundColor = UIColor.gray
self.tabBar.autoresizingMask = [.flexibleWidth, .flexibleHeight]
let firstPage = TabOneViewController()
let firstPageItem = UITabBarItem(title: "First Page", image:nil, selectedImage:nil)
firstPage.tabBarItem = firstPageItem
let dizmeTab = ViewController()
dizmeTab.setDizmeSDKInstance(dizmeSDK: self.dizmeSDK)
let dizmeTabItem = UITabBarItem(title: "Dizme Page", image: nil, selectedImage: nil)
dizmeTab.tabBarItem = dizmeTabItem
self.viewControllers = [firstPage,dizmeTab]
}
}
........
ViewController.swift
import dizme_sdk_framework
import UIKit
class ViewController: UIViewController, DizmeSDKInitCallback, DizmeSDKCallback {
private var dizmeSDK:DizmeSDK!
private var dizmeViewController: UIViewController!
public func setDizmeSDKInstance(dizmeSDK: DizmeSDK) {
self.dizmeSDK = dizmeSDK
self.dizmeViewController = dizmeSDK.getDizmeViewController()
}
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.systemTeal
self.title = "Dizme"
dizmeSDK.getStatus(callback: self)
}
func onGetStatusCompleted(status: dizme_sdk_framework.DizmeSDKStatus?, dizmeSDKError: DizmeSDKError?) {
if (dizmeSDKError == DizmeSDKError.NOT_READY || status == DizmeSDKStatus.ERROR) {
dizmeSDK.getStatus(callback: self)
return
}
if (status == DizmeSDKStatus.UNINITIALIZED) {
self.dizmeSDK.createWallet(walletPassword: "Kjufhte7557ujf@oolzzh", dizmeSDKEnvironment: DizmeSDKEnvironment.StageNet, dizmeSDKLanguage: DizmeSDKLanguage.en, pushToken: "NOT_A_REAL_TOKEN_57757ifinisnvdcsdcdscdsndosncwscunrsNOEWndonwdanIUNFWIRFNadskldnweadocsnd", domainInvitation: "https://agent-cl.dizme.io/api/v1/invitation/dizme_default_invitation", domain: "dizme",callback: self)
}
if (status == DizmeSDKStatus.INITIALIZED) {
dizmeSDK.openWallet(walletPassword: "Kjufhte7557ujf@oolzzh",
pushToken: "NOT_A_REAL_TOKEN_57757ifinisnvdcsdcdscdsndosncwscunrsNOEWndonwdanIUNFWIRFNadskldnweadocsnd",
callback: self)
}
self.dizmeViewController = dizmeSDK.getDizmeViewController()
.....
.....
.....
}
func onCreateWalletCompleted(dizmeSDKInitResult: DizmeSDKInitResult) {
let initStatus:DizmeSDKInitStatus? = dizmeSDKInitResult.getInitStatus()
if (dizmeSDKInitResult.getInitStatus() == DizmeSDKInitStatus.INITIALIZED) {
dizmeSDK.startDizme(callback: self, dataFromIntent: nil)
}
}
func onOpenWalletCompleted(dizmeSDKInitResult: dizme_sdk_framework.DizmeSDKInitResult) {
let initStatus:DizmeSDKInitStatus? = dizmeSDKInitResult.getInitStatus()
if (dizmeSDKInitResult.getInitStatus() == DizmeSDKInitStatus.STARTED) {
dizmeSDK.startDizme(callback: self, dataFromIntent: nil)
}
}
func onStartCompleted(startResult: Bool, dizmeSDKInitError: dizme_sdk_framework.DizmeSDKInitError?) {
dizmeSDK.analyzeNotify(callback: self, notifyMessageAsDict: ["destination":"dizme","owner":"dizme","click_action":"FLUTTER_NOTIFICATION_CLICK"])
dizmeSDK.setNotifyCallback(callback: self)
dizmeSDK.testNotifications()
return
}
.....
.....
.....
}
Customization of DizmeSDK
Some characteristics of the SDK can be customized.
To do this, the Integrating Application must add a JSON file with the name dizme_sdk_config.json to the path PROJECT_MAIN_DIRECTORY/dizme/
Within the latter, by adding the defined keys, with the relative values, it is possible to customize some aspects of the SDK.
Then, within Xcode, click on the root element of the Projects Navigator View (on the left side of the IDE, the Navigator Area) and then click on the Target element on the right side (under Targets). Then select the Build Phases Tab.
From here, click on the + button and select New Run Script Phase.
Move the latter to the end of the phase's List.
Whitin the created Run Script block, copy the following line of code:
mkdir ${BUILT_PRODUCTS_DIR}/${TARGET_NAME}.app/Frameworks/App.framework/flutter_assets/dizme cp dizme/dizme_sdk_config.json ${BUILT_PRODUCTS_DIR}/${TARGET_NAME}.app/Frameworks/App.framework/flutter_assets/dizme.
Below, the description of the currently customizable aspects with the indication of the key to be inserted inside the JSON object and the relative value.
- Primary color of the SDK's views:
- Key:
primaryColor - Value: string. Color to be set, as Hex String.
- Default value:
"#0181C8"
- Key:
- Secondary color of the SDK's views:
- Key:
secondaryColor - Value: string. Color to be set, as Hex String.
- Default value:
"#0A4B8F"
- Key:
- Text color used on Primary Color:
- Key:
textColorOnPrimary - Value: string. Color to be set, as Hex String.
- Default value:
"#FFFFFF"
- Key:
- Show/Hide Top portion of the Home Page (Including Avatar and Username label):
- Key:
show_only_credentials_on_home_page - Value: boolean. If
true, only the credential list will be shown on the HomePage. - Default value:
false
- Key:
Below an example of the JSON file (dizme_sdk_config.json):
{
"show_only_credentials_on_home_page":true,
"primaryColor" : "#006F98",
"textColorOnPrimary" :"#FFFFFF",
"secondaryColor":"#0B2E4F"
}