Skip to content

Conversation

@philipliu
Copy link
Contributor

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

  • Title follows SDP-1234: Add new feature or Chore: Refactor package xyz format. The Jira ticket code was included if available.
  • PR has a focused scope and doesn't mix features with refactoring
  • Tests are included (if applicable)
  • CHANGELOG.md is updated (if applicable)
  • CONFIG/SECRETS changes are updated in helmcharts and deployments (if applicable)
  • Preview deployment works as expected
  • Ready for production

@philipliu philipliu temporarily deployed to Anchor Integration Tests November 10, 2025 20:19 — with GitHub Actions Inactive
@philipliu philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) November 10, 2025 20:19 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@philipliu philipliu marked this pull request as ready for review November 10, 2025 20:24
Copilot AI review requested due to automatic review settings November 10, 2025 20:24
@philipliu philipliu temporarily deployed to Anchor Integration Tests November 10, 2025 20:24 — with GitHub Actions Inactive
@philipliu philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) November 10, 2025 20:24 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

Copy link
Contributor

Copilot AI left a 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 SEP45Service for 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.

Copy link
Contributor

@marwen-abid marwen-abid left a 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
Copy link
Contributor

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.

if clientDomain != "" {
key, err := s.fetchSigningKeyFromClientDomain(clientDomain)
if err != nil {
return nil, err
Copy link
Contributor

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

TOMLClient stellartoml.ClientInterface
NetworkPassphrase string
WebAuthVerifyContractID string
SEP45SigningKeypair *keypair.Full
Copy link
Contributor

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 .

signedEntries = append(signedEntries, signedEntry)
}

return xdr.SorobanAuthorizationEntries(signedEntries), nil
Copy link
Contributor

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
Copy link
Contributor

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 ?

Copy link
Contributor Author

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 😓

@philipliu philipliu temporarily deployed to Receiver Registration - E2E Integration Tests (Stellar) November 13, 2025 15:51 — with GitHub Actions Inactive
@philipliu philipliu temporarily deployed to Anchor Integration Tests November 13, 2025 15:51 — with GitHub Actions Inactive
@stellar-jenkins
Copy link

@philipliu philipliu merged commit dac48f3 into feature/c-accounts Nov 13, 2025
16 checks passed
@philipliu philipliu deleted the philip/sdp-1863-sep-45-impl branch November 13, 2025 16:04
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