go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/buildbucket/proto/token.proto (about) 1 // Copyright 2022 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 package buildbucket.v2; 18 19 option go_package = "go.chromium.org/luci/buildbucket/proto;buildbucketpb"; 20 21 // TokenBody describes internal structure of the token. 22 message TokenBody { 23 // Id of the build this token is generated for. 24 int64 build_id = 1; 25 26 // Possible purposes of the token. 27 enum Purpose { 28 // The default value. This value is used if purpose is omitted. 29 PURPOSE_UNSPECIFIED = 0; 30 // The token is a token for updating a build. 31 BUILD = 1; 32 // The token is a token for updating a backend task. DO NOT USE. DEPRECATED. 33 TASK = 2 [deprecated = true]; 34 // The token is a token for starting a build. 35 START_BUILD = 3; 36 // The token is a token for starting and registering a backend task with the 37 // build it runs. 38 START_BUILD_TASK = 4; 39 } 40 41 // Purpose of the token. 42 Purpose purpose = 2; 43 44 // An additional random byte slice to be used to generate the token. 45 bytes state = 3; 46 } 47 48 // TokenEnvelope is what is actually being serialized and represented 49 // as a token (after being encoded using base64 standard raw encoding). 50 message TokenEnvelope { 51 52 // Possible version of the token. 53 enum Version { 54 // The default value. This value is used if version is omitted. 55 VERSION_UNSPECIFIED = 0; 56 57 // The token is saved in model.Build like a password. 58 UNENCRYPTED_PASSWORD_LIKE = 1; 59 60 // The token is encrypted using go.chromium.org/luci/server/secrets. 61 ENCRYPTED = 2; 62 } 63 // Version of the token. 64 Version version = 1; 65 66 // Serialized and potentially encrypted TokenBody. 67 bytes payload = 2; 68 }