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

[BREAKING CHANGE] refactor: remove the tx parameter from the sign method in the Signer trait #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EthanYuan
Copy link
Contributor

The sign method should be independent of CKB tx and should only be concerned with the signing message. Otherwise, it could lead to confusion.

pub trait Signer {
    /// `message` type is variable length, because different algorithm have
    /// different length of message:
    ///   * secp256k1 => 256bits
    ///   * RSA       => 512bits (when key size is 1024bits)
    fn sign(
        &self,
        id: &[u8],
        message: &[u8],
        recoverable: bool,
        tx: &TransactionView,
    ) -> Result<Bytes, SignerError>;
}

remove the tx parameter:

pub trait Signer {
    /// `message` type is variable length, because different algorithm have
    /// different length of message:
    ///   * secp256k1 => 256bits
    ///   * RSA       => 512bits (when key size is 1024bits)
    fn sign(&self, id: &[u8], message: &[u8], recoverable: bool) -> Result<Bytes, SignerError>;
}

@EthanYuan EthanYuan changed the title refactor: remove the tx parameter from the sign method in the Signer trait [BREAKING CHANGE] refactor: remove the tx parameter from the sign method in the Signer trait Mar 18, 2024
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.

1 participant