Metadata-Version: 2.4
Name: twof
Version: 0.0.1
Summary: Two Fish Blue Fish - A 2 Factor verfication of deployed software hashes
Author: Maintainers
Author-email: solubrew@solutionsbrewer.com
License: MIT
Platform: Linux
Requires-Python: >=3.6
Requires-Dist: backoff
Requires-Dist: click
Requires-Dist: dnspython
Requires-Dist: certifi
Requires-Dist: web3
Requires-Dist: requests
Requires-Dist: defusedxml; platform_system == "Windows"
Requires-Dist: futures; python_version < "3"
Requires-Dist: six; platform_system == "Linux" and python_version > "3.3"
Requires-Dist: pypiwin32; platform_system == "Windows"
Requires-Dist: wheel<=0.29.0; python_version < "2.7"
Description: # TwoF
        
        TwoF is a Python module that uses stored hashes from the blockchain to verify domains and websites. It provides a secure, decentralized method to store cryptographic hashes of website content or domain certificates on the blockchain and retrieve them for verification, ensuring authenticity and integrity against tampering or phishing attempts. By leveraging blockchain's immutability, TwoF offers a trustless way to confirm that a domain or website matches its registered hash.
        
        ## Features
        
        - **Blockchain Hash Storage**: Store hashes of domain certificates, website content, or metadata on supported blockchain networks.
        - **Verification Mechanism**: Retrieve stored hashes from the blockchain and compare them against computed hashes of current domain/website data.
        - **Supported Blockchains**: Integration with <BLOCKCHAIN_NETWORK1> and <BLOCKCHAIN_NETWORK2> via smart contracts or transaction data.
        - **Hash Algorithms**: Support for multiple hashing methods like SHA-256, SHA-512, with salting options.
        - **Domain/Website Fetching**: Automatically fetch and hash website content or SSL certificates for verification.
        - **Error Handling and Security**: Built-in checks for blockchain connectivity, hash mismatches, and secure key management.
        - **Extensible**: Customize blockchain providers, hash functions, or add support for new networks.
        - **Cross-Platform Compatibility**: Works on Windows, macOS, and Linux.
        
        ## Installation
        
        You can install TwoF via pip:
        
        ```bash
        pip install twof
        ```
        
        Alternatively, clone the repository and install from source:
        
        ```bash
        git clone https://github.com/<USER_OR_ORG>/twof.git
        cd twof
        pip install -e .
        ```
        
        ### Requirements
        
        - Python 3.<MIN_VERSION> or higher
        - Dependencies: web3, requests, hashlib (automatically installed via pip where applicable)
        
        ## Quick Start
        
        Import the module, configure blockchain access, and verify a domain:
        
        ```python
        import twof
        
        # Initialize TwoF with blockchain config
        config = {
            'network': '<BLOCKCHAIN_NETWORK>',
            'api_key': '<API_KEY>',
            'contract_address': '<CONTRACT_ADDR>'
        }
        verifier = twof.Verifier(config)
        
        # Verify a domain
        is_valid = verifier.verify_domain('example.com', stored_hash_key='domain_hash_id')
        print(is_valid)  # True if hashes match
        ```
        
        ## Usage
        
        ### Storing Hashes on Blockchain
        
        Store a hash for a domain or website:
        
        ```python
        # Compute hash of website content
        content_hash = twof.compute_hash('https://example.com', mode='content')
        
        # Store on blockchain
        tx_id = verifier.store_hash('domain_hash_id', content_hash)
        print(tx_id)  # Transaction ID on blockchain
        ```
        
        ### Verifying Domains/Websites
        
        Retrieve and compare hashes:
        
        ```python
        # Fetch stored hash from blockchain
        stored_hash = verifier.get_stored_hash('domain_hash_id')
        
        # Compute current hash
        current_hash = twof.compute_hash('https://example.com', mode='certificate')
        
        # Manual verification
        match = stored_hash == current_hash
        ```
        
        ### Supported Modes
        
        - `content`: Hash the HTML content of the website.
        - `certificate`: Hash the SSL/TLS certificate.
        - `metadata`: Hash custom metadata like headers or DNS records.
        
        ## Examples
        
        ### Example 1: Domain Verification Workflow
        
        ```python
        import twof
        
        config = {'network': '<NETWORK>', 'api_key': '<KEY>'}
        verifier = twof.Verifier(config)
        
        # Store initial hash
        initial_hash = twof.compute_hash('https://secure-site.com', mode='content')
        verifier.store_hash('secure_site_hash', initial_hash)
        
        # Later verification
        is_verified = verifier.verify_domain('secure-site.com', 'secure_site_hash')
        if is_verified:
            print("Domain verified successfully.")
        else:
            print("Verification failed: Potential tampering.")
        ```
        
        ### Example 2: Batch Verification
        
        ```python
        import twof
        
        verifier = twof.Verifier(config)
        domains = ['example.com', 'test.com']
        hash_keys = ['ex_hash', 'test_hash']
        
        results = {}
        for domain, key in zip(domains, hash_keys):
            results[domain] = verifier.verify_domain(domain, key)
        
        print(results)  # e.g., {'example.com': True, 'test.com': False}
        ```
        
        ## Configuration Guide
        
        The config dictionary or YAML file must include:
        
        - `network`: Blockchain network (e.g., 'ethereum', 'binance')
        - `api_key`: Provider API key for node access
        - `contract_address`: Smart contract for hash storage (if applicable)
        - `hash_algorithm`: Default hash method (e.g., 'sha256')
        
        For advanced customization, refer to the [docs/config-reference.md](docs/config-reference.md).
        
        ## Contributing
        
        Contributions are welcome! Please follow these steps:
        
        1. Fork the repository.
        2. Create a feature branch (`git checkout -b feature/<FEATURE_NAME>`).
        3. Commit your changes (`git commit -am 'Add some feature'`).
        4. Push to the branch (`git push origin feature/<FEATURE_NAME>`).
        5. Open a Pull Request.
        
        See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
        
        ## License
        
        This project is licensed under the <LICENSE_TYPE> License - see the [LICENSE](LICENSE.md) file for details.
        
        ## Acknowledgments
        
        - Built with inspiration from blockchain security and verification communities.
        - Thanks to contributors of underlying libraries like web3, requests, hashlib.
Description-Content-Type: text/markdown
