WalletUnit

What is a WalletUnit in the EUDI context:

To better reflect this, the SDK provides a WalletUnit object holding the unit’s state.

WalletUnit States

A WalletUnit can be in different states allowing the user to finish different tasks.

The WalletState is provided as flow of the SDK’s WalletUnit object. It should be observed in a central place if the app shall react on changes in the WalletState.

val walletState: Flow<WalletState> = WalletSdkApi.walletUnit.state

Registration

To register the app at the given WalletProvider, the registration has to be started. The app has to provide the following user information to the SDK to complete the registration:

The registration is triggered by the register function. A RegistrationRequest object has to be created, containing the credentials, and passed to the sdk. This function returns an Either containing a RegistrationError or Unit. On successful registration, the sdk triggers a login with the same credentials.

val registrationRequest = RegistrationRequest(email= "me@example.com", username = "me", password = "supersecretpassword")
val result: Either<RegistrationError, Unit> = WalletSdkApi.walletUnit.register(registrationRequest)

The SDK is saving relevant data, the WalletState changes to Operational.

Login

If the user has already registered at the WalletProvider a Login can be started. A prior registration could have been done on e.g. a WalletProvider’s website or through a former registration in an app using the same provider. A LoginRequest, containing the following valid login data from the user, has to be created and passed to the login function.

val loginRequest = LoginRequest(email = "me@example.com", password = "supersecretpassword")
val result: Either<LoginError, Unit> = WalletSdkApi.walletUnit.login(loginRequest)

The SDK is saving relevant data, the WalletState changes to Operational.

Valid State

For the SDK to become Valid, at least one PID(Person Identifitcation Data) Credential has to be loaded. See Credentials for details.