mfer/proto/mf.proto

70 lines
1.7 KiB
Protocol Buffer
Raw Normal View History

2021-10-26 09:00:50 +00:00
syntax = "proto3";
2022-02-02 04:12:32 +00:00
option go_package = "git.eeqj.de/sneak/mfer/mfer";
2021-10-26 09:00:50 +00:00
2021-11-03 11:19:42 +00:00
import "google/protobuf/timestamp.proto";
2021-10-26 09:00:50 +00:00
message MFFile {
2021-11-03 10:49:40 +00:00
enum Version {
NONE = 0;
ONE = 1; // only one for now
}
2021-11-03 11:19:42 +00:00
// required mffile root attributes 1xx
2022-02-02 07:40:50 +00:00
required Version version = 101;
required bytes innerMessage = 102;
2021-11-03 10:49:40 +00:00
// these are used solely to detect corruption/truncation
// and not for cryptographic integrity.
2022-02-02 07:40:50 +00:00
required uint64 size = 103;
required bytes sha256 = 104;
2021-11-03 10:49:40 +00:00
2021-11-03 11:19:42 +00:00
// 2xx for optional manifest root attributes
2021-11-03 10:49:40 +00:00
// think we might use gosignify instead of gpg:
// github.com/frankbraun/gosignify
//detached signature, ascii or binary
2022-02-02 07:40:50 +00:00
bytes signature = 201;
2021-11-03 10:49:40 +00:00
//full GPG key id
2022-02-02 07:40:50 +00:00
bytes signer = 202;
2021-11-03 10:49:40 +00:00
//full GPG signing public key, ascii or binary
2022-02-02 07:40:50 +00:00
bytes signingPubKey = 203;
2021-10-26 09:00:50 +00:00
}
message MFFilePath {
2021-11-03 11:19:42 +00:00
// required attributes:
2022-02-02 07:40:50 +00:00
required string path = 101;
required uint64 size = 102;
2021-11-03 11:19:42 +00:00
// gotta have at least one:
repeated MFFileChecksum hashes = 201;
// optional per-file metadata
2022-02-02 07:40:50 +00:00
string mimeType = 301;
google.protobuf.Timestamp mtime = 302;
google.protobuf.Timestamp ctime = 303;
google.protobuf.Timestamp atime = 304;
2021-11-03 10:39:41 +00:00
}
message MFFileChecksum {
2021-11-03 11:19:42 +00:00
// 1.0 golang implementation must write a multihash here
// it's ok to only ever use/verify sha256 multihash
2022-02-02 07:40:50 +00:00
required bytes multiHash = 1;
2021-10-26 09:00:50 +00:00
}
message MFFileInner {
2021-11-03 10:49:40 +00:00
enum Version {
NONE = 0;
ONE = 1; // only one for now
}
2022-02-02 07:40:50 +00:00
required Version version = 101;
2021-11-03 11:19:42 +00:00
// required manifest attributes:
2022-02-02 07:40:50 +00:00
required uint64 fileCount = 102; //FIXME is this necessary?
2021-11-03 11:19:42 +00:00
repeated MFFilePath files = 103;
// optional manifest attributes 2xx:
2022-02-02 07:40:50 +00:00
google.protobuf.Timestamp createdAt = 201;
2021-10-26 09:00:50 +00:00
}
2021-11-03 11:19:42 +00:00