-
Notifications
You must be signed in to change notification settings - Fork 175
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
fromSeed not importing correctly #1368
Labels
defect
Suspected defect such as a bug or regression
Comments
This looks to be an issue with rust? Deno.test("curve - from seed", () => {
const fromRust = "SXAIDJ4BO5XTRKA6FZ2PAIWPWAEMS33YHCAAADNECY4YRCM2XXKGAUDBFM"
console.log(fromRust);
const rckp = fromSeed(new TextEncoder().encode(fromRust));
console.log(rckp.getPublicKey());
}) deno test -A --filter "curve - from seed"
curve - from seed ...
------- post-test output -------
SXAIDJ4BO5XTRKA6FZ2PAIWPWAEMS33YHCAAADNECY4YRCM2XXKGAUDBFM
XB34B373UKSFV5FMDSY6RWAV26IEE3J465QF6J4DFNWEUX4UQI2TMLDW
----- post-test output end -----
curve - from seed ... ok (4ms)
ok | 1 passed | 0 failed | 93 filtered out (79ms) Similar code, but this time from the go library: func Test_FromRust(t *testing.T) {
k := "SXAIDJ4BO5XTRKA6FZ2PAIWPWAEMS33YHCAAADNECY4YRCM2XXKGAUDBFM"
t.Log(k)
ck, err := FromCurveSeed([]byte(k))
if err != nil {
t.Fatal(err)
}
cp, err := ck.PublicKey()
if err != nil {
t.Fatal(err)
}
t.Log(cp)
}
} === RUN Test_FromRust
nkeys_test.go:734: SXAIDJ4BO5XTRKA6FZ2PAIWPWAEMS33YHCAAADNECY4YRCM2XXKGAUDBFM
nkeys_test.go:743: XB34B373UKSFV5FMDSY6RWAV26IEE3J465QF6J4DFNWEUX4UQI2TMLDW
--- PASS: Test_FromRust (0.00s)
PASS |
@Jarema - not sure if this creates an encoding issue, but the serialization of the public key in go/javascript match. |
I think this is an issue with https://github.com/wasmCloud/nkeys |
I will dig it bit later, but if you use #[test]
fn roundtrip_encoding_go() {
let kp =
XKey::from_seed("SXAIDJ4BO5XTRKA6FZ2PAIWPWAEMS33YHCAAADNECY4YRCM2XXKGAUDBFM").unwrap();
let pk = "XB34B373UKSFV5FMDSY6RWAV26IEE3J465QF6J4DFNWEUX4UQI2TMLDW";
let seed = kp.seed().unwrap();
let public_key = kp.public_key();
println!("XX Seed: {}", seed);
println!("Public Key:\n{}", public_key);
println!("expected:\n{}", pk);
assert_eq!(public_key, pk);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version were you using?
Possibly a problem for Curve keys only. Trying to import a seed string using fromSeed() does not generate the same public key.
The resultant public key does not match.
What environment was the server running in?
LInux - vscode
Is this defect reproducible?
generate rust key
use resultant key in JS
Given the capability you are leveraging, describe your expectation?
Public keys should match
Given the expectation, what is the defect you are observing?
Public keys don't match
The text was updated successfully, but these errors were encountered: