Ether Binder
Set of utilities for interacting with Ethereum and it's smart contracts with PHP, with generating ABI bindings and Ethereum-related types
Loading...
Searching...
No Matches
M8B\EtherBinder\Misc\InnerHashedMessage Class Reference
Inheritance diagram for M8B\EtherBinder\Misc\InnerHashedMessage:
M8B\EtherBinder\Misc\AbstractSigningMessage

Public Member Functions

 setMessage (string $message)
 
 getMessage ()
 
 sign (Key $key)
 
 isSigned ()
 
 toJson (bool $pretty)
 
 __toString ()
 
 getSignature ()
 
 validateSignature ()
 

Static Public Member Functions

static fromJSON (string $json)
 

Protected Member Functions

 preProcessMessage ()
 

Detailed Description

InnerHashedMessage is a subclass of AbstractSigningMessage designed to handle messages where the content is hashed internally. The message gets prepended with "\x19Ethereum Signed Message:\n32" followed by the Keccak-256 hash of the message.

Author
DubbaThony

Member Function Documentation

◆ __toString()

M8B\EtherBinder\Misc\AbstractSigningMessage::__toString ( )
inherited

Default to string behaviour is pretty printed JSON.

Returns
string Pretty printed JSON
Exceptions
EthBinderLogicException
See also
self::toJson

◆ fromJSON()

static M8B\EtherBinder\Misc\AbstractSigningMessage::fromJSON ( string $json)
staticinherited

Creates signed message from JSON string. Does not on its own validate the message, just parses it into object.

Parameters
string$jsonJSON object of message
Returns
static parsed message object
Exceptions
BadAddressChecksumException
EthBinderLogicException
InvalidHexException
InvalidHexLengthException
JsonException

◆ getMessage()

M8B\EtherBinder\Misc\AbstractSigningMessage::getMessage ( )
inherited

Get the current message.

Returns
string The current message.

◆ getSignature()

M8B\EtherBinder\Misc\AbstractSigningMessage::getSignature ( )
inherited

Retrieve the signature object.

Returns
Signature The clone of existing signature.

◆ isSigned()

M8B\EtherBinder\Misc\AbstractSigningMessage::isSigned ( )
inherited

Check if message is signed.

Returns
bool True if message has been signed, false otherwise.

◆ preProcessMessage()

M8B\EtherBinder\Misc\InnerHashedMessage::preProcessMessage ( )
protected
Exceptions
EthBinderLogicException

Reimplemented from M8B\EtherBinder\Misc\AbstractSigningMessage.

◆ setMessage()

M8B\EtherBinder\Misc\AbstractSigningMessage::setMessage ( string $message)
inherited

Set the message. This will invalidate and remove the current signature if message is different from currently set and if signature is present

Parameters
string$messageThe new message.

◆ sign()

M8B\EtherBinder\Misc\AbstractSigningMessage::sign ( Key $key)
inherited

Sign the message.

Parameters
Key$keyPrivate key for signing.
Returns
Signature Clone of generated signature.
Exceptions
EthBinderLogicException

◆ toJson()

M8B\EtherBinder\Misc\AbstractSigningMessage::toJson ( bool $pretty)
inherited

Convert object state to JSON string, producing JSON object similar to MEW and other wallets that support signing

Parameters
bool$prettyUse JSON pretty print option if true.
Returns
string The object state as a JSON string.
Exceptions
EthBinderLogicException

◆ validateSignature()

M8B\EtherBinder\Misc\AbstractSigningMessage::validateSignature ( )
inherited

Validate if the existing signature matches address it claims to be from.

Returns
bool True if signature is valid, false otherwise.
Exceptions
EthBinderLogicException
EthBinderRuntimeException

The documentation for this class was generated from the following file: