common.blob

io.token.proto.common.blob /common/src/main/proto/blob.proto


syntax = "proto3";
package io.token.proto.common.blob;
option java_outer_classname = "BlobProtos";
option csharp_namespace = "Tokenio.Proto.Common.BlobProtos";

import "extensions/field.proto";

// Representation of a blob of data.
message Blob {
  string id = 1;             // Hash of the payload, route, shard
  Payload payload = 2 [(io.token.proto.extensions.field.redact) = true];

  enum AccessMode {
    DEFAULT = 0; // Owner or token-participants can read.
    PUBLIC = 1;  // Anyone can read. Good for, e.g., profile pictures
  }

  message Payload {
    string owner_id = 1;        // Who owns this blob (member id)
    string type = 2;            // Mime type
    string name = 3;            // Name of file
    bytes data = 4;             // Data
    AccessMode access_mode = 5; // Is it public?
  }
}

// Attachment of a blob to a token.
message Attachment {
  string blob_id = 1; // Blob ID
  string type = 2;    // Mime type
  string name = 3;    // Name of file
}