forked from henrybear327/go-proton-api
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathblock_types.go
More file actions
49 lines (40 loc) · 1.45 KB
/
block_types.go
File metadata and controls
49 lines (40 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package proton
// Block is a block of file contents. They are split in 4MB blocks although this number may change in the future.
// Each block is its own data packet separated from the key packet which is held by the node,
// which means the sessionKey is the same for every block.
type Block struct {
Index int
BareURL string // URL to the block
Token string // Token for download URL
Hash string // Encrypted block's sha256 hash, in base64
EncSignature string // Encrypted signature of the block
SignatureEmail string // Email used to sign the block
}
type BlockUploadReq struct {
AddressID string
ShareID string
LinkID string
RevisionID string
BlockList []BlockUploadInfo
}
type BlockUploadInfo struct {
Index int
Size int64
EncSignature string
Hash string
Verifier BlockUploadVerifier `json:",omitempty"`
}
// BlockUploadVerifier holds the per-block verification token required by the
// Proton storage backend to authenticate that the block was correctly encrypted.
type BlockUploadVerifier struct {
Token string `json:",omitempty"`
}
// RevisionVerification is the response from the block upload verification endpoint.
type RevisionVerification struct {
VerificationCode string // Base64-encoded verification code XOR'd with each block
ContentKeyPacket string // Encrypted content session key (for client-side integrity check)
}
type BlockUploadLink struct {
Token string
BareURL string
}