The thought process is to keep the complete business logic in Flutter (Dart files),
only for the below functions, we should reach to platform-specific code:
Data fetch from & store to DB (we have to live with this until the August release),
crypto functions - enc, dec, trust validations
SDK calls for bio matches/dedupe
Creating Registration packet
For each scenario, here we are listing down the possible method channel calls to platform-specific code with the expected response DTO structure.
View(TODO) ---------- channels ------------- Pigeon ------------------ Platform specific code SCENE:on_launch 1. ------------------------ getCenterMachineDetails() -------------------> ResponseWrapper -> { response : { centerName centerId centerStatus machineName machineId machineStatus }, errorCode : "" } "NOT_INITIALIZED" //DO machine status check //DO center status check 2. ------------------------ getGlobalParams() -------------------> load all the global params (key-value pairs) in the context. SCENE:Login user_validation -------------------getUserDetail(userId)-------------------------------> ResponseWrapper -> { response : { userId is_active is_locked is_onboarded centerName centerId machineName machineId failedAttempts }, errorCode : "" } //DO user validation online: ---------------------------------------- auth endpoint call -----------------------------> enc(response) <---------------------------------------------------------------------------------- decrypted(response) //validate auth token (signature check & expiry & aud & iss check) //parse token ----------------------------- saveUserDetail(userId) { username password(plain) roles auth-token refresh-token } offline: credential_check ------------(offline) getStoredCredential(userId, authMethod)-------------------> ResponseWrapper -> { response : [{ credential : <string> salt: <string> type: <string> subType: <string> }], errorCode : "" } //Do pwd comparision //store user logged in details in SharedPreferences NAVIGATION:Load onboard page only if valid user session details found in sharedPreferences & is_onboarded is false NAVIGATION:Load homepage only if valid user session details found in sharedPreferences SCENE:Sync only when ONLINE and valid auth-token session (either OPERATOR/SUPERVISOR): policy_certificate_sync ------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } configuration_sync ------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } schema_sync ------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } masterdata_sync------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } userdetails_sync------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } trust_certs_sync------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } prereg_data_sync------------------------------------------------------------------ API call store in DB <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } //Handle progress & errors offline: Machine is offline //DO nothing SCENE:Registration
0 Comments