Attachments & Drive Shares
Attachments
Attachment upload and download via /mail/v4/attachments.
Upload
attachment, err := c.UploadAttachment(ctx, addrKR, proton.CreateAttachmentReq{
MessageID: "message-id",
Filename: "document.pdf",
MIMEType: "application/pdf",
Disposition: proton.AttachmentDisposition,
Body: fileBytes,
})
Upload is encrypted with the address keyring and signed (detached) before upload. The server stores the encrypted KeyPacket, DataPacket, and Signature separately.
Download
// Download as bytes
data, err := c.GetAttachment(ctx, attachmentID)
// Stream into io.ReaderFrom
err := c.GetAttachmentInto(ctx, attachmentID, reader)
Key Types
| Type | Description |
|---|---|
Attachment |
ID, name, size, MIME type, disposition (inline/attachment), headers, key packets, signature |
CreateAttachmentReq |
MessageID, filename, MIME type, disposition, content ID, body bytes |
Disposition |
InlineDisposition, AttachmentDisposition |
Drive Shares
Operations
// List shares
shares, err := c.ListShares(ctx, all)
// Get a single share with full key material
share, err := c.GetShare(ctx, shareID)
Key Derivation
// Decrypt passphrase with address keyring, verify signature, unlock share key
keyRing, err := share.GetKeyRing(addrKR)
// Returns *crypto.KeyRing for Drive access
Key Types
| Type | Description |
|---|---|
ShareMetadata |
ShareID, linkID, volumeID, type, state, creation/modify times, creator email |
Share |
Extends metadata with addressID, addressKeyID, encrypted key, passphrase, passphrase signature |
ShareType |
Main (1), Standard (2), Device (3) |
ShareState |
Active (1), Deleted (2) |
No comments to display
No comments to display