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

SEP-45: Stellar Web Authentication for Contract Accounts #1561

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

philipliu
Copy link
Contributor

@philipliu philipliu commented Oct 8, 2024

This adds the initial draft for SEP-0045, which is a proposal for a new API to allow for web authentication for contract accounts. It is based on SEP-10 which is the web authentication API for classic accounts but with modifications to support Soroban's authentication model.

This is based on a previous PR authored by @leighmcculloch.

@philipliu philipliu changed the title [SEP-45] Web authentication for contracts SEP-45: Web authentication for contracts Oct 8, 2024
@philipliu philipliu force-pushed the contract-web-auth branch 7 times, most recently from a7ce911 to cf1b01a Compare October 10, 2024 15:12
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
@philipliu philipliu force-pushed the contract-web-auth branch 3 times, most recently from 34263e5 to ce26a97 Compare October 10, 2024 17:50
Copy link

github-actions bot commented Nov 9, 2024

This pull request is stale because it has been open for 30 days with no activity. It will be closed in 30 days unless the stale label is removed.

@github-actions github-actions bot added the stale label Nov 9, 2024
@philipliu philipliu removed the stale label Nov 9, 2024
@philipliu philipliu force-pushed the contract-web-auth branch 2 times, most recently from b32b4ff to f36707c Compare November 27, 2024 22:53
@philipliu philipliu changed the title SEP-45: Web authentication for contracts SEP-45: Stellar Web Authentication for Contract Accounts Nov 27, 2024
Copy link
Contributor

@marcelosalloum marcelosalloum left a comment

Choose a reason for hiding this comment

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

Should SEP-45 eventually fully replace SEP-10? if so, I believe we should replace occurrences of C-address account(s) with just Account and define what it means at the top of the document. A definition that includes C-address, G-address, and mux accounts would make it flexible from the starting point, WDYT?

ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
@philipliu
Copy link
Contributor Author

Should SEP-45 eventually fully replace SEP-10? if so, I believe we should replace occurrences of C-address account(s) with just Account and define what it means at the top of the document. A definition that includes C-address, G-address, and mux accounts would make it flexible from the starting point, WDYT?

I think we should initially support C-addresses only. As the ecosystem begins to adopt the protocol, we may uncover issues. By starting with C-addresses only, it will be easier to support G-addresses later, rather than removing support if there are issues.

That being said, I think a definition section is helpful. I will add it.

@philipliu philipliu marked this pull request as ready for review December 2, 2024 21:35
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.

Aside from my other comments, I didn't see a good place to raise this one in particular so I'm making it here.

The SorobanAuthorizationEntry XDR struct contains a SorobanCredentials struct within it, but we're not using that field in the authorization entries we pass between the client and server. Why is that?

Couldn't we do something like this instead?

  • The response to the GET request is a list of authorization entires where:
    • the first one is the entry for the client account, which doesn't have a signature present in its SorobanCredentials struct
    • the second one is the entry for the server account, which has a signature present in its SorobanCredentials struct
    • the third one is optional, depending on whether the client domain account is being verified, and if present, does not have a signature present in its SorobanCredentials struct

In the POST request, the auth entires can include the signatures from the client in their credentials struct.

This way, we're only passing auth entry XDRs back and forth, rather than entires + signatures + credentials.

ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
@philipliu
Copy link
Contributor Author

the second one is the entry for the server account, which has a signature present in its SorobanCredentials struct

There wouldn't be an authorization entry for the server because the require_auth calls are only on the client address and an optional client domain address, right?

In the POST request, the auth entires can include the signatures from the client in their credentials struct.

This way, we're only passing auth entry XDRs back and forth, rather than entires + signatures + credentials.

Are you suggesting that we include the server signatures in each of the SorboanCredentials arrays?

@JakeUrban
Copy link
Contributor

JakeUrban commented Dec 3, 2024

There wouldn't be an authorization entry for the server because the require_auth calls are only on the client address and an optional client domain address, right?

That depends on the implementation of the server's contract. We could require implementations to require authorization from the client and server (and optionally the client domain's address). The server could simulate the transaction to generate the auth entries, send it to the client, then simulate the entries sent back by the client in enforcing mode to validate the signatures.

Are you suggesting that we include the server signatures in each of the SorboanCredentials arrays?

I'm suggesting we use the credentials struct with the auth entries structs so the API looks like this:

GET <WEB_AUTH_ENDPOINT_SEP0045> Response

{
  "authorization_entries": [
"AAAAAQAAAAHw6CVqzY+dCq3myVJBo1kb3nEGE7oO6obmJeUNvYQ0uiUmvl6zrExtAAAAAAAAAAEAAAAAAAAAAahbWC88MmIccL/85Jd6Myxjq5sHF+2dnq1+2H8osKvEAAAAD3dlYl9hdXRoX3ZlcmlmeQAAAAAHAAAAEgAAAAHw6CVqzY+dCq3myVJBo1kb3nEGE7oO6obmJeUNvYQ0ugAAAA4AAAADMTIzAAAAAA4AAAAObG9jYWxob3N0OjgwODAAAAAAAA4AAAAObG9jYWxob3N0OjgwODAAAAAAAAEAAAABAAAADgAAAAozMDc4NjE1NjE1AAAAAAAA",
"AAAAAQAAAAHw6CVqzY+dCq3myVJBo1kb3nEGE7oO6obmJeUNvYQ0uiUmvl6zrExtAAAAAAAAAAEAAAAAAAAAAahbWC88MmIccL/85Jd6Myxjq5sHF+2dnq1+2H8osKvEAAAAD3dlYl9hdXRoX3ZlcmlmeQAAAAAHAAAAEgAAAAHw6CVqzY+dCq3myVJBo1kb3nEGE7oO6obmJeUNvYQ0ugAAAA4AAAADMTIzAAAAAA4AAAAObG9jYWxob3N0OjgwODAAAAAAAA4AAAAObG9jYWxob3N0OjgwODAAAAAAAAEAAAABAAAADgAAAAozMDc4NjE1NjE1AAAAAAAA"
  ]
}

Where the first entry contains a SorobanCredentials struct with a missing signature field from the client, and the second entry contains a credentials struct with a signature from the server present. That way, the request to the POST <WEB_AUTH_ENDPOINT_SEP0045> would have an identical format, but the first entry would be updated to include the client's signature.

@philipliu
Copy link
Contributor Author

Implemented your suggestion, @JakeUrban 👍

ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
Copy link
Member

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

👏🏻 Few comments in line.

ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
ecosystem/sep-0045.md Outdated Show resolved Hide resolved
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.

5 participants