-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sign with sargon #1277
Sign with sargon #1277
Conversation
1fb76b6
to
7098d4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excellent work!
I’m still reviewing and testing, but I’ve left some initial comments.
Additionally to the comments, you can go ahead and delete the ResolveNotaryAndSignersUseCase
.
import kotlin.time.Duration.Companion.milliseconds | ||
|
||
@Singleton | ||
class WalletInteractor @Inject constructor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this class name should include the "sign" word, since it's all about signing?
E.g. "WalletSignerInteractor", "SignerInteractor"?
unless this WalletInteractor
will implement other interactors later?
Another point to consider is that if this is solely about signing, perhaps we could move it under the accessfactorsources
package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also you do not need the @Inject constructor
here since you have already the @Provides
module that does exactly this thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is intended to be used for other interactions as well. Although this is something that can change.
@@ -67,6 +68,9 @@ class MainActivity : FragmentActivity() { | |||
@Inject | |||
lateinit var biometricsHandler: BiometricsHandler | |||
|
|||
@Inject | |||
lateinit var getProfileUseCase: GetProfileUseCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not needed, right?
I removed it (locally in my branch) and signed a couple of transactions without issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋🏽
@@ -195,45 +194,6 @@ fun Profile.addAccounts( | |||
return updatedProfile.withUpdatedContentHint() | |||
} | |||
|
|||
@Suppress("UnusedParameter") | |||
fun Profile.addAuthSigningFactorInstanceForEntity( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice and clean!
@@ -67,6 +68,9 @@ class MainActivity : FragmentActivity() { | |||
@Inject | |||
lateinit var biometricsHandler: BiometricsHandler | |||
|
|||
@Inject | |||
lateinit var getProfileUseCase: GetProfileUseCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not invoked anywhere, is it still needed here?
) | ||
).perFactorSource | ||
} else { | ||
request.perFactorSource.map { perFactorSource -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to understand the behavior here. Why do we have different logic if the factorSourceKind
is FactorSourceKind.DEVICE
? Is it because we should only request the biometric prompt once? I assume a request with factorSourceKind == FactorSourceKind .DEVICE
can have multiple perFactorSource
but we need to ask for biometrics once to fulfill all of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly as it currently stands, when FactorSourceKind.DEVICE
is requested we perform poly sign. Meaning that we sign with multiple device factor sources with just one biometric. This is tbd though. One reason somewhat against this is what happens if one of those many devices misses the mnemonic. Do we fail the whole operation or we just return a signature of each device that can sign and skip the rest? How should that be depicted in the ui. I think we are going to discuss this tomorrow.
} | ||
} | ||
|
||
fun List<OutputPerFactorSource<Signable.ID.Transaction>>.into() = SignWithFactorsOutcomeOfTransactionIntentHash.Signed( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a clearer name would be better, such as signed
or toSigned
?
6a87fad
to
9028a72
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work! 🙇🏽
Description
This PR uses sargon to sign transactions, subintents, and rola. This is the first time that sargon can dictate and orchestrate what UI should be shown in host, and expect a response.
AccessFactorSourcesProxy
directly we use sargon os.WalletInteractor
WalletInteractor
is asking for signatures withAccessFactorSourcesProxy
and returns back the resultCommonException
kind.CommonException.SigningRejected
.GetSignaturesViewModel
is now responsible of returning the signatures to sargon os. The only logic that it handles is that it groups into a single biometrics request, multiple mnemonics. There is no ordering of the factor sources as it was. The ordering is handled by signatures collector in sargon.Signable
interface which works similar to aSignable
in sargon.### This PR is still WIP. Remaining tasks:GetSignaturesViewModel
needs to useBiometricsHandler
for obvious reasons, but also to handle the BiometricsException gracefully.AuthenticationSigner
does not do that. So,sargonOs.signAuth
needs to be integrated with signatures collector. Fortunately the android host will not change much in terms of implementation since the interactor is the sole point of friction.