lib/WalletManager.php
/*
     * Decode an integrated address
     *
     * @param string An integrated wallet address
     */
Decode an integrated address
@param string An integrated wallet address
Decode an integrated address @param string An integrated wallet address
public function integrated_decode($iAddress)
    {
        if (strlen($iAddress) !== 109) {
            throw new Exception('Error: Invalid integrated address length');
        }
        $data = $this->base58->decode($iAddress);
        $data = substr($data, 0, -8);
        $prefix = substr($data, 0, 6);
        $key_spend_public = substr($data, 6, 64);
        $key_view_public = substr($data, 70, 64);
        $payment_id = substr($data, 134);
        $address = $this->encode_address($key_spend_public, $key_view_public);
        if ($prefix !== $this->wallet_integrated_prefix) {
            throw new Exception("Error: Invalid prefix");
        }
        if (strlen($payment_id) !== $this->payment_id_length_integrated) {
            throw new Exception('Error: Invalid payment id length');
        }
        return array(
            'integrated_address' => $iAddress,
            'address' => $address,
            'view_public' => $key_view_public,
            'spend_public' => $key_spend_public,
            'payment_id' => $payment_id,
        );
    }
public function integrated_decode ( $ iAddress ) { if ( strlen ( $ iAddress ) !== 109 ) { throw new Exception ( 'Error: Invalid integrated address length' ) ; } $ data = $ this -> base58 -> decode ( $ iAddress ) ; $ data = substr ( $ data , 0 , - 8 ) ; $ prefix = substr ( $ data , 0 , 6 ) ; $ key_spend_public = substr ( $ data , 6 , 64 ) ; $ key_view_public = substr ( $ data , 70 , 64 ) ; $ payment_id = substr ( $ data , 134 ) ; $ address = $ this -> encode_address ( $ key_spend_public , $ key_view_public ) ; if ( $ prefix !== $ this -> wallet_integrated_prefix ) { throw new Exception ( " Error: Invalid prefix " ) ; } if ( strlen ( $ payment_id ) !== $ this -> payment_id_length_integrated ) { throw new Exception ( 'Error: Invalid payment id length' ) ; } return array ( 'integrated_address' => $ iAddress , 'address' => $ address , 'view_public' => $ key_view_public , 'spend_public' => $ key_spend_public , 'payment_id' => $ payment_id , ) ; }
Decode an integrated address
 @param string An integrated wallet address
Decode an integrated address @param string An integrated wallet address
// Validate integrated address length. // Base58 decode the address. // Split into the prefix, spend key, view key & payment_id. // Check the prefix is correct. // Validate integrated address length.