-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: support Micheline-style signatures for Tezos #330
Feature: support Micheline-style signatures for Tezos #330
Conversation
Problem: web wallets do not allow signing raw messages. Instead, they require binary payloads in a specific format. Solution: support Micheline-style signatures, i.e. signatures supported by wallets like Beacon. Users can now use Micheline or raw signatures by specifying the `signature.signingType` field to "micheline" or "raw". By default, "raw" is assumed.
16d848f
to
5f364fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Example: 2022-09-23T14:41:19.029Z | ||
|
||
:param timestamp: The timestamp to format. | ||
:return: The formatted timestamp. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will have to consider the same for the Python client. Maybe we should rather apply the python standard and I adjust the TS SDK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't matter to me, whatever you prefer.
On an unrelated note, how are we gonna use Tezos wallets from the Python SDK?
src/aleph/chains/tezos.py
Outdated
@@ -10,13 +12,82 @@ | |||
LOGGER = logging.getLogger(__name__) | |||
CHAIN_NAME = "TEZOS" | |||
|
|||
# Default dApp URI for Micheline-style signatures | |||
DEFAULT_DAPP_URI = "aleph.im" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFAULT_DAPP_URI = "aleph.im" | |
DEFAULT_DAPP_URL = "https://aleph.im" |
src/aleph/chains/tezos.py
Outdated
@@ -41,6 +115,10 @@ async def verify_signature(message: BasePendingMessage) -> bool: | |||
public_key_hash, | |||
) | |||
|
|||
verification_buffer = get_tezos_verification_buffer( | |||
message, signature_type, dapp_uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message, signature_type, dapp_uri | |
message, signature_type, dapp_url |
"sender": "tz1VrPqrVdMFsgykWyhGH7SYcQ9avHTjPcdD", | ||
"type": "POST", | ||
"channel": "ALEPH-TEST", | ||
"signature": '{"signingType":"micheline","signature":"sigXD8iT5ivdawgPzE1AbtDwqqAjJhS5sHS1psyE74YjfiaQnxWZsATNjncdsuQw3b9xaK79krxtsC8uQoT5TcUXmo66aovT","publicKey":"edpkvapDnjnasrNcmUdMZXhQZwpX6viPyuGCq6nrP4W7ZJCm7EFTpS"}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"signature": '{"signingType":"micheline","signature":"sigXD8iT5ivdawgPzE1AbtDwqqAjJhS5sHS1psyE74YjfiaQnxWZsATNjncdsuQw3b9xaK79krxtsC8uQoT5TcUXmo66aovT","publicKey":"edpkvapDnjnasrNcmUdMZXhQZwpX6viPyuGCq6nrP4W7ZJCm7EFTpS"}', | |
"signature": '{"dAppUrl": "aleph.im", "signingType":"micheline","signature":"sigXD8iT5ivdawgPzE1AbtDwqqAjJhS5sHS1psyE74YjfiaQnxWZsATNjncdsuQw3b9xaK79krxtsC8uQoT5TcUXmo66aovT","publicKey":"edpkvapDnjnasrNcmUdMZXhQZwpX6viPyuGCq6nrP4W7ZJCm7EFTpS"}', |
src/aleph/chains/tezos.py
Outdated
|
||
|
||
def get_tezos_verification_buffer( | ||
message: BasePendingMessage, signature_type: TezosSignatureType, dapp_uri: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message: BasePendingMessage, signature_type: TezosSignatureType, dapp_uri: str | |
message: BasePendingMessage, signature_type: TezosSignatureType, dapp_url: str |
src/aleph/chains/tezos.py
Outdated
return verification_buffer | ||
elif signature_type == TezosSignatureType.MICHELINE: | ||
return micheline_verification_buffer( | ||
verification_buffer, message.time, dapp_uri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verification_buffer, message.time, dapp_uri | |
verification_buffer, message.time, dapp_url |
minum required change
Problem: web wallets do not allow signing raw messages. Instead, they require binary payloads in a specific format. Solution: support Micheline-style signatures, i.e. signatures supported by wallets like Beacon. Users can now use Micheline or raw signatures by specifying the `signature.signingType` field to "micheline" or "raw". By default, "raw" is assumed. Co-authored-by: Mike Hukiewitz <70762838+MHHukiewitz@users.noreply.github.com>
Problem: web wallets do not allow signing raw messages. Instead, they require binary payloads in a specific format. Solution: support Micheline-style signatures, i.e. signatures supported by wallets like Beacon. Users can now use Micheline or raw signatures by specifying the `signature.signingType` field to "micheline" or "raw". By default, "raw" is assumed. Co-authored-by: Mike Hukiewitz <70762838+MHHukiewitz@users.noreply.github.com>
Problem: web wallets do not allow signing raw messages. Instead, they require binary payloads in a specific format. Solution: support Micheline-style signatures, i.e. signatures supported by wallets like Beacon. Users can now use Micheline or raw signatures by specifying the `signature.signingType` field to "micheline" or "raw". By default, "raw" is assumed. Co-authored-by: Mike Hukiewitz <70762838+MHHukiewitz@users.noreply.github.com>
Problem: web wallets do not allow signing raw messages. Instead, they require binary payloads in a specific format. Solution: support Micheline-style signatures, i.e. signatures supported by wallets like Beacon. Users can now use Micheline or raw signatures by specifying the `signature.signingType` field to "micheline" or "raw". By default, "raw" is assumed. Co-authored-by: Mike Hukiewitz <70762838+MHHukiewitz@users.noreply.github.com>
Problem: web wallets do not allow signing raw messages. Instead, they require binary payloads in a specific format. Solution: support Micheline-style signatures, i.e. signatures supported by wallets like Beacon. Users can now use Micheline or raw signatures by specifying the `signature.signingType` field to "micheline" or "raw". By default, "raw" is assumed. Co-authored-by: Mike Hukiewitz <70762838+MHHukiewitz@users.noreply.github.com>
Problem: web wallets do not allow signing raw messages. Instead, they require binary payloads in a specific format.
Solution: support Micheline-style signatures, i.e. signatures supported by wallets like Beacon.
Users can now use Micheline or raw signatures by specifying the
signature.signingType
field to "micheline" or "raw". By default, "raw" is assumed.