Add IconsClient.getPublic() for reading public icons across accounts#368
Open
lucasrosa90 wants to merge 1 commit into
Open
Add IconsClient.getPublic() for reading public icons across accounts#368lucasrosa90 wants to merge 1 commit into
IconsClient.getPublic() for reading public icons across accounts#368lucasrosa90 wants to merge 1 commit into
Conversation
|
rkeene
reviewed
Jun 11, 2026
| async getPublicContent( | ||
| relativePath: string, | ||
| options?: { ttl?: number } | ||
| ): Promise<{ data: Buffer; mimeType: string } | null> { |
Contributor
Author
There was a problem hiding this comment.
@rkeene It is, but as get was already using this type I just did the same:
async get(relativePath: string): Promise<{ data: Buffer; mimeType: string } | null> {
Contributor
Author
There was a problem hiding this comment.
Agreed Blob is the cleaner type conceptually, but I'd keep { data: Buffer; mimeType } for now:
- It's symmetric with
put()(we write aBuffer, so we read one back) and consistent withIconData/the rest of the storage API. - Consumer needs sync
.toString('base64')for data URLs andBlobforces an extraawait blob.arrayBuffer(). - Changing
get()return is breaking on a published lib.
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.



Adds a way to download a public icon's bytes, including one that belongs to another account, instead of only being able to mint a public URL.
Changes
getPublic()onIconsClientto download a public icon's bytes, including one that belongs to another account. Returns{ data, mimeType }, ornullwhen there's nothing there.getPublicContent()on the session and provider. It mints the public URL, fetches it, and lets the anchor decrypt server-side via/api/public, so the caller never needs the owner's key.get(), not-found and post-delete cases, and cross-account reads (plus a negative test for the owner-pinned policy). Added anAnySignerTestPathPolicyand harness to model the deployed behavior.