Skip to content

Kan/passkeys compatibility#868

Merged
Kay-Zee merged 13 commits into
masterfrom
kan/passkeys-compatibility
Sep 10, 2025
Merged

Kan/passkeys compatibility#868
Kay-Zee merged 13 commits into
masterfrom
kan/passkeys-compatibility

Conversation

@Kay-Zee
Copy link
Copy Markdown
Member

@Kay-Zee Kay-Zee commented Jul 4, 2025

Closes: #???

Description

Adds initial understanding of the ExtensionData field for transaction signatures

Does not yet allow adding of ExtensionData to the signature, i.e. no passkeys support yet in this PR.


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Copy link
Copy Markdown
Contributor

@tarakby tarakby left a comment

Choose a reason for hiding this comment

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

  • If my understanding is correct, the current transaction IDs in tests should remain the same after the change. Test should pass without updating the transaction IDs.
  • It would be good to add a new test where at least one transaction signature is of the webauthn scheme

Comment thread transaction.go Outdated
Comment thread transaction.go Outdated
Comment thread transaction_legacy.go Outdated
Comment thread transaction.go Outdated
Comment thread transaction_test.go Outdated
Comment thread transaction_legacy.go Outdated
Comment thread go.mod Outdated
Comment thread transaction.go Outdated
Comment thread transaction.go Outdated
@chasefleming chasefleming requested a review from Copilot September 9, 2025 23:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds initial support for passkeys compatibility by introducing ExtensionData field support in transaction signatures. It maintains backward compatibility by creating legacy canonical forms for existing signatures while preparing for future passkey authentication.

  • Adds ExtensionData field to TransactionSignature and related structures
  • Implements legacy transaction decoding fallback for backward compatibility
  • Updates dependency versions in examples/go.mod

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
transaction_legacy.go New file implementing legacy transaction signature canonical forms and decoding
transaction.go Adds ExtensionData field support and legacy compatibility logic
examples/go.mod Updates various dependency versions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread transaction.go Outdated
// Checks if the scheme is plain authentication scheme, and indicate that it
// is required to use the legacy canonical form.
// We check for a valid scheme identifier, as this should be the only case
// where the extension data can be left out of the cannonical form.
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

Typo in comment: 'cannonical' should be 'canonical'.

Copilot uses AI. Check for mistakes.
Comment thread transaction.go Outdated
// Until we deprecate the old TransactionSignature format, we need to have two canonical forms.
// int is not RLP-serializable, therefore s.SignerIndex and s.KeyIndex are converted to uint
if s.shouldUseLegacyCanonicalForm() {
// This is the legacy cononical form, mainly here for backward compatibility
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

Typo in comment: 'cononical' should be 'canonical'.

Copilot uses AI. Check for mistakes.
Comment thread transaction.go
if err != nil {
return nil, err
// If the transaction is in the legacy format, convert it to the canonical form
if strings.Contains(err.Error(), "too few elements") { // since the rlp library does not have this error type, just check string
Copy link

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

Using string matching for error handling is fragile. Consider defining a custom error type or using error wrapping/unwrapping patterns for more robust error handling.

Copilot uses AI. Check for mistakes.
Comment thread transaction.go
if err != nil {
return nil, err
// If the transaction is in the legacy format, convert it to the canonical form
if strings.Contains(err.Error(), "too few elements") { // since the rlp library does not have this error type, just check string
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a better check than this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not really, this is working off the go ethereum error: https://github.com/ethereum/go-ethereum/blob/master/rlp/decode.go#L108-L112

which is

type decodeError struct {
	msg string
	typ reflect.Type
	ctx []string
}

so only really gives you msg to work with. There is no additional ctx for the error we're working with.

Comment thread go.mod Outdated
Comment thread transaction.go
@chasefleming
Copy link
Copy Markdown
Member

@bjartek @bluesign Can you review as well? Will this break anything for you?

@Kay-Zee
Copy link
Copy Markdown
Member Author

Kay-Zee commented Sep 10, 2025

going to merge, to unblock somethings in flow-go, but if there are other comments, i will come back and address

@Kay-Zee Kay-Zee merged commit 5e8eb0e into master Sep 10, 2025
1 check passed
@Kay-Zee Kay-Zee deleted the kan/passkeys-compatibility branch September 10, 2025 00:04
@bjartek
Copy link
Copy Markdown
Contributor

bjartek commented Sep 10, 2025

Took a peek and cant see anything from our side.

@bluesign
Copy link
Copy Markdown
Contributor

all good from my side too, super excited for passkeys

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.

8 participants