Download the PHP package cardano-php/cip8-verifier without Composer
On this page you can find all versions of the php package cardano-php/cip8-verifier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cardano-php/cip8-verifier
More information about cardano-php/cip8-verifier
Files in cardano-php/cip8-verifier
Package cip8-verifier
Short Description A PHP library to verify Cardano CIP-8 signed messages.
License MIT
Informations about the package cip8-verifier
CIP8 Verifier
A robust, production-ready PHP library for verifying Cardano CIP-8 signed messages. This library provides a clean, type-safe API for validating cryptographic signatures from Cardano wallets.
Features
- โ Full CIP-8 Compliance - Complete implementation of Cardano's CIP-8 message verification standard
- ๐ Cryptographically Secure - Uses Ed25519 signature verification with proper validation
- ๐๏ธ Clean Architecture - Built following SOLID principles with dependency injection
- ๐ก๏ธ Type Safe - Full PHP 8.1+ type hints and readonly classes
- โก High Performance - Optimized CBOR parsing and efficient algorithms
- ๐งช Thoroughly Tested - Comprehensive test suite ensuring reliability
- ๐ Well Documented - Clear API documentation and usage examples
Requirements
- PHP 8.1 or higher
ext-sodiumextension (for cryptographic operations)spomky-labs/cbor-phppackage (for CBOR encoding/decoding)
Installation
Install via Composer:
Quick Start
Please refer to the frontend example code to see how to obtain the signatureCbor, signatureKey, challengeHex, expectedSignerStakeAddress and networkMode values.
API Reference
Main Classes
CIP8Verifier
The main orchestrator class that coordinates all verification operations.
VerificationRequest (readonly DTO)
Input data structure for verification requests.
VerificationResult (readonly DTO)
Output data structure containing verification results.
Exception Hierarchy
The library provides specific exceptions for different error scenarios:
Service Classes
The library follows a modular architecture with focused service classes:
PublicKeyExtractor- Extracts public keys from signature keysStakeAddressGenerator- Generates Cardano stake addressesBech32Encoder- Handles bech32 address encodingCoseParser- Parses COSE_Sign1 message structuresSignatureVerifier- Verifies Ed25519 signatures
Usage Examples
Error Handling
Dependency Injection
Architecture
The library follows clean architecture principles with clear separation of concerns:
Network Modes
The library supports both Cardano networks:
- Mainnet:
networkMode = 1 - Testnet:
networkMode = 0
Wallet Compatibility
This library supports signature verification from:
- โ Lite Wallets (Nami, Eternl, etc.) - Direct payload signing
- โ Hardware Wallet (Ledger) - Blake2b hashed payload signing
Security Considerations
- All cryptographic operations use the
sodiumextension for security - Signature validation follows Ed25519 standards
- Public key and signature length validation prevents malformed input attacks
- CBOR parsing is handled securely with proper error handling
Performance
The library is optimized for performance:
- Efficient CBOR parsing and encoding
- Minimal memory allocations
- Fast cryptographic operations using native sodium functions
- Clean service architecture allows for easy optimization
Contributing
Contributions are welcome! Please ensure your code follows:
- PSR-12 coding standards
- Comprehensive test coverage
- Proper type hints
- Clear documentation
Testing
Changelog
See CHANGELOG.md for version history and changes.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- ๐ Documentation: Check this README and inline code documentation
- ๐ Bug Reports: Open an issue on GitHub
- ๐ก Feature Requests: Open an issue with the
enhancementlabel - ๐ฌ Questions: Start a discussion on GitHub Discussions