nectar.message module
- class nectar.message.Message(*args: Any, **kwargs: Any)
-
- sign(account: str | Account | None = None, **kwargs: Any) Any
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 'nectar.message.MessageV1'>, <class 'nectar.message.MessageV2'>)
- valid_exceptions = (<class 'nectar.exceptions.AccountDoesNotExistsException'>, <class 'nectar.exceptions.InvalidMessageSignature'>, <class 'nectar.exceptions.WrongMemoKey'>, <class 'nectar.exceptions.InvalidMemoKeyException'>)
- verify(**kwargs: Any) bool
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 nectar.message.MessageV1(message: str, blockchain_instance: Any | None = None, *args: Any, **kwargs: Any)
Bases:
objectAllow 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: str | Account | None = None, **kwargs: Any) Any
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: Any) bool
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 nectar.message.MessageV2(message: str, blockchain_instance: Any | None = None, *args: Any, **kwargs: Any)
Bases:
objectAllow to sign and verify Messages that are sigend with a private key
- sign(account: str | Account | None = None, **kwargs: Any) Any
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: Any) bool
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