Skip to content
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

feat: add support for SEP-10 v3.1.0. #319

Merged

Conversation

overcat
Copy link
Member

@overcat overcat commented Jan 26, 2021

resolve #315

  • Updates the SEP-10 utility function parameters to support SEP-10 v3.1
    • A new required webAuthDomain parameter was added to the following functions
      • Sep10Challenge#newChallenge(KeyPair, Network, String, String, String, TimeBounds)
      • Sep10Challenge#readChallengeTransaction(String, String, Network, String, String)
      • Sep10Challenge#readChallengeTransaction(String, String, Network, String[], String)
      • Sep10Challenge#verifyChallengeTransactionSigners(String, String, Network, String, String, Set)
      • Sep10Challenge#verifyChallengeTransactionSigners(String, String, Network, String[], String, Set)
      • Sep10Challenge#verifyChallengeTransactionThreshold(String, String, Network, String[], String, int, Set)
      • Sep10Challenge#verifyChallengeTransactionThreshold(String, String, Network, String, String, int, Set)
    • The webAuthDomain parameter is expected to match the value of the Manage Data operation with the 'web_auth_domain' key, if present.

@overcat overcat marked this pull request as ready for review January 26, 2021 14:13
Copy link
Contributor

@tamirms tamirms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good to me but I'll yield to @leighmcculloch for the final approval

Copy link
Contributor

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, although one concern. @JakeUrban could you chime in?

* @return {@link ChallengeTransaction}, the decoded transaction envelope and client account ID contained within.
* @throws InvalidSep10ChallengeException If the SEP-0010 validation fails, the exception will be thrown.
* @throws IOException If read XDR string fails, the exception will be thrown.
*/
public static ChallengeTransaction readChallengeTransaction(String challengeXdr, String serverAccountId, Network network, String[] domainNames) throws InvalidSep10ChallengeException, IOException {
public static ChallengeTransaction readChallengeTransaction(String challengeXdr, String serverAccountId, Network network, String[] domainNames, String webAuthDomain) throws InvalidSep10ChallengeException, IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Go SDK we need to put the webauth domain before the home domains to preserve an odd but awkward case that can break applications without them realizing, so I think there would be value in having all SDKs have that field first for consistency. But it also doesn't really matter. cc @JakeUrban

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense to try to keep function signatures consistent across languages. I'm pretty sure that ship has already sailed anyway. The change made looks good to me 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Copy link
Contributor

@JakeUrban JakeUrban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks @overcat

* @return {@link ChallengeTransaction}, the decoded transaction envelope and client account ID contained within.
* @throws InvalidSep10ChallengeException If the SEP-0010 validation fails, the exception will be thrown.
* @throws IOException If read XDR string fails, the exception will be thrown.
*/
public static ChallengeTransaction readChallengeTransaction(String challengeXdr, String serverAccountId, Network network, String[] domainNames) throws InvalidSep10ChallengeException, IOException {
public static ChallengeTransaction readChallengeTransaction(String challengeXdr, String serverAccountId, Network network, String[] domainNames, String webAuthDomain) throws InvalidSep10ChallengeException, IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense to try to keep function signatures consistent across languages. I'm pretty sure that ship has already sailed anyway. The change made looks good to me 👍

@tamirms
Copy link
Contributor

tamirms commented Feb 2, 2021

@overcat could you try rebasing your branch on top of master? we need to retrigger circle ci so that the PR can be merged

@overcat overcat requested a review from tamirms February 2, 2021 14:30
@tamirms tamirms merged commit d20dc6c into lightsail-network:master Feb 2, 2021
@overcat
Copy link
Member Author

overcat commented Feb 2, 2021

Thank you all.

@overcat overcat deleted the dev-sep10-v3.1.0 branch February 2, 2021 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SEP-10 v3.1 Changes (from the SDF)
4 participants