Skip to content

Commit

Permalink
Remove identity attributes reveal (#11)
Browse files Browse the repository at this point in the history
- Remove ID attributes reveal from the account creation flow
- Rename account details Transfers tab to Activity
- Show Identity data tab only if needed. Do not show the tab for accounts without revealed attributes
  • Loading branch information
Radiokot authored Mar 26, 2024
1 parent f50d00d commit 975feaa
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 519 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
- Validation of metadata checksum when adding CIS-2 tokens
- Display of balance/ownership when adding CIS-2 tokens

### Removed
- Revealing identity attributes when creating an account

### Fixed

- An issue where signing a text message through WalletConnect did not work
Expand All @@ -32,6 +35,8 @@
- WalletConnect session proposals are now rejected if the namespace or methods are not supported, or if the wallet contains no accounts.
- WalletConnect transaction signing request now shows the receiver
(either smart contract or an account) and amount of CCD to send (not including CIS-2 tokens)
- Transfers tab renamed to Activity on the account details screen
- Identity data tab on the account details screen is no longer shown for accounts without revealed attributes
- CIS-2 tokens with corrupted or missing metadata can no longer be added

[Unreleased]: https://github.com/Concordium/cryptox-android/compare/0.6.1-qa.5...HEAD
5 changes: 0 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,6 @@
android:launchMode="singleTop"
android:parentActivityName=".ui.account.newaccountidentity.NewAccountIdentityActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.account.newaccountidentityattributes.NewAccountIdentityAttributesActivity"
android:launchMode="singleTop"
android:parentActivityName=".ui.account.newaccountsetup.NewAccountSetupActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.account.newaccountconfirmed.NewAccountConfirmedActivity"
android:launchMode="singleTop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ class AccountDetailsPagerAdapter(
}
}

override fun getCount(): Int {
return 3
}
override fun getCount(): Int =
if (account.revealedAttributes.isNotEmpty())
3
else
2

private fun getFirstPositionFragment(): Fragment {
return when (account.transactionStatus) {
Expand All @@ -53,7 +55,7 @@ class AccountDetailsPagerAdapter(
}
}

private fun getThirdPositionFragment() : Fragment {
private fun getThirdPositionFragment(): Fragment {
return when (account.transactionStatus) {
TransactionStatus.ABSENT -> AccountDetailsErrorFragment()
TransactionStatus.COMMITTED -> AccountDetailsPendingFragment()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import com.concordium.wallet.data.model.AccountSubmissionStatus
import com.concordium.wallet.data.model.CredentialWrapper
import com.concordium.wallet.data.model.GlobalParams
import com.concordium.wallet.data.model.GlobalParamsWrapper
import com.concordium.wallet.data.model.IdentityAttribute
import com.concordium.wallet.data.model.PossibleAccount
import com.concordium.wallet.data.model.RawJson
import com.concordium.wallet.data.model.ShieldedAccountEncryptionStatus
Expand All @@ -37,7 +36,6 @@ import com.concordium.wallet.data.room.Account
import com.concordium.wallet.data.room.Identity
import com.concordium.wallet.data.room.Recipient
import com.concordium.wallet.data.room.WalletDatabase
import com.concordium.wallet.ui.account.newaccountidentityattributes.SelectableIdentityAttribute
import com.concordium.wallet.ui.common.BackendErrorHandler
import com.concordium.wallet.util.DateTimeUtil
import com.concordium.wallet.util.KeyCreationVersion
Expand Down Expand Up @@ -92,7 +90,6 @@ open class NewAccountViewModel(application: Application) :
}

class TempData {
var revealedAttributeList: List<SelectableIdentityAttribute> = ArrayList()
var globalParams: GlobalParams? = null
var submissionId: String? = null
var accountAddress: String? = null
Expand Down Expand Up @@ -126,13 +123,7 @@ open class NewAccountViewModel(application: Application) :
}
}

fun confirmWithoutAttributes() {
tempData.revealedAttributeList = emptyList()
getGlobalInfo()
}

fun confirmSelectedAttributes(revealedAttributeList: List<SelectableIdentityAttribute>) {
tempData.revealedAttributeList = revealedAttributeList
fun createAccount() {
getGlobalInfo()
}

Expand Down Expand Up @@ -208,27 +199,22 @@ open class NewAccountViewModel(application: Application) :

tempData.nextCredNumber = accountRepository.nextCredNumber(identity.id)

val revealedAttributes = JsonArray()
for (identityAttribute in tempData.revealedAttributeList) {
revealedAttributes.add(identityAttribute.name)
}

val output: CreateCredentialOutput? =
if (keyCreationVersion.useV1) {
val net = AppConfig.net
val seed = AuthPreferences(getApplication()).getSeedHex(password)

val credentialInput = CreateCredentialInputV1(
idProviderInfo,
arsInfos,
globalParams,
identityObject,
revealedAttributes,
seed,
net,
identity.identityIndex,
tempData.nextCredNumber ?: 0,
(DateTimeUtil.nowPlusMinutes(5).time) / 1000
ipInfo = idProviderInfo,
arsInfos = arsInfos,
global = globalParams,
identityObject = identityObject,
revealedAttributes = JsonArray(),
seed = seed,
net = net,
identityIndex = identity.identityIndex,
accountNumber = tempData.nextCredNumber ?: 0,
expiry = (DateTimeUtil.nowPlusMinutes(5).time) / 1000,
)

App.appCore.cryptoLibrary.createCredentialV1(credentialInput)
Expand All @@ -240,20 +226,18 @@ open class NewAccountViewModel(application: Application) :
val generateAccountsInput =
GenerateAccountsInput(globalParams, identityObject, privateIdObjectData)
val nextAccountNumber = findNextAccountNumber(generateAccountsInput)
if (nextAccountNumber == null) {
// Error has been handled
?: // Error has been handled
return
}

val credentialInput = CreateCredentialInput(
identityObject,
privateIdObjectData,
globalParams,
idProviderInfo,
revealedAttributes,
nextAccountNumber,
arsInfos,
(DateTimeUtil.nowPlusMinutes(5).time) / 1000
ipInfo = idProviderInfo,
arsInfos = arsInfos,
global = globalParams,
identityObject = identityObject,
privateIdObjectData = privateIdObjectData,
revealedAttributes = JsonArray(),
accountNumber = nextAccountNumber,
expiry = (DateTimeUtil.nowPlusMinutes(5).time) / 1000,
)

App.appCore.cryptoLibrary.createCredential(credentialInput)
Expand Down Expand Up @@ -379,7 +363,6 @@ open class NewAccountViewModel(application: Application) :
val encryptedAccountData = tempData.encryptedAccountData
val credential = tempData.credential
val submissionStatus = TransactionStatus.RECEIVED
val revealedAttributeList = tempData.revealedAttributeList
if (accountAddress == null || submissionId == null || encryptedAccountData == null ||
credential == null
) {
Expand All @@ -389,32 +372,28 @@ open class NewAccountViewModel(application: Application) :
}

val newAccount = Account(
0,
identity.id,
accountName,
accountAddress,
submissionId,
submissionStatus,
encryptedAccountData,
revealedAttributeList.map { IdentityAttribute(it.name, it.value) },
credential,
BigInteger.ZERO,
BigInteger.ZERO,
BigInteger.ZERO,
BigInteger.ZERO,
BigInteger.ZERO,
null,
null,
ShieldedAccountEncryptionStatus.ENCRYPTED,
BigInteger.ZERO,
BigInteger.ZERO,
false,
null,
null,
null,
null,
null,
tempData.nextCredNumber ?: 0
id = 0,
identityId = identity.id,
name = accountName,
address = accountAddress,
submissionId = submissionId,
transactionStatus = submissionStatus,
encryptedAccountData = encryptedAccountData,
revealedAttributes = emptyList(),
credential = credential,
finalizedBalance = BigInteger.ZERO,
currentBalance = BigInteger.ZERO,
totalBalance = BigInteger.ZERO,
totalUnshieldedBalance = BigInteger.ZERO,
totalShieldedBalance = BigInteger.ZERO,
finalizedEncryptedBalance = null,
currentEncryptedBalance = null,
encryptedBalanceStatus = ShieldedAccountEncryptionStatus.ENCRYPTED,
totalStaked = BigInteger.ZERO,
totalAtDisposal = BigInteger.ZERO,
readOnly = false,
finalizedAccountReleaseSchedule = null,
credNumber = tempData.nextCredNumber ?: 0,
)
saveNewAccount(newAccount)
}
Expand Down

This file was deleted.

Loading

0 comments on commit 975feaa

Please sign in to comment.