refactor(architecture): split auth/service.go into focused sub-services - #317
Merged
cypriannwokolo2-creator merged 10 commits intoSep 1, 2026
Conversation
…truct Replace the fragile NewService(..., dependencies ...any) variadic any signature with a typed Dependencies struct. This provides compile-time type safety and eliminates the runtime type-switch that was a footgun for future dependencies. - Add Dependencies struct with typed fields for all optional collaborators - Change NewService to accept Dependencies instead of ...any - Update all callers across service tests, handler tests, integration tests, attack vector tests, and main.go Closes cocor-tech#156
Extract Stellar transaction signing (SignXDR), payment building/submission (BuildPaymentTx), and balance queries (GetBalance) into pkg/stellar helpers. This is part of splitting wallet/service.go to keep it focused on orchestration and security policy. Refs cocor-tech#158
- Created internal/domain/auth/jwt for JWT generation and validation - Created internal/domain/auth/nonce for nonce generation and signature verification - Consolidated duplicate JWT signers into parameterized GenerateToken - Reuse Stellar SDK keypair/StrKey instead of hand-rolled CRC16 Closes cocor-tech#157
|
@Chinonso-Peter Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
- Moved CreateSession/ValidateSession/RefreshToken/List/Revoke logic to session sub-service - Moved Argon2id hashing to password sub-service - auth.Service now composes nonce, session, and jwt sub-services - Preserves existing Service interface for handler backward compatibility Closes cocor-tech#157
…reen build Master's merged domain refactors (incentives split, swap CAS, wallet) were incomplete at the origin tip. Complete the split design: - incentives: extend Repository with referral/incentive/streak lookups and status transitions; implement postgres + mock; define parseUUID and ErrIncentiveNotFound; drop duplicate legacy methods from service.go - swap: reconcile service with SwapOfferRequest, remove duplicate Repository interface, restore CAS mock in handler tests, fix typo in test - wallet: add Balance type, map service to current repo/mock APIs - contribution/payout: integration test now mocks FindByTxnHash dedup - webhook: clear secret before persist so only secret_hash is stored; dispatcher test signs/verifies with secret_hash - handler: fix swap history envelope, stale websocket bridge test
| pipe.Del(ctx, fmt.Sprintf("session:%s", hash)) | ||
| } | ||
| pipe.Del(ctx, userSessionsKey) | ||
| pipe.Exec(ctx) |
cypriannwokolo2-creator
merged commit Sep 1, 2026
0db6cd8
into
cocor-tech:master
5 of 6 checks passed
cypriannwokolo2-creator
added a commit
to Chinonso-Peter/moistello-backend
that referenced
this pull request
Sep 1, 2026
| input.OfferorAmount, | ||
| input.RequestedAsset, | ||
| input.RequestedAmount, | ||
| uint64(expiresAt.Unix()), |
| return fmt.Errorf("encoding trustline tx: %w", err) | ||
| } | ||
| // Bounded async funding with context and timeout | ||
| go func() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits internal/domain/auth/service.go (523 lines) into focused auth sub-services.
Changes
Acceptance Criteria
Closes #157