/
Copy of Implementation rough notes

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:

  1. Data fetch from & store to DB (we have to live with this until the August release),

  2. crypto functions - enc, dec, trust validations

  3. SDK calls for bio matches/dedupe

  4. 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.

1 View(TODO) ---------- channels ------------- Pigeon ------------------ Platform specific code 2 3SCENE:on_launch 4 1. ------------------------ getCenterMachineDetails() -------------------> 5 ResponseWrapper -> 6 { 7 response : { 8 centerName 9 centerId 10 centerStatus 11 machineName 12 machineId 13 machineStatus 14 }, 15 errorCode : "" 16 } 17 "NOT_INITIALIZED" 18 19 20 //DO machine status check 21 //DO center status check 22 23 2. ------------------------ getGlobalParams() -------------------> 24 25 load all the global params (key-value pairs) in the context. 26 27 28SCENE:Login user_validation -------------------getUserDetail(userId)-------------------------------> 29 ResponseWrapper -> 30 { 31 response : { 32 userId 33 is_active 34 is_locked 35 is_onboarded 36 centerName 37 centerId 38 machineName 39 machineId 40 failedAttempts 41 }, 42 errorCode : "" 43 } 44 45 //DO user validation 46 47 48 online: ---------------------------------------- auth endpoint call -----------------------------> enc(response) 49 <---------------------------------------------------------------------------------- decrypted(response) 50 //validate auth token (signature check & expiry & aud & iss check) 51 //parse token ----------------------------- saveUserDetail(userId) 52 { 53 username 54 password(plain) 55 roles 56 auth-token 57 refresh-token 58 } 59 60 61 offline: 62 credential_check ------------(offline) getStoredCredential(userId, authMethod)-------------------> 63 64 ResponseWrapper -> 65 { 66 response : [{ 67 credential : <string> 68 salt: <string> 69 type: <string> 70 subType: <string> 71 }], 72 errorCode : "" 73 } 74 //Do pwd comparision 75 76 //store user logged in details in 77 SharedPreferences 78 79NAVIGATION:Load onboard page only if valid user session details found in sharedPreferences & is_onboarded is false 80NAVIGATION:Load homepage only if valid user session details found in sharedPreferences 81 82SCENE:Sync 83 only when ONLINE and valid auth-token session (either OPERATOR/SUPERVISOR): 84 policy_certificate_sync ------------------------------------------------------------------ API call 85 store in DB 86 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 87 configuration_sync ------------------------------------------------------------------ API call 88 store in DB 89 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 90 schema_sync ------------------------------------------------------------------ API call 91 store in DB 92 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 93 masterdata_sync------------------------------------------------------------------ API call 94 store in DB 95 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 96 userdetails_sync------------------------------------------------------------------ API call 97 store in DB 98 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 99 trust_certs_sync------------------------------------------------------------------ API call 100 store in DB 101 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 102 prereg_data_sync------------------------------------------------------------------ API call 103 store in DB 104 <----------------------------------------------- ResponseWrapper { response: <status>, errorCode: "" } 105 //Handle progress & errors 106 107 offline: Machine is offline 108 //DO nothing 109 110 111SCENE:Registration 112 113 114 115