跳到主要内容

getEncryptionInfo

FileEncryptionInfoWrapper getEncryptionInfo(fileId)

GET /api/2.0/files/{fileId}/access

Get file encryption information

Returns what the caller needs in order to decrypt one file of an end-to-end encrypted private room: userKeys holds the key pairs of the calling account, the private half of each of them encrypted with that person's own password, and fileKeys holds the file keys that were issued to this account for this file, each naming the public key it was encrypted for. Only the keys of the calling account are ever returned, never those of the other people in the room. An account that holds no key pair yet, and a file no key was issued for, answer with empty lists rather than with an error, so an empty fileKeys means the caller cannot open that file rather than that the file is unencrypted. The caller needs read access to the file; a caller without it, and a file that does not exist, are both refused with 403. The operation is read-only. Keys are issued by PUT api/2.0/files/{fileId}/access, and the personal key pairs are managed under api/2.0/privacyroom/keys.

Parameters​

NameInTypeDescriptionNotes
fileIdpathInteger (int32)The file whose encryption keys are read. Only a file in an end-to-end encrypted private room has any.[required]

Responses​

Status codeDescriptionTypeResponse headers
200The key pairs of the caller and the file keys issued to themFileEncryptionInfoWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The file cannot carry encryption keys--
403The file does not exist, or the caller has no read access to it--
404The file does not exist--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

FileEncryptionInfoWrapper

Third-party storage​

For a file or folder in a connected third-party storage the identifier is a string such as sbox-42, and the call differs in these parts only:

NameInTypeDescriptionNotes
fileIdpathStringThe file whose encryption keys are read. Only a file in an end-to-end encrypted private room has any.[required] [example: sbox-42-L1JlcG9ydC5kb2N4]

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: Not defined
  • Accept: application/json