github.com/s7techlab/cckit@v0.10.5/extensions/owner/chaincode_owner.proto (about)

     1  // Chaincode owner service
     2  
     3  syntax = "proto3";
     4  
     5  option go_package = "github.com/s7techlab/cckit/extensions/owner";
     6  
     7  package extensions.owner;
     8  
     9  import "google/api/annotations.proto";
    10  import "google/protobuf/empty.proto";
    11  import "google/protobuf/timestamp.proto";
    12  import "mwitkow/go-proto-validators/validator.proto";
    13  
    14  // ChaincodeOwnerService allows to store information about chaincode "owners" in chaincode state
    15  service ChaincodeOwnerService {
    16  
    17      // Checks tx creator is owner
    18      rpc GetOwnerByTxCreator (google.protobuf.Empty) returns (ChaincodeOwner) {
    19          option (google.api.http) = {
    20              get: "/chaincode/owners/whoami"
    21          };
    22      }
    23  
    24      // Get owners list
    25      rpc ListOwners (google.protobuf.Empty) returns (ChaincodeOwners) {
    26          option (google.api.http) = {
    27              get: "/chaincode/owners"
    28          };
    29      }
    30  
    31      // Get owner by msp_id and certificate subject
    32      rpc GetOwner (OwnerId) returns (ChaincodeOwner) {
    33          option (google.api.http) = {
    34              get: "/chaincode/owners/{msp_id}/{subject}"
    35          };
    36      }
    37  
    38      // Register new chaincode owner, method can be call by current owner or if no owner exists
    39      // If chaincode owner with same MspID, certificate subject and issuer exists - throws error
    40      rpc CreateOwner (CreateOwnerRequest) returns (ChaincodeOwner) {
    41          option (google.api.http) = {
    42              post: "/chaincode/owners"
    43              body: "*"
    44          };
    45      }
    46  
    47      // Register tx creator as chaincode owner
    48      rpc CreateOwnerTxCreator (google.protobuf.Empty) returns (ChaincodeOwner) {
    49          option (google.api.http) = {
    50              post: "/chaincode/owners/txcreator"
    51              body: "*"
    52          };
    53      }
    54  
    55      //  Update chaincode owner. Msp id and certificate subject must be equal to current owner certificate
    56      rpc UpdateOwner (UpdateOwnerRequest) returns (ChaincodeOwner) {
    57          option (google.api.http) = {
    58              put: "/chaincode/owners"
    59              body: "*"
    60          };
    61      }
    62  
    63      // Delete owner
    64      rpc DeleteOwner (OwnerId) returns (ChaincodeOwner) {
    65          option (google.api.http) = {
    66              delete: "/chaincode/owners/{msp_id}/{subject}"
    67          };
    68      }
    69  }
    70  
    71  // List: Chaincode owners
    72  message ChaincodeOwners {
    73      repeated ChaincodeOwner items = 1;
    74  }
    75  
    76  // State: information stored in chaincode state about chaincode owner
    77  message ChaincodeOwner {
    78      // Msp Id
    79      string msp_id = 1;
    80      //  certificate subject
    81      string subject = 2;
    82      //  certificate issuer
    83      string issuer = 3;
    84      // cert valid not after
    85      google.protobuf.Timestamp expires_at = 4;
    86      // Certificate
    87      bytes cert = 5;
    88      // Creator identity info
    89      string updated_by_msp_id = 6;
    90      // Certificate
    91      bytes updated_by_cert = 7;
    92      // Updated at
    93      google.protobuf.Timestamp updated_at = 8;
    94  }
    95  
    96  // Request: register owner
    97  message CreateOwnerRequest {
    98      // Msp Id
    99      string msp_id = 1 [(validator.field) = {string_not_empty: true}];
   100      // Certificate
   101      bytes cert = 2 [(validator.field) = {length_gt: 0}];
   102  }
   103  
   104  // Request: update owner certificate
   105  message UpdateOwnerRequest {
   106      // Msp Id
   107      string msp_id = 1 [(validator.field) = {string_not_empty: true}];
   108      // Current certificate
   109      bytes cert = 2 [(validator.field) = {length_gt: 0}];
   110  }
   111  
   112  // Id: owner identifier
   113  message OwnerId {
   114      // Msp Id
   115      string msp_id = 1 [(validator.field) = {string_not_empty: true}];
   116      // Certificate subject
   117      string subject = 2 [(validator.field) = {string_not_empty: true}];
   118  }
   119  
   120  // Event: new chaincode owner registered
   121  message ChaincodeOwnerCreated {
   122      // Msp Id
   123      string msp_id = 1;
   124      // certificate subject
   125      string subject = 2;
   126      //  certificate issuer
   127      string issuer = 3;
   128      // cert valid not after
   129      google.protobuf.Timestamp expires_at = 4;
   130  }
   131  
   132  // Event: new chaincode owner registered
   133  message ChaincodeOwnerUpdated {
   134      // Msp Id
   135      string msp_id = 1;
   136      // certificate subject
   137      string subject = 2;
   138      // cert valid not after
   139      google.protobuf.Timestamp expires_at = 3;
   140  }
   141  
   142  // Event: chaincode owner deleted`
   143  message ChaincodeOwnerDeleted {
   144      // Msp Id
   145      string msp_id = 1;
   146      // certificate subject
   147      string subject = 2;
   148  }