Skip to content
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

Merged

Conversation

odesenfans
Copy link
Contributor

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.

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.
@odesenfans odesenfans force-pushed the od-tezos-support-micheline-signatures branch from 16d848f to 5f364fd Compare September 26, 2022 11:12
Copy link
Member

@MHHukiewitz MHHukiewitz left a 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.
Copy link
Member

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?

Copy link
Contributor Author

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?

@@ -10,13 +12,82 @@
LOGGER = logging.getLogger(__name__)
CHAIN_NAME = "TEZOS"

# Default dApp URI for Micheline-style signatures
DEFAULT_DAPP_URI = "aleph.im"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DEFAULT_DAPP_URI = "aleph.im"
DEFAULT_DAPP_URL = "https://aleph.im"

src/aleph/chains/tezos.py Outdated Show resolved Hide resolved
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
message, signature_type, dapp_uri
message, signature_type, dapp_url

"sender": "tz1VrPqrVdMFsgykWyhGH7SYcQ9avHTjPcdD",
"type": "POST",
"channel": "ALEPH-TEST",
"signature": '{"signingType":"micheline","signature":"sigXD8iT5ivdawgPzE1AbtDwqqAjJhS5sHS1psyE74YjfiaQnxWZsATNjncdsuQw3b9xaK79krxtsC8uQoT5TcUXmo66aovT","publicKey":"edpkvapDnjnasrNcmUdMZXhQZwpX6viPyuGCq6nrP4W7ZJCm7EFTpS"}',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"signature": '{"signingType":"micheline","signature":"sigXD8iT5ivdawgPzE1AbtDwqqAjJhS5sHS1psyE74YjfiaQnxWZsATNjncdsuQw3b9xaK79krxtsC8uQoT5TcUXmo66aovT","publicKey":"edpkvapDnjnasrNcmUdMZXhQZwpX6viPyuGCq6nrP4W7ZJCm7EFTpS"}',
"signature": '{"dAppUrl": "aleph.im", "signingType":"micheline","signature":"sigXD8iT5ivdawgPzE1AbtDwqqAjJhS5sHS1psyE74YjfiaQnxWZsATNjncdsuQw3b9xaK79krxtsC8uQoT5TcUXmo66aovT","publicKey":"edpkvapDnjnasrNcmUdMZXhQZwpX6viPyuGCq6nrP4W7ZJCm7EFTpS"}',



def get_tezos_verification_buffer(
message: BasePendingMessage, signature_type: TezosSignatureType, dapp_uri: str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
message: BasePendingMessage, signature_type: TezosSignatureType, dapp_uri: str
message: BasePendingMessage, signature_type: TezosSignatureType, dapp_url: str

return verification_buffer
elif signature_type == TezosSignatureType.MICHELINE:
return micheline_verification_buffer(
verification_buffer, message.time, dapp_uri
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
verification_buffer, message.time, dapp_uri
verification_buffer, message.time, dapp_url

@odesenfans odesenfans merged commit e8bc64e into aleph-im:dev Sep 26, 2022
@odesenfans odesenfans deleted the od-tezos-support-micheline-signatures branch September 26, 2022 12:20
odesenfans added a commit that referenced this pull request Oct 17, 2022
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>
odesenfans added a commit that referenced this pull request Oct 27, 2022
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>
odesenfans added a commit that referenced this pull request Jan 9, 2023
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>
odesenfans added a commit that referenced this pull request Mar 21, 2023
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>
This was referenced Apr 14, 2023
odesenfans added a commit that referenced this pull request Apr 24, 2023
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants