feat(sdk): add support to path addressed requests in sdk - #546
Open
MCarlomagno wants to merge 8 commits into
Open
feat(sdk): add support to path addressed requests in sdk#546MCarlomagno wants to merge 8 commits into
MCarlomagno wants to merge 8 commits into
Conversation
andrei-21
reviewed
Aug 11, 2026
| @@ -220,39 +221,35 @@ impl PubkyResource { | |||
| /// - Returns [`Error::Request`] if the constructed transport URL is invalid. | |||
| pub fn to_transport_url(&self) -> Result<Url, Error> { | |||
| let rel = self.path.as_str().trim_start_matches('/'); | |||
Contributor
There was a problem hiding this comment.
This line appears in multiple methods. You didn't really touched this code, but would it make sense to encapsulate or make it somehow reusable?.
| /// Render as `https://_pubky.<owner>/<abs-path>` for transport. | ||
| /// Render as `https://_pubky.<owner>/storage/<owner>/<abs-path>` for transport. | ||
| /// | ||
| /// This converts the addressed resource into the actual homeserver URL used |
Contributor
There was a problem hiding this comment.
This comment and the implementation confuse me. By the actual homeserver URL I would expect homeserver's host or something. Maybe I miss something in terminology here?..
Member
Author
There was a problem hiding this comment.
yes right, I didn't notice the confusing wording, I will replace by something like
"/// Converts the resource into its canonical transport URL"
| let rel = self.path.as_str().trim_start_matches('/'); | ||
| let https = format!("https://_pubky.{}/{}", self.owner.z32(), rel); | ||
| let owner = self.owner.z32(); | ||
| let https = format!("https://_pubky.{owner}/storage/{owner}/{rel}"); |
Contributor
There was a problem hiding this comment.
AI claims that session.storage().list("/") will not work anymore, because the server allows to list /pub or /priv. Is it intentional?
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #527.
Summary
Updates the Rust and JavaScript SDKs to use the path-addressed storage routes introduced in #536 and #543:
/storage/{owner}/pub/file.txt/pub/file.txt{owner}path segmentpubky-hostpubky-hostresolve_pubky,resolvePubky, andPubkyResource::to_transport_urlnow produce the path-addressed form.PubkyResource::from_transport_urlaccepts both forms, taking the owner from the path for canonical URLs even when the request uses an explicit homeserver authority.Acceptance criteria
/storage/{owner}/....resolve_pubky,resolvePubky, andto_transport_urlreturn path-addressed URLs.pubky-host.pubky-host.pubky-hostwire shape.