@backblaze-labs/b2-sdk 0.2.0 → 0.3.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 +42 -1
- package/README.md +20 -2
- package/dist/_virtual/_b2-sdk-version-json.cjs +1 -1
- package/dist/_virtual/_b2-sdk-version-json.js +1 -1
- package/dist/auth/file.cjs.map +1 -1
- package/dist/backup/client.cjs +206 -0
- package/dist/backup/client.cjs.map +1 -0
- package/dist/backup/client.d.cts +238 -0
- package/dist/backup/client.d.cts.map +1 -0
- package/dist/backup/client.d.ts +238 -0
- package/dist/backup/client.d.ts.map +1 -0
- package/dist/backup/client.js +206 -0
- package/dist/backup/client.js.map +1 -0
- package/dist/backup/index.cjs +15 -0
- package/dist/backup/index.d.cts +22 -0
- package/dist/backup/index.d.cts.map +1 -0
- package/dist/backup/index.d.ts +22 -0
- package/dist/backup/index.d.ts.map +1 -0
- package/dist/backup/index.js +7 -0
- package/dist/backup/raw.cjs +146 -0
- package/dist/backup/raw.cjs.map +1 -0
- package/dist/backup/raw.d.cts +122 -0
- package/dist/backup/raw.d.cts.map +1 -0
- package/dist/backup/raw.d.ts +122 -0
- package/dist/backup/raw.d.ts.map +1 -0
- package/dist/backup/raw.js +146 -0
- package/dist/backup/raw.js.map +1 -0
- package/dist/bucket.cjs +2 -1
- package/dist/bucket.cjs.map +1 -1
- package/dist/bucket.js +2 -1
- package/dist/bucket.js.map +1 -1
- package/dist/copy/large.cjs +5 -3
- package/dist/copy/large.cjs.map +1 -1
- package/dist/copy/large.d.cts.map +1 -1
- package/dist/copy/large.d.ts.map +1 -1
- package/dist/copy/large.js +5 -3
- package/dist/copy/large.js.map +1 -1
- package/dist/download/checksum.cjs +6 -2
- package/dist/download/checksum.cjs.map +1 -1
- package/dist/download/checksum.js +6 -2
- package/dist/download/checksum.js.map +1 -1
- package/dist/download/parallel.cjs +52 -15
- package/dist/download/parallel.cjs.map +1 -1
- package/dist/download/parallel.d.cts +8 -1
- package/dist/download/parallel.d.cts.map +1 -1
- package/dist/download/parallel.d.ts +8 -1
- package/dist/download/parallel.d.ts.map +1 -1
- package/dist/download/parallel.js +52 -15
- package/dist/download/parallel.js.map +1 -1
- package/dist/download/single.cjs +141 -6
- package/dist/download/single.cjs.map +1 -1
- package/dist/download/single.d.cts.map +1 -1
- package/dist/download/single.d.ts.map +1 -1
- package/dist/download/single.js +141 -6
- package/dist/download/single.js.map +1 -1
- package/dist/errors/index.cjs +173 -3
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.cts +119 -0
- package/dist/errors/index.d.cts.map +1 -1
- package/dist/errors/index.d.ts +119 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +161 -4
- package/dist/errors/index.js.map +1 -1
- package/dist/http/retry.cjs +1 -1
- package/dist/http/retry.cjs.map +1 -1
- package/dist/http/retry.js +1 -1
- package/dist/http/retry.js.map +1 -1
- package/dist/http/transport.cjs +61 -23
- package/dist/http/transport.cjs.map +1 -1
- package/dist/http/transport.d.cts +25 -3
- package/dist/http/transport.d.cts.map +1 -1
- package/dist/http/transport.d.ts +25 -3
- package/dist/http/transport.d.ts.map +1 -1
- package/dist/http/transport.js +59 -22
- package/dist/http/transport.js.map +1 -1
- package/dist/index.cjs +25 -2
- package/dist/index.d.cts +6 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/object.cjs +1 -1
- package/dist/object.cjs.map +1 -1
- package/dist/object.d.cts +4 -2
- package/dist/object.d.cts.map +1 -1
- package/dist/object.d.ts +4 -2
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +1 -1
- package/dist/object.js.map +1 -1
- package/dist/partner/account-info.d.cts +43 -0
- package/dist/partner/account-info.d.cts.map +1 -0
- package/dist/partner/account-info.d.ts +43 -0
- package/dist/partner/account-info.d.ts.map +1 -0
- package/dist/partner/auth-clone.cjs +64 -0
- package/dist/partner/auth-clone.cjs.map +1 -0
- package/dist/partner/auth-clone.d.cts +27 -0
- package/dist/partner/auth-clone.d.cts.map +1 -0
- package/dist/partner/auth-clone.d.ts +27 -0
- package/dist/partner/auth-clone.d.ts.map +1 -0
- package/dist/partner/auth-clone.js +63 -0
- package/dist/partner/auth-clone.js.map +1 -0
- package/dist/partner/auth-core.cjs +175 -0
- package/dist/partner/auth-core.cjs.map +1 -0
- package/dist/partner/auth-core.d.cts +111 -0
- package/dist/partner/auth-core.d.cts.map +1 -0
- package/dist/partner/auth-core.d.ts +111 -0
- package/dist/partner/auth-core.d.ts.map +1 -0
- package/dist/partner/auth-core.js +175 -0
- package/dist/partner/auth-core.js.map +1 -0
- package/dist/partner/auth-shape.cjs +36 -0
- package/dist/partner/auth-shape.cjs.map +1 -0
- package/dist/partner/auth-shape.d.cts +12 -0
- package/dist/partner/auth-shape.d.cts.map +1 -0
- package/dist/partner/auth-shape.d.ts +12 -0
- package/dist/partner/auth-shape.d.ts.map +1 -0
- package/dist/partner/auth-shape.js +36 -0
- package/dist/partner/auth-shape.js.map +1 -0
- package/dist/partner/client.cjs +255 -0
- package/dist/partner/client.cjs.map +1 -0
- package/dist/partner/client.d.cts +335 -0
- package/dist/partner/client.d.cts.map +1 -0
- package/dist/partner/client.d.ts +335 -0
- package/dist/partner/client.d.ts.map +1 -0
- package/dist/partner/client.js +255 -0
- package/dist/partner/client.js.map +1 -0
- package/dist/partner/endpoint-url.cjs +108 -0
- package/dist/partner/endpoint-url.cjs.map +1 -0
- package/dist/partner/endpoint-url.d.cts +72 -0
- package/dist/partner/endpoint-url.d.cts.map +1 -0
- package/dist/partner/endpoint-url.d.ts +72 -0
- package/dist/partner/endpoint-url.d.ts.map +1 -0
- package/dist/partner/endpoint-url.js +105 -0
- package/dist/partner/endpoint-url.js.map +1 -0
- package/dist/partner/in-memory.cjs +135 -0
- package/dist/partner/in-memory.cjs.map +1 -0
- package/dist/partner/in-memory.d.cts +99 -0
- package/dist/partner/in-memory.d.cts.map +1 -0
- package/dist/partner/in-memory.d.ts +99 -0
- package/dist/partner/in-memory.d.ts.map +1 -0
- package/dist/partner/in-memory.js +135 -0
- package/dist/partner/in-memory.js.map +1 -0
- package/dist/partner/index.cjs +18 -0
- package/dist/partner/index.d.cts +23 -0
- package/dist/partner/index.d.cts.map +1 -0
- package/dist/partner/index.d.ts +23 -0
- package/dist/partner/index.d.ts.map +1 -0
- package/dist/partner/index.js +7 -0
- package/dist/partner/raw.cjs +392 -0
- package/dist/partner/raw.cjs.map +1 -0
- package/dist/partner/raw.d.cts +223 -0
- package/dist/partner/raw.d.cts.map +1 -0
- package/dist/partner/raw.d.ts +223 -0
- package/dist/partner/raw.d.ts.map +1 -0
- package/dist/partner/raw.js +390 -0
- package/dist/partner/raw.js.map +1 -0
- package/dist/partner/redaction-placeholders.cjs +10 -0
- package/dist/partner/redaction-placeholders.cjs.map +1 -0
- package/dist/partner/redaction-placeholders.d.cts +5 -0
- package/dist/partner/redaction-placeholders.d.cts.map +1 -0
- package/dist/partner/redaction-placeholders.d.ts +5 -0
- package/dist/partner/redaction-placeholders.d.ts.map +1 -0
- package/dist/partner/redaction-placeholders.js +9 -0
- package/dist/partner/redaction-placeholders.js.map +1 -0
- package/dist/partner/redaction.cjs +267 -0
- package/dist/partner/redaction.cjs.map +1 -0
- package/dist/partner/redaction.d.cts +124 -0
- package/dist/partner/redaction.d.cts.map +1 -0
- package/dist/partner/redaction.d.ts +124 -0
- package/dist/partner/redaction.d.ts.map +1 -0
- package/dist/partner/redaction.js +257 -0
- package/dist/partner/redaction.js.map +1 -0
- package/dist/raw/index.cjs +81 -19
- package/dist/raw/index.cjs.map +1 -1
- package/dist/raw/index.d.cts +6 -2
- package/dist/raw/index.d.cts.map +1 -1
- package/dist/raw/index.d.ts +6 -2
- package/dist/raw/index.d.ts.map +1 -1
- package/dist/raw/index.js +81 -19
- package/dist/raw/index.js.map +1 -1
- package/dist/raw/url.cjs +111 -0
- package/dist/raw/url.cjs.map +1 -0
- package/dist/raw/url.d.cts +41 -0
- package/dist/raw/url.d.cts.map +1 -0
- package/dist/raw/url.d.ts +41 -0
- package/dist/raw/url.d.ts.map +1 -0
- package/dist/raw/url.js +110 -0
- package/dist/raw/url.js.map +1 -0
- package/dist/s3/sigv4.cjs +15 -10
- package/dist/s3/sigv4.cjs.map +1 -1
- package/dist/s3/sigv4.js +15 -10
- package/dist/s3/sigv4.js.map +1 -1
- package/dist/simulator/index.cjs +1197 -206
- package/dist/simulator/index.cjs.map +1 -1
- package/dist/simulator/index.d.cts +109 -11
- package/dist/simulator/index.d.cts.map +1 -1
- package/dist/simulator/index.d.ts +109 -11
- package/dist/simulator/index.d.ts.map +1 -1
- package/dist/simulator/index.js +1196 -209
- package/dist/simulator/index.js.map +1 -1
- package/dist/simulator/partner.cjs +719 -0
- package/dist/simulator/partner.cjs.map +1 -0
- package/dist/simulator/partner.d.cts +183 -0
- package/dist/simulator/partner.d.cts.map +1 -0
- package/dist/simulator/partner.d.ts +183 -0
- package/dist/simulator/partner.d.ts.map +1 -0
- package/dist/simulator/partner.js +718 -0
- package/dist/simulator/partner.js.map +1 -0
- package/dist/simulator/validation.cjs +577 -0
- package/dist/simulator/validation.cjs.map +1 -1
- package/dist/simulator/validation.d.cts +117 -0
- package/dist/simulator/validation.d.cts.map +1 -1
- package/dist/simulator/validation.d.ts +117 -0
- package/dist/simulator/validation.d.ts.map +1 -1
- package/dist/simulator/validation.js +563 -1
- package/dist/simulator/validation.js.map +1 -1
- package/dist/streams/file-source.cjs +1 -1
- package/dist/streams/file-source.cjs.map +1 -1
- package/dist/streams/file-source.js +1 -1
- package/dist/streams/file-source.js.map +1 -1
- package/dist/streams/index.cjs +1 -1
- package/dist/streams/index.js +1 -1
- package/dist/streams/source.cjs +2 -1
- package/dist/streams/source.cjs.map +1 -1
- package/dist/streams/source.js +2 -1
- package/dist/streams/source.js.map +1 -1
- package/dist/sync/b2-sha1-reader.cjs +6 -2
- package/dist/sync/b2-sha1-reader.cjs.map +1 -1
- package/dist/sync/b2-sha1-reader.d.cts.map +1 -1
- package/dist/sync/b2-sha1-reader.d.ts.map +1 -1
- package/dist/sync/b2-sha1-reader.js +6 -2
- package/dist/sync/b2-sha1-reader.js.map +1 -1
- package/dist/sync/download-staging.cjs +11 -10
- package/dist/sync/download-staging.cjs.map +1 -1
- package/dist/sync/download-staging.d.cts +2 -1
- package/dist/sync/download-staging.d.cts.map +1 -1
- package/dist/sync/download-staging.d.ts +2 -1
- package/dist/sync/download-staging.d.ts.map +1 -1
- package/dist/sync/download-staging.js +11 -10
- package/dist/sync/download-staging.js.map +1 -1
- package/dist/sync/filters.cjs.map +1 -1
- package/dist/sync/filters.js.map +1 -1
- package/dist/sync/local-file-io.cjs +11 -6
- package/dist/sync/local-file-io.cjs.map +1 -1
- package/dist/sync/local-file-io.d.cts +1 -0
- package/dist/sync/local-file-io.d.cts.map +1 -1
- package/dist/sync/local-file-io.d.ts +1 -0
- package/dist/sync/local-file-io.d.ts.map +1 -1
- package/dist/sync/local-file-io.js +11 -6
- package/dist/sync/local-file-io.js.map +1 -1
- package/dist/sync/local-sha1.cjs +6 -15
- package/dist/sync/local-sha1.cjs.map +1 -1
- package/dist/sync/local-sha1.d.cts +0 -8
- package/dist/sync/local-sha1.d.cts.map +1 -1
- package/dist/sync/local-sha1.d.ts +0 -8
- package/dist/sync/local-sha1.d.ts.map +1 -1
- package/dist/sync/local-sha1.js +7 -15
- package/dist/sync/local-sha1.js.map +1 -1
- package/dist/sync/policies/compare.cjs +5 -3
- package/dist/sync/policies/compare.cjs.map +1 -1
- package/dist/sync/policies/compare.d.cts.map +1 -1
- package/dist/sync/policies/compare.d.ts.map +1 -1
- package/dist/sync/policies/compare.js +6 -4
- package/dist/sync/policies/compare.js.map +1 -1
- package/dist/sync/policies/index.cjs +4 -10
- package/dist/sync/policies/index.cjs.map +1 -1
- package/dist/sync/policies/index.js +4 -10
- package/dist/sync/policies/index.js.map +1 -1
- package/dist/sync/scanners/b2.cjs +2 -2
- package/dist/sync/scanners/b2.cjs.map +1 -1
- package/dist/sync/scanners/b2.js +2 -2
- package/dist/sync/scanners/b2.js.map +1 -1
- package/dist/sync/scanners/local.cjs.map +1 -1
- package/dist/sync/scanners/local.js.map +1 -1
- package/dist/sync/synchronizer.cjs +3 -2
- package/dist/sync/synchronizer.cjs.map +1 -1
- package/dist/sync/synchronizer.js +3 -2
- package/dist/sync/synchronizer.js.map +1 -1
- package/dist/types/auth.cjs +4 -0
- package/dist/types/auth.cjs.map +1 -1
- package/dist/types/auth.d.cts +4 -0
- package/dist/types/auth.d.cts.map +1 -1
- package/dist/types/auth.d.ts +4 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/auth.js +4 -0
- package/dist/types/auth.js.map +1 -1
- package/dist/types/backup.d.cts +80 -0
- package/dist/types/backup.d.cts.map +1 -0
- package/dist/types/backup.d.ts +80 -0
- package/dist/types/backup.d.ts.map +1 -0
- package/dist/types/bucket.cjs.map +1 -1
- package/dist/types/bucket.d.cts +4 -2
- package/dist/types/bucket.d.cts.map +1 -1
- package/dist/types/bucket.d.ts +4 -2
- package/dist/types/bucket.d.ts.map +1 -1
- package/dist/types/bucket.js.map +1 -1
- package/dist/types/download.cjs +62 -0
- package/dist/types/download.cjs.map +1 -0
- package/dist/types/download.d.cts +98 -0
- package/dist/types/download.d.cts.map +1 -1
- package/dist/types/download.d.ts +98 -0
- package/dist/types/download.d.ts.map +1 -1
- package/dist/types/download.js +61 -0
- package/dist/types/download.js.map +1 -0
- package/dist/types/encryption.cjs +58 -229
- package/dist/types/encryption.cjs.map +1 -1
- package/dist/types/encryption.d.cts +32 -0
- package/dist/types/encryption.d.cts.map +1 -1
- package/dist/types/encryption.d.ts +32 -0
- package/dist/types/encryption.d.ts.map +1 -1
- package/dist/types/encryption.js +56 -229
- package/dist/types/encryption.js.map +1 -1
- package/dist/types/errors.cjs +9 -0
- package/dist/types/errors.cjs.map +1 -1
- package/dist/types/errors.d.cts +1 -1
- package/dist/types/errors.d.cts.map +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +9 -0
- package/dist/types/errors.js.map +1 -1
- package/dist/types/file.cjs.map +1 -1
- package/dist/types/file.d.cts +15 -2
- package/dist/types/file.d.cts.map +1 -1
- package/dist/types/file.d.ts +15 -2
- package/dist/types/file.d.ts.map +1 -1
- package/dist/types/file.js.map +1 -1
- package/dist/types/ids.cjs +30 -0
- package/dist/types/ids.cjs.map +1 -1
- package/dist/types/ids.d.cts +32 -0
- package/dist/types/ids.d.cts.map +1 -1
- package/dist/types/ids.d.ts +32 -0
- package/dist/types/ids.d.ts.map +1 -1
- package/dist/types/ids.js +28 -1
- package/dist/types/ids.js.map +1 -1
- package/dist/types/index.d.cts +10 -6
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +10 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lock.cjs.map +1 -1
- package/dist/types/lock.d.cts +14 -0
- package/dist/types/lock.d.cts.map +1 -1
- package/dist/types/lock.d.ts +14 -0
- package/dist/types/lock.d.ts.map +1 -1
- package/dist/types/lock.js.map +1 -1
- package/dist/types/notifications.cjs +1 -1
- package/dist/types/notifications.cjs.map +1 -1
- package/dist/types/notifications.d.cts +5 -3
- package/dist/types/notifications.d.cts.map +1 -1
- package/dist/types/notifications.d.ts +5 -3
- package/dist/types/notifications.d.ts.map +1 -1
- package/dist/types/notifications.js +1 -1
- package/dist/types/notifications.js.map +1 -1
- package/dist/types/partner.cjs +32 -0
- package/dist/types/partner.cjs.map +1 -0
- package/dist/types/partner.d.cts +394 -0
- package/dist/types/partner.d.cts.map +1 -0
- package/dist/types/partner.d.ts +394 -0
- package/dist/types/partner.d.ts.map +1 -0
- package/dist/types/partner.js +29 -0
- package/dist/types/partner.js.map +1 -0
- package/dist/types/upload.d.cts +31 -18
- package/dist/types/upload.d.cts.map +1 -1
- package/dist/types/upload.d.ts +31 -18
- package/dist/types/upload.d.ts.map +1 -1
- package/dist/upload/abort-scope.cjs +0 -45
- package/dist/upload/abort-scope.cjs.map +1 -1
- package/dist/upload/abort-scope.d.cts +0 -22
- package/dist/upload/abort-scope.d.cts.map +1 -1
- package/dist/upload/abort-scope.d.ts +0 -22
- package/dist/upload/abort-scope.d.ts.map +1 -1
- package/dist/upload/abort-scope.js +1 -44
- package/dist/upload/abort-scope.js.map +1 -1
- package/dist/upload/finish.cjs +3 -8
- package/dist/upload/finish.cjs.map +1 -1
- package/dist/upload/finish.d.cts.map +1 -1
- package/dist/upload/finish.d.ts.map +1 -1
- package/dist/upload/finish.js +1 -6
- package/dist/upload/finish.js.map +1 -1
- package/dist/upload/large.cjs +5 -1
- package/dist/upload/large.cjs.map +1 -1
- package/dist/upload/large.d.cts +16 -2
- package/dist/upload/large.d.cts.map +1 -1
- package/dist/upload/large.d.ts +16 -2
- package/dist/upload/large.d.ts.map +1 -1
- package/dist/upload/large.js +5 -1
- package/dist/upload/large.js.map +1 -1
- package/dist/upload/options.cjs.map +1 -1
- package/dist/upload/options.d.cts +12 -0
- package/dist/upload/options.d.cts.map +1 -1
- package/dist/upload/options.d.ts +12 -0
- package/dist/upload/options.d.ts.map +1 -1
- package/dist/upload/options.js.map +1 -1
- package/dist/upload/resume.cjs +2 -1
- package/dist/upload/resume.cjs.map +1 -1
- package/dist/upload/resume.d.cts +3 -1
- package/dist/upload/resume.d.cts.map +1 -1
- package/dist/upload/resume.d.ts +3 -1
- package/dist/upload/resume.d.ts.map +1 -1
- package/dist/upload/resume.js +2 -1
- package/dist/upload/resume.js.map +1 -1
- package/dist/upload/retry.cjs +8 -3
- package/dist/upload/retry.cjs.map +1 -1
- package/dist/upload/retry.js +8 -3
- package/dist/upload/retry.js.map +1 -1
- package/dist/upload/single.cjs +2 -1
- package/dist/upload/single.cjs.map +1 -1
- package/dist/upload/single.d.cts +6 -0
- package/dist/upload/single.d.cts.map +1 -1
- package/dist/upload/single.d.ts +6 -0
- package/dist/upload/single.d.ts.map +1 -1
- package/dist/upload/single.js +2 -1
- package/dist/upload/single.js.map +1 -1
- package/dist/upload/stream.cjs +6 -4
- package/dist/upload/stream.cjs.map +1 -1
- package/dist/upload/stream.d.cts +6 -0
- package/dist/upload/stream.d.cts.map +1 -1
- package/dist/upload/stream.d.ts +6 -0
- package/dist/upload/stream.d.ts.map +1 -1
- package/dist/upload/stream.js +3 -1
- package/dist/upload/stream.js.map +1 -1
- package/dist/util/abort.cjs +114 -0
- package/dist/util/abort.cjs.map +1 -0
- package/dist/util/abort.d.cts +65 -0
- package/dist/util/abort.d.cts.map +1 -0
- package/dist/util/abort.d.ts +65 -0
- package/dist/util/abort.d.ts.map +1 -0
- package/dist/util/abort.js +109 -0
- package/dist/util/abort.js.map +1 -0
- package/dist/util/defaults.cjs +3 -0
- package/dist/util/defaults.cjs.map +1 -1
- package/dist/util/defaults.d.cts +2 -0
- package/dist/util/defaults.d.cts.map +1 -1
- package/dist/util/defaults.d.ts +2 -0
- package/dist/util/defaults.d.ts.map +1 -1
- package/dist/util/defaults.js +3 -1
- package/dist/util/defaults.js.map +1 -1
- package/dist/util/md5.cjs +211 -0
- package/dist/util/md5.cjs.map +1 -0
- package/dist/util/md5.d.cts +43 -0
- package/dist/util/md5.d.cts.map +1 -0
- package/dist/util/md5.d.ts +43 -0
- package/dist/util/md5.d.ts.map +1 -0
- package/dist/util/md5.js +209 -0
- package/dist/util/md5.js.map +1 -0
- package/dist/util/normalize.cjs +5 -5
- package/dist/util/normalize.cjs.map +1 -1
- package/dist/util/normalize.d.cts +7 -7
- package/dist/util/normalize.d.cts.map +1 -1
- package/dist/util/normalize.d.ts +7 -7
- package/dist/util/normalize.d.ts.map +1 -1
- package/dist/util/normalize.js +5 -5
- package/dist/util/normalize.js.map +1 -1
- package/dist/util/paginator.cjs +7 -1
- package/dist/util/paginator.cjs.map +1 -1
- package/dist/util/paginator.d.cts +3 -1
- package/dist/util/paginator.d.cts.map +1 -1
- package/dist/util/paginator.d.ts +3 -1
- package/dist/util/paginator.d.ts.map +1 -1
- package/dist/util/paginator.js +7 -1
- package/dist/util/paginator.js.map +1 -1
- package/package.json +38 -16
|
@@ -77,6 +77,31 @@ export declare const SSE_NONE: NoEncryption;
|
|
|
77
77
|
* @returns An SSE-C encryption setting ready to pass to upload or download calls.
|
|
78
78
|
*/
|
|
79
79
|
export declare function sseCustomer(customerKey: string, customerKeyMd5: string): SseCCustomerSetting;
|
|
80
|
+
export declare const SSE_C_KEY_REDACTION = "[redacted SSE-C key]";
|
|
81
|
+
declare const NODE_INSPECT_CUSTOM: unique symbol;
|
|
82
|
+
interface SseCKeyMaterial {
|
|
83
|
+
readonly algorithm: EncryptionAlgorithm;
|
|
84
|
+
readonly customerKey: string;
|
|
85
|
+
readonly customerKeyMd5: string;
|
|
86
|
+
}
|
|
87
|
+
interface SseCKeyRedactionOptions {
|
|
88
|
+
readonly label: string;
|
|
89
|
+
readonly mode?: 'SSE-C';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Wraps SSE-C key material so diagnostic stringification redacts key fields.
|
|
93
|
+
*
|
|
94
|
+
* The returned object keeps `customerKey` and `customerKeyMd5` readable by
|
|
95
|
+
* property access for request header construction, but makes them
|
|
96
|
+
* non-enumerable so object spread and generic serializers do not copy them.
|
|
97
|
+
* Callers that need wire headers must read those fields directly.
|
|
98
|
+
*
|
|
99
|
+
* @param key - SSE-C key material to wrap.
|
|
100
|
+
* @param options - Redaction label and optional encryption mode discriminator.
|
|
101
|
+
*
|
|
102
|
+
* @returns A redacted view with the same readable key fields.
|
|
103
|
+
*/
|
|
104
|
+
export declare function redactSseCKeyMaterial<T extends SseCKeyMaterial>(key: T, options: SseCKeyRedactionOptions): T;
|
|
80
105
|
/**
|
|
81
106
|
* Safe wrapper around an SSE-C customer key. Hides the key bytes from
|
|
82
107
|
* `JSON.stringify`, `console.log`, and Node's `util.inspect`. Use {@link EncryptionKey.fromBytes}
|
|
@@ -144,5 +169,12 @@ export declare class EncryptionKey {
|
|
|
144
169
|
* @returns A short opaque label indicating this is an SSE-C key.
|
|
145
170
|
*/
|
|
146
171
|
toString(): string;
|
|
172
|
+
/**
|
|
173
|
+
* Hides the key bytes from Node's `util.inspect` (and therefore `console.log`).
|
|
174
|
+
*
|
|
175
|
+
* @returns A short opaque label indicating this is an SSE-C key.
|
|
176
|
+
*/
|
|
177
|
+
[NODE_INSPECT_CUSTOM](): string;
|
|
147
178
|
}
|
|
179
|
+
export {};
|
|
148
180
|
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/types/encryption.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/types/encryption.js"],"names":[],"mappings":"AAEA,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;AAC/F,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAA;AAEjF,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;CACxC;AAED,mEAAmE;AACnE,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAA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;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CACxB;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,eAAe,EAC7D,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,uBAAuB,GAC/B,CAAC,CAqBH;AAED;;;;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;IAIlB;;;;OAIG;IACH,CAAC,mBAAmB,CAAC,IAAI,MAAM;CAGhC"}
|
|
@@ -77,6 +77,31 @@ export declare const SSE_NONE: NoEncryption;
|
|
|
77
77
|
* @returns An SSE-C encryption setting ready to pass to upload or download calls.
|
|
78
78
|
*/
|
|
79
79
|
export declare function sseCustomer(customerKey: string, customerKeyMd5: string): SseCCustomerSetting;
|
|
80
|
+
export declare const SSE_C_KEY_REDACTION = "[redacted SSE-C key]";
|
|
81
|
+
declare const NODE_INSPECT_CUSTOM: unique symbol;
|
|
82
|
+
interface SseCKeyMaterial {
|
|
83
|
+
readonly algorithm: EncryptionAlgorithm;
|
|
84
|
+
readonly customerKey: string;
|
|
85
|
+
readonly customerKeyMd5: string;
|
|
86
|
+
}
|
|
87
|
+
interface SseCKeyRedactionOptions {
|
|
88
|
+
readonly label: string;
|
|
89
|
+
readonly mode?: 'SSE-C';
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Wraps SSE-C key material so diagnostic stringification redacts key fields.
|
|
93
|
+
*
|
|
94
|
+
* The returned object keeps `customerKey` and `customerKeyMd5` readable by
|
|
95
|
+
* property access for request header construction, but makes them
|
|
96
|
+
* non-enumerable so object spread and generic serializers do not copy them.
|
|
97
|
+
* Callers that need wire headers must read those fields directly.
|
|
98
|
+
*
|
|
99
|
+
* @param key - SSE-C key material to wrap.
|
|
100
|
+
* @param options - Redaction label and optional encryption mode discriminator.
|
|
101
|
+
*
|
|
102
|
+
* @returns A redacted view with the same readable key fields.
|
|
103
|
+
*/
|
|
104
|
+
export declare function redactSseCKeyMaterial<T extends SseCKeyMaterial>(key: T, options: SseCKeyRedactionOptions): T;
|
|
80
105
|
/**
|
|
81
106
|
* Safe wrapper around an SSE-C customer key. Hides the key bytes from
|
|
82
107
|
* `JSON.stringify`, `console.log`, and Node's `util.inspect`. Use {@link EncryptionKey.fromBytes}
|
|
@@ -144,5 +169,12 @@ export declare class EncryptionKey {
|
|
|
144
169
|
* @returns A short opaque label indicating this is an SSE-C key.
|
|
145
170
|
*/
|
|
146
171
|
toString(): string;
|
|
172
|
+
/**
|
|
173
|
+
* Hides the key bytes from Node's `util.inspect` (and therefore `console.log`).
|
|
174
|
+
*
|
|
175
|
+
* @returns A short opaque label indicating this is an SSE-C key.
|
|
176
|
+
*/
|
|
177
|
+
[NODE_INSPECT_CUSTOM](): string;
|
|
147
178
|
}
|
|
179
|
+
export {};
|
|
148
180
|
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/types/encryption.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/types/encryption.js"],"names":[],"mappings":"AAEA,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;AAC/F,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAA;AAEjF,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;CACxC;AAED,mEAAmE;AACnE,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAA;IACvC,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,+FAA+F;IAC/F,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAChC;AAED,uFAAuF;AACvF,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE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,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;IAIlB;;;;OAIG;IACH,CAAC,mBAAmB,CAAC,IAAI,MAAM;CAGhC"}
|
package/dist/types/encryption.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { md5Base64 } from "../util/md5.js";
|
|
1
2
|
//#region src/types/encryption.ts
|
|
2
3
|
/** Named constants for the supported server-side encryption algorithms. */
|
|
3
4
|
var EncryptionAlgorithm = {
|
|
@@ -56,233 +57,61 @@ function bytesToBase64(bytes) {
|
|
|
56
57
|
for (const b of bytes) binary += String.fromCharCode(b);
|
|
57
58
|
return btoa(binary);
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
* @returns The base64-encoded MD5 digest.
|
|
73
|
-
*/
|
|
74
|
-
async function md5Base64(bytes) {
|
|
75
|
-
try {
|
|
76
|
-
const { createHash } = await import("node:crypto");
|
|
77
|
-
if (typeof createHash !== "function") throw new Error("createHash unavailable");
|
|
78
|
-
return createHash("md5").update(bytes).digest("base64");
|
|
79
|
-
} catch {
|
|
80
|
-
return bytesToBase64(md5Bytes(bytes));
|
|
81
|
-
}
|
|
60
|
+
var SSE_C_KEY_REDACTION = "[redacted SSE-C key]";
|
|
61
|
+
var NODE_INSPECT_CUSTOM = Symbol.for("nodejs.util.inspect.custom");
|
|
62
|
+
function sseCKeyRedactedJson(key, options) {
|
|
63
|
+
return {
|
|
64
|
+
...options.mode !== void 0 ? { mode: options.mode } : {},
|
|
65
|
+
algorithm: key.algorithm,
|
|
66
|
+
customerKey: SSE_C_KEY_REDACTION,
|
|
67
|
+
customerKeyMd5: SSE_C_KEY_REDACTION
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function sseCKeyRedactedString(options) {
|
|
71
|
+
return `[${options.label} ${SSE_C_KEY_REDACTION}]`;
|
|
82
72
|
}
|
|
83
73
|
/**
|
|
84
|
-
*
|
|
85
|
-
* input. Used as a browser fallback for SSE-C key MD5 computation; not
|
|
86
|
-
* intended for security-sensitive purposes (MD5 is broken cryptographically).
|
|
74
|
+
* Wraps SSE-C key material so diagnostic stringification redacts key fields.
|
|
87
75
|
*
|
|
88
|
-
*
|
|
76
|
+
* The returned object keeps `customerKey` and `customerKeyMd5` readable by
|
|
77
|
+
* property access for request header construction, but makes them
|
|
78
|
+
* non-enumerable so object spread and generic serializers do not copy them.
|
|
79
|
+
* Callers that need wire headers must read those fields directly.
|
|
89
80
|
*
|
|
90
|
-
* @
|
|
81
|
+
* @param key - SSE-C key material to wrap.
|
|
82
|
+
* @param options - Redaction label and optional encryption mode discriminator.
|
|
83
|
+
*
|
|
84
|
+
* @returns A redacted view with the same readable key fields.
|
|
91
85
|
*/
|
|
92
|
-
function
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
12,
|
|
114
|
-
17,
|
|
115
|
-
22,
|
|
116
|
-
7,
|
|
117
|
-
12,
|
|
118
|
-
17,
|
|
119
|
-
22,
|
|
120
|
-
5,
|
|
121
|
-
9,
|
|
122
|
-
14,
|
|
123
|
-
20,
|
|
124
|
-
5,
|
|
125
|
-
9,
|
|
126
|
-
14,
|
|
127
|
-
20,
|
|
128
|
-
5,
|
|
129
|
-
9,
|
|
130
|
-
14,
|
|
131
|
-
20,
|
|
132
|
-
5,
|
|
133
|
-
9,
|
|
134
|
-
14,
|
|
135
|
-
20,
|
|
136
|
-
4,
|
|
137
|
-
11,
|
|
138
|
-
16,
|
|
139
|
-
23,
|
|
140
|
-
4,
|
|
141
|
-
11,
|
|
142
|
-
16,
|
|
143
|
-
23,
|
|
144
|
-
4,
|
|
145
|
-
11,
|
|
146
|
-
16,
|
|
147
|
-
23,
|
|
148
|
-
4,
|
|
149
|
-
11,
|
|
150
|
-
16,
|
|
151
|
-
23,
|
|
152
|
-
6,
|
|
153
|
-
10,
|
|
154
|
-
15,
|
|
155
|
-
21,
|
|
156
|
-
6,
|
|
157
|
-
10,
|
|
158
|
-
15,
|
|
159
|
-
21,
|
|
160
|
-
6,
|
|
161
|
-
10,
|
|
162
|
-
15,
|
|
163
|
-
21,
|
|
164
|
-
6,
|
|
165
|
-
10,
|
|
166
|
-
15,
|
|
167
|
-
21
|
|
168
|
-
];
|
|
169
|
-
const k = new Uint32Array([
|
|
170
|
-
3614090360,
|
|
171
|
-
3905402710,
|
|
172
|
-
606105819,
|
|
173
|
-
3250441966,
|
|
174
|
-
4118548399,
|
|
175
|
-
1200080426,
|
|
176
|
-
2821735955,
|
|
177
|
-
4249261313,
|
|
178
|
-
1770035416,
|
|
179
|
-
2336552879,
|
|
180
|
-
4294925233,
|
|
181
|
-
2304563134,
|
|
182
|
-
1804603682,
|
|
183
|
-
4254626195,
|
|
184
|
-
2792965006,
|
|
185
|
-
1236535329,
|
|
186
|
-
4129170786,
|
|
187
|
-
3225465664,
|
|
188
|
-
643717713,
|
|
189
|
-
3921069994,
|
|
190
|
-
3593408605,
|
|
191
|
-
38016083,
|
|
192
|
-
3634488961,
|
|
193
|
-
3889429448,
|
|
194
|
-
568446438,
|
|
195
|
-
3275163606,
|
|
196
|
-
4107603335,
|
|
197
|
-
1163531501,
|
|
198
|
-
2850285829,
|
|
199
|
-
4243563512,
|
|
200
|
-
1735328473,
|
|
201
|
-
2368359562,
|
|
202
|
-
4294588738,
|
|
203
|
-
2272392833,
|
|
204
|
-
1839030562,
|
|
205
|
-
4259657740,
|
|
206
|
-
2763975236,
|
|
207
|
-
1272893353,
|
|
208
|
-
4139469664,
|
|
209
|
-
3200236656,
|
|
210
|
-
681279174,
|
|
211
|
-
3936430074,
|
|
212
|
-
3572445317,
|
|
213
|
-
76029189,
|
|
214
|
-
3654602809,
|
|
215
|
-
3873151461,
|
|
216
|
-
530742520,
|
|
217
|
-
3299628645,
|
|
218
|
-
4096336452,
|
|
219
|
-
1126891415,
|
|
220
|
-
2878612391,
|
|
221
|
-
4237533241,
|
|
222
|
-
1700485571,
|
|
223
|
-
2399980690,
|
|
224
|
-
4293915773,
|
|
225
|
-
2240044497,
|
|
226
|
-
1873313359,
|
|
227
|
-
4264355552,
|
|
228
|
-
2734768916,
|
|
229
|
-
1309151649,
|
|
230
|
-
4149444226,
|
|
231
|
-
3174756917,
|
|
232
|
-
718787259,
|
|
233
|
-
3951481745
|
|
234
|
-
]);
|
|
235
|
-
let a0 = 1732584193;
|
|
236
|
-
let b0 = 4023233417;
|
|
237
|
-
let c0 = 2562383102;
|
|
238
|
-
let d0 = 271733878;
|
|
239
|
-
const m = /* @__PURE__ */ new Uint32Array(16);
|
|
240
|
-
const view = new DataView(padded.buffer);
|
|
241
|
-
for (let block = 0; block < padded.byteLength; block += 64) {
|
|
242
|
-
for (let i = 0; i < 16; i++) m[i] = view.getUint32(block + i * 4, true);
|
|
243
|
-
let A = a0;
|
|
244
|
-
let B = b0;
|
|
245
|
-
let C = c0;
|
|
246
|
-
let D = d0;
|
|
247
|
-
for (let i = 0; i < 64; i++) {
|
|
248
|
-
let f;
|
|
249
|
-
let g;
|
|
250
|
-
if (i < 16) {
|
|
251
|
-
f = B & C | ~B & D;
|
|
252
|
-
g = i;
|
|
253
|
-
} else if (i < 32) {
|
|
254
|
-
f = D & B | ~D & C;
|
|
255
|
-
g = (5 * i + 1) % 16;
|
|
256
|
-
} else if (i < 48) {
|
|
257
|
-
f = B ^ C ^ D;
|
|
258
|
-
g = (3 * i + 5) % 16;
|
|
259
|
-
} else {
|
|
260
|
-
f = C ^ (B | ~D);
|
|
261
|
-
g = 7 * i % 16;
|
|
262
|
-
}
|
|
263
|
-
const temp = D;
|
|
264
|
-
D = C;
|
|
265
|
-
C = B;
|
|
266
|
-
const sum = A + f + (k[i] ?? 0) + (m[g] ?? 0) >>> 0;
|
|
267
|
-
const shift = s[i] ?? 0;
|
|
268
|
-
const rotated = (sum << shift | sum >>> 32 - shift) >>> 0;
|
|
269
|
-
B = B + rotated >>> 0;
|
|
270
|
-
A = temp;
|
|
86
|
+
function redactSseCKeyMaterial(key, options) {
|
|
87
|
+
const redacted = {
|
|
88
|
+
...options.mode !== void 0 ? { mode: options.mode } : {},
|
|
89
|
+
algorithm: key.algorithm
|
|
90
|
+
};
|
|
91
|
+
Object.defineProperties(redacted, {
|
|
92
|
+
customerKey: {
|
|
93
|
+
value: key.customerKey,
|
|
94
|
+
enumerable: false
|
|
95
|
+
},
|
|
96
|
+
customerKeyMd5: {
|
|
97
|
+
value: key.customerKeyMd5,
|
|
98
|
+
enumerable: false
|
|
99
|
+
},
|
|
100
|
+
toJSON: {
|
|
101
|
+
value: () => sseCKeyRedactedJson(key, options),
|
|
102
|
+
enumerable: false
|
|
103
|
+
},
|
|
104
|
+
toString: {
|
|
105
|
+
value: () => sseCKeyRedactedString(options),
|
|
106
|
+
enumerable: false
|
|
271
107
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const outView = new DataView(out.buffer);
|
|
279
|
-
outView.setUint32(0, a0, true);
|
|
280
|
-
outView.setUint32(4, b0, true);
|
|
281
|
-
outView.setUint32(8, c0, true);
|
|
282
|
-
outView.setUint32(12, d0, true);
|
|
283
|
-
return out;
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(redacted, NODE_INSPECT_CUSTOM, {
|
|
110
|
+
value: () => sseCKeyRedactedString(options),
|
|
111
|
+
enumerable: false
|
|
112
|
+
});
|
|
113
|
+
return redacted;
|
|
284
114
|
}
|
|
285
|
-
var KEY_REDACTED = "[redacted SSE-C key]";
|
|
286
115
|
/**
|
|
287
116
|
* Safe wrapper around an SSE-C customer key. Hides the key bytes from
|
|
288
117
|
* `JSON.stringify`, `console.log`, and Node's `util.inspect`. Use {@link EncryptionKey.fromBytes}
|
|
@@ -345,12 +174,10 @@ var EncryptionKey = class EncryptionKey {
|
|
|
345
174
|
* replaced with a placeholder string.
|
|
346
175
|
*/
|
|
347
176
|
toJSON() {
|
|
348
|
-
return {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
customerKeyMd5: KEY_REDACTED
|
|
353
|
-
};
|
|
177
|
+
return sseCKeyRedactedJson(this, {
|
|
178
|
+
label: "EncryptionKey SSE-C",
|
|
179
|
+
mode: this.mode
|
|
180
|
+
});
|
|
354
181
|
}
|
|
355
182
|
/**
|
|
356
183
|
* Hides the key bytes from default `toString()`.
|
|
@@ -358,18 +185,18 @@ var EncryptionKey = class EncryptionKey {
|
|
|
358
185
|
* @returns A short opaque label indicating this is an SSE-C key.
|
|
359
186
|
*/
|
|
360
187
|
toString() {
|
|
361
|
-
return
|
|
188
|
+
return sseCKeyRedactedString({ label: "EncryptionKey SSE-C" });
|
|
362
189
|
}
|
|
363
190
|
/**
|
|
364
191
|
* Hides the key bytes from Node's `util.inspect` (and therefore `console.log`).
|
|
365
192
|
*
|
|
366
193
|
* @returns A short opaque label indicating this is an SSE-C key.
|
|
367
194
|
*/
|
|
368
|
-
[
|
|
195
|
+
[NODE_INSPECT_CUSTOM]() {
|
|
369
196
|
return this.toString();
|
|
370
197
|
}
|
|
371
198
|
};
|
|
372
199
|
//#endregion
|
|
373
|
-
export { EncryptionAlgorithm, EncryptionKey, EncryptionMode, SSE_B2, SSE_NONE, sseCustomer };
|
|
200
|
+
export { EncryptionAlgorithm, EncryptionKey, EncryptionMode, SSE_B2, SSE_C_KEY_REDACTION, SSE_NONE, redactSseCKeyMaterial, sseCustomer };
|
|
374
201
|
|
|
375
202
|
//# sourceMappingURL=encryption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.js","names":[],"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/** Server-side encryption using customer-provided keys as returned by B2 responses. */\nexport interface SseCPublicSetting {\n /** Encryption mode discriminator. Always `'SSE-C'`. */\n readonly mode: 'SSE-C'\n /** Encryption algorithm. Always `'AES256'`. */\n readonly algorithm: EncryptionAlgorithm\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/** No-encryption shape returned by B2 response objects. */\nexport interface NoEncryptionWireSetting {\n /** Encryption mode discriminator. B2 response payloads use null for no encryption. */\n readonly mode: null\n /** Encryption algorithm. B2 response payloads use null when no encryption is applied. */\n readonly algorithm: null\n}\n\n/** Union of all server-side encryption settings: B2-managed, customer-provided, or none. */\nexport type EncryptionSetting = SseB2Setting | SseCCustomerSetting | NoEncryption\n\n/** Server-side encryption setting returned by B2 response objects. */\nexport type PublicEncryptionSetting =\n | SseB2Setting\n | SseCPublicSetting\n | NoEncryption\n | NoEncryptionWireSetting\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"],"mappings":";;AACA,IAAa,sBAAsB;;AAEjC,QAAQ,SACV;;;;;;;;;;AAcA,IAAa,iBAAiB;;CAE5B,OAAO;;CAEP,MAAM;;CAEN,MAAM;AACR;;AA0DA,IAAa,SAAuB;CAAE,MAAM;CAAU,WAAW;AAAS;;AAG1E,IAAa,WAAyB,EAAE,MAAM,OAAO;;;;;;;;AASrD,SAAgB,YAAY,aAAqB,gBAA6C;CAC5F,OAAO;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;EACA,OAAO;GACL,MAAM,KAAK;GACX,WAAW,KAAK;GAChB,aAAa;GACb,gBAAgB;EAClB;CACF;;;;;;CAOA,WAAmB;EACjB,OAAO,wBAAwB,aAAa;CAC9C;;;;;;CAOA,CAAC,OAAO,IAAI,4BAA4B,KAAa;EACnD,OAAO,KAAK,SAAS;CACvB;AACF"}
|
|
1
|
+
{"version":3,"file":"encryption.js","names":[],"sources":["../../src/types/encryption.ts"],"sourcesContent":["import { md5Base64 } from '../util/md5.ts'\n\n/** 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/** Server-side encryption using customer-provided keys as returned by B2 responses. */\nexport interface SseCPublicSetting {\n /** Encryption mode discriminator. Always `'SSE-C'`. */\n readonly mode: 'SSE-C'\n /** Encryption algorithm. Always `'AES256'`. */\n readonly algorithm: EncryptionAlgorithm\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/** No-encryption shape returned by B2 response objects. */\nexport interface NoEncryptionWireSetting {\n /** Encryption mode discriminator. B2 response payloads use null for no encryption. */\n readonly mode: null\n /** Encryption algorithm. B2 response payloads use null when no encryption is applied. */\n readonly algorithm: null\n}\n\n/** Union of all server-side encryption settings: B2-managed, customer-provided, or none. */\nexport type EncryptionSetting = SseB2Setting | SseCCustomerSetting | NoEncryption\n\n/** Server-side encryption setting returned by B2 response objects. */\nexport type PublicEncryptionSetting =\n | SseB2Setting\n | SseCPublicSetting\n | NoEncryption\n | NoEncryptionWireSetting\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\nexport const SSE_C_KEY_REDACTION = '[redacted SSE-C key]'\n\nconst NODE_INSPECT_CUSTOM = Symbol.for('nodejs.util.inspect.custom')\n\ninterface SseCKeyMaterial {\n readonly algorithm: EncryptionAlgorithm\n readonly customerKey: string\n readonly customerKeyMd5: string\n}\n\ninterface SseCKeyRedactionOptions {\n readonly label: string\n readonly mode?: 'SSE-C'\n}\n\ninterface RedactedSseCKeyJson {\n readonly mode?: 'SSE-C'\n readonly algorithm: EncryptionAlgorithm\n readonly customerKey: string\n readonly customerKeyMd5: string\n}\n\nfunction sseCKeyRedactedJson(\n key: SseCKeyMaterial,\n options: SseCKeyRedactionOptions,\n): RedactedSseCKeyJson {\n return {\n ...(options.mode !== undefined ? { mode: options.mode } : {}),\n algorithm: key.algorithm,\n customerKey: SSE_C_KEY_REDACTION,\n // The MD5 is not secret key material, but it is still derived from a\n // customer-provided key. Keep logged key views fully opaque by default.\n customerKeyMd5: SSE_C_KEY_REDACTION,\n }\n}\n\nfunction sseCKeyRedactedString(options: SseCKeyRedactionOptions): string {\n return `[${options.label} ${SSE_C_KEY_REDACTION}]`\n}\n\n/**\n * Wraps SSE-C key material so diagnostic stringification redacts key fields.\n *\n * The returned object keeps `customerKey` and `customerKeyMd5` readable by\n * property access for request header construction, but makes them\n * non-enumerable so object spread and generic serializers do not copy them.\n * Callers that need wire headers must read those fields directly.\n *\n * @param key - SSE-C key material to wrap.\n * @param options - Redaction label and optional encryption mode discriminator.\n *\n * @returns A redacted view with the same readable key fields.\n */\nexport function redactSseCKeyMaterial<T extends SseCKeyMaterial>(\n key: T,\n options: SseCKeyRedactionOptions,\n): T {\n const redacted = {\n ...(options.mode !== undefined ? { mode: options.mode } : {}),\n algorithm: key.algorithm,\n } as T & {\n toJSON(): RedactedSseCKeyJson\n toString(): string\n }\n\n Object.defineProperties(redacted, {\n customerKey: { value: key.customerKey, enumerable: false },\n customerKeyMd5: { value: key.customerKeyMd5, enumerable: false },\n toJSON: { value: () => sseCKeyRedactedJson(key, options), enumerable: false },\n toString: { value: () => sseCKeyRedactedString(options), enumerable: false },\n })\n Object.defineProperty(redacted, NODE_INSPECT_CUSTOM, {\n value: () => sseCKeyRedactedString(options),\n enumerable: false,\n })\n\n return redacted\n}\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 sseCKeyRedactedJson(this, { label: 'EncryptionKey SSE-C', mode: this.mode }) as {\n mode: 'SSE-C'\n algorithm: EncryptionAlgorithm\n customerKey: string\n customerKeyMd5: string\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 sseCKeyRedactedString({ label: 'EncryptionKey SSE-C' })\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 [NODE_INS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KAAK,OAAO;GAAG,YAAY;EAAM;EAC5E,UAAU;GAAE,aAAa,sBAAsB,OAAO;GAAG,YAAY;EAAM;CAC7E,CAAC;CACD,OAAO,eAAe,UAAU,qBAAqB;EACnD,aAAa,sBAAsB,OAAO;EAC1C,YAAY;CACd,CAAC;CAED,OAAO;AACT;;;;;;AAOA,IAAa,gBAAb,MAAa,cAAc;;CAEzB,OAAgB;;CAEhB,YAA0C;;CAE1C;;CAEA;;;;;;;;;;CAWA,YAAoB,aAAqB,gBAAwB;EAC/D,KAAK,cAAc;EACnB,KAAK,iBAAiB;CACxB;;;;;;;;;;;CAYA,aAAa,UAAU,QAA4C;EACjE,IAAI,OAAO,eAAe,IACxB,MAAM,IAAI,MAAM,sDAAsD,OAAO,WAAW,EAAE;EAE5F,MAAM,cAAc,cAAc,MAAM;EACxC,MAAM,iBAAiB,MAAM,UAAU,MAAM;EAC7C,OAAO,IAAI,cAAc,aAAa,cAAc;CACtD;;;;;;;;;;CAWA,OAAO,WAAW,aAAqB,gBAAuC;EAC5E,OAAO,IAAI,cAAc,aAAa,cAAc;CACtD;;;;;;;CAQA,SASE;EACA,OAAO,oBAAoB,MAAM;GAAE,OAAO;GAAuB,MAAM,KAAK;EAAK,CAAC;CAMpF;;;;;;CAOA,WAAmB;EACjB,OAAO,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;CAC/D;;;;;;CAOA,CAAC,uBAA+B;EAC9B,OAAO,KAAK,SAAS;CACvB;AACF"}
|
package/dist/types/errors.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var KNOWN_B2_ERROR_CODES = [
|
|
|
20
20
|
"duplicate_bucket_name",
|
|
21
21
|
"too_many_buckets",
|
|
22
22
|
"too_many_files",
|
|
23
|
+
"too_many_members",
|
|
23
24
|
"cap_exceeded",
|
|
24
25
|
"storage_cap_exceeded",
|
|
25
26
|
"transaction_cap_exceeded",
|
|
@@ -28,9 +29,16 @@ var KNOWN_B2_ERROR_CODES = [
|
|
|
28
29
|
"service_unavailable",
|
|
29
30
|
"internal_error",
|
|
30
31
|
"bad_json",
|
|
32
|
+
"invalid_account_id",
|
|
31
33
|
"invalid_bucket_id",
|
|
32
34
|
"invalid_bucket_name",
|
|
33
35
|
"invalid_bucket_info",
|
|
36
|
+
"invalid_computer_id",
|
|
37
|
+
"invalid_email",
|
|
38
|
+
"invalid_group_id",
|
|
39
|
+
"invalid_member_account_id",
|
|
40
|
+
"invalid_region",
|
|
41
|
+
"invalid_sms_phone",
|
|
34
42
|
"file_not_present",
|
|
35
43
|
"no_such_file",
|
|
36
44
|
"out_of_range",
|
|
@@ -39,6 +47,7 @@ var KNOWN_B2_ERROR_CODES = [
|
|
|
39
47
|
"invalid_file_name",
|
|
40
48
|
"invalid_file_info",
|
|
41
49
|
"invalid_part_number",
|
|
50
|
+
"method_failure",
|
|
42
51
|
"bad_sha1_checksum"
|
|
43
52
|
];
|
|
44
53
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","names":[],"sources":["../../src/types/errors.ts"],"sourcesContent":["/**\n * B2 API error codes documented by the SDK.\n * This list drives `KnownB2ErrorCode`; `B2ErrorCode` adds a string fallback\n * so callers can receive unknown future server codes while keeping autocomplete\n * for known values.\n */\nexport const KNOWN_B2_ERROR_CODES = [\n 'expired_auth_token',\n 'bad_auth_token',\n 'unauthorized',\n 'bad_request',\n 'bad_bucket_name',\n 'bad_bucket_id',\n 'not_found',\n 'method_not_allowed',\n 'request_timeout',\n 'too_many_requests',\n 'conflict',\n 'duplicate_bucket_name',\n 'too_many_buckets',\n 'too_many_files',\n 'cap_exceeded',\n 'storage_cap_exceeded',\n 'transaction_cap_exceeded',\n 'download_cap_exceeded',\n 'access_denied',\n 'service_unavailable',\n 'internal_error',\n 'bad_json',\n 'invalid_bucket_id',\n 'invalid_bucket_name',\n 'invalid_bucket_info',\n 'file_not_present',\n 'no_such_file',\n 'out_of_range',\n 'range_not_satisfiable',\n 'invalid_file_id',\n 'invalid_file_name',\n 'invalid_file_info',\n 'invalid_part_number',\n 'bad_sha1_checksum',\n] as const\n\n/** B2 error codes documented by the SDK and classified exhaustively. */\nexport type KnownB2ErrorCode = (typeof KNOWN_B2_ERROR_CODES)[number]\n\n/**\n * B2 API error code value.\n * Known codes are enumerated for autocomplete; unknown future server codes are\n * still accepted as strings.\n */\nexport type B2ErrorCode = KnownB2ErrorCode | (string & {})\n\n/** Standard error response body returned by the B2 API on failure. */\nexport interface B2ErrorResponse {\n /** HTTP status code from the B2 API response. */\n readonly status: number\n /** Machine-readable error code identifying the specific failure. */\n readonly code: B2ErrorCode\n /** Human-readable description of the error. */\n readonly message: string\n}\n"],"mappings":";;;;;;;AAMA,IAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"errors.cjs","names":[],"sources":["../../src/types/errors.ts"],"sourcesContent":["/**\n * B2 API error codes documented by the SDK.\n * This list drives `KnownB2ErrorCode`; `B2ErrorCode` adds a string fallback\n * so callers can receive unknown future server codes while keeping autocomplete\n * for known values.\n */\nexport const KNOWN_B2_ERROR_CODES = [\n 'expired_auth_token',\n 'bad_auth_token',\n 'unauthorized',\n 'bad_request',\n 'bad_bucket_name',\n 'bad_bucket_id',\n 'not_found',\n 'method_not_allowed',\n 'request_timeout',\n 'too_many_requests',\n 'conflict',\n 'duplicate_bucket_name',\n 'too_many_buckets',\n 'too_many_files',\n 'too_many_members',\n 'cap_exceeded',\n 'storage_cap_exceeded',\n 'transaction_cap_exceeded',\n 'download_cap_exceeded',\n 'access_denied',\n 'service_unavailable',\n 'internal_error',\n 'bad_json',\n 'invalid_account_id',\n 'invalid_bucket_id',\n 'invalid_bucket_name',\n 'invalid_bucket_info',\n 'invalid_computer_id',\n 'invalid_email',\n 'invalid_group_id',\n 'invalid_member_account_id',\n 'invalid_region',\n 'invalid_sms_phone',\n 'file_not_present',\n 'no_such_file',\n 'out_of_range',\n 'range_not_satisfiable',\n 'invalid_file_id',\n 'invalid_file_name',\n 'invalid_file_info',\n 'invalid_part_number',\n 'method_failure',\n 'bad_sha1_checksum',\n] as const\n\n/** B2 error codes documented by the SDK and classified exhaustively. */\nexport type KnownB2ErrorCode = (typeof KNOWN_B2_ERROR_CODES)[number]\n\n/**\n * B2 API error code value.\n * Known codes are enumerated for autocomplete; unknown future server codes are\n * still accepted as strings.\n */\nexport type B2ErrorCode = KnownB2ErrorCode | (string & {})\n\n/** Standard error response body returned by the B2 API on failure. */\nexport interface B2ErrorResponse {\n /** HTTP status code from the B2 API response. */\n readonly status: number\n /** Machine-readable error code identifying the specific failure. */\n readonly code: B2ErrorCode\n /** Human-readable description of the error. */\n readonly message: string\n}\n"],"mappings":";;;;;;;AAMA,IAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
package/dist/types/errors.d.cts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* so callers can receive unknown future server codes while keeping autocomplete
|
|
5
5
|
* for known values.
|
|
6
6
|
*/
|
|
7
|
-
export declare const KNOWN_B2_ERROR_CODES: readonly ["expired_auth_token", "bad_auth_token", "unauthorized", "bad_request", "bad_bucket_name", "bad_bucket_id", "not_found", "method_not_allowed", "request_timeout", "too_many_requests", "conflict", "duplicate_bucket_name", "too_many_buckets", "too_many_files", "cap_exceeded", "storage_cap_exceeded", "transaction_cap_exceeded", "download_cap_exceeded", "access_denied", "service_unavailable", "internal_error", "bad_json", "invalid_bucket_id", "invalid_bucket_name", "invalid_bucket_info", "file_not_present", "no_such_file", "out_of_range", "range_not_satisfiable", "invalid_file_id", "invalid_file_name", "invalid_file_info", "invalid_part_number", "bad_sha1_checksum"];
|
|
7
|
+
export declare const KNOWN_B2_ERROR_CODES: readonly ["expired_auth_token", "bad_auth_token", "unauthorized", "bad_request", "bad_bucket_name", "bad_bucket_id", "not_found", "method_not_allowed", "request_timeout", "too_many_requests", "conflict", "duplicate_bucket_name", "too_many_buckets", "too_many_files", "too_many_members", "cap_exceeded", "storage_cap_exceeded", "transaction_cap_exceeded", "download_cap_exceeded", "access_denied", "service_unavailable", "internal_error", "bad_json", "invalid_account_id", "invalid_bucket_id", "invalid_bucket_name", "invalid_bucket_info", "invalid_computer_id", "invalid_email", "invalid_group_id", "invalid_member_account_id", "invalid_region", "invalid_sms_phone", "file_not_present", "no_such_file", "out_of_range", "range_not_satisfiable", "invalid_file_id", "invalid_file_name", "invalid_file_info", "invalid_part_number", "method_failure", "bad_sha1_checksum"];
|
|
8
8
|
/** B2 error codes documented by the SDK and classified exhaustively. */
|
|
9
9
|
export type KnownB2ErrorCode = (typeof KNOWN_B2_ERROR_CODES)[number];
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,o2BA4CvB,CAAA;AAEV,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpE;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAE1D,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"}
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* so callers can receive unknown future server codes while keeping autocomplete
|
|
5
5
|
* for known values.
|
|
6
6
|
*/
|
|
7
|
-
export declare const KNOWN_B2_ERROR_CODES: readonly ["expired_auth_token", "bad_auth_token", "unauthorized", "bad_request", "bad_bucket_name", "bad_bucket_id", "not_found", "method_not_allowed", "request_timeout", "too_many_requests", "conflict", "duplicate_bucket_name", "too_many_buckets", "too_many_files", "cap_exceeded", "storage_cap_exceeded", "transaction_cap_exceeded", "download_cap_exceeded", "access_denied", "service_unavailable", "internal_error", "bad_json", "invalid_bucket_id", "invalid_bucket_name", "invalid_bucket_info", "file_not_present", "no_such_file", "out_of_range", "range_not_satisfiable", "invalid_file_id", "invalid_file_name", "invalid_file_info", "invalid_part_number", "bad_sha1_checksum"];
|
|
7
|
+
export declare const KNOWN_B2_ERROR_CODES: readonly ["expired_auth_token", "bad_auth_token", "unauthorized", "bad_request", "bad_bucket_name", "bad_bucket_id", "not_found", "method_not_allowed", "request_timeout", "too_many_requests", "conflict", "duplicate_bucket_name", "too_many_buckets", "too_many_files", "too_many_members", "cap_exceeded", "storage_cap_exceeded", "transaction_cap_exceeded", "download_cap_exceeded", "access_denied", "service_unavailable", "internal_error", "bad_json", "invalid_account_id", "invalid_bucket_id", "invalid_bucket_name", "invalid_bucket_info", "invalid_computer_id", "invalid_email", "invalid_group_id", "invalid_member_account_id", "invalid_region", "invalid_sms_phone", "file_not_present", "no_such_file", "out_of_range", "range_not_satisfiable", "invalid_file_id", "invalid_file_name", "invalid_file_info", "invalid_part_number", "method_failure", "bad_sha1_checksum"];
|
|
8
8
|
/** B2 error codes documented by the SDK and classified exhaustively. */
|
|
9
9
|
export type KnownB2ErrorCode = (typeof KNOWN_B2_ERROR_CODES)[number];
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,o2BA4CvB,CAAA;AAEV,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpE;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAE1D,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"}
|
package/dist/types/errors.js
CHANGED
|
@@ -20,6 +20,7 @@ var KNOWN_B2_ERROR_CODES = [
|
|
|
20
20
|
"duplicate_bucket_name",
|
|
21
21
|
"too_many_buckets",
|
|
22
22
|
"too_many_files",
|
|
23
|
+
"too_many_members",
|
|
23
24
|
"cap_exceeded",
|
|
24
25
|
"storage_cap_exceeded",
|
|
25
26
|
"transaction_cap_exceeded",
|
|
@@ -28,9 +29,16 @@ var KNOWN_B2_ERROR_CODES = [
|
|
|
28
29
|
"service_unavailable",
|
|
29
30
|
"internal_error",
|
|
30
31
|
"bad_json",
|
|
32
|
+
"invalid_account_id",
|
|
31
33
|
"invalid_bucket_id",
|
|
32
34
|
"invalid_bucket_name",
|
|
33
35
|
"invalid_bucket_info",
|
|
36
|
+
"invalid_computer_id",
|
|
37
|
+
"invalid_email",
|
|
38
|
+
"invalid_group_id",
|
|
39
|
+
"invalid_member_account_id",
|
|
40
|
+
"invalid_region",
|
|
41
|
+
"invalid_sms_phone",
|
|
34
42
|
"file_not_present",
|
|
35
43
|
"no_such_file",
|
|
36
44
|
"out_of_range",
|
|
@@ -39,6 +47,7 @@ var KNOWN_B2_ERROR_CODES = [
|
|
|
39
47
|
"invalid_file_name",
|
|
40
48
|
"invalid_file_info",
|
|
41
49
|
"invalid_part_number",
|
|
50
|
+
"method_failure",
|
|
42
51
|
"bad_sha1_checksum"
|
|
43
52
|
];
|
|
44
53
|
//#endregion
|