Skip to content

feat: Stellar address validation utility (#166)#210

Merged
SudiptaPaul-31 merged 1 commit into
Lumina-eX:mainfrom
Ebenezer199914:feature/stellar-address-validation-utility
Jun 28, 2026
Merged

feat: Stellar address validation utility (#166)#210
SudiptaPaul-31 merged 1 commit into
Lumina-eX:mainfrom
Ebenezer199914:feature/stellar-address-validation-utility

Conversation

@Ebenezer199914

Copy link
Copy Markdown
Contributor

Summary

Closes #166

Implements a proper Stellar address validation utility using the Stellar SDK's StrKey.isValidEd25519PublicKey, which decodes the Base32-encoded address and validates the checksum — far more robust than a simple length + prefix check.

Changes

  • lib/utils/stellar-address.ts — new utility with two exports:
    • isValidStellarAddress(address) — returns true for valid Stellar Ed25519 public keys
    • getStellarAddressError(address) — returns a descriptive error string or null
  • lib/utils/stellar-address.test.ts — 13 unit tests covering:
    • Valid real keypair address
    • Bad checksum, wrong prefix, wrong length
    • Non-string inputs (null, undefined, number, object)
    • Empty string and whitespace-only string
    • getStellarAddressError messages for all cases
  • vitest.config.ts — registered new test file
  • .github/workflows/ci.yml — added Run unit tests step before build
  • package.json — removed duplicate test:unit key

Test results

✓ lib/utils/stellar-address.test.ts (13 tests)
✓ lib/blockchain/group-verification.test.ts (14 tests)
✓ components/GroupVerificationBadge.test.tsx (2 tests)

Test Files  3 passed (3)
      Tests 29 passed (29)

CI

The CI workflow now runs npm run test:unit on every PR before the build step.

- Add lib/utils/stellar-address.ts with isValidStellarAddress and
  getStellarAddressError using StrKey.isValidEd25519PublicKey for
  proper checksum-aware validation via the Stellar SDK
- Add 13 unit tests covering valid addresses, bad checksum, wrong
  prefix, non-string inputs, empty/whitespace, and error messages
- Register new test file in vitest.config.ts
- Add 'Run unit tests' step to CI workflow before build
- Fix duplicate test:unit key in package.json (kept vitest run)
@SudiptaPaul-31 SudiptaPaul-31 merged commit 9275726 into Lumina-eX:main Jun 28, 2026
1 check passed
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.

Stellar Address Validation Utility

2 participants