@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
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
const require_abort = require("../util/abort.cjs");
|
|
2
|
+
const require_retry = require("../http/retry.cjs");
|
|
3
|
+
const require_realms = require("../auth/realms.cjs");
|
|
4
|
+
const require_url_guard = require("../http/url-guard.cjs");
|
|
5
|
+
const require_transport = require("../http/transport.cjs");
|
|
6
|
+
const require_in_memory = require("./in-memory.cjs");
|
|
7
|
+
const require_raw = require("./raw.cjs");
|
|
8
|
+
//#region src/partner/auth-core.ts
|
|
9
|
+
/**
|
|
10
|
+
* Internal Partner authorization state machine shared by public facades.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
var PartnerAuthCore = class {
|
|
15
|
+
/** Low-level Partner raw client used for authorization and Partner endpoints. */
|
|
16
|
+
raw;
|
|
17
|
+
/** Partner authorization state storage. */
|
|
18
|
+
partnerAccountInfo;
|
|
19
|
+
/** Default transport URL guard, or null when a custom transport owns guarding. */
|
|
20
|
+
urlGuard;
|
|
21
|
+
/** Retry-wrapped transport shared by facade-specific raw clients. */
|
|
22
|
+
transport;
|
|
23
|
+
/** Endpoint suffixes validated from cached authorization during construction. */
|
|
24
|
+
cachedEndpointSuffixes;
|
|
25
|
+
/** Resolved Partner authorize realm URL. */
|
|
26
|
+
realmUrl;
|
|
27
|
+
/** Whether custom authorize realms are trusted. */
|
|
28
|
+
allowCustomAuthorizeRealm;
|
|
29
|
+
#masterKeyId;
|
|
30
|
+
#masterKey;
|
|
31
|
+
additionalAllowedSuffixes;
|
|
32
|
+
disableSsrfGuard;
|
|
33
|
+
#inflightReauth = null;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a shared Partner authorization core.
|
|
36
|
+
*
|
|
37
|
+
* @param options - Credentials, state storage, transport, retry, and guard settings.
|
|
38
|
+
*/
|
|
39
|
+
constructor(options) {
|
|
40
|
+
this.#masterKeyId = options.masterKeyId;
|
|
41
|
+
this.#masterKey = options.masterKey;
|
|
42
|
+
this.realmUrl = require_realms.getRealmUrl(options.realm ?? "production");
|
|
43
|
+
this.partnerAccountInfo = options.partnerAccountInfo ?? new require_in_memory.InMemoryPartnerAccountInfo();
|
|
44
|
+
this.additionalAllowedSuffixes = options.additionalAllowedHostSuffixes;
|
|
45
|
+
this.disableSsrfGuard = options.disableSsrfGuard ?? false;
|
|
46
|
+
this.allowCustomAuthorizeRealm = options.allowCustomAuthorizeRealm ?? false;
|
|
47
|
+
let baseTransport;
|
|
48
|
+
if (options.transport !== void 0) {
|
|
49
|
+
baseTransport = options.transport;
|
|
50
|
+
this.urlGuard = null;
|
|
51
|
+
} else {
|
|
52
|
+
const urlGuard = new require_url_guard.UrlGuard();
|
|
53
|
+
baseTransport = new require_transport.FetchTransport({
|
|
54
|
+
urlGuard,
|
|
55
|
+
...options.userAgent !== void 0 ? { userAgent: options.userAgent } : {},
|
|
56
|
+
...options.followSameOriginRedirects !== void 0 ? { followSameOriginRedirects: options.followSameOriginRedirects } : {}
|
|
57
|
+
});
|
|
58
|
+
this.urlGuard = urlGuard;
|
|
59
|
+
}
|
|
60
|
+
this.transport = new require_transport.RetryTransport({
|
|
61
|
+
transport: baseTransport,
|
|
62
|
+
retry: {
|
|
63
|
+
...require_retry.DEFAULT_RETRY_OPTIONS,
|
|
64
|
+
...options.retry
|
|
65
|
+
},
|
|
66
|
+
onReauth: (signal) => this.reauthorize(signal)
|
|
67
|
+
});
|
|
68
|
+
this.cachedEndpointSuffixes = this.validateCachedAuth();
|
|
69
|
+
if (this.cachedEndpointSuffixes !== void 0) this.lockUrlGuardFromSuffixes(this.cachedEndpointSuffixes);
|
|
70
|
+
this.raw = new require_raw.PartnerRawClient({
|
|
71
|
+
transport: this.transport,
|
|
72
|
+
...this.cachedEndpointSuffixes !== void 0 ? { authorizedPartnerEndpointSuffixes: this.cachedEndpointSuffixes } : {},
|
|
73
|
+
...options.allowCustomAuthorizeRealm !== void 0 ? { allowCustomAuthorizeRealm: options.allowCustomAuthorizeRealm } : {}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Authenticates with B2 Partner authorization and stores the authorization state.
|
|
78
|
+
*
|
|
79
|
+
* @param options - Optional abort signal.
|
|
80
|
+
*
|
|
81
|
+
* @returns The normalized Partner authorization response.
|
|
82
|
+
*/
|
|
83
|
+
async authorize(options) {
|
|
84
|
+
require_abort.throwIfSignalAborted(options?.signal);
|
|
85
|
+
const auth = await this.raw.authorizePartner(this.#masterKeyId, this.#masterKey, this.realmUrl, options?.signal !== void 0 ? { signal: options.signal } : void 0);
|
|
86
|
+
require_abort.throwIfSignalAborted(options?.signal);
|
|
87
|
+
this.partnerAccountInfo.setAuth(auth);
|
|
88
|
+
this.lockUrlGuard(auth);
|
|
89
|
+
return auth;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Locks the default transport URL guard to suffixes from a validated auth response.
|
|
93
|
+
*
|
|
94
|
+
* @param auth - Partner authorization response to derive suffixes from.
|
|
95
|
+
*/
|
|
96
|
+
lockUrlGuard(auth) {
|
|
97
|
+
this.lockUrlGuardFromSuffixes(require_raw.derivePartnerAllowedSuffixes(auth, this.realmUrl));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Locks the default transport URL guard to previously validated endpoint suffixes.
|
|
101
|
+
*
|
|
102
|
+
* @param derived - Validated endpoint suffixes.
|
|
103
|
+
*/
|
|
104
|
+
lockUrlGuardFromSuffixes(derived) {
|
|
105
|
+
if (this.urlGuard === null) return;
|
|
106
|
+
const merged = this.disableSsrfGuard === true ? [] : this.additionalAllowedSuffixes !== void 0 ? Array.from(/* @__PURE__ */ new Set([...derived, ...this.additionalAllowedSuffixes])) : derived;
|
|
107
|
+
this.urlGuard.setAllowedSuffixes(merged);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validates a Partner authorization snapshot and returns endpoint suffixes.
|
|
111
|
+
*
|
|
112
|
+
* @param auth - Partner authorization response to validate.
|
|
113
|
+
*
|
|
114
|
+
* @returns Host suffixes safe for Partner-token endpoint requests.
|
|
115
|
+
*
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
validateEndpointSuffixes(auth) {
|
|
119
|
+
return require_raw.validatePartnerAuthorizeResponseEndpoints(auth, this.realmUrl, this.allowCustomAuthorizeRealm);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Validates an auth snapshot, locks the default URL guard, and returns endpoint suffixes.
|
|
123
|
+
*
|
|
124
|
+
* @param auth - Partner authorization response to validate and activate.
|
|
125
|
+
*
|
|
126
|
+
* @returns Host suffixes safe for Partner-token endpoint requests.
|
|
127
|
+
*
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
activateEndpointSuffixes(auth) {
|
|
131
|
+
const suffixes = this.validateEndpointSuffixes(auth);
|
|
132
|
+
this.lockUrlGuardFromSuffixes(suffixes);
|
|
133
|
+
return suffixes;
|
|
134
|
+
}
|
|
135
|
+
validateCachedAuth() {
|
|
136
|
+
const cachedAuth = this.partnerAccountInfo.getAuth();
|
|
137
|
+
if (cachedAuth === null) return void 0;
|
|
138
|
+
try {
|
|
139
|
+
return this.validateEndpointSuffixes(cachedAuth);
|
|
140
|
+
} catch {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
reauthorize(signal) {
|
|
145
|
+
require_abort.throwIfSignalAborted(signal);
|
|
146
|
+
const inflight = this.#inflightReauth ?? this.startReauthorize();
|
|
147
|
+
inflight.waiters += 1;
|
|
148
|
+
return require_abort.raceWithAbort(inflight.promise, signal).finally(() => {
|
|
149
|
+
inflight.waiters -= 1;
|
|
150
|
+
if (inflight.waiters === 0 && !inflight.settled && !inflight.controller.signal.aborted) inflight.controller.abort(signal?.aborted === true ? require_abort.abortReason(signal) : void 0);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
startReauthorize() {
|
|
154
|
+
const controller = new AbortController();
|
|
155
|
+
const inflight = {
|
|
156
|
+
controller,
|
|
157
|
+
promise: require_abort.raceWithAbort(this.doReauthorize(controller.signal), controller.signal).finally(() => {
|
|
158
|
+
if (this.#inflightReauth?.controller !== controller) return;
|
|
159
|
+
this.#inflightReauth.settled = true;
|
|
160
|
+
this.#inflightReauth = null;
|
|
161
|
+
}),
|
|
162
|
+
waiters: 0,
|
|
163
|
+
settled: false
|
|
164
|
+
};
|
|
165
|
+
this.#inflightReauth = inflight;
|
|
166
|
+
return inflight;
|
|
167
|
+
}
|
|
168
|
+
async doReauthorize(signal) {
|
|
169
|
+
return (await this.authorize({ signal })).authorizationToken;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
//#endregion
|
|
173
|
+
exports.PartnerAuthCore = PartnerAuthCore;
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=auth-core.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-core.cjs","names":["#masterKeyId","#masterKey","#inflightReauth"],"sources":["../../src/partner/auth-core.ts"],"sourcesContent":["import { getRealmUrl } from '../auth/realms.ts'\nimport { DEFAULT_RETRY_OPTIONS, type RetryOptions } from '../http/retry.ts'\nimport type { HttpTransport } from '../http/transport.ts'\nimport { FetchTransport, RetryTransport } from '../http/transport.ts'\nimport { UrlGuard } from '../http/url-guard.ts'\nimport type { PartnerAuthorizeResponse } from '../types/partner.ts'\nimport { abortReason, raceWithAbort, throwIfSignalAborted } from '../util/abort.ts'\nimport type { PartnerAccountInfo } from './account-info.ts'\nimport { InMemoryPartnerAccountInfo } from './in-memory.ts'\nimport {\n derivePartnerAllowedSuffixes,\n PartnerRawClient,\n validatePartnerAuthorizeResponseEndpoints,\n} from './raw.ts'\n\n/** Shared Partner authorization options used by Partner and Backup facades. */\nexport interface PartnerAuthCoreOptions {\n /** The Master Application Key ID for the partner administrator account. */\n readonly masterKeyId: string\n /** The Master Application Key secret. */\n readonly masterKey: string\n /** B2 realm alias or direct trusted realm URL. Defaults to `\"production\"`. */\n readonly realm?: string\n /** Storage backend for Partner authorization state. */\n readonly partnerAccountInfo?: PartnerAccountInfo\n /** Custom HTTP transport. Defaults to {@link FetchTransport}. */\n readonly transport?: HttpTransport\n /** Override retry behavior for retryable requests. */\n readonly retry?: Partial<RetryOptions>\n /** Custom user-agent string prepended to the SDK default. */\n readonly userAgent?: string\n /** Extra trusted host suffixes to merge into the default SSRF guard. */\n readonly additionalAllowedHostSuffixes?: readonly string[]\n /** Explicitly disable default SSRF guard suffix locking. */\n readonly disableSsrfGuard?: boolean\n /** Whether the default fetch transport may follow same-origin GET/HEAD redirects. */\n readonly followSameOriginRedirects?: boolean\n /** Allow direct custom authorize realms for tests or private proxies. */\n readonly allowCustomAuthorizeRealm?: boolean\n}\n\n/** Options for Partner authorization through {@link PartnerAuthCore}. */\nexport interface PartnerAuthCoreAuthorizeOptions {\n /** Abort signal for cancelling the authorize request. */\n readonly signal?: AbortSignal\n}\n\ninterface InflightPartnerReauth {\n readonly controller: AbortController\n readonly promise: Promise<string>\n waiters: number\n settled: boolean\n}\n\n/**\n * Internal Partner authorization state machine shared by public facades.\n *\n * @internal\n */\nexport class PartnerAuthCore {\n /** Low-level Partner raw client used for authorization and Partner endpoints. */\n readonly raw: PartnerRawClient\n /** Partner authorization state storage. */\n readonly partnerAccountInfo: PartnerAccountInfo\n /** Default transport URL guard, or null when a custom transport owns guarding. */\n readonly urlGuard: UrlGuard | null\n /** Retry-wrapped transport shared by facade-specific raw clients. */\n readonly transport: HttpTransport\n /** Endpoint suffixes validated from cached authorization during construction. */\n readonly cachedEndpointSuffixes: readonly string[] | undefined\n /** Resolved Partner authorize realm URL. */\n private readonly realmUrl: string\n /** Whether custom authorize realms are trusted. */\n private readonly allowCustomAuthorizeRealm: boolean\n readonly #masterKeyId: string\n readonly #masterKey: string\n private readonly additionalAllowedSuffixes: readonly string[] | undefined\n private readonly disableSsrfGuard: boolean\n #inflightReauth: InflightPartnerReauth | null = null\n\n /**\n * Creates a shared Partner authorization core.\n *\n * @param options - Credentials, state storage, transport, retry, and guard settings.\n */\n constructor(options: PartnerAuthCoreOptions) {\n this.#masterKeyId = options.masterKeyId\n this.#masterKey = options.masterKey\n this.realmUrl = getRealmUrl(options.realm ?? 'production')\n this.partnerAccountInfo = options.partnerAccountInfo ?? new InMemoryPartnerAccountInfo()\n this.additionalAllowedSuffixes = options.additionalAllowedHostSuffixes\n this.disableSsrfGuard = options.disableSsrfGuard ?? false\n this.allowCustomAuthorizeRealm = options.allowCustomAuthorizeRealm ?? false\n\n let baseTransport: HttpTransport\n if (options.transport !== undefined) {\n baseTransport = options.transport\n this.urlGuard = null\n } else {\n const urlGuard = new UrlGuard()\n baseTransport = new FetchTransport({\n urlGuard,\n ...(options.userAgent !== undefined ? { userAgent: options.userAgent } : {}),\n ...(options.followSameOriginRedirects !== undefined\n ? { followSameOriginRedirects: options.followSameOriginRedirects }\n : {}),\n })\n this.urlGuard = urlGuard\n }\n\n this.transport = new RetryTransport({\n transport: baseTransport,\n retry: { ...DEFAULT_RETRY_OPTIONS, ...options.retry },\n onReauth: (signal) => this.reauthorize(signal),\n })\n\n this.cachedEndpointSuffixes = this.validateCachedAuth()\n if (this.cachedEndpointSuffixes !== undefined) {\n this.lockUrlGuardFromSuffixes(this.cachedEndpointSuffixes)\n }\n\n this.raw = new PartnerRawClient({\n transport: this.transport,\n ...(this.cachedEndpointSuffixes !== undefined\n ? { authorizedPartnerEndpointSuffixes: this.cachedEndpointSuffixes }\n : {}),\n ...(options.allowCustomAuthorizeRealm !== undefined\n ? { allowCustomAuthorizeRealm: options.allowCustomAuthorizeRealm }\n : {}),\n })\n }\n\n /**\n * Authenticates with B2 Partner authorization and stores the authorization state.\n *\n * @param options - Optional abort signal.\n *\n * @returns The normalized Partner authorization response.\n */\n async authorize(options?: PartnerAuthCoreAuthorizeOptions): Promise<PartnerAuthorizeResponse> {\n throwIfSignalAborted(options?.signal)\n const auth = await this.raw.authorizePartner(\n this.#masterKeyId,\n this.#masterKey,\n this.realmUrl,\n options?.signal !== undefined ? { signal: options.signal } : undefined,\n )\n throwIfSignalAborted(options?.signal)\n this.partnerAccountInfo.setAuth(auth)\n this.lockUrlGuard(auth)\n return auth\n }\n\n /**\n * Locks the default transport URL guard to suffixes from a validated auth response.\n *\n * @param auth - Partner authorization response to derive suffixes from.\n */\n lockUrlGuard(auth: PartnerAuthorizeResponse): void {\n this.lockUrlGuardFromSuffixes(derivePartnerAllowedSuffixes(auth, this.realmUrl))\n }\n\n /**\n * Locks the default transport URL guard to previously validated endpoint suffixes.\n *\n * @param derived - Validated endpoint suffixes.\n */\n private lockUrlGuardFromSuffixes(derived: readonly string[]): void {\n if (this.urlGuard === null) return\n const merged =\n this.disableSsrfGuard === true\n ? []\n : this.additionalAllowedSuffixes !== undefined\n ? Array.from(new Set([...derived, ...this.additionalAllowedSuffixes]))\n : derived\n this.urlGuard.setAllowedSuffixes(merged)\n }\n\n /**\n * Validates a Partner authorization snapshot and returns endpoint suffixes.\n *\n * @param auth - Partner authorization response to validate.\n *\n * @returns Host suffixes safe for Partner-token endpoint requests.\n *\n * @internal\n */\n private validateEndpointSuffixes(auth: PartnerAuthorizeResponse): readonly string[] {\n return validatePartnerAuthorizeResponseEndpoints(\n auth,\n this.realmUrl,\n this.allowCustomAuthorizeRealm,\n )\n }\n\n /**\n * Validates an auth snapshot, locks the default URL guard, and returns endpoint suffixes.\n *\n * @param auth - Partner authorization response to validate and activate.\n *\n * @returns Host suffixes safe for Partner-token endpoint requests.\n *\n * @internal\n */\n activateEndpointSuffixes(auth: PartnerAuthorizeResponse): readonly string[] {\n const suffixes = this.validateEndpointSuffixes(auth)\n this.lockUrlGuardFromSuffixes(suffixes)\n return suffixes\n }\n\n private validateCachedAuth(): readonly string[] | undefined {\n const cachedAuth = this.partnerAccountInfo.getAuth()\n if (cachedAuth === null) return undefined\n try {\n return this.validateEndpointSuffixes(cachedAuth)\n } catch {\n // Do not mutate a shared PartnerAccountInfo during construction. The\n // facade will ignore this auth locally until authorize() replaces it.\n return undefined\n }\n }\n\n private reauthorize(signal: AbortSignal | undefined): Promise<string> {\n throwIfSignalAborted(signal)\n const inflight = this.#inflightReauth ?? this.startReauthorize()\n inflight.waiters += 1\n return raceWithAbort(inflight.promise, signal).finally(() => {\n inflight.waiters -= 1\n if (inflight.waiters === 0 && !inflight.settled && !inflight.controller.signal.aborted) {\n inflight.controller.abort(signal?.aborted === true ? abortReason(signal) : undefined)\n }\n })\n }\n\n private startReauthorize(): InflightPartnerReauth {\n const controller = new AbortController()\n const promise = raceWithAbort(this.doReauthorize(controller.signal), controller.signal).finally(\n () => {\n if (this.#inflightReauth?.controller !== controller) return\n this.#inflightReauth.settled = true\n this.#inflightReauth = null\n },\n )\n const inflight: InflightPartnerReauth = {\n controller,\n promise,\n waiters: 0,\n settled: false,\n }\n this.#inflightReauth = inflight\n return inflight\n }\n\n private async doReauthorize(signal: AbortSignal): Promise<string> {\n const auth = await this.authorize({ signal })\n return auth.authorizationToken\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA2DA,IAAa,kBAAb,MAA6B;;CAE3B;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;CACA;CACA;CACA;CACA;CACA,kBAAgD;;;;;;CAOhD,YAAY,SAAiC;EAC3C,KAAKA,eAAe,QAAQ;EAC5B,KAAKC,aAAa,QAAQ;EAC1B,KAAK,WAAW,eAAA,YAAY,QAAQ,SAAS,YAAY;EACzD,KAAK,qBAAqB,QAAQ,sBAAsB,IAAI,kBAAA,2BAA2B;EACvF,KAAK,4BAA4B,QAAQ;EACzC,KAAK,mBAAmB,QAAQ,oBAAoB;EACpD,KAAK,4BAA4B,QAAQ,6BAA6B;EAEtE,IAAI;EACJ,IAAI,QAAQ,cAAc,KAAA,GAAW;GACnC,gBAAgB,QAAQ;GACxB,KAAK,WAAW;EAClB,OAAO;GACL,MAAM,WAAW,IAAI,kBAAA,S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Ac,QAAsC;EAEhE,QAAO,MADY,KAAK,UAAU,EAAE,OAAO,CAAC,EAAA,CAChC;CACd;AACF"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { RetryOptions } from '../http/retry.js';
|
|
2
|
+
import { HttpTransport } from '../http/transport.js';
|
|
3
|
+
import { UrlGuard } from '../http/url-guard.js';
|
|
4
|
+
import { PartnerAuthorizeResponse } from '../types/partner.js';
|
|
5
|
+
import { PartnerAccountInfo } from './account-info.js';
|
|
6
|
+
import { PartnerRawClient } from './raw.js';
|
|
7
|
+
/** Shared Partner authorization options used by Partner and Backup facades. */
|
|
8
|
+
export interface PartnerAuthCoreOptions {
|
|
9
|
+
/** The Master Application Key ID for the partner administrator account. */
|
|
10
|
+
readonly masterKeyId: string;
|
|
11
|
+
/** The Master Application Key secret. */
|
|
12
|
+
readonly masterKey: string;
|
|
13
|
+
/** B2 realm alias or direct trusted realm URL. Defaults to `"production"`. */
|
|
14
|
+
readonly realm?: string;
|
|
15
|
+
/** Storage backend for Partner authorization state. */
|
|
16
|
+
readonly partnerAccountInfo?: PartnerAccountInfo;
|
|
17
|
+
/** Custom HTTP transport. Defaults to {@link FetchTransport}. */
|
|
18
|
+
readonly transport?: HttpTransport;
|
|
19
|
+
/** Override retry behavior for retryable requests. */
|
|
20
|
+
readonly retry?: Partial<RetryOptions>;
|
|
21
|
+
/** Custom user-agent string prepended to the SDK default. */
|
|
22
|
+
readonly userAgent?: string;
|
|
23
|
+
/** Extra trusted host suffixes to merge into the default SSRF guard. */
|
|
24
|
+
readonly additionalAllowedHostSuffixes?: readonly string[];
|
|
25
|
+
/** Explicitly disable default SSRF guard suffix locking. */
|
|
26
|
+
readonly disableSsrfGuard?: boolean;
|
|
27
|
+
/** Whether the default fetch transport may follow same-origin GET/HEAD redirects. */
|
|
28
|
+
readonly followSameOriginRedirects?: boolean;
|
|
29
|
+
/** Allow direct custom authorize realms for tests or private proxies. */
|
|
30
|
+
readonly allowCustomAuthorizeRealm?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Options for Partner authorization through {@link PartnerAuthCore}. */
|
|
33
|
+
export interface PartnerAuthCoreAuthorizeOptions {
|
|
34
|
+
/** Abort signal for cancelling the authorize request. */
|
|
35
|
+
readonly signal?: AbortSignal;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Internal Partner authorization state machine shared by public facades.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare class PartnerAuthCore {
|
|
43
|
+
#private;
|
|
44
|
+
/** Low-level Partner raw client used for authorization and Partner endpoints. */
|
|
45
|
+
readonly raw: PartnerRawClient;
|
|
46
|
+
/** Partner authorization state storage. */
|
|
47
|
+
readonly partnerAccountInfo: PartnerAccountInfo;
|
|
48
|
+
/** Default transport URL guard, or null when a custom transport owns guarding. */
|
|
49
|
+
readonly urlGuard: UrlGuard | null;
|
|
50
|
+
/** Retry-wrapped transport shared by facade-specific raw clients. */
|
|
51
|
+
readonly transport: HttpTransport;
|
|
52
|
+
/** Endpoint suffixes validated from cached authorization during construction. */
|
|
53
|
+
readonly cachedEndpointSuffixes: readonly string[] | undefined;
|
|
54
|
+
/** Resolved Partner authorize realm URL. */
|
|
55
|
+
private readonly realmUrl;
|
|
56
|
+
/** Whether custom authorize realms are trusted. */
|
|
57
|
+
private readonly allowCustomAuthorizeRealm;
|
|
58
|
+
private readonly additionalAllowedSuffixes;
|
|
59
|
+
private readonly disableSsrfGuard;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a shared Partner authorization core.
|
|
62
|
+
*
|
|
63
|
+
* @param options - Credentials, state storage, transport, retry, and guard settings.
|
|
64
|
+
*/
|
|
65
|
+
constructor(options: PartnerAuthCoreOptions);
|
|
66
|
+
/**
|
|
67
|
+
* Authenticates with B2 Partner authorization and stores the authorization state.
|
|
68
|
+
*
|
|
69
|
+
* @param options - Optional abort signal.
|
|
70
|
+
*
|
|
71
|
+
* @returns The normalized Partner authorization response.
|
|
72
|
+
*/
|
|
73
|
+
authorize(options?: PartnerAuthCoreAuthorizeOptions): Promise<PartnerAuthorizeResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* Locks the default transport URL guard to suffixes from a validated auth response.
|
|
76
|
+
*
|
|
77
|
+
* @param auth - Partner authorization response to derive suffixes from.
|
|
78
|
+
*/
|
|
79
|
+
lockUrlGuard(auth: PartnerAuthorizeResponse): void;
|
|
80
|
+
/**
|
|
81
|
+
* Locks the default transport URL guard to previously validated endpoint suffixes.
|
|
82
|
+
*
|
|
83
|
+
* @param derived - Validated endpoint suffixes.
|
|
84
|
+
*/
|
|
85
|
+
private lockUrlGuardFromSuffixes;
|
|
86
|
+
/**
|
|
87
|
+
* Validates a Partner authorization snapshot and returns endpoint suffixes.
|
|
88
|
+
*
|
|
89
|
+
* @param auth - Partner authorization response to validate.
|
|
90
|
+
*
|
|
91
|
+
* @returns Host suffixes safe for Partner-token endpoint requests.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
private validateEndpointSuffixes;
|
|
96
|
+
/**
|
|
97
|
+
* Validates an auth snapshot, locks the default URL guard, and returns endpoint suffixes.
|
|
98
|
+
*
|
|
99
|
+
* @param auth - Partner authorization response to validate and activate.
|
|
100
|
+
*
|
|
101
|
+
* @returns Host suffixes safe for Partner-token endpoint requests.
|
|
102
|
+
*
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
activateEndpointSuffixes(auth: PartnerAuthorizeResponse): readonly string[];
|
|
106
|
+
private validateCachedAuth;
|
|
107
|
+
private reauthorize;
|
|
108
|
+
private startReauthorize;
|
|
109
|
+
private doReauthorize;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=auth-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-core.d.ts","sourceRoot":"","sources":["../../src/partner/auth-core.js"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM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,eAAe;;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAA;IAC9B,2CAA2C;IAC3C,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAA;IAC/C,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IAClC,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAA;IACjC,iFAAiF;IACjF,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IAC9D,4CAA4C;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAS;IAGnD,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA+B;IACzE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAG1C;;;;OAIG;gBACS,OAAO,EAAE,sBAAsB;IA+C3C;;;;;;OAMG;IACG,SAAS,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAc7F;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,wBAAwB,GAAG,IAAI;IAIlD;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAWhC;;;;;;;;OAQG;IACH,OAAO,CAAC,wBAAwB;IAQhC;;;;;;;;OAQG;IACH,wBAAwB,CAAC,IAAI,EAAE,wBAAwB,GAAG,SAAS,MAAM,EAAE;IAM3E,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,gBAAgB;YAmBV,aAAa;CAI5B"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { RetryOptions } from '../http/retry.js';
|
|
2
|
+
import { HttpTransport } from '../http/transport.js';
|
|
3
|
+
import { UrlGuard } from '../http/url-guard.js';
|
|
4
|
+
import { PartnerAuthorizeResponse } from '../types/partner.js';
|
|
5
|
+
import { PartnerAccountInfo } from './account-info.js';
|
|
6
|
+
import { PartnerRawClient } from './raw.js';
|
|
7
|
+
/** Shared Partner authorization options used by Partner and Backup facades. */
|
|
8
|
+
export interface PartnerAuthCoreOptions {
|
|
9
|
+
/** The Master Application Key ID for the partner administrator account. */
|
|
10
|
+
readonly masterKeyId: string;
|
|
11
|
+
/** The Master Application Key secret. */
|
|
12
|
+
readonly masterKey: string;
|
|
13
|
+
/** B2 realm alias or direct trusted realm URL. Defaults to `"production"`. */
|
|
14
|
+
readonly realm?: string;
|
|
15
|
+
/** Storage backend for Partner authorization state. */
|
|
16
|
+
readonly partnerAccountInfo?: PartnerAccountInfo;
|
|
17
|
+
/** Custom HTTP transport. Defaults to {@link FetchTransport}. */
|
|
18
|
+
readonly transport?: HttpTransport;
|
|
19
|
+
/** Override retry behavior for retryable requests. */
|
|
20
|
+
readonly retry?: Partial<RetryOptions>;
|
|
21
|
+
/** Custom user-agent string prepended to the SDK default. */
|
|
22
|
+
readonly userAgent?: string;
|
|
23
|
+
/** Extra trusted host suffixes to merge into the default SSRF guard. */
|
|
24
|
+
readonly additionalAllowedHostSuffixes?: readonly string[];
|
|
25
|
+
/** Explicitly disable default SSRF guard suffix locking. */
|
|
26
|
+
readonly disableSsrfGuard?: boolean;
|
|
27
|
+
/** Whether the default fetch transport may follow same-origin GET/HEAD redirects. */
|
|
28
|
+
readonly followSameOriginRedirects?: boolean;
|
|
29
|
+
/** Allow direct custom authorize realms for tests or private proxies. */
|
|
30
|
+
readonly allowCustomAuthorizeRealm?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Options for Partner authorization through {@link PartnerAuthCore}. */
|
|
33
|
+
export interface PartnerAuthCoreAuthorizeOptions {
|
|
34
|
+
/** Abort signal for cancelling the authorize request. */
|
|
35
|
+
readonly signal?: AbortSignal;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Internal Partner authorization state machine shared by public facades.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
export declare class PartnerAuthCore {
|
|
43
|
+
#private;
|
|
44
|
+
/** Low-level Partner raw client used for authorization and Partner endpoints. */
|
|
45
|
+
readonly raw: PartnerRawClient;
|
|
46
|
+
/** Partner authorization state storage. */
|
|
47
|
+
readonly partnerAccountInfo: PartnerAccountInfo;
|
|
48
|
+
/** Default transport URL guard, or null when a custom transport owns guarding. */
|
|
49
|
+
readonly urlGuard: UrlGuard | null;
|
|
50
|
+
/** Retry-wrapped transport shared by facade-specific raw clients. */
|
|
51
|
+
readonly transport: HttpTransport;
|
|
52
|
+
/** Endpoint suffixes validated from cached authorization during construction. */
|
|
53
|
+
readonly cachedEndpointSuffixes: readonly string[] | undefined;
|
|
54
|
+
/** Resolved Partner authorize realm URL. */
|
|
55
|
+
private readonly realmUrl;
|
|
56
|
+
/** Whether custom authorize realms are trusted. */
|
|
57
|
+
private readonly allowCustomAuthorizeRealm;
|
|
58
|
+
private readonly additionalAllowedSuffixes;
|
|
59
|
+
private readonly disableSsrfGuard;
|
|
60
|
+
/**
|
|
61
|
+
* Creates a shared Partner authorization core.
|
|
62
|
+
*
|
|
63
|
+
* @param options - Credentials, state storage, transport, retry, and guard settings.
|
|
64
|
+
*/
|
|
65
|
+
constructor(options: PartnerAuthCoreOptions);
|
|
66
|
+
/**
|
|
67
|
+
* Authenticates with B2 Partner authorization and stores the authorization state.
|
|
68
|
+
*
|
|
69
|
+
* @param options - Optional abort signal.
|
|
70
|
+
*
|
|
71
|
+
* @returns The normalized Partner authorization response.
|
|
72
|
+
*/
|
|
73
|
+
authorize(options?: PartnerAuthCoreAuthorizeOptions): Promise<PartnerAuthorizeResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* Locks the default transport URL guard to suffixes from a validated auth response.
|
|
76
|
+
*
|
|
77
|
+
* @param auth - Partner authorization response to derive suffixes from.
|
|
78
|
+
*/
|
|
79
|
+
lockUrlGuard(auth: PartnerAuthorizeResponse): void;
|
|
80
|
+
/**
|
|
81
|
+
* Locks the default transport URL guard to previously validated endpoint suffixes.
|
|
82
|
+
*
|
|
83
|
+
* @param derived - Validated endpoint suffixes.
|
|
84
|
+
*/
|
|
85
|
+
private lockUrlGuardFromSuffixes;
|
|
86
|
+
/**
|
|
87
|
+
* Validates a Partner authorization snapshot and returns endpoint suffixes.
|
|
88
|
+
*
|
|
89
|
+
* @param auth - Partner authorization response to validate.
|
|
90
|
+
*
|
|
91
|
+
* @returns Host suffixes safe for Partner-token endpoint requests.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
private validateEndpointSuffixes;
|
|
96
|
+
/**
|
|
97
|
+
* Validates an auth snapshot, locks the default URL guard, and returns endpoint suffixes.
|
|
98
|
+
*
|
|
99
|
+
* @param auth - Partner authorization response to validate and activate.
|
|
100
|
+
*
|
|
101
|
+
* @returns Host suffixes safe for Partner-token endpoint requests.
|
|
102
|
+
*
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
activateEndpointSuffixes(auth: PartnerAuthorizeResponse): readonly string[];
|
|
106
|
+
private validateCachedAuth;
|
|
107
|
+
private reauthorize;
|
|
108
|
+
private startReauthorize;
|
|
109
|
+
private doReauthorize;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=auth-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-core.d.ts","sourceRoot":"","sources":["../../src/partner/auth-core.js"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAEL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;IACjC,iFAAiF;IACjF,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;IAC9D,4CAA4C;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAS;IAGnD,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA+B;IACzE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAG1C;;;;OAIG;gBACS,OAAO,EAAE,sBAAsB;IA+C3C;;;;;;OAMG;IACG,SAAS,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAc7F;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,wBAAwB,GAAG,IAAI;IAIlD;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAWhC;;;;;;;;OAQG;IACH,OAAO,CAAC,wBAAwB;IAQhC;;;;;;;;OAQG;IACH,wBAAwB,CAAC,IAAI,EAAE,wBAAwB,GAAG,SAAS,MAAM,EAAE;IAM3E,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,gBAAgB;YAmBV,aAAa;CAI5B"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { abortReason, raceWithAbort, throwIfSignalAborted } from "../util/abort.js";
|
|
2
|
+
import { DEFAULT_RETRY_OPTIONS } from "../http/retry.js";
|
|
3
|
+
import { getRealmUrl } from "../auth/realms.js";
|
|
4
|
+
import { UrlGuard } from "../http/url-guard.js";
|
|
5
|
+
import { FetchTransport, RetryTransport } from "../http/transport.js";
|
|
6
|
+
import { InMemoryPartnerAccountInfo } from "./in-memory.js";
|
|
7
|
+
import { PartnerRawClient, derivePartnerAllowedSuffixes, validatePartnerAuthorizeResponseEndpoints } from "./raw.js";
|
|
8
|
+
//#region src/partner/auth-core.ts
|
|
9
|
+
/**
|
|
10
|
+
* Internal Partner authorization state machine shared by public facades.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
var PartnerAuthCore = class {
|
|
15
|
+
/** Low-level Partner raw client used for authorization and Partner endpoints. */
|
|
16
|
+
raw;
|
|
17
|
+
/** Partner authorization state storage. */
|
|
18
|
+
partnerAccountInfo;
|
|
19
|
+
/** Default transport URL guard, or null when a custom transport owns guarding. */
|
|
20
|
+
urlGuard;
|
|
21
|
+
/** Retry-wrapped transport shared by facade-specific raw clients. */
|
|
22
|
+
transport;
|
|
23
|
+
/** Endpoint suffixes validated from cached authorization during construction. */
|
|
24
|
+
cachedEndpointSuffixes;
|
|
25
|
+
/** Resolved Partner authorize realm URL. */
|
|
26
|
+
realmUrl;
|
|
27
|
+
/** Whether custom authorize realms are trusted. */
|
|
28
|
+
allowCustomAuthorizeRealm;
|
|
29
|
+
#masterKeyId;
|
|
30
|
+
#masterKey;
|
|
31
|
+
additionalAllowedSuffixes;
|
|
32
|
+
disableSsrfGuard;
|
|
33
|
+
#inflightReauth = null;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a shared Partner authorization core.
|
|
36
|
+
*
|
|
37
|
+
* @param options - Credentials, state storage, transport, retry, and guard settings.
|
|
38
|
+
*/
|
|
39
|
+
constructor(options) {
|
|
40
|
+
this.#masterKeyId = options.masterKeyId;
|
|
41
|
+
this.#masterKey = options.masterKey;
|
|
42
|
+
this.realmUrl = getRealmUrl(options.realm ?? "production");
|
|
43
|
+
this.partnerAccountInfo = options.partnerAccountInfo ?? new InMemoryPartnerAccountInfo();
|
|
44
|
+
this.additionalAllowedSuffixes = options.additionalAllowedHostSuffixes;
|
|
45
|
+
this.disableSsrfGuard = options.disableSsrfGuard ?? false;
|
|
46
|
+
this.allowCustomAuthorizeRealm = options.allowCustomAuthorizeRealm ?? false;
|
|
47
|
+
let baseTransport;
|
|
48
|
+
if (options.transport !== void 0) {
|
|
49
|
+
baseTransport = options.transport;
|
|
50
|
+
this.urlGuard = null;
|
|
51
|
+
} else {
|
|
52
|
+
const urlGuard = new UrlGuard();
|
|
53
|
+
baseTransport = new FetchTransport({
|
|
54
|
+
urlGuard,
|
|
55
|
+
...options.userAgent !== void 0 ? { userAgent: options.userAgent } : {},
|
|
56
|
+
...options.followSameOriginRedirects !== void 0 ? { followSameOriginRedirects: options.followSameOriginRedirects } : {}
|
|
57
|
+
});
|
|
58
|
+
this.urlGuard = urlGuard;
|
|
59
|
+
}
|
|
60
|
+
this.transport = new RetryTransport({
|
|
61
|
+
transport: baseTransport,
|
|
62
|
+
retry: {
|
|
63
|
+
...DEFAULT_RETRY_OPTIONS,
|
|
64
|
+
...options.retry
|
|
65
|
+
},
|
|
66
|
+
onReauth: (signal) => this.reauthorize(signal)
|
|
67
|
+
});
|
|
68
|
+
this.cachedEndpointSuffixes = this.validateCachedAuth();
|
|
69
|
+
if (this.cachedEndpointSuffixes !== void 0) this.lockUrlGuardFromSuffixes(this.cachedEndpointSuffixes);
|
|
70
|
+
this.raw = new PartnerRawClient({
|
|
71
|
+
transport: this.transport,
|
|
72
|
+
...this.cachedEndpointSuffixes !== void 0 ? { authorizedPartnerEndpointSuffixes: this.cachedEndpointSuffixes } : {},
|
|
73
|
+
...options.allowCustomAuthorizeRealm !== void 0 ? { allowCustomAuthorizeRealm: options.allowCustomAuthorizeRealm } : {}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Authenticates with B2 Partner authorization and stores the authorization state.
|
|
78
|
+
*
|
|
79
|
+
* @param options - Optional abort signal.
|
|
80
|
+
*
|
|
81
|
+
* @returns The normalized Partner authorization response.
|
|
82
|
+
*/
|
|
83
|
+
async authorize(options) {
|
|
84
|
+
throwIfSignalAborted(options?.signal);
|
|
85
|
+
const auth = await this.raw.authorizePartner(this.#masterKeyId, this.#masterKey, this.realmUrl, options?.signal !== void 0 ? { signal: options.signal } : void 0);
|
|
86
|
+
throwIfSignalAborted(options?.signal);
|
|
87
|
+
this.partnerAccountInfo.setAuth(auth);
|
|
88
|
+
this.lockUrlGuard(auth);
|
|
89
|
+
return auth;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Locks the default transport URL guard to suffixes from a validated auth response.
|
|
93
|
+
*
|
|
94
|
+
* @param auth - Partner authorization response to derive suffixes from.
|
|
95
|
+
*/
|
|
96
|
+
lockUrlGuard(auth) {
|
|
97
|
+
this.lockUrlGuardFromSuffixes(derivePartnerAllowedSuffixes(auth, this.realmUrl));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Locks the default transport URL guard to previously validated endpoint suffixes.
|
|
101
|
+
*
|
|
102
|
+
* @param derived - Validated endpoint suffixes.
|
|
103
|
+
*/
|
|
104
|
+
lockUrlGuardFromSuffixes(derived) {
|
|
105
|
+
if (this.urlGuard === null) return;
|
|
106
|
+
const merged = this.disableSsrfGuard === true ? [] : this.additionalAllowedSuffixes !== void 0 ? Array.from(/* @__PURE__ */ new Set([...derived, ...this.additionalAllowedSuffixes])) : derived;
|
|
107
|
+
this.urlGuard.setAllowedSuffixes(merged);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validates a Partner authorization snapshot and returns endpoint suffixes.
|
|
111
|
+
*
|
|
112
|
+
* @param auth - Partner authorization response to validate.
|
|
113
|
+
*
|
|
114
|
+
* @returns Host suffixes safe for Partner-token endpoint requests.
|
|
115
|
+
*
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
validateEndpointSuffixes(auth) {
|
|
119
|
+
return validatePartnerAuthorizeResponseEndpoints(auth, this.realmUrl, this.allowCustomAuthorizeRealm);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Validates an auth snapshot, locks the default URL guard, and returns endpoint suffixes.
|
|
123
|
+
*
|
|
124
|
+
* @param auth - Partner authorization response to validate and activate.
|
|
125
|
+
*
|
|
126
|
+
* @returns Host suffixes safe for Partner-token endpoint requests.
|
|
127
|
+
*
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
activateEndpointSuffixes(auth) {
|
|
131
|
+
const suffixes = this.validateEndpointSuffixes(auth);
|
|
132
|
+
this.lockUrlGuardFromSuffixes(suffixes);
|
|
133
|
+
return suffixes;
|
|
134
|
+
}
|
|
135
|
+
validateCachedAuth() {
|
|
136
|
+
const cachedAuth = this.partnerAccountInfo.getAuth();
|
|
137
|
+
if (cachedAuth === null) return void 0;
|
|
138
|
+
try {
|
|
139
|
+
return this.validateEndpointSuffixes(cachedAuth);
|
|
140
|
+
} catch {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
reauthorize(signal) {
|
|
145
|
+
throwIfSignalAborted(signal);
|
|
146
|
+
const inflight = this.#inflightReauth ?? this.startReauthorize();
|
|
147
|
+
inflight.waiters += 1;
|
|
148
|
+
return raceWithAbort(inflight.promise, signal).finally(() => {
|
|
149
|
+
inflight.waiters -= 1;
|
|
150
|
+
if (inflight.waiters === 0 && !inflight.settled && !inflight.controller.signal.aborted) inflight.controller.abort(signal?.aborted === true ? abortReason(signal) : void 0);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
startReauthorize() {
|
|
154
|
+
const controller = new AbortController();
|
|
155
|
+
const inflight = {
|
|
156
|
+
controller,
|
|
157
|
+
promise: raceWithAbort(this.doReauthorize(controller.signal), controller.signal).finally(() => {
|
|
158
|
+
if (this.#inflightReauth?.controller !== controller) return;
|
|
159
|
+
this.#inflightReauth.settled = true;
|
|
160
|
+
this.#inflightReauth = null;
|
|
161
|
+
}),
|
|
162
|
+
waiters: 0,
|
|
163
|
+
settled: false
|
|
164
|
+
};
|
|
165
|
+
this.#inflightReauth = inflight;
|
|
166
|
+
return inflight;
|
|
167
|
+
}
|
|
168
|
+
async doReauthorize(signal) {
|
|
169
|
+
return (await this.authorize({ signal })).authorizationToken;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
//#endregion
|
|
173
|
+
export { PartnerAuthCore };
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=auth-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-core.js","names":["#masterKeyId","#masterKey","#inflightReauth"],"sources":["../../src/partner/auth-core.ts"],"sourcesContent":["import { getRealmUrl } from '../auth/realms.ts'\nimport { DEFAULT_RETRY_OPTIONS, type RetryOptions } from '../http/retry.ts'\nimport type { HttpTransport } from '../http/transport.ts'\nimport { FetchTransport, RetryTransport } from '../http/transport.ts'\nimport { UrlGuard } from '../http/url-guard.ts'\nimport type { PartnerAuthorizeResponse } from '../types/partner.ts'\nimport { abortReason, raceWithAbort, throwIfSignalAborted } from '../util/abort.ts'\nimport type { PartnerAccountInfo } from './account-info.ts'\nimport { InMemoryPartnerAccountInfo } from './in-memory.ts'\nimport {\n derivePartnerAllowedSuffixes,\n PartnerRawClient,\n validatePartnerAuthorizeResponseEndpoints,\n} from './raw.ts'\n\n/** Shared Partner authorization options used by Partner and Backup facades. */\nexport interface PartnerAuthCoreOptions {\n /** The Master Application Key ID for the partner administrator account. */\n readonly masterKeyId: string\n /** The Master Application Key secret. */\n readonly masterKey: string\n /** B2 realm alias or direct trusted realm URL. Defaults to `\"production\"`. */\n readonly realm?: string\n /** Storage backend for Partner authorization state. */\n readonly partnerAccountInfo?: PartnerAccountInfo\n /** Custom HTTP transport. Defaults to {@link FetchTransport}. */\n readonly transport?: HttpTransport\n /** Override retry behavior for retryable requests. */\n readonly retry?: Partial<RetryOptions>\n /** Custom user-agent string prepended to the SDK default. */\n readonly userAgent?: string\n /** Extra trusted host suffixes to merge into the default SSRF guard. */\n readonly additionalAllowedHostSuffixes?: readonly string[]\n /** Explicitly disable default SSRF guard suffix locking. */\n readonly disableSsrfGuard?: boolean\n /** Whether the default fetch transport may follow same-origin GET/HEAD redirects. */\n readonly followSameOriginRedirects?: boolean\n /** Allow direct custom authorize realms for tests or private proxies. */\n readonly allowCustomAuthorizeRealm?: boolean\n}\n\n/** Options for Partner authorization through {@link PartnerAuthCore}. */\nexport interface PartnerAuthCoreAuthorizeOptions {\n /** Abort signal for cancelling the authorize request. */\n readonly signal?: AbortSignal\n}\n\ninterface InflightPartnerReauth {\n readonly controller: AbortController\n readonly promise: Promise<string>\n waiters: number\n settled: boolean\n}\n\n/**\n * Internal Partner authorization state machine shared by public facades.\n *\n * @internal\n */\nexport class PartnerAuthCore {\n /** Low-level Partner raw client used for authorization and Partner endpoints. */\n readonly raw: PartnerRawClient\n /** Partner authorization state storage. */\n readonly partnerAccountInfo: PartnerAccountInfo\n /** Default transport URL guard, or null when a custom transport owns guarding. */\n readonly urlGuard: UrlGuard | null\n /** Retry-wrapped transport shared by facade-specific raw clients. */\n readonly transport: HttpTransport\n /** Endpoint suffixes validated from cached authorization during construction. */\n readonly cachedEndpointSuffixes: readonly string[] | undefined\n /** Resolved Partner authorize realm URL. */\n private readonly realmUrl: string\n /** Whether custom authorize realms are trusted. */\n private readonly allowCustomAuthorizeRealm: boolean\n readonly #masterKeyId: string\n readonly #masterKey: string\n private readonly additionalAllowedSuffixes: readonly string[] | undefined\n private readonly disableSsrfGuard: boolean\n #inflightReauth: InflightPartnerReauth | null = null\n\n /**\n * Creates a shared Partner authorization core.\n *\n * @param options - Credentials, state storage, transport, retry, and guard settings.\n */\n constructor(options: PartnerAuthCoreOptions) {\n this.#masterKeyId = options.masterKeyId\n this.#masterKey = options.masterKey\n this.realmUrl = getRealmUrl(options.realm ?? 'production')\n this.partnerAccountInfo = options.partnerAccountInfo ?? new InMemoryPartnerAccountInfo()\n this.additionalAllowedSuffixes = options.additionalAllowedHostSuffixes\n this.disableSsrfGuard = options.disableSsrfGuard ?? false\n this.allowCustomAuthorizeRealm = options.allowCustomAuthorizeRealm ?? false\n\n let baseTransport: HttpTransport\n if (options.transport !== undefined) {\n baseTransport = options.transport\n this.urlGuard = null\n } else {\n const urlGuard = new UrlGuard()\n baseTransport = new FetchTransport({\n urlGuard,\n ...(options.userAgent !== undefined ? { userAgent: options.userAgent } : {}),\n ...(options.followSameOriginRedirects !== undefined\n ? { followSameOriginRedirects: options.followSameOriginRedirects }\n : {}),\n })\n this.urlGuard = urlGuard\n }\n\n this.transport = new RetryTransport({\n transport: baseTransport,\n retry: { ...DEFAULT_RETRY_OPTIONS, ...options.retry },\n onReauth: (signal) => this.reauthorize(signal),\n })\n\n this.cachedEndpointSuffixes = this.validateCachedAuth()\n if (this.cachedEndpointSuffixes !== undefined) {\n this.lockUrlGuardFromSuffixes(this.cachedEndpointSuffixes)\n }\n\n this.raw = new PartnerRawClient({\n transport: this.transport,\n ...(this.cachedEndpointSuffixes !== undefined\n ? { authorizedPartnerEndpointSuffixes: this.cachedEndpointSuffixes }\n : {}),\n ...(options.allowCustomAuthorizeRealm !== undefined\n ? { allowCustomAuthorizeRealm: options.allowCustomAuthorizeRealm }\n : {}),\n })\n }\n\n /**\n * Authenticates with B2 Partner authorization and stores the authorization state.\n *\n * @param options - Optional abort signal.\n *\n * @returns The normalized Partner authorization response.\n */\n async authorize(options?: PartnerAuthCoreAuthorizeOptions): Promise<PartnerAuthorizeResponse> {\n throwIfSignalAborted(options?.signal)\n const auth = await this.raw.authorizePartner(\n this.#masterKeyId,\n this.#masterKey,\n this.realmUrl,\n options?.signal !== undefined ? { signal: options.signal } : undefined,\n )\n throwIfSignalAborted(options?.signal)\n this.partnerAccountInfo.setAuth(auth)\n this.lockUrlGuard(auth)\n return auth\n }\n\n /**\n * Locks the default transport URL guard to suffixes from a validated auth response.\n *\n * @param auth - Partner authorization response to derive suffixes from.\n */\n lockUrlGuard(auth: PartnerAuthorizeResponse): void {\n this.lockUrlGuardFromSuffixes(derivePartnerAllowedSuffixes(auth, this.realmUrl))\n }\n\n /**\n * Locks the default transport URL guard to previously validated endpoint suffixes.\n *\n * @param derived - Validated endpoint suffixes.\n */\n private lockUrlGuardFromSuffixes(derived: readonly string[]): void {\n if (this.urlGuard === null) return\n const merged =\n this.disableSsrfGuard === true\n ? []\n : this.additionalAllowedSuffixes !== undefined\n ? Array.from(new Set([...derived, ...this.additionalAllowedSuffixes]))\n : derived\n this.urlGuard.setAllowedSuffixes(merged)\n }\n\n /**\n * Validates a Partner authorization snapshot and returns endpoint suffixes.\n *\n * @param auth - Partner authorization response to validate.\n *\n * @returns Host suffixes safe for Partner-token endpoint requests.\n *\n * @internal\n */\n private validateEndpointSuffixes(auth: PartnerAuthorizeResponse): readonly string[] {\n return validatePartnerAuthorizeResponseEndpoints(\n auth,\n this.realmUrl,\n this.allowCustomAuthorizeRealm,\n )\n }\n\n /**\n * Validates an auth snapshot, locks the default URL guard, and returns endpoint suffixes.\n *\n * @param auth - Partner authorization response to validate and activate.\n *\n * @returns Host suffixes safe for Partner-token endpoint requests.\n *\n * @internal\n */\n activateEndpointSuffixes(auth: PartnerAuthorizeResponse): readonly string[] {\n const suffixes = this.validateEndpointSuffixes(auth)\n this.lockUrlGuardFromSuffixes(suffixes)\n return suffixes\n }\n\n private validateCachedAuth(): readonly string[] | undefined {\n const cachedAuth = this.partnerAccountInfo.getAuth()\n if (cachedAuth === null) return undefined\n try {\n return this.validateEndpointSuffixes(cachedAuth)\n } catch {\n // Do not mutate a shared PartnerAccountInfo during construction. The\n // facade will ignore this auth locally until authorize() replaces it.\n return undefined\n }\n }\n\n private reauthorize(signal: AbortSignal | undefined): Promise<string> {\n throwIfSignalAborted(signal)\n const inflight = this.#inflightReauth ?? this.startReauthorize()\n inflight.waiters += 1\n return raceWithAbort(inflight.promise, signal).finally(() => {\n inflight.waiters -= 1\n if (inflight.waiters === 0 && !inflight.settled && !inflight.controller.signal.aborted) {\n inflight.controller.abort(signal?.aborted === true ? abortReason(signal) : undefined)\n }\n })\n }\n\n private startReauthorize(): InflightPartnerReauth {\n const controller = new AbortController()\n const promise = raceWithAbort(this.doReauthorize(controller.signal), controller.signal).finally(\n () => {\n if (this.#inflightReauth?.controller !== controller) return\n this.#inflightReauth.settled = true\n this.#inflightReauth = null\n },\n )\n const inflight: InflightPartnerReauth = {\n controller,\n promise,\n waiters: 0,\n settled: false,\n }\n this.#inflightReauth = inflight\n return inflight\n }\n\n private async doReauthorize(signal: AbortSignal): Promise<string> {\n const auth = await this.authorize({ signal })\n return auth.authorizationToken\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA2DA,IAAa,kBAAb,MAA6B;;CAE3B;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;;CAEA;CACA;CACA;CACA;CACA;CACA,kBAAgD;;;;;;CAOhD,YAAY,SAAiC;EAC3C,KAAKA,eAAe,QAAQ;EAC5B,KAAKC,aAAa,QAAQ;EAC1B,KAAK,WAAW,YAAY,QAAQ,SAAS,YAAY;EACzD,KAAK,qBAAqB,QAAQ,sBAAsB,IAAI,2BAA2B;EACvF,KAAK,4BAA4B,QAAQ;EACzC,KAAK,mBAAmB,QAAQ,oBAAoB;EACpD,KAAK,4BAA4B,QAAQ,6BAA6B;EAEtE,IAAI;EACJ,IAAI,QAAQ,cAAc,KAAA,GAAW;GACnC,gBAAgB,QAAQ;GACxB,KAAK,WAAW;EAClB,OAAO;GACL,MAAM,WAAW,IAAI,SAAS;GAC9B,gBAAgB,IAAI,eAAe;IACjC;IACA,GAAI,QAAQ,cAAc,KAAA,IAAY,EAAE,WAAW,QAAQ,UAAU,IAAI,CAAC;IAC1E,GAAI,QAAQ,8BAA8B,KAAA,IACtC,EAAE,2BAA2B,QAAQ,0BAA0B,IAC/D,CAAC;GACP,CAAC;GACD,KAAK,WAAW;EAClB;EAEA,KAAK,YAAY,IAAI,eAAe;GAClC,WAAW;GACX,OAAO;IAAE,GAAG;IAAuB,GAAG,QAAQ;GAAM;GACpD,WAAW,WAAW,KAAK,YAAY,MAAM;EAC/C,CAAC;EAED,KAAK,yBAAyB,KAAK,mBAAmB;EACtD,IAAI,KAAK,2BAA2B,KAAA,GAClC,KAAK,yBAAyB,KAAK,sBAAsB;EAG3D,KAAK,MAAM,IAAI,iBAAiB;GAC9B,WAAW,KAAK;GAChB,GAAI,KAAK,2BAA2B,KAAA,IAChC,EAAE,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