Skip to content

feat: integrate stellar-strkey for key validation (closes #7)#20

Merged
ayshadogo merged 3 commits intoDfunder:mainfrom
Idrhas:feat/stellar-strkey-key-validation
Mar 4, 2026
Merged

feat: integrate stellar-strkey for key validation (closes #7)#20
ayshadogo merged 3 commits intoDfunder:mainfrom
Idrhas:feat/stellar-strkey-key-validation

Conversation

@Idrhas
Copy link
Contributor

@Idrhas Idrhas commented Mar 4, 2026

Closes #7

What this adds

Cargo.toml

  • Added stellar-strkey = "0.0.8" for StrKey encoding/decoding
  • Added ed25519-dalek = "2" for public key derivation from secret seeds

src/utils/mod.rs (new)

  • Exposes pub mod keypair

src/utils/keypair.rs (new)

  • is_valid_public_key(key: &str) -> bool — validates G-prefixed Stellar public keys
  • is_valid_secret_key(key: &str) -> bool — validates S-prefixed Stellar secret keys
  • public_key_from_secret(secret: &str) -> Result<String, KeyError> — derives public key from secret
  • KeyError enum with InvalidSecretKey and InvalidPublicKey variants
  • 18 unit tests covering valid keys, invalid inputs, wrong prefix, truncated strings, cross-type mismatches, and correct derivation

src/main.rs

  • Added pub mod utils

@ayshadogo ayshadogo merged commit 9f5dfce into Dfunder:main Mar 4, 2026
3 checks 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.

Integrate stellar-strkey for Key Validation

2 participants