@backblaze-labs/b2-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +121 -0
- package/LICENSE +21 -0
- package/README.md +664 -0
- package/dist/auth/account-info.d.cts +51 -0
- package/dist/auth/account-info.d.cts.map +1 -0
- package/dist/auth/account-info.d.ts +51 -0
- package/dist/auth/account-info.d.ts.map +1 -0
- package/dist/auth/file.cjs +210 -0
- package/dist/auth/file.cjs.map +1 -0
- package/dist/auth/file.d.cts +157 -0
- package/dist/auth/file.d.cts.map +1 -0
- package/dist/auth/file.d.ts +157 -0
- package/dist/auth/file.d.ts.map +1 -0
- package/dist/auth/file.js +210 -0
- package/dist/auth/file.js.map +1 -0
- package/dist/auth/in-memory.cjs +184 -0
- package/dist/auth/in-memory.cjs.map +1 -0
- package/dist/auth/in-memory.d.cts +147 -0
- package/dist/auth/in-memory.d.cts.map +1 -0
- package/dist/auth/in-memory.d.ts +147 -0
- package/dist/auth/in-memory.d.ts.map +1 -0
- package/dist/auth/in-memory.js +184 -0
- package/dist/auth/in-memory.js.map +1 -0
- package/dist/auth/index.cjs +10 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +6 -0
- package/dist/auth/index.d.cts.map +1 -0
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +10 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/realms.cjs +12 -0
- package/dist/auth/realms.cjs.map +1 -0
- package/dist/auth/realms.d.cts +12 -0
- package/dist/auth/realms.d.cts.map +1 -0
- package/dist/auth/realms.d.ts +12 -0
- package/dist/auth/realms.d.ts.map +1 -0
- package/dist/auth/realms.js +12 -0
- package/dist/auth/realms.js.map +1 -0
- package/dist/auth/upload-url-pool.cjs +52 -0
- package/dist/auth/upload-url-pool.cjs.map +1 -0
- package/dist/auth/upload-url-pool.d.cts +35 -0
- package/dist/auth/upload-url-pool.d.cts.map +1 -0
- package/dist/auth/upload-url-pool.d.ts +35 -0
- package/dist/auth/upload-url-pool.d.ts.map +1 -0
- package/dist/auth/upload-url-pool.js +52 -0
- package/dist/auth/upload-url-pool.js.map +1 -0
- package/dist/bucket.cjs +789 -0
- package/dist/bucket.cjs.map +1 -0
- package/dist/bucket.d.cts +659 -0
- package/dist/bucket.d.cts.map +1 -0
- package/dist/bucket.d.ts +659 -0
- package/dist/bucket.d.ts.map +1 -0
- package/dist/bucket.js +789 -0
- package/dist/bucket.js.map +1 -0
- package/dist/client.cjs +230 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +222 -0
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.ts +222 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +230 -0
- package/dist/client.js.map +1 -0
- package/dist/copy/large.cjs +74 -0
- package/dist/copy/large.cjs.map +1 -0
- package/dist/copy/large.d.cts +53 -0
- package/dist/copy/large.d.cts.map +1 -0
- package/dist/copy/large.d.ts +53 -0
- package/dist/copy/large.d.ts.map +1 -0
- package/dist/copy/large.js +74 -0
- package/dist/copy/large.js.map +1 -0
- package/dist/download/parallel.cjs +122 -0
- package/dist/download/parallel.cjs.map +1 -0
- package/dist/download/parallel.d.cts +42 -0
- package/dist/download/parallel.d.cts.map +1 -0
- package/dist/download/parallel.d.ts +42 -0
- package/dist/download/parallel.d.ts.map +1 -0
- package/dist/download/parallel.js +122 -0
- package/dist/download/parallel.js.map +1 -0
- package/dist/download/single.cjs +117 -0
- package/dist/download/single.cjs.map +1 -0
- package/dist/download/single.d.cts +152 -0
- package/dist/download/single.d.cts.map +1 -0
- package/dist/download/single.d.ts +152 -0
- package/dist/download/single.d.ts.map +1 -0
- package/dist/download/single.js +117 -0
- package/dist/download/single.js.map +1 -0
- package/dist/errors/index.cjs +268 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.cts +264 -0
- package/dist/errors/index.d.cts.map +1 -0
- package/dist/errors/index.d.ts +264 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +268 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/http/retry.cjs +36 -0
- package/dist/http/retry.cjs.map +1 -0
- package/dist/http/retry.d.cts +34 -0
- package/dist/http/retry.d.cts.map +1 -0
- package/dist/http/retry.d.ts +34 -0
- package/dist/http/retry.d.ts.map +1 -0
- package/dist/http/retry.js +36 -0
- package/dist/http/retry.js.map +1 -0
- package/dist/http/transport.cjs +143 -0
- package/dist/http/transport.cjs.map +1 -0
- package/dist/http/transport.d.cts +122 -0
- package/dist/http/transport.d.cts.map +1 -0
- package/dist/http/transport.d.ts +122 -0
- package/dist/http/transport.d.ts.map +1 -0
- package/dist/http/transport.js +143 -0
- package/dist/http/transport.js.map +1 -0
- package/dist/http/url-guard.cjs +97 -0
- package/dist/http/url-guard.cjs.map +1 -0
- package/dist/http/url-guard.d.cts +88 -0
- package/dist/http/url-guard.d.cts.map +1 -0
- package/dist/http/url-guard.d.ts +88 -0
- package/dist/http/url-guard.d.ts.map +1 -0
- package/dist/http/url-guard.js +97 -0
- package/dist/http/url-guard.js.map +1 -0
- package/dist/http/user-agent.cjs +51 -0
- package/dist/http/user-agent.cjs.map +1 -0
- package/dist/http/user-agent.d.cts +28 -0
- package/dist/http/user-agent.d.cts.map +1 -0
- package/dist/http/user-agent.d.ts +28 -0
- package/dist/http/user-agent.d.ts.map +1 -0
- package/dist/http/user-agent.js +51 -0
- package/dist/http/user-agent.js.map +1 -0
- package/dist/index.cjs +78 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +39 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/notifications/index.cjs +7 -0
- package/dist/notifications/index.cjs.map +1 -0
- package/dist/notifications/index.d.cts +3 -0
- package/dist/notifications/index.d.cts.map +1 -0
- package/dist/notifications/index.d.ts +3 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +7 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/webhook.cjs +106 -0
- package/dist/notifications/webhook.cjs.map +1 -0
- package/dist/notifications/webhook.d.cts +146 -0
- package/dist/notifications/webhook.d.cts.map +1 -0
- package/dist/notifications/webhook.d.ts +146 -0
- package/dist/notifications/webhook.d.ts.map +1 -0
- package/dist/notifications/webhook.js +106 -0
- package/dist/notifications/webhook.js.map +1 -0
- package/dist/object.cjs +212 -0
- package/dist/object.cjs.map +1 -0
- package/dist/object.d.cts +263 -0
- package/dist/object.d.cts.map +1 -0
- package/dist/object.d.ts +263 -0
- package/dist/object.d.ts.map +1 -0
- package/dist/object.js +212 -0
- package/dist/object.js.map +1 -0
- package/dist/package.json.cjs +9 -0
- package/dist/package.json.cjs.map +1 -0
- package/dist/package.json.js +9 -0
- package/dist/package.json.js.map +1 -0
- package/dist/raw/encoding.cjs +47 -0
- package/dist/raw/encoding.cjs.map +1 -0
- package/dist/raw/encoding.d.cts +46 -0
- package/dist/raw/encoding.d.cts.map +1 -0
- package/dist/raw/encoding.d.ts +46 -0
- package/dist/raw/encoding.d.ts.map +1 -0
- package/dist/raw/encoding.js +47 -0
- package/dist/raw/encoding.js.map +1 -0
- package/dist/raw/index.cjs +600 -0
- package/dist/raw/index.cjs.map +1 -0
- package/dist/raw/index.d.cts +381 -0
- package/dist/raw/index.d.cts.map +1 -0
- package/dist/raw/index.d.ts +381 -0
- package/dist/raw/index.d.ts.map +1 -0
- package/dist/raw/index.js +601 -0
- package/dist/raw/index.js.map +1 -0
- package/dist/s3/index.cjs +23 -0
- package/dist/s3/index.cjs.map +1 -0
- package/dist/s3/index.d.cts +74 -0
- package/dist/s3/index.d.cts.map +1 -0
- package/dist/s3/index.d.ts +74 -0
- package/dist/s3/index.d.ts.map +1 -0
- package/dist/s3/index.js +23 -0
- package/dist/s3/index.js.map +1 -0
- package/dist/simulator/capabilities.cjs +53 -0
- package/dist/simulator/capabilities.cjs.map +1 -0
- package/dist/simulator/capabilities.d.cts +15 -0
- package/dist/simulator/capabilities.d.cts.map +1 -0
- package/dist/simulator/capabilities.d.ts +15 -0
- package/dist/simulator/capabilities.d.ts.map +1 -0
- package/dist/simulator/capabilities.js +53 -0
- package/dist/simulator/capabilities.js.map +1 -0
- package/dist/simulator/index.cjs +1559 -0
- package/dist/simulator/index.cjs.map +1 -0
- package/dist/simulator/index.d.cts +495 -0
- package/dist/simulator/index.d.cts.map +1 -0
- package/dist/simulator/index.d.ts +495 -0
- package/dist/simulator/index.d.ts.map +1 -0
- package/dist/simulator/index.js +1560 -0
- package/dist/simulator/index.js.map +1 -0
- package/dist/simulator/validation.cjs +174 -0
- package/dist/simulator/validation.cjs.map +1 -0
- package/dist/simulator/validation.d.cts +104 -0
- package/dist/simulator/validation.d.cts.map +1 -0
- package/dist/simulator/validation.d.ts +104 -0
- package/dist/simulator/validation.d.ts.map +1 -0
- package/dist/simulator/validation.js +174 -0
- package/dist/simulator/validation.js.map +1 -0
- package/dist/streams/collect.cjs +26 -0
- package/dist/streams/collect.cjs.map +1 -0
- package/dist/streams/collect.d.cts +18 -0
- package/dist/streams/collect.d.cts.map +1 -0
- package/dist/streams/collect.d.ts +18 -0
- package/dist/streams/collect.d.ts.map +1 -0
- package/dist/streams/collect.js +26 -0
- package/dist/streams/collect.js.map +1 -0
- package/dist/streams/hash.cjs +123 -0
- package/dist/streams/hash.cjs.map +1 -0
- package/dist/streams/hash.d.cts +42 -0
- package/dist/streams/hash.d.cts.map +1 -0
- package/dist/streams/hash.d.ts +42 -0
- package/dist/streams/hash.d.ts.map +1 -0
- package/dist/streams/hash.js +101 -0
- package/dist/streams/hash.js.map +1 -0
- package/dist/streams/index.cjs +13 -0
- package/dist/streams/index.cjs.map +1 -0
- package/dist/streams/index.d.cts +7 -0
- package/dist/streams/index.d.cts.map +1 -0
- package/dist/streams/index.d.ts +7 -0
- package/dist/streams/index.d.ts.map +1 -0
- package/dist/streams/index.js +13 -0
- package/dist/streams/index.js.map +1 -0
- package/dist/streams/progress.cjs +47 -0
- package/dist/streams/progress.cjs.map +1 -0
- package/dist/streams/progress.d.cts +53 -0
- package/dist/streams/progress.d.cts.map +1 -0
- package/dist/streams/progress.d.ts +53 -0
- package/dist/streams/progress.d.ts.map +1 -0
- package/dist/streams/progress.js +47 -0
- package/dist/streams/progress.js.map +1 -0
- package/dist/streams/source.cjs +155 -0
- package/dist/streams/source.cjs.map +1 -0
- package/dist/streams/source.d.cts +140 -0
- package/dist/streams/source.d.cts.map +1 -0
- package/dist/streams/source.d.ts +140 -0
- package/dist/streams/source.d.ts.map +1 -0
- package/dist/streams/source.js +155 -0
- package/dist/streams/source.js.map +1 -0
- package/dist/sync/actions/index.cjs +191 -0
- package/dist/sync/actions/index.cjs.map +1 -0
- package/dist/sync/actions/index.d.cts +167 -0
- package/dist/sync/actions/index.d.cts.map +1 -0
- package/dist/sync/actions/index.d.ts +167 -0
- package/dist/sync/actions/index.d.ts.map +1 -0
- package/dist/sync/actions/index.js +191 -0
- package/dist/sync/actions/index.js.map +1 -0
- package/dist/sync/index.cjs +23 -0
- package/dist/sync/index.cjs.map +1 -0
- package/dist/sync/index.d.cts +21 -0
- package/dist/sync/index.d.cts.map +1 -0
- package/dist/sync/index.d.ts +21 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +23 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/pairing.cjs +31 -0
- package/dist/sync/pairing.cjs.map +1 -0
- package/dist/sync/pairing.d.cts +13 -0
- package/dist/sync/pairing.d.cts.map +1 -0
- package/dist/sync/pairing.d.ts +13 -0
- package/dist/sync/pairing.d.ts.map +1 -0
- package/dist/sync/pairing.js +31 -0
- package/dist/sync/pairing.js.map +1 -0
- package/dist/sync/policies/compare.cjs +14 -0
- package/dist/sync/policies/compare.cjs.map +1 -0
- package/dist/sync/policies/compare.d.cts +13 -0
- package/dist/sync/policies/compare.d.cts.map +1 -0
- package/dist/sync/policies/compare.d.ts +13 -0
- package/dist/sync/policies/compare.d.ts.map +1 -0
- package/dist/sync/policies/compare.js +14 -0
- package/dist/sync/policies/compare.js.map +1 -0
- package/dist/sync/policies/index.cjs +74 -0
- package/dist/sync/policies/index.cjs.map +1 -0
- package/dist/sync/policies/index.d.cts +42 -0
- package/dist/sync/policies/index.d.cts.map +1 -0
- package/dist/sync/policies/index.d.ts +42 -0
- package/dist/sync/policies/index.d.ts.map +1 -0
- package/dist/sync/policies/index.js +74 -0
- package/dist/sync/policies/index.js.map +1 -0
- package/dist/sync/scanners/b2.cjs +57 -0
- package/dist/sync/scanners/b2.cjs.map +1 -0
- package/dist/sync/scanners/b2.d.cts +20 -0
- package/dist/sync/scanners/b2.d.cts.map +1 -0
- package/dist/sync/scanners/b2.d.ts +20 -0
- package/dist/sync/scanners/b2.d.ts.map +1 -0
- package/dist/sync/scanners/b2.js +57 -0
- package/dist/sync/scanners/b2.js.map +1 -0
- package/dist/sync/scanners/local.cjs +58 -0
- package/dist/sync/scanners/local.cjs.map +1 -0
- package/dist/sync/scanners/local.d.cts +24 -0
- package/dist/sync/scanners/local.d.cts.map +1 -0
- package/dist/sync/scanners/local.d.ts +24 -0
- package/dist/sync/scanners/local.d.ts.map +1 -0
- package/dist/sync/scanners/local.js +58 -0
- package/dist/sync/scanners/local.js.map +1 -0
- package/dist/sync/synchronizer.cjs +203 -0
- package/dist/sync/synchronizer.cjs.map +1 -0
- package/dist/sync/synchronizer.d.cts +52 -0
- package/dist/sync/synchronizer.d.cts.map +1 -0
- package/dist/sync/synchronizer.d.ts +52 -0
- package/dist/sync/synchronizer.d.ts.map +1 -0
- package/dist/sync/synchronizer.js +181 -0
- package/dist/sync/synchronizer.js.map +1 -0
- package/dist/sync/types.d.cts +121 -0
- package/dist/sync/types.d.cts.map +1 -0
- package/dist/sync/types.d.ts +121 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/types/auth.cjs +58 -0
- package/dist/types/auth.cjs.map +1 -0
- package/dist/types/auth.d.cts +150 -0
- package/dist/types/auth.d.cts.map +1 -0
- package/dist/types/auth.d.ts +150 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +58 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/bucket.cjs +44 -0
- package/dist/types/bucket.cjs.map +1 -0
- package/dist/types/bucket.d.cts +245 -0
- package/dist/types/bucket.d.cts.map +1 -0
- package/dist/types/bucket.d.ts +245 -0
- package/dist/types/bucket.d.ts.map +1 -0
- package/dist/types/bucket.js +44 -0
- package/dist/types/bucket.js.map +1 -0
- package/dist/types/download.d.cts +110 -0
- package/dist/types/download.d.cts.map +1 -0
- package/dist/types/download.d.ts +110 -0
- package/dist/types/download.d.ts.map +1 -0
- package/dist/types/encryption.cjs +343 -0
- package/dist/types/encryption.cjs.map +1 -0
- package/dist/types/encryption.d.cts +132 -0
- package/dist/types/encryption.d.cts.map +1 -0
- package/dist/types/encryption.d.ts +132 -0
- package/dist/types/encryption.d.ts.map +1 -0
- package/dist/types/encryption.js +321 -0
- package/dist/types/encryption.js.map +1 -0
- package/dist/types/errors.d.cts +16 -0
- package/dist/types/errors.d.cts.map +1 -0
- package/dist/types/errors.d.ts +16 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/file.cjs +23 -0
- package/dist/types/file.cjs.map +1 -0
- package/dist/types/file.d.cts +220 -0
- package/dist/types/file.d.cts.map +1 -0
- package/dist/types/file.d.ts +220 -0
- package/dist/types/file.d.ts.map +1 -0
- package/dist/types/file.js +23 -0
- package/dist/types/file.js.map +1 -0
- package/dist/types/ids.cjs +27 -0
- package/dist/types/ids.cjs.map +1 -0
- package/dist/types/ids.d.cts +84 -0
- package/dist/types/ids.d.cts.map +1 -0
- package/dist/types/ids.d.ts +84 -0
- package/dist/types/ids.d.ts.map +1 -0
- package/dist/types/ids.js +27 -0
- package/dist/types/ids.js.map +1 -0
- package/dist/types/index.d.cts +25 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/key.d.cts +84 -0
- package/dist/types/key.d.cts.map +1 -0
- package/dist/types/key.d.ts +84 -0
- package/dist/types/key.d.ts.map +1 -0
- package/dist/types/lock.cjs +17 -0
- package/dist/types/lock.cjs.map +1 -0
- package/dist/types/lock.d.cts +92 -0
- package/dist/types/lock.d.cts.map +1 -0
- package/dist/types/lock.d.ts +92 -0
- package/dist/types/lock.d.ts.map +1 -0
- package/dist/types/lock.js +17 -0
- package/dist/types/lock.js.map +1 -0
- package/dist/types/notifications.cjs +24 -0
- package/dist/types/notifications.cjs.map +1 -0
- package/dist/types/notifications.d.cts +97 -0
- package/dist/types/notifications.d.cts.map +1 -0
- package/dist/types/notifications.d.ts +97 -0
- package/dist/types/notifications.d.ts.map +1 -0
- package/dist/types/notifications.js +24 -0
- package/dist/types/notifications.js.map +1 -0
- package/dist/types/replication.d.cts +42 -0
- package/dist/types/replication.d.cts.map +1 -0
- package/dist/types/replication.d.ts +42 -0
- package/dist/types/replication.d.ts.map +1 -0
- package/dist/types/upload.d.cts +219 -0
- package/dist/types/upload.d.cts.map +1 -0
- package/dist/types/upload.d.ts +219 -0
- package/dist/types/upload.d.ts.map +1 -0
- package/dist/upload/cancel.cjs +10 -0
- package/dist/upload/cancel.cjs.map +1 -0
- package/dist/upload/cancel.d.cts +23 -0
- package/dist/upload/cancel.d.cts.map +1 -0
- package/dist/upload/cancel.d.ts +23 -0
- package/dist/upload/cancel.d.ts.map +1 -0
- package/dist/upload/cancel.js +10 -0
- package/dist/upload/cancel.js.map +1 -0
- package/dist/upload/concurrency.cjs +54 -0
- package/dist/upload/concurrency.cjs.map +1 -0
- package/dist/upload/concurrency.d.cts +46 -0
- package/dist/upload/concurrency.d.cts.map +1 -0
- package/dist/upload/concurrency.d.ts +46 -0
- package/dist/upload/concurrency.d.ts.map +1 -0
- package/dist/upload/concurrency.js +54 -0
- package/dist/upload/concurrency.js.map +1 -0
- package/dist/upload/large.cjs +222 -0
- package/dist/upload/large.cjs.map +1 -0
- package/dist/upload/large.d.cts +71 -0
- package/dist/upload/large.d.cts.map +1 -0
- package/dist/upload/large.d.ts +71 -0
- package/dist/upload/large.d.ts.map +1 -0
- package/dist/upload/large.js +222 -0
- package/dist/upload/large.js.map +1 -0
- package/dist/upload/resume.cjs +34 -0
- package/dist/upload/resume.cjs.map +1 -0
- package/dist/upload/resume.d.cts +33 -0
- package/dist/upload/resume.d.cts.map +1 -0
- package/dist/upload/resume.d.ts +33 -0
- package/dist/upload/resume.d.ts.map +1 -0
- package/dist/upload/resume.js +34 -0
- package/dist/upload/resume.js.map +1 -0
- package/dist/upload/single.cjs +47 -0
- package/dist/upload/single.cjs.map +1 -0
- package/dist/upload/single.d.cts +51 -0
- package/dist/upload/single.d.cts.map +1 -0
- package/dist/upload/single.d.ts +51 -0
- package/dist/upload/single.d.ts.map +1 -0
- package/dist/upload/single.js +47 -0
- package/dist/upload/single.js.map +1 -0
- package/dist/upload/stream.cjs +198 -0
- package/dist/upload/stream.cjs.map +1 -0
- package/dist/upload/stream.d.cts +61 -0
- package/dist/upload/stream.d.cts.map +1 -0
- package/dist/upload/stream.d.ts +61 -0
- package/dist/upload/stream.d.ts.map +1 -0
- package/dist/upload/stream.js +198 -0
- package/dist/upload/stream.js.map +1 -0
- package/dist/util/best-effort.cjs +10 -0
- package/dist/util/best-effort.cjs.map +1 -0
- package/dist/util/best-effort.d.cts +31 -0
- package/dist/util/best-effort.d.cts.map +1 -0
- package/dist/util/best-effort.d.ts +31 -0
- package/dist/util/best-effort.d.ts.map +1 -0
- package/dist/util/best-effort.js +10 -0
- package/dist/util/best-effort.js.map +1 -0
- package/dist/util/defaults.cjs +11 -0
- package/dist/util/defaults.cjs.map +1 -0
- package/dist/util/defaults.d.cts +54 -0
- package/dist/util/defaults.d.cts.map +1 -0
- package/dist/util/defaults.d.ts +54 -0
- package/dist/util/defaults.d.ts.map +1 -0
- package/dist/util/defaults.js +11 -0
- package/dist/util/defaults.js.map +1 -0
- package/dist/util/normalize.cjs +16 -0
- package/dist/util/normalize.cjs.map +1 -0
- package/dist/util/normalize.d.cts +62 -0
- package/dist/util/normalize.d.cts.map +1 -0
- package/dist/util/normalize.d.ts +62 -0
- package/dist/util/normalize.d.ts.map +1 -0
- package/dist/util/normalize.js +16 -0
- package/dist/util/normalize.js.map +1 -0
- package/dist/util/paginator.cjs +20 -0
- package/dist/util/paginator.cjs.map +1 -0
- package/dist/util/paginator.d.cts +120 -0
- package/dist/util/paginator.d.cts.map +1 -0
- package/dist/util/paginator.d.ts +120 -0
- package/dist/util/paginator.d.ts.map +1 -0
- package/dist/util/paginator.js +20 -0
- package/dist/util/paginator.js.map +1 -0
- package/dist/util/plan-ranges.cjs +28 -0
- package/dist/util/plan-ranges.cjs.map +1 -0
- package/dist/util/plan-ranges.d.cts +56 -0
- package/dist/util/plan-ranges.d.cts.map +1 -0
- package/dist/util/plan-ranges.d.ts +56 -0
- package/dist/util/plan-ranges.d.ts.map +1 -0
- package/dist/util/plan-ranges.js +28 -0
- package/dist/util/plan-ranges.js.map +1 -0
- package/dist/util/text-codec.cjs +7 -0
- package/dist/util/text-codec.cjs.map +1 -0
- package/dist/util/text-codec.d.cts +26 -0
- package/dist/util/text-codec.d.cts.map +1 -0
- package/dist/util/text-codec.d.ts +26 -0
- package/dist/util/text-codec.d.ts.map +1 -0
- package/dist/util/text-codec.js +7 -0
- package/dist/util/text-codec.js.map +1 -0
- package/dist/util/to-error.cjs +7 -0
- package/dist/util/to-error.cjs.map +1 -0
- package/dist/util/to-error.d.cts +15 -0
- package/dist/util/to-error.d.cts.map +1 -0
- package/dist/util/to-error.d.ts +15 -0
- package/dist/util/to-error.d.ts.map +1 -0
- package/dist/util/to-error.js +7 -0
- package/dist/util/to-error.js.map +1 -0
- package/dist/version.cjs +6 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.d.cts +14 -0
- package/dist/version.d.cts.map +1 -0
- package/dist/version.d.ts +14 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +198 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/** Named constants for the supported server-side encryption algorithms. */
|
|
2
|
+
export declare const EncryptionAlgorithm: {
|
|
3
|
+
/** AES with a 256-bit key. The only algorithm B2 currently supports. */
|
|
4
|
+
readonly Aes256: "AES256";
|
|
5
|
+
};
|
|
6
|
+
/** Supported server-side encryption algorithm. Derived from {@link EncryptionAlgorithm}. */
|
|
7
|
+
export type EncryptionAlgorithm = (typeof EncryptionAlgorithm)[keyof typeof EncryptionAlgorithm];
|
|
8
|
+
/**
|
|
9
|
+
* Named constants for the server-side encryption mode used by a file.
|
|
10
|
+
*
|
|
11
|
+
* Most callers should use the {@link SSE_B2}, {@link SSE_NONE}, and
|
|
12
|
+
* {@link sseCustomer} helpers below which return complete
|
|
13
|
+
* {@link EncryptionSetting} objects. These constants are useful when you
|
|
14
|
+
* need the bare mode discriminator (e.g., when introspecting a file's
|
|
15
|
+
* current encryption setting).
|
|
16
|
+
*/
|
|
17
|
+
export declare const EncryptionMode: {
|
|
18
|
+
/** B2-managed encryption keys. */
|
|
19
|
+
readonly SseB2: "SSE-B2";
|
|
20
|
+
/** Customer-provided encryption keys. */
|
|
21
|
+
readonly SseC: "SSE-C";
|
|
22
|
+
/** No encryption. */
|
|
23
|
+
readonly None: "none";
|
|
24
|
+
};
|
|
25
|
+
/** Server-side encryption mode for files stored in B2. Derived from {@link EncryptionMode}. */
|
|
26
|
+
export type EncryptionMode = (typeof EncryptionMode)[keyof typeof EncryptionMode];
|
|
27
|
+
/** Server-side encryption using B2-managed keys (SSE-B2). */
|
|
28
|
+
export interface SseB2Setting {
|
|
29
|
+
/** Encryption mode discriminator. Always `'SSE-B2'`. */
|
|
30
|
+
readonly mode: 'SSE-B2';
|
|
31
|
+
/** Encryption algorithm. Always `'AES256'`. */
|
|
32
|
+
readonly algorithm: EncryptionAlgorithm;
|
|
33
|
+
}
|
|
34
|
+
/** Server-side encryption using customer-provided keys (SSE-C). */
|
|
35
|
+
export interface SseCCustomerSetting {
|
|
36
|
+
/** Encryption mode discriminator. Always `'SSE-C'`. */
|
|
37
|
+
readonly mode: 'SSE-C';
|
|
38
|
+
/** Encryption algorithm. Always `'AES256'`. */
|
|
39
|
+
readonly algorithm: EncryptionAlgorithm;
|
|
40
|
+
/** Base64-encoded 256-bit encryption key provided by the customer. */
|
|
41
|
+
readonly customerKey: string;
|
|
42
|
+
/** Base64-encoded MD5 digest of the customer-provided key, used for integrity verification. */
|
|
43
|
+
readonly customerKeyMd5: string;
|
|
44
|
+
}
|
|
45
|
+
/** Indicates no server-side encryption is applied. */
|
|
46
|
+
export interface NoEncryption {
|
|
47
|
+
/** Encryption mode discriminator. Always `'none'`. */
|
|
48
|
+
readonly mode: 'none';
|
|
49
|
+
}
|
|
50
|
+
/** Union of all server-side encryption settings: B2-managed, customer-provided, or none. */
|
|
51
|
+
export type EncryptionSetting = SseB2Setting | SseCCustomerSetting | NoEncryption;
|
|
52
|
+
/** Pre-built SSE-B2 encryption setting using AES-256. */
|
|
53
|
+
export declare const SSE_B2: SseB2Setting;
|
|
54
|
+
/** Pre-built setting indicating no server-side encryption. */
|
|
55
|
+
export declare const SSE_NONE: NoEncryption;
|
|
56
|
+
/**
|
|
57
|
+
* Creates an SSE-C encryption setting with a customer-provided key.
|
|
58
|
+
* @param customerKey - Base64-encoded 256-bit encryption key.
|
|
59
|
+
* @param customerKeyMd5 - Base64-encoded MD5 digest of the key.
|
|
60
|
+
*
|
|
61
|
+
* @returns An SSE-C encryption setting ready to pass to upload or download calls.
|
|
62
|
+
*/
|
|
63
|
+
export declare function sseCustomer(customerKey: string, customerKeyMd5: string): SseCCustomerSetting;
|
|
64
|
+
/**
|
|
65
|
+
* Safe wrapper around an SSE-C customer key. Hides the key bytes from
|
|
66
|
+
* `JSON.stringify`, `console.log`, and Node's `util.inspect`. Use {@link EncryptionKey.fromBytes}
|
|
67
|
+
* to construct one from a raw 32-byte key; the MD5 digest is computed internally.
|
|
68
|
+
*/
|
|
69
|
+
export declare class EncryptionKey {
|
|
70
|
+
/** Encryption mode discriminant. Always `'SSE-C'` for this class. */
|
|
71
|
+
readonly mode: "SSE-C";
|
|
72
|
+
/** Encryption algorithm. B2's S3-compatible API only supports AES-256. */
|
|
73
|
+
readonly algorithm: EncryptionAlgorithm;
|
|
74
|
+
/** Base64-encoded 256-bit customer key. Logged as `[redacted SSE-C key]` via `toJSON` / `toString`. */
|
|
75
|
+
readonly customerKey: string;
|
|
76
|
+
/** Base64-encoded MD5 digest of the customer key. Required by B2 for integrity verification. */
|
|
77
|
+
readonly customerKeyMd5: string;
|
|
78
|
+
/**
|
|
79
|
+
* Internal constructor. Use {@link EncryptionKey.fromBytes} or
|
|
80
|
+
* {@link EncryptionKey.fromBase64} instead.
|
|
81
|
+
*
|
|
82
|
+
* @param customerKey - Base64-encoded 256-bit encryption key.
|
|
83
|
+
* @param customerKeyMd5 - Base64-encoded MD5 digest of the key.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
private constructor();
|
|
88
|
+
/**
|
|
89
|
+
* Builds an EncryptionKey from a raw 32-byte (256-bit) key. Computes the
|
|
90
|
+
* required base64 MD5 digest internally.
|
|
91
|
+
*
|
|
92
|
+
* @param rawKey - The raw 256-bit key as bytes. Must be exactly 32 bytes.
|
|
93
|
+
*
|
|
94
|
+
* @returns A safely-wrapped EncryptionKey ready for upload/download.
|
|
95
|
+
*
|
|
96
|
+
* @throws If the key is not exactly 32 bytes.
|
|
97
|
+
*/
|
|
98
|
+
static fromBytes(rawKey: Uint8Array): Promise<EncryptionKey>;
|
|
99
|
+
/**
|
|
100
|
+
* Builds an EncryptionKey from precomputed base64 strings. Use this in
|
|
101
|
+
* environments where MD5 must be computed externally (e.g., browsers).
|
|
102
|
+
*
|
|
103
|
+
* @param customerKey - Base64-encoded 256-bit encryption key.
|
|
104
|
+
* @param customerKeyMd5 - Base64-encoded MD5 digest of the key.
|
|
105
|
+
*
|
|
106
|
+
* @returns A safely-wrapped EncryptionKey ready for upload/download.
|
|
107
|
+
*/
|
|
108
|
+
static fromBase64(customerKey: string, customerKeyMd5: string): EncryptionKey;
|
|
109
|
+
/**
|
|
110
|
+
* Hides the key bytes from `JSON.stringify`.
|
|
111
|
+
*
|
|
112
|
+
* @returns A redacted shape: same mode and algorithm, but the key and MD5
|
|
113
|
+
* replaced with a placeholder string.
|
|
114
|
+
*/
|
|
115
|
+
toJSON(): {
|
|
116
|
+
/** Encryption mode discriminant. */
|
|
117
|
+
mode: 'SSE-C';
|
|
118
|
+
/** Encryption algorithm. */
|
|
119
|
+
algorithm: EncryptionAlgorithm;
|
|
120
|
+
/** Always the literal redaction placeholder; the real key never leaves the instance. */
|
|
121
|
+
customerKey: string;
|
|
122
|
+
/** Always the literal redaction placeholder; the real MD5 never leaves the instance. */
|
|
123
|
+
customerKeyMd5: string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Hides the key bytes from default `toString()`.
|
|
127
|
+
*
|
|
128
|
+
* @returns A short opaque label indicating this is an SSE-C key.
|
|
129
|
+
*/
|
|
130
|
+
toString(): string;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/types/encryption.js"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB;IAC9B,wEAAwE;;CAEhE,CAAA;AAEV,4FAA4F;AAC5F,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAA;AAEhG;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc;IACzB,kCAAkC;;IAElC,yCAAyC;;IAEzC,qBAAqB;;CAEb,CAAA;AAEV,+FAA+F;AA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B;;;;;;;;OAQG;IACH,OAAO;IAKP;;;;;;;;;OASG;WACU,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IASlE;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,aAAa;IAI7E;;;;;OAKG;IACH,MAAM,IAAI;QACR,oCAAoC;QACpC,IAAI,EAAE,OAAO,CAAA;QACb,4BAA4B;QAC5B,SAAS,EAAE,mBAAmB,CAAA;QAC9B,wFAAwF;QACxF,WAAW,EAAE,MAAM,CAAA;QACnB,wFAAwF;QACxF,cAAc,EAAE,MAAM,CAAA;KACvB;IASD;;;;OAIG;IACH,QAAQ,IAAI,MAAM;CAYnB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/** Named constants for the supported server-side encryption algorithms. */
|
|
2
|
+
export declare const EncryptionAlgorithm: {
|
|
3
|
+
/** AES with a 256-bit key. The only algorithm B2 currently supports. */
|
|
4
|
+
readonly Aes256: "AES256";
|
|
5
|
+
};
|
|
6
|
+
/** Supported server-side encryption algorithm. Derived from {@link EncryptionAlgorithm}. */
|
|
7
|
+
export type EncryptionAlgorithm = (typeof EncryptionAlgorithm)[keyof typeof EncryptionAlgorithm];
|
|
8
|
+
/**
|
|
9
|
+
* Named constants for the server-side encryption mode used by a file.
|
|
10
|
+
*
|
|
11
|
+
* Most callers should use the {@link SSE_B2}, {@link SSE_NONE}, and
|
|
12
|
+
* {@link sseCustomer} helpers below which return complete
|
|
13
|
+
* {@link EncryptionSetting} objects. These constants are useful when you
|
|
14
|
+
* need the bare mode discriminator (e.g., when introspecting a file's
|
|
15
|
+
* current encryption setting).
|
|
16
|
+
*/
|
|
17
|
+
export declare const EncryptionMode: {
|
|
18
|
+
/** B2-managed encryption keys. */
|
|
19
|
+
readonly SseB2: "SSE-B2";
|
|
20
|
+
/** Customer-provided encryption keys. */
|
|
21
|
+
readonly SseC: "SSE-C";
|
|
22
|
+
/** No encryption. */
|
|
23
|
+
readonly None: "none";
|
|
24
|
+
};
|
|
25
|
+
/** Server-side encryption mode for files stored in B2. Derived from {@link EncryptionMode}. */
|
|
26
|
+
export type EncryptionMode = (typeof EncryptionMode)[keyof typeof EncryptionMode];
|
|
27
|
+
/** Server-side encryption using B2-managed keys (SSE-B2). */
|
|
28
|
+
export interface SseB2Setting {
|
|
29
|
+
/** Encryption mode discriminator. Always `'SSE-B2'`. */
|
|
30
|
+
readonly mode: 'SSE-B2';
|
|
31
|
+
/** Encryption algorithm. Always `'AES256'`. */
|
|
32
|
+
readonly algorithm: EncryptionAlgorithm;
|
|
33
|
+
}
|
|
34
|
+
/** Server-side encryption using customer-provided keys (SSE-C). */
|
|
35
|
+
export interface SseCCustomerSetting {
|
|
36
|
+
/** Encryption mode discriminator. Always `'SSE-C'`. */
|
|
37
|
+
readonly mode: 'SSE-C';
|
|
38
|
+
/** Encryption algorithm. Always `'AES256'`. */
|
|
39
|
+
readonly algorithm: EncryptionAlgorithm;
|
|
40
|
+
/** Base64-encoded 256-bit encryption key provided by the customer. */
|
|
41
|
+
readonly customerKey: string;
|
|
42
|
+
/** Base64-encoded MD5 digest of the customer-provided key, used for integrity verification. */
|
|
43
|
+
readonly customerKeyMd5: string;
|
|
44
|
+
}
|
|
45
|
+
/** Indicates no server-side encryption is applied. */
|
|
46
|
+
export interface NoEncryption {
|
|
47
|
+
/** Encryption mode discriminator. Always `'none'`. */
|
|
48
|
+
readonly mode: 'none';
|
|
49
|
+
}
|
|
50
|
+
/** Union of all server-side encryption settings: B2-managed, customer-provided, or none. */
|
|
51
|
+
export type EncryptionSetting = SseB2Setting | SseCCustomerSetting | NoEncryption;
|
|
52
|
+
/** Pre-built SSE-B2 encryption setting using AES-256. */
|
|
53
|
+
export declare const SSE_B2: SseB2Setting;
|
|
54
|
+
/** Pre-built setting indicating no server-side encryption. */
|
|
55
|
+
export declare const SSE_NONE: NoEncryption;
|
|
56
|
+
/**
|
|
57
|
+
* Creates an SSE-C encryption setting with a customer-provided key.
|
|
58
|
+
* @param customerKey - Base64-encoded 256-bit encryption key.
|
|
59
|
+
* @param customerKeyMd5 - Base64-encoded MD5 digest of the key.
|
|
60
|
+
*
|
|
61
|
+
* @returns An SSE-C encryption setting ready to pass to upload or download calls.
|
|
62
|
+
*/
|
|
63
|
+
export declare function sseCustomer(customerKey: string, customerKeyMd5: string): SseCCustomerSetting;
|
|
64
|
+
/**
|
|
65
|
+
* Safe wrapper around an SSE-C customer key. Hides the key bytes from
|
|
66
|
+
* `JSON.stringify`, `console.log`, and Node's `util.inspect`. Use {@link EncryptionKey.fromBytes}
|
|
67
|
+
* to construct one from a raw 32-byte key; the MD5 digest is computed internally.
|
|
68
|
+
*/
|
|
69
|
+
export declare class EncryptionKey {
|
|
70
|
+
/** Encryption mode discriminant. Always `'SSE-C'` for this class. */
|
|
71
|
+
readonly mode: "SSE-C";
|
|
72
|
+
/** Encryption algorithm. B2's S3-compatible API only supports AES-256. */
|
|
73
|
+
readonly algorithm: EncryptionAlgorithm;
|
|
74
|
+
/** Base64-encoded 256-bit customer key. Logged as `[redacted SSE-C key]` via `toJSON` / `toString`. */
|
|
75
|
+
readonly customerKey: string;
|
|
76
|
+
/** Base64-encoded MD5 digest of the customer key. Required by B2 for integrity verification. */
|
|
77
|
+
readonly customerKeyMd5: string;
|
|
78
|
+
/**
|
|
79
|
+
* Internal constructor. Use {@link EncryptionKey.fromBytes} or
|
|
80
|
+
* {@link EncryptionKey.fromBase64} instead.
|
|
81
|
+
*
|
|
82
|
+
* @param customerKey - Base64-encoded 256-bit encryption key.
|
|
83
|
+
* @param customerKeyMd5 - Base64-encoded MD5 digest of the key.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
private constructor();
|
|
88
|
+
/**
|
|
89
|
+
* Builds an EncryptionKey from a raw 32-byte (256-bit) key. Computes the
|
|
90
|
+
* required base64 MD5 digest internally.
|
|
91
|
+
*
|
|
92
|
+
* @param rawKey - The raw 256-bit key as bytes. Must be exactly 32 bytes.
|
|
93
|
+
*
|
|
94
|
+
* @returns A safely-wrapped EncryptionKey ready for upload/download.
|
|
95
|
+
*
|
|
96
|
+
* @throws If the key is not exactly 32 bytes.
|
|
97
|
+
*/
|
|
98
|
+
static fromBytes(rawKey: Uint8Array): Promise<EncryptionKey>;
|
|
99
|
+
/**
|
|
100
|
+
* Builds an EncryptionKey from precomputed base64 strings. Use this in
|
|
101
|
+
* environments where MD5 must be computed externally (e.g., browsers).
|
|
102
|
+
*
|
|
103
|
+
* @param customerKey - Base64-encoded 256-bit encryption key.
|
|
104
|
+
* @param customerKeyMd5 - Base64-encoded MD5 digest of the key.
|
|
105
|
+
*
|
|
106
|
+
* @returns A safely-wrapped EncryptionKey ready for upload/download.
|
|
107
|
+
*/
|
|
108
|
+
static fromBase64(customerKey: string, customerKeyMd5: string): EncryptionKey;
|
|
109
|
+
/**
|
|
110
|
+
* Hides the key bytes from `JSON.stringify`.
|
|
111
|
+
*
|
|
112
|
+
* @returns A redacted shape: same mode and algorithm, but the key and MD5
|
|
113
|
+
* replaced with a placeholder string.
|
|
114
|
+
*/
|
|
115
|
+
toJSON(): {
|
|
116
|
+
/** Encryption mode discriminant. */
|
|
117
|
+
mode: 'SSE-C';
|
|
118
|
+
/** Encryption algorithm. */
|
|
119
|
+
algorithm: EncryptionAlgorithm;
|
|
120
|
+
/** Always the literal redaction placeholder; the real key never leaves the instance. */
|
|
121
|
+
customerKey: string;
|
|
122
|
+
/** Always the literal redaction placeholder; the real MD5 never leaves the instance. */
|
|
123
|
+
customerKeyMd5: string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Hides the key bytes from default `toString()`.
|
|
127
|
+
*
|
|
128
|
+
* @returns A short opaque label indicating this is an SSE-C key.
|
|
129
|
+
*/
|
|
130
|
+
toString(): string;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -0,0 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AA+B,CAAA;AAEtD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,mBAAmB,CAE5F;AAuJD;;;;GAIG;AACH,qBAAa,aAAa;IACxB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAG,OAAO,CAAS;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAW;IAClD,uGAAuG;IACvG,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,gGAAgG;IAChG,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAE/B;;;;;;;;OAQG;IACH,OAAO;IAKP;;;;;;;;;OASG;WACU,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IASlE;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,aAAa;IAI7E;;;;;OAKG;IACH,MAAM,IAAI;QACR,oCAAoC;QACpC,IAAI,EAAE,OAAO,CAAA;QACb,4BAA4B;QAC5B,SAAS,EAAE,mBAAmB,CAAA;QAC9B,wFAAwF;QACxF,WAAW,EAAE,MAAM,CAAA;QACnB,wFAAwF;QACxF,cAAc,EAAE,MAAM,CAAA;KACvB;IASD;;;;OAIG;IACH,QAAQ,IAAI,MAAM;CAYnB"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
const EncryptionAlgorithm = {
|
|
2
|
+
/** AES with a 256-bit key. The only algorithm B2 currently supports. */
|
|
3
|
+
Aes256: "AES256"
|
|
4
|
+
};
|
|
5
|
+
const EncryptionMode = {
|
|
6
|
+
/** B2-managed encryption keys. */
|
|
7
|
+
SseB2: "SSE-B2",
|
|
8
|
+
/** Customer-provided encryption keys. */
|
|
9
|
+
SseC: "SSE-C",
|
|
10
|
+
/** No encryption. */
|
|
11
|
+
None: "none"
|
|
12
|
+
};
|
|
13
|
+
const SSE_B2 = { mode: "SSE-B2", algorithm: "AES256" };
|
|
14
|
+
const SSE_NONE = { mode: "none" };
|
|
15
|
+
function sseCustomer(customerKey, customerKeyMd5) {
|
|
16
|
+
return { mode: "SSE-C", algorithm: "AES256", customerKey, customerKeyMd5 };
|
|
17
|
+
}
|
|
18
|
+
function bytesToBase64(bytes) {
|
|
19
|
+
const g = globalThis;
|
|
20
|
+
if (g.Buffer) {
|
|
21
|
+
return g.Buffer.from(bytes).toString("base64");
|
|
22
|
+
}
|
|
23
|
+
let binary = "";
|
|
24
|
+
for (const b of bytes) binary += String.fromCharCode(b);
|
|
25
|
+
return btoa(binary);
|
|
26
|
+
}
|
|
27
|
+
async function md5Base64(bytes) {
|
|
28
|
+
try {
|
|
29
|
+
const { createHash } = await import("node:crypto");
|
|
30
|
+
if (typeof createHash !== "function") throw new Error("createHash unavailable");
|
|
31
|
+
return createHash("md5").update(bytes).digest("base64");
|
|
32
|
+
} catch {
|
|
33
|
+
return bytesToBase64(md5Bytes(bytes));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function md5Bytes(data) {
|
|
37
|
+
const originalBitLength = data.byteLength * 8;
|
|
38
|
+
const padLength = (data.byteLength + 8 >>> 6) + 1;
|
|
39
|
+
const padded = new Uint8Array(padLength * 64);
|
|
40
|
+
padded.set(data);
|
|
41
|
+
padded[data.byteLength] = 128;
|
|
42
|
+
const lowBits = originalBitLength >>> 0;
|
|
43
|
+
const highBits = Math.floor(originalBitLength / 4294967296) >>> 0;
|
|
44
|
+
const lengthView = new DataView(padded.buffer, padded.byteLength - 8, 8);
|
|
45
|
+
lengthView.setUint32(0, lowBits, true);
|
|
46
|
+
lengthView.setUint32(4, highBits, true);
|
|
47
|
+
const s = [
|
|
48
|
+
7,
|
|
49
|
+
12,
|
|
50
|
+
17,
|
|
51
|
+
22,
|
|
52
|
+
7,
|
|
53
|
+
12,
|
|
54
|
+
17,
|
|
55
|
+
22,
|
|
56
|
+
7,
|
|
57
|
+
12,
|
|
58
|
+
17,
|
|
59
|
+
22,
|
|
60
|
+
7,
|
|
61
|
+
12,
|
|
62
|
+
17,
|
|
63
|
+
22,
|
|
64
|
+
5,
|
|
65
|
+
9,
|
|
66
|
+
14,
|
|
67
|
+
20,
|
|
68
|
+
5,
|
|
69
|
+
9,
|
|
70
|
+
14,
|
|
71
|
+
20,
|
|
72
|
+
5,
|
|
73
|
+
9,
|
|
74
|
+
14,
|
|
75
|
+
20,
|
|
76
|
+
5,
|
|
77
|
+
9,
|
|
78
|
+
14,
|
|
79
|
+
20,
|
|
80
|
+
4,
|
|
81
|
+
11,
|
|
82
|
+
16,
|
|
83
|
+
23,
|
|
84
|
+
4,
|
|
85
|
+
11,
|
|
86
|
+
16,
|
|
87
|
+
23,
|
|
88
|
+
4,
|
|
89
|
+
11,
|
|
90
|
+
16,
|
|
91
|
+
23,
|
|
92
|
+
4,
|
|
93
|
+
11,
|
|
94
|
+
16,
|
|
95
|
+
23,
|
|
96
|
+
6,
|
|
97
|
+
10,
|
|
98
|
+
15,
|
|
99
|
+
21,
|
|
100
|
+
6,
|
|
101
|
+
10,
|
|
102
|
+
15,
|
|
103
|
+
21,
|
|
104
|
+
6,
|
|
105
|
+
10,
|
|
106
|
+
15,
|
|
107
|
+
21,
|
|
108
|
+
6,
|
|
109
|
+
10,
|
|
110
|
+
15,
|
|
111
|
+
21
|
|
112
|
+
];
|
|
113
|
+
const k = new Uint32Array([
|
|
114
|
+
3614090360,
|
|
115
|
+
3905402710,
|
|
116
|
+
606105819,
|
|
117
|
+
3250441966,
|
|
118
|
+
4118548399,
|
|
119
|
+
1200080426,
|
|
120
|
+
2821735955,
|
|
121
|
+
4249261313,
|
|
122
|
+
1770035416,
|
|
123
|
+
2336552879,
|
|
124
|
+
4294925233,
|
|
125
|
+
2304563134,
|
|
126
|
+
1804603682,
|
|
127
|
+
4254626195,
|
|
128
|
+
2792965006,
|
|
129
|
+
1236535329,
|
|
130
|
+
4129170786,
|
|
131
|
+
3225465664,
|
|
132
|
+
643717713,
|
|
133
|
+
3921069994,
|
|
134
|
+
3593408605,
|
|
135
|
+
38016083,
|
|
136
|
+
3634488961,
|
|
137
|
+
3889429448,
|
|
138
|
+
568446438,
|
|
139
|
+
3275163606,
|
|
140
|
+
4107603335,
|
|
141
|
+
1163531501,
|
|
142
|
+
2850285829,
|
|
143
|
+
4243563512,
|
|
144
|
+
1735328473,
|
|
145
|
+
2368359562,
|
|
146
|
+
4294588738,
|
|
147
|
+
2272392833,
|
|
148
|
+
1839030562,
|
|
149
|
+
4259657740,
|
|
150
|
+
2763975236,
|
|
151
|
+
1272893353,
|
|
152
|
+
4139469664,
|
|
153
|
+
3200236656,
|
|
154
|
+
681279174,
|
|
155
|
+
3936430074,
|
|
156
|
+
3572445317,
|
|
157
|
+
76029189,
|
|
158
|
+
3654602809,
|
|
159
|
+
3873151461,
|
|
160
|
+
530742520,
|
|
161
|
+
3299628645,
|
|
162
|
+
4096336452,
|
|
163
|
+
1126891415,
|
|
164
|
+
2878612391,
|
|
165
|
+
4237533241,
|
|
166
|
+
1700485571,
|
|
167
|
+
2399980690,
|
|
168
|
+
4293915773,
|
|
169
|
+
2240044497,
|
|
170
|
+
1873313359,
|
|
171
|
+
4264355552,
|
|
172
|
+
2734768916,
|
|
173
|
+
1309151649,
|
|
174
|
+
4149444226,
|
|
175
|
+
3174756917,
|
|
176
|
+
718787259,
|
|
177
|
+
3951481745
|
|
178
|
+
]);
|
|
179
|
+
let a0 = 1732584193;
|
|
180
|
+
let b0 = 4023233417;
|
|
181
|
+
let c0 = 2562383102;
|
|
182
|
+
let d0 = 271733878;
|
|
183
|
+
const m = new Uint32Array(16);
|
|
184
|
+
const view = new DataView(padded.buffer);
|
|
185
|
+
for (let block = 0; block < padded.byteLength; block += 64) {
|
|
186
|
+
for (let i = 0; i < 16; i++) m[i] = view.getUint32(block + i * 4, true);
|
|
187
|
+
let A = a0;
|
|
188
|
+
let B = b0;
|
|
189
|
+
let C = c0;
|
|
190
|
+
let D = d0;
|
|
191
|
+
for (let i = 0; i < 64; i++) {
|
|
192
|
+
let f;
|
|
193
|
+
let g;
|
|
194
|
+
if (i < 16) {
|
|
195
|
+
f = B & C | ~B & D;
|
|
196
|
+
g = i;
|
|
197
|
+
} else if (i < 32) {
|
|
198
|
+
f = D & B | ~D & C;
|
|
199
|
+
g = (5 * i + 1) % 16;
|
|
200
|
+
} else if (i < 48) {
|
|
201
|
+
f = B ^ C ^ D;
|
|
202
|
+
g = (3 * i + 5) % 16;
|
|
203
|
+
} else {
|
|
204
|
+
f = C ^ (B | ~D);
|
|
205
|
+
g = 7 * i % 16;
|
|
206
|
+
}
|
|
207
|
+
const temp = D;
|
|
208
|
+
D = C;
|
|
209
|
+
C = B;
|
|
210
|
+
const sum = A + f + (k[i] ?? 0) + (m[g] ?? 0) >>> 0;
|
|
211
|
+
const shift = s[i] ?? 0;
|
|
212
|
+
const rotated = (sum << shift | sum >>> 32 - shift) >>> 0;
|
|
213
|
+
B = B + rotated >>> 0;
|
|
214
|
+
A = temp;
|
|
215
|
+
}
|
|
216
|
+
a0 = a0 + A >>> 0;
|
|
217
|
+
b0 = b0 + B >>> 0;
|
|
218
|
+
c0 = c0 + C >>> 0;
|
|
219
|
+
d0 = d0 + D >>> 0;
|
|
220
|
+
}
|
|
221
|
+
const out = new Uint8Array(16);
|
|
222
|
+
const outView = new DataView(out.buffer);
|
|
223
|
+
outView.setUint32(0, a0, true);
|
|
224
|
+
outView.setUint32(4, b0, true);
|
|
225
|
+
outView.setUint32(8, c0, true);
|
|
226
|
+
outView.setUint32(12, d0, true);
|
|
227
|
+
return out;
|
|
228
|
+
}
|
|
229
|
+
const KEY_REDACTED = "[redacted SSE-C key]";
|
|
230
|
+
class EncryptionKey {
|
|
231
|
+
/** Encryption mode discriminant. Always `'SSE-C'` for this class. */
|
|
232
|
+
mode = "SSE-C";
|
|
233
|
+
/** Encryption algorithm. B2's S3-compatible API only supports AES-256. */
|
|
234
|
+
algorithm = "AES256";
|
|
235
|
+
/** Base64-encoded 256-bit customer key. Logged as `[redacted SSE-C key]` via `toJSON` / `toString`. */
|
|
236
|
+
customerKey;
|
|
237
|
+
/** Base64-encoded MD5 digest of the customer key. Required by B2 for integrity verification. */
|
|
238
|
+
customerKeyMd5;
|
|
239
|
+
/**
|
|
240
|
+
* Internal constructor. Use {@link EncryptionKey.fromBytes} or
|
|
241
|
+
* {@link EncryptionKey.fromBase64} instead.
|
|
242
|
+
*
|
|
243
|
+
* @param customerKey - Base64-encoded 256-bit encryption key.
|
|
244
|
+
* @param customerKeyMd5 - Base64-encoded MD5 digest of the key.
|
|
245
|
+
*
|
|
246
|
+
* @internal
|
|
247
|
+
*/
|
|
248
|
+
constructor(customerKey, customerKeyMd5) {
|
|
249
|
+
this.customerKey = customerKey;
|
|
250
|
+
this.customerKeyMd5 = customerKeyMd5;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Builds an EncryptionKey from a raw 32-byte (256-bit) key. Computes the
|
|
254
|
+
* required base64 MD5 digest internally.
|
|
255
|
+
*
|
|
256
|
+
* @param rawKey - The raw 256-bit key as bytes. Must be exactly 32 bytes.
|
|
257
|
+
*
|
|
258
|
+
* @returns A safely-wrapped EncryptionKey ready for upload/download.
|
|
259
|
+
*
|
|
260
|
+
* @throws If the key is not exactly 32 bytes.
|
|
261
|
+
*/
|
|
262
|
+
static async fromBytes(rawKey) {
|
|
263
|
+
if (rawKey.byteLength !== 32) {
|
|
264
|
+
throw new Error(`SSE-C key must be exactly 32 bytes (256 bits); got ${rawKey.byteLength}.`);
|
|
265
|
+
}
|
|
266
|
+
const customerKey = bytesToBase64(rawKey);
|
|
267
|
+
const customerKeyMd5 = await md5Base64(rawKey);
|
|
268
|
+
return new EncryptionKey(customerKey, customerKeyMd5);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Builds an EncryptionKey from precomputed base64 strings. Use this in
|
|
272
|
+
* environments where MD5 must be computed externally (e.g., browsers).
|
|
273
|
+
*
|
|
274
|
+
* @param customerKey - Base64-encoded 256-bit encryption key.
|
|
275
|
+
* @param customerKeyMd5 - Base64-encoded MD5 digest of the key.
|
|
276
|
+
*
|
|
277
|
+
* @returns A safely-wrapped EncryptionKey ready for upload/download.
|
|
278
|
+
*/
|
|
279
|
+
static fromBase64(customerKey, customerKeyMd5) {
|
|
280
|
+
return new EncryptionKey(customerKey, customerKeyMd5);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Hides the key bytes from `JSON.stringify`.
|
|
284
|
+
*
|
|
285
|
+
* @returns A redacted shape: same mode and algorithm, but the key and MD5
|
|
286
|
+
* replaced with a placeholder string.
|
|
287
|
+
*/
|
|
288
|
+
toJSON() {
|
|
289
|
+
return {
|
|
290
|
+
mode: this.mode,
|
|
291
|
+
algorithm: this.algorithm,
|
|
292
|
+
customerKey: KEY_REDACTED,
|
|
293
|
+
customerKeyMd5: KEY_REDACTED
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Hides the key bytes from default `toString()`.
|
|
298
|
+
*
|
|
299
|
+
* @returns A short opaque label indicating this is an SSE-C key.
|
|
300
|
+
*/
|
|
301
|
+
toString() {
|
|
302
|
+
return `[EncryptionKey SSE-C ${KEY_REDACTED}]`;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Hides the key bytes from Node's `util.inspect` (and therefore `console.log`).
|
|
306
|
+
*
|
|
307
|
+
* @returns A short opaque label indicating this is an SSE-C key.
|
|
308
|
+
*/
|
|
309
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
310
|
+
return this.toString();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
export {
|
|
314
|
+
EncryptionAlgorithm,
|
|
315
|
+
EncryptionKey,
|
|
316
|
+
EncryptionMode,
|
|
317
|
+
SSE_B2,
|
|
318
|
+
SSE_NONE,
|
|
319
|
+
sseCustomer
|
|
320
|
+
};
|
|
321
|
+
//# sourceMappingURL=encryption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.js","sources":["../../src/types/encryption.ts"],"sourcesContent":["/** Named constants for the supported server-side encryption algorithms. */\nexport const EncryptionAlgorithm = {\n /** AES with a 256-bit key. The only algorithm B2 currently supports. */\n Aes256: 'AES256',\n} as const\n\n/** Supported server-side encryption algorithm. Derived from {@link EncryptionAlgorithm}. */\nexport type EncryptionAlgorithm = (typeof EncryptionAlgorithm)[keyof typeof EncryptionAlgorithm]\n\n/**\n * Named constants for the server-side encryption mode used by a file.\n *\n * Most callers should use the {@link SSE_B2}, {@link SSE_NONE}, and\n * {@link sseCustomer} helpers below which return complete\n * {@link EncryptionSetting} objects. These constants are useful when you\n * need the bare mode discriminator (e.g., when introspecting a file's\n * current encryption setting).\n */\nexport const EncryptionMode = {\n /** B2-managed encryption keys. */\n SseB2: 'SSE-B2',\n /** Customer-provided encryption keys. */\n SseC: 'SSE-C',\n /** No encryption. */\n None: 'none',\n} as const\n\n/** Server-side encryption mode for files stored in B2. Derived from {@link EncryptionMode}. */\nexport type EncryptionMode = (typeof EncryptionMode)[keyof typeof EncryptionMode]\n\n/** Server-side encryption using B2-managed keys (SSE-B2). */\nexport interface SseB2Setting {\n /** Encryption mode discriminator. Always `'SSE-B2'`. */\n readonly mode: 'SSE-B2'\n /** Encryption algorithm. Always `'AES256'`. */\n readonly algorithm: EncryptionAlgorithm\n}\n\n/** Server-side encryption using customer-provided keys (SSE-C). */\nexport interface SseCCustomerSetting {\n /** Encryption mode discriminator. Always `'SSE-C'`. */\n readonly mode: 'SSE-C'\n /** Encryption algorithm. Always `'AES256'`. */\n readonly algorithm: EncryptionAlgorithm\n /** Base64-encoded 256-bit encryption key provided by the customer. */\n readonly customerKey: string\n /** Base64-encoded MD5 digest of the customer-provided key, used for integrity verification. */\n readonly customerKeyMd5: string\n}\n\n/** Indicates no server-side encryption is applied. */\nexport interface NoEncryption {\n /** Encryption mode discriminator. Always `'none'`. */\n readonly mode: 'none'\n}\n\n/** Union of all server-side encryption settings: B2-managed, customer-provided, or none. */\nexport type EncryptionSetting = SseB2Setting | SseCCustomerSetting | NoEncryption\n\n/** Pre-built SSE-B2 encryption setting using AES-256. */\nexport const SSE_B2: SseB2Setting = { mode: 'SSE-B2', algorithm: 'AES256' }\n\n/** Pre-built setting indicating no server-side encryption. */\nexport const SSE_NONE: NoEncryption = { mode: 'none' }\n\n/**\n * Creates an SSE-C encryption setting with a customer-provided key.\n * @param customerKey - Base64-encoded 256-bit encryption key.\n * @param customerKeyMd5 - Base64-encoded MD5 digest of the key.\n *\n * @returns An SSE-C encryption setting ready to pass to upload or download calls.\n */\nexport function sseCustomer(customerKey: string, customerKeyMd5: string): SseCCustomerSetting {\n return { mode: 'SSE-C', algorithm: 'AES256', customerKey, customerKeyMd5 }\n}\n\n/**\n * Encodes raw bytes as base64 in an isomorphic way (Node Buffer fallback to btoa).\n *\n * @param bytes - The raw bytes to encode.\n *\n * @returns The base64-encoded string.\n */\nfunction bytesToBase64(bytes: Uint8Array): string {\n // Prefer Node's Buffer when available (faster), but degrade to btoa() in\n // browsers / Deno / Workers where Buffer isn't a global. We access via\n // globalThis to avoid a hard reference to a Node-only symbol — that would\n // break the type-check in non-Node runtimes (Deno, browser-mode Vitest).\n const g = globalThis as {\n Buffer?: { from(b: Uint8Array): { toString(encoding: string): string } }\n }\n if (g.Buffer) {\n return g.Buffer.from(bytes).toString('base64')\n }\n let binary = ''\n for (const b of bytes) binary += String.fromCharCode(b)\n return btoa(binary)\n}\n\n/**\n * Computes the MD5 digest of the given bytes as a base64 string. Prefers\n * `node:crypto` for native speed when available; falls back to a pure-JS\n * implementation in browser / edge runtimes because WebCrypto's\n * `crypto.subtle.digest` deliberately does not support MD5.\n *\n * MD5 is used here only for SSE-C key integrity (matching the B2 wire\n * protocol). It is **not** a security boundary; the customer key itself is\n * the secret. Bundling a pure-JS fallback keeps `EncryptionKey.fromBytes`\n * isomorphic.\n *\n * @param bytes - The bytes to digest.\n *\n * @returns The base64-encoded MD5 digest.\n */\nasync function md5Base64(bytes: Uint8Array): Promise<string> {\n try {\n const { createHash } = await import('node:crypto')\n // Vite's browser shim resolves the import but does not implement\n // `createHash`. Probe explicitly so we fall through to the pure-JS path.\n if (typeof createHash !== 'function') throw new Error('createHash unavailable')\n return createHash('md5').update(bytes).digest('base64')\n /* v8 ignore next 3 -- fallback only reachable in non-Node runtimes */\n } catch {\n return bytesToBase64(md5Bytes(bytes))\n }\n}\n\n/**\n * Pure-JS MD5 implementation per RFC 1321. Returns the 16-byte digest of the\n * input. Used as a browser fallback for SSE-C key MD5 computation; not\n * intended for security-sensitive purposes (MD5 is broken cryptographically).\n *\n * @param data - The bytes to hash.\n *\n * @returns The 16-byte MD5 digest.\n */\nfunction md5Bytes(data: Uint8Array): Uint8Array {\n // Padding: append 0x80, then zeros, then the original length in bits as a\n // little-endian 64-bit integer, so the total length is a multiple of 64.\n const originalBitLength = data.byteLength * 8\n const padLength = ((data.byteLength + 8) >>> 6) + 1\n const padded = new Uint8Array(padLength * 64)\n padded.set(data)\n padded[data.byteLength] = 0x80\n // Write the 64-bit length (little-endian). JS bitwise ops are 32-bit, so\n // split into low/high halves.\n const lowBits = originalBitLength >>> 0\n const highBits = Math.floor(originalBitLength / 0x1_0000_0000) >>> 0\n const lengthView = new DataView(padded.buffer, padded.byteLength - 8, 8)\n lengthView.setUint32(0, lowBits, true)\n lengthView.setUint32(4, highBits, true)\n\n // Per-round shift amounts.\n const s = [\n 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9,\n 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21,\n 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21,\n ]\n // Per-round sine-derived constants K[i] = floor(2^32 * abs(sin(i + 1))).\n const k = new Uint32Array([\n 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,\n 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,\n 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,\n 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,\n 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,\n 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,\n 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,\n 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,\n ])\n\n let a0 = 0x67452301\n let b0 = 0xefcdab89\n let c0 = 0x98badcfe\n let d0 = 0x10325476\n\n const m = new Uint32Array(16)\n const view = new DataView(padded.buffer)\n for (let block = 0; block < padded.byteLength; block += 64) {\n for (let i = 0; i < 16; i++) m[i] = view.getUint32(block + i * 4, true)\n let A = a0\n let B = b0\n let C = c0\n let D = d0\n for (let i = 0; i < 64; i++) {\n let f: number\n let g: number\n if (i < 16) {\n f = (B & C) | (~B & D)\n g = i\n } else if (i < 32) {\n f = (D & B) | (~D & C)\n g = (5 * i + 1) % 16\n } else if (i < 48) {\n f = B ^ C ^ D\n g = (3 * i + 5) % 16\n } else {\n f = C ^ (B | ~D)\n g = (7 * i) % 16\n }\n const temp = D\n D = C\n C = B\n const sum = (A + f + (k[i] ?? 0) + (m[g] ?? 0)) >>> 0\n const shift = s[i] ?? 0\n const rotated = ((sum << shift) | (sum >>> (32 - shift))) >>> 0\n B = (B + rotated) >>> 0\n A = temp\n }\n a0 = (a0 + A) >>> 0\n b0 = (b0 + B) >>> 0\n c0 = (c0 + C) >>> 0\n d0 = (d0 + D) >>> 0\n }\n\n const out = new Uint8Array(16)\n const outView = new DataView(out.buffer)\n outView.setUint32(0, a0, true)\n outView.setUint32(4, b0, true)\n outView.setUint32(8, c0, true)\n outView.setUint32(12, d0, true)\n return out\n}\n\nconst KEY_REDACTED = '[redacted SSE-C key]'\n\n/**\n * Safe wrapper around an SSE-C customer key. Hides the key bytes from\n * `JSON.stringify`, `console.log`, and Node's `util.inspect`. Use {@link EncryptionKey.fromBytes}\n * to construct one from a raw 32-byte key; the MD5 digest is computed internally.\n */\nexport class EncryptionKey {\n /** Encryption mode discriminant. Always `'SSE-C'` for this class. */\n readonly mode = 'SSE-C' as const\n /** Encryption algorithm. B2's S3-compatible API only supports AES-256. */\n readonly algorithm: EncryptionAlgorithm = 'AES256'\n /** Base64-encoded 256-bit customer key. Logged as `[redacted SSE-C key]` via `toJSON` / `toString`. */\n readonly customerKey: string\n /** Base64-encoded MD5 digest of the customer key. Required by B2 for integrity verification. */\n readonly customerKeyMd5: string\n\n /**\n * Internal constructor. Use {@link EncryptionKey.fromBytes} or\n * {@link EncryptionKey.fromBase64} instead.\n *\n * @param customerKey - Base64-encoded 256-bit encryption key.\n * @param customerKeyMd5 - Base64-encoded MD5 digest of the key.\n *\n * @internal\n */\n private constructor(customerKey: string, customerKeyMd5: string) {\n this.customerKey = customerKey\n this.customerKeyMd5 = customerKeyMd5\n }\n\n /**\n * Builds an EncryptionKey from a raw 32-byte (256-bit) key. Computes the\n * required base64 MD5 digest internally.\n *\n * @param rawKey - The raw 256-bit key as bytes. Must be exactly 32 bytes.\n *\n * @returns A safely-wrapped EncryptionKey ready for upload/download.\n *\n * @throws If the key is not exactly 32 bytes.\n */\n static async fromBytes(rawKey: Uint8Array): Promise<EncryptionKey> {\n if (rawKey.byteLength !== 32) {\n throw new Error(`SSE-C key must be exactly 32 bytes (256 bits); got ${rawKey.byteLength}.`)\n }\n const customerKey = bytesToBase64(rawKey)\n const customerKeyMd5 = await md5Base64(rawKey)\n return new EncryptionKey(customerKey, customerKeyMd5)\n }\n\n /**\n * Builds an EncryptionKey from precomputed base64 strings. Use this in\n * environments where MD5 must be computed externally (e.g., browsers).\n *\n * @param customerKey - Base64-encoded 256-bit encryption key.\n * @param customerKeyMd5 - Base64-encoded MD5 digest of the key.\n *\n * @returns A safely-wrapped EncryptionKey ready for upload/download.\n */\n static fromBase64(customerKey: string, customerKeyMd5: string): EncryptionKey {\n return new EncryptionKey(customerKey, customerKeyMd5)\n }\n\n /**\n * Hides the key bytes from `JSON.stringify`.\n *\n * @returns A redacted shape: same mode and algorithm, but the key and MD5\n * replaced with a placeholder string.\n */\n toJSON(): {\n /** Encryption mode discriminant. */\n mode: 'SSE-C'\n /** Encryption algorithm. */\n algorithm: EncryptionAlgorithm\n /** Always the literal redaction placeholder; the real key never leaves the instance. */\n customerKey: string\n /** Always the literal redaction placeholder; the real MD5 never leaves the instance. */\n customerKeyMd5: string\n } {\n return {\n mode: this.mode,\n algorithm: this.algorithm,\n customerKey: KEY_REDACTED,\n customerKeyMd5: KEY_REDACTED,\n }\n }\n\n /**\n * Hides the key bytes from default `toString()`.\n *\n * @returns A short opaque label indicating this is an SSE-C key.\n */\n toString(): string {\n return `[EncryptionKey SSE-C ${KEY_REDACTED}]`\n }\n\n /**\n * Hides the key bytes from Node's `util.inspect` (and therefore `console.log`).\n *\n * @returns A short opaque label indicating this is an SSE-C key.\n */\n [Symbol.for('nodejs.util.inspect.custom')](): string {\n return this.toString()\n }\n}\n"],"names":[],"mappings":"AACO,MAAM,sBAAsB;AAAA;AAAA,EAEjC,QAAQ;AACV;AAcO,MAAM,iBAAiB;AAAA;AAAA,EAE5B,OAAO;AAAA;AAAA,EAEP,MAAM;AAAA;AA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AAA,MACX,WAAW,KAAK;AAAA,MAChB,aAAa;AAAA,MACb,gBAAgB;AAAA,IAAA;AAAA,EAEpB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAmB;AACjB,WAAO,wBAAwB,YAAY;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,CAAC,OAAO,IAAI,4BAA4B,CAAC,IAAY;AACnD,WAAO,KAAK,SAAA;AAAA,EACd;AACF;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Known B2 API error codes.
|
|
3
|
+
* The union includes a `string & {}` fallback to allow unknown error codes
|
|
4
|
+
* while still providing autocomplete for well-known values.
|
|
5
|
+
*/
|
|
6
|
+
export type B2ErrorCode = 'expired_auth_token' | 'bad_auth_token' | 'unauthorized' | 'bad_request' | 'bad_bucket_id' | 'not_found' | 'method_not_allowed' | 'request_timeout' | 'conflict' | 'duplicate_bucket_name' | 'too_many_buckets' | 'too_many_files' | 'cap_exceeded' | 'storage_cap_exceeded' | 'transaction_cap_exceeded' | 'access_denied' | 'service_unavailable' | 'internal_error' | 'bad_json' | 'invalid_bucket_id' | 'file_not_present' | 'no_such_file' | 'out_of_range' | 'range_not_satisfiable' | 'invalid_file_id' | 'invalid_part_number' | 'bad_sha1_checksum' | 'download_cap_exceeded' | (string & {});
|
|
7
|
+
/** Standard error response body returned by the B2 API on failure. */
|
|
8
|
+
export interface B2ErrorResponse {
|
|
9
|
+
/** HTTP status code from the B2 API response. */
|
|
10
|
+
readonly status: number;
|
|
11
|
+
/** Machine-readable error code identifying the specific failure. */
|
|
12
|
+
readonly code: B2ErrorCode;
|
|
13
|
+
/** Human-readable description of the error. */
|
|
14
|
+
readonly message: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,WAAW,GACnB,oBAAoB,GACpB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,eAAe,GACf,WAAW,GACX,oBAAoB,GACpB,iBAAiB,GACjB,UAAU,GACV,uBAAuB,GACvB,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,sBAAsB,GACtB,0BAA0B,GAC1B,eAAe,GACf,qBAAqB,GACrB,gBAAgB,GAChB,UAAU,GACV,mBAAmB,GACnB,kBAAkB,GAClB,cAAc,GACd,cAAc,GACd,uBAAuB,GACvB,iBAAiB,GACjB,qBAAqB,GACrB,mBAAmB,GACnB,uBAAuB,GACvB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEjB,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Known B2 API error codes.
|
|
3
|
+
* The union includes a `string & {}` fallback to allow unknown error codes
|
|
4
|
+
* while still providing autocomplete for well-known values.
|
|
5
|
+
*/
|
|
6
|
+
export type B2ErrorCode = 'expired_auth_token' | 'bad_auth_token' | 'unauthorized' | 'bad_request' | 'bad_bucket_id' | 'not_found' | 'method_not_allowed' | 'request_timeout' | 'conflict' | 'duplicate_bucket_name' | 'too_many_buckets' | 'too_many_files' | 'cap_exceeded' | 'storage_cap_exceeded' | 'transaction_cap_exceeded' | 'access_denied' | 'service_unavailable' | 'internal_error' | 'bad_json' | 'invalid_bucket_id' | 'file_not_present' | 'no_such_file' | 'out_of_range' | 'range_not_satisfiable' | 'invalid_file_id' | 'invalid_part_number' | 'bad_sha1_checksum' | 'download_cap_exceeded' | (string & {});
|
|
7
|
+
/** Standard error response body returned by the B2 API on failure. */
|
|
8
|
+
export interface B2ErrorResponse {
|
|
9
|
+
/** HTTP status code from the B2 API response. */
|
|
10
|
+
readonly status: number;
|
|
11
|
+
/** Machine-readable error code identifying the specific failure. */
|
|
12
|
+
readonly code: B2ErrorCode;
|
|
13
|
+
/** Human-readable description of the error. */
|
|
14
|
+
readonly message: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=errors.d.ts.map
|