Summary
Use the SDK's capability check helper to validate the authorized key before dispatching each action verb, producing a clear failure when required capabilities are missing.
Why
Today a workflow learns about missing permissions only after an API call fails, often with a generic 401/403 from whichever operation happened first. The SDK already knows the authorized key's capabilities and can report exactly which capabilities are missing. That makes failures faster, clearer, and safer for destructive operations.
SDK support (already available)
B2Client.hasCapabilities(required)
Capability constants
B2InsufficientCapabilityError
AllowedInfo.capabilities from authorization
Proposed surface
No new input is required. Add an internal mapping from action verb to required capabilities and validate it after authorize() / before command dispatch. Examples:
upload: writeFiles
download/head/verify: readFiles
list: listFiles
presign: shareFiles
delete/purge: deleteFiles
retention: file retention/legal-hold capabilities depending on requested inputs
Acceptance criteria
Out of scope
Summary
Use the SDK's capability check helper to validate the authorized key before dispatching each action verb, producing a clear failure when required capabilities are missing.
Why
Today a workflow learns about missing permissions only after an API call fails, often with a generic 401/403 from whichever operation happened first. The SDK already knows the authorized key's capabilities and can report exactly which capabilities are missing. That makes failures faster, clearer, and safer for destructive operations.
SDK support (already available)
B2Client.hasCapabilities(required)CapabilityconstantsB2InsufficientCapabilityErrorAllowedInfo.capabilitiesfrom authorizationProposed surface
No new input is required. Add an internal mapping from action verb to required capabilities and validate it after
authorize()/ before command dispatch. Examples:upload:writeFilesdownload/head/verify:readFileslist:listFilespresign:shareFilesdelete/purge:deleteFilesretention: file retention/legal-hold capabilities depending on requested inputsAcceptance criteria
legal-hold,retention-mode, andbypass-governance.Out of scope