-
Notifications
You must be signed in to change notification settings - Fork 23
feat: support signed urls #85
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
base: 08-29-refactor_migrate_to_esm_use_pkg-utils_for_build_switch_tests_to_vitest
Are you sure you want to change the base?
feat: support signed urls #85
Conversation
🦋 Changeset detectedLatest commit: 1d5caee The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
15b38f9
to
e023476
Compare
05bed0c
to
e0fdb42
Compare
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
e023476
to
463af15
Compare
e0fdb42
to
d2aec21
Compare
463af15
to
cacea62
Compare
Moving to draft until |
7bac3b9
to
ab747dc
Compare
35b44c3
to
3654954
Compare
3654954
to
d5b6cc8
Compare
f80b5ba
to
826e441
Compare
2cd545d
to
5ab286b
Compare
5ab286b
to
dd6faa1
Compare
Blocked by sanity-io/signed-urls#23 |
dd6faa1
to
1d5caee
Compare
sanity-io/signed-urls#23 merged with an upstream fix, so this one is ready now. 🥳 |
The Media Library introduces the concept of Protected assets, which can only be accessed via an authenticated session or signed URLs. To support Protected assets in user applications, we need to provide tooling to simplify the DX for actually generating signed URLs.
This package currently ships with no dependencies, however we now require some small crypto dependencies to handle generating signatures. As this feature will only be used by a small subset of users, and to avoid adding extraneous dependencies to user bundles, it seemed to make sense to provide an extended image URL builder with some extra signing specific methods at a different export path.
These extra methods are:
expiry
- for defining an expirysigningKey
- for providing a key ID and private keysignedUrl
- for generating a signed URL withexpiry
(optional),keyid
andsignature
params.The extended builder still exposes the
url
method, which will omit any signing specific parameters even if they have been provided.To facilitate this, I refactored the ImageUrlBuilder class slightly to better support extending it.
I’ve also added tests to cover the new functionality.