beem.message

class beem.message.Message(*args, **kwargs)

Bases: beem.message.MessageV1, beem.message.MessageV2

sign(*args, **kwargs)

Sign a message with an account’s memo key :param str account: (optional) the account that owns the bet

(defaults to default_account)
Raises:ValueError – If not account for signing is provided
Returns:the signed message encapsulated in a known format
supported_formats = (<class 'beem.message.MessageV1'>, <class 'beem.message.MessageV2'>)
valid_exceptions = (<class 'beem.exceptions.AccountDoesNotExistsException'>, <class 'beem.exceptions.InvalidMessageSignature'>, <class 'beem.exceptions.WrongMemoKey'>, <class 'beem.exceptions.InvalidMemoKeyException'>)
verify(**kwargs)

Verify a message with an account’s memo key :param str account: (optional) the account that owns the bet

(defaults to default_account)
Returns:True if the message is verified successfully

:raises InvalidMessageSignature if the signature is not ok

class beem.message.MessageV1(message, blockchain_instance=None, *args, **kwargs)

Bases: object

Allow to sign and verify Messages that are sigend with a private key

MESSAGE_SPLIT = ('-----BEGIN HIVE SIGNED MESSAGE-----', '-----BEGIN META-----', '-----BEGIN SIGNATURE-----', '-----END HIVE SIGNED MESSAGE-----')
SIGNED_MESSAGE_ENCAPSULATED = '\n{MESSAGE_SPLIT[0]}\n{message}\n{MESSAGE_SPLIT[1]}\naccount={meta[account]}\nmemokey={meta[memokey]}\nblock={meta[block]}\ntimestamp={meta[timestamp]}\n{MESSAGE_SPLIT[2]}\n{signature}\n{MESSAGE_SPLIT[3]}'
SIGNED_MESSAGE_META = '{message}\naccount={meta[account]}\nmemokey={meta[memokey]}\nblock={meta[block]}\ntimestamp={meta[timestamp]}'
sign(account=None, **kwargs)

Sign a message with an account’s memo key :param str account: (optional) the account that owns the bet

(defaults to default_account)
Raises:ValueError – If not account for signing is provided
Returns:the signed message encapsulated in a known format
verify(**kwargs)

Verify a message with an account’s memo key :param str account: (optional) the account that owns the bet

(defaults to default_account)
Returns:True if the message is verified successfully

:raises InvalidMessageSignature if the signature is not ok

class beem.message.MessageV2(message, blockchain_instance=None, *args, **kwargs)

Bases: object

Allow to sign and verify Messages that are sigend with a private key

sign(account=None, **kwargs)

Sign a message with an account’s memo key :param str account: (optional) the account that owns the bet

(defaults to default_account)
Raises:ValueError – If not account for signing is provided
Returns:the signed message encapsulated in a known format
verify(**kwargs)

Verify a message with an account’s memo key :param str account: (optional) the account that owns the bet

(defaults to default_account)
Returns:True if the message is verified successfully

:raises InvalidMessageSignature if the signature is not ok