-
Notifications
You must be signed in to change notification settings - Fork 662
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
LinkAuth abstraction for lookup and signup #10019
Conversation
Diffuse output:
APK
|
private val Throwable.isAttestationError: Boolean | ||
get() = when (this) { | ||
// Stripe backend could not verify the intregrity of the request | ||
is APIException -> stripeError?.code == "link_failed_to_attest_request" | ||
// Interaction with Integrity API to generate tokens resulted in a failure | ||
is AttestationError -> true | ||
else -> false | ||
} |
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 logic was obtained from FC
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.
instead of copying this fn could we move it into a location where both FC + PaymentSheet can use it? e.g. I think payments-core may be used by both
} | ||
|
||
@Test | ||
fun `sign in attempt with token fetch failure returns AttestationFailed`() = runTest { |
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.
how is this different from the test case above?
private val Throwable.isAttestationError: Boolean | ||
get() = when (this) { | ||
// Stripe backend could not verify the intregrity of the request | ||
is APIException -> stripeError?.code == "link_failed_to_attest_request" | ||
// Interaction with Integrity API to generate tokens resulted in a failure | ||
is AttestationError -> true | ||
else -> false | ||
} |
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.
instead of copying this fn could we move it into a location where both FC + PaymentSheet can use it? e.g. I think payments-core may be used by both
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.
There are several places in this file where getOrThrow
is being used on a result -- can you update to instead take advantage of the result type (ie use something like .onSuccess
and .onFailure
?
return signupResult.toLinkAuthResult() | ||
} | ||
|
||
override suspend fun lookUp( |
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.
Should this function be named lookUpConsumer for consistency with LinkAccountManager?
ok to do in a follow up
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.
Ok to address PR comments later
ad0f050
to
7b949db
Compare
7b949db
to
492e84b
Compare
Summary
LinkAuth
will be used as an abstraction to call lookup and signup. It will use attestation endpoints when the attestation flag is enabled. It will use the old endpoints otherwise.LinkAuth
will replaceLinkAccountManager
inSignUpVieModel
(for look up and signup)LinkActivityViewModel
(for look up)LinkAuth
usesLinkAccountManager
andIntegrityRequestManager
underneath.Motivation
JIRA
Testing