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

Handle bip137 #410

Closed
RyanKung opened this issue May 5, 2023 · 0 comments
Closed

Handle bip137 #410

RyanKung opened this issue May 5, 2023 · 0 comments
Assignees

Comments

@RyanKung
Copy link
Member

RyanKung commented May 5, 2023

    #[test]
    fn test_verify_bip137() {
	// The sig is created by unisat.
	// let sig = await window.unisat.signMessage("hello world");
	// sig = "G4j29m8WutQfZJaonWuXLoXhlhlPfJzbN/Vmz2hdiAYwFMpvTPZslHaOBaotsFfkN26KpaCF3Az0ooUr6vMbNBg="
	// signer = "bc1p43s0vyuq6wvsfqmw5vd2thhv5pg755ekasw2y8jwh754ezdayfkqvsrama"

	let msg = "hello world";
	let sig_b64 = "G4j29m8WutQfZJaonWuXLoXhlhlPfJzbN/Vmz2hdiAYwFMpvTPZslHaOBaotsFfkN26KpaCF3Az0ooUr6vMbNBg=";
	let mut sig: Vec<u8> = general_purpose::STANDARD.decode(sig_b64).unwrap();
	assert_eq!(sig.len(), 65);
	sig.rotate_left(1);
	assert_eq!(sig[64], 27);
	let pk = ecdsa::recover(msg, sig).unwrap();
    }

For now, it's using eip191 to handle the recover_id.

googolmo added a commit to googolmo/rings-node that referenced this issue May 5, 2023
@googolmo googolmo mentioned this issue May 5, 2023
@googolmo googolmo self-assigned this May 5, 2023
RyanKung pushed a commit that referenced this issue May 6, 2023
* add bip137

#410

* add bip137 verfiy fn

* remove unused num-integer
@RyanKung RyanKung closed this as completed May 9, 2023
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

No branches or pull requests

2 participants