Closed zrus closed 10 months ago
@zrus I am a bit confused because all string representations of public keys are z-base32, I am not sure how did you get "pn5xw633pn5xw633pn5xw633pn5xw633pn5xw633pn5xw633pn5q"?
You can see the code working in this example:
println!("\nResolving pk:{}...\n", keypair);
let reader = PkarrClient::new();
let instant = Instant::now();
let signed_packet = reader
.relay_get(
&Url::parse(DEFAULT_PKARR_RELAY).unwrap(),
"x748s37789udakuuchh793ybk5mnrpdue5uo648idomaw7qqkw5o"
.try_into()
.unwrap(),
)
.await?;
println!("Resolved {:?} \n{}", instant.elapsed(), signed_packet);
In the code above, I use try_into()
to convert the z32
string to a public key.
While I think the code is working as expected, there might be a documentation problem or insufficient examples, or need for a CLI, so please suggest how can I make this better.
That being said, I am mostly focused on making a Rust Mainline implementation at the moment, so these enhancement will have less priority, but I will always be responsive to issues like this.
@zrus I am a bit confused because all string representations of public keys are z-base32, I am not sure how did you get "pn5xw633pn5xw633pn5xw633pn5xw633pn5xw633pn5xw633pn5q"?
Is x748s37789udakuuchh793ybk5mnrpdue5uo648idomaw7qqkw5o
already in z-base32 format? If so, I might have misunderstood. I once again turn x748s37789udakuuchh793ybk5mnrpdue5uo648idomaw7qqkw5o
into z-base32 somewhere in my flow.
Thank you for you quick response.
Brief
When I use
relay_get
with mypublic_key
that I just put. I see in the implementation will useformat_relay_url
to make mypublic_key
to_z32
as zbase32 String. The issue is: When callingrelay_get
with thatpublic_key
the key now is totally different from the key that passed as path of api request in the web demo. And, I can get my record via the web demo using mypublic_key
which didn't beto_z32
ed.E.g: my
public_key
isx748s37789udakuuchh793ybk5mnrpdue5uo648idomaw7qqkw5o
which turned intopn5xw633pn5xw633pn5xw633pn5xw633pn5xw633pn5xw633pn5q
by usingto_z32
.Reality
Your implementation of
relay_get
:Your implementation of
format_relay_url
:My raw test function that demonstrates relay getting flow non-to_z32:
As the web demo, I see in the API calling, it is the non-z32
public_key
as the key I passed to the field:https://relay.pkarr.org/x748s37789udakuuchh793ybk5mnrpdue5uo648idomaw7qqkw5o
Expectation
Work as the web demo.
Suggestion
Remove the
to_z32
when callingformat_relay_url
inrelay_get
.