-
Notifications
You must be signed in to change notification settings - Fork 42
SDP-1863: Implement SEP-45 challenge creation #942
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
Conversation
|
stellar-disbursement-platform-backend-preview is available here: |
|
stellar-disbursement-platform-backend-preview is available here: |
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.
Pull Request Overview
This PR implements the SEP-45 challenge creation flow as part of replacing the Anchor Platform functionality. It introduces a new SEP-45 service with utilities for XDR manipulation, Soroban authorization entry signing, and contract invocation.
Key changes:
- Adds
SEP45Servicefor creating authentication challenges using Soroban smart contracts - Implements XDR utilities for building and signing Soroban authorization entries
- Extends RPC client with ledger sequence retrieval capability
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/utils/xdr.go | New utility functions for constructing ScMapEntry values and signing Soroban authorization entries with signature verification |
| internal/stellar/rpc_client.go | Adds GetLatestLedgerSequence method to retrieve current ledger for signature expiration calculation |
| internal/stellar/rpc.go | Updates RPCClient interface with new ledger sequence method |
| internal/stellar/mocks/rpc_client.go | Auto-generated mock implementation for the updated interface |
| internal/services/sep45_service.go | Implements SEP-45 challenge creation with domain validation, TOML client domain verification, and server signature generation |
| internal/services/sep45_service_test.go | Comprehensive test suite covering validation, domain checks, client attribution, and signature generation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
marwen-abid
left a comment
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.
LGTM!
| clientAttributionRequired: opts.ClientAttributionRequired, | ||
| allowHTTPRetry: opts.AllowHTTPRetry, | ||
| baseURL: opts.BaseURL, | ||
| }, nil |
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.
Nice! I like that you extracted everything that may cause a failure downstream early on. We should do this more often.
internal/services/sep45_service.go
Outdated
| if clientDomain != "" { | ||
| key, err := s.fetchSigningKeyFromClientDomain(clientDomain) | ||
| if err != nil { | ||
| return nil, err |
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.
nit: Should wrap this error
internal/services/sep45_service.go
Outdated
| TOMLClient stellartoml.ClientInterface | ||
| NetworkPassphrase string | ||
| WebAuthVerifyContractID string | ||
| SEP45SigningKeypair *keypair.Full |
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.
nit: We should name this ServerSigningKey or SigningKey or SEP1key .
internal/services/sep45_service.go
Outdated
| signedEntries = append(signedEntries, signedEntry) | ||
| } | ||
|
|
||
| return xdr.SorobanAuthorizationEntries(signedEntries), nil |
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 believe this is a redundant type conversion. It can just be return signedEntries, nil
| @@ -0,0 +1,143 @@ | |||
| package utils | |||
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.
We should have unit tests for this file. Maybe in another PR ?
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'll add it in this PR. I forgot about this 😓
|
stellar-disbursement-platform-backend-preview is available here: |
What
This implements the SEP-45 challenge creation flow https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0045.md#challenge.
Why
The Anchor Platform has been removed, so we need to reimplement SEP-45.
Known limitations
The HTTP handler, dependency injection, and challenge validation will be implemented separately to keep the size of this PR reasonable.
Checklist
SDP-1234: Add new featureorChore: Refactor package xyzformat. The Jira ticket code was included if available.CHANGELOG.mdis updated (if applicable)