github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/ephemeral.go (about)

     1  // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
     2  //   Input file: avdl/keybase1/ephemeral.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	"errors"
     8  	"fmt"
     9  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
    10  )
    11  
    12  type EkGeneration int64
    13  
    14  func (o EkGeneration) DeepCopy() EkGeneration {
    15  	return o
    16  }
    17  
    18  type DeviceEkMetadata struct {
    19  	Kid         KID          `codec:"kid" json:"device_ephemeral_dh_public"`
    20  	HashMeta    HashMeta     `codec:"hashMeta" json:"hash_meta"`
    21  	Generation  EkGeneration `codec:"generation" json:"generation"`
    22  	Ctime       Time         `codec:"ctime" json:"ctime"`
    23  	DeviceCtime Time         `codec:"deviceCtime" json:"deviceCtime"`
    24  }
    25  
    26  func (o DeviceEkMetadata) DeepCopy() DeviceEkMetadata {
    27  	return DeviceEkMetadata{
    28  		Kid:         o.Kid.DeepCopy(),
    29  		HashMeta:    o.HashMeta.DeepCopy(),
    30  		Generation:  o.Generation.DeepCopy(),
    31  		Ctime:       o.Ctime.DeepCopy(),
    32  		DeviceCtime: o.DeviceCtime.DeepCopy(),
    33  	}
    34  }
    35  
    36  type DeviceEkStatement struct {
    37  	CurrentDeviceEkMetadata DeviceEkMetadata `codec:"currentDeviceEkMetadata" json:"current_device_ek_metadata"`
    38  }
    39  
    40  func (o DeviceEkStatement) DeepCopy() DeviceEkStatement {
    41  	return DeviceEkStatement{
    42  		CurrentDeviceEkMetadata: o.CurrentDeviceEkMetadata.DeepCopy(),
    43  	}
    44  }
    45  
    46  type DeviceEk struct {
    47  	Seed     Bytes32          `codec:"seed" json:"seed"`
    48  	Metadata DeviceEkMetadata `codec:"metadata" json:"metadata"`
    49  }
    50  
    51  func (o DeviceEk) DeepCopy() DeviceEk {
    52  	return DeviceEk{
    53  		Seed:     o.Seed.DeepCopy(),
    54  		Metadata: o.Metadata.DeepCopy(),
    55  	}
    56  }
    57  
    58  type UserEkStatement struct {
    59  	CurrentUserEkMetadata UserEkMetadata `codec:"currentUserEkMetadata" json:"current_user_ek_metadata"`
    60  }
    61  
    62  func (o UserEkStatement) DeepCopy() UserEkStatement {
    63  	return UserEkStatement{
    64  		CurrentUserEkMetadata: o.CurrentUserEkMetadata.DeepCopy(),
    65  	}
    66  }
    67  
    68  type UserEkMetadata struct {
    69  	Kid        KID          `codec:"kid" json:"user_ephemeral_dh_public"`
    70  	HashMeta   HashMeta     `codec:"hashMeta" json:"hash_meta"`
    71  	Generation EkGeneration `codec:"generation" json:"generation"`
    72  	Ctime      Time         `codec:"ctime" json:"ctime"`
    73  }
    74  
    75  func (o UserEkMetadata) DeepCopy() UserEkMetadata {
    76  	return UserEkMetadata{
    77  		Kid:        o.Kid.DeepCopy(),
    78  		HashMeta:   o.HashMeta.DeepCopy(),
    79  		Generation: o.Generation.DeepCopy(),
    80  		Ctime:      o.Ctime.DeepCopy(),
    81  	}
    82  }
    83  
    84  type UserEkBoxed struct {
    85  	Box                string         `codec:"box" json:"box"`
    86  	DeviceEkGeneration EkGeneration   `codec:"deviceEkGeneration" json:"device_ek_generation"`
    87  	Metadata           UserEkMetadata `codec:"metadata" json:"metadata"`
    88  }
    89  
    90  func (o UserEkBoxed) DeepCopy() UserEkBoxed {
    91  	return UserEkBoxed{
    92  		Box:                o.Box,
    93  		DeviceEkGeneration: o.DeviceEkGeneration.DeepCopy(),
    94  		Metadata:           o.Metadata.DeepCopy(),
    95  	}
    96  }
    97  
    98  type UserEkBoxMetadata struct {
    99  	Box                 string       `codec:"box" json:"box"`
   100  	RecipientGeneration EkGeneration `codec:"recipientGeneration" json:"recipient_generation"`
   101  	RecipientDeviceID   DeviceID     `codec:"recipientDeviceID" json:"recipient_device_id"`
   102  }
   103  
   104  func (o UserEkBoxMetadata) DeepCopy() UserEkBoxMetadata {
   105  	return UserEkBoxMetadata{
   106  		Box:                 o.Box,
   107  		RecipientGeneration: o.RecipientGeneration.DeepCopy(),
   108  		RecipientDeviceID:   o.RecipientDeviceID.DeepCopy(),
   109  	}
   110  }
   111  
   112  type UserEk struct {
   113  	Seed     Bytes32        `codec:"seed" json:"seed"`
   114  	Metadata UserEkMetadata `codec:"metadata" json:"metadata"`
   115  }
   116  
   117  func (o UserEk) DeepCopy() UserEk {
   118  	return UserEk{
   119  		Seed:     o.Seed.DeepCopy(),
   120  		Metadata: o.Metadata.DeepCopy(),
   121  	}
   122  }
   123  
   124  type UserEkReboxArg struct {
   125  	UserEkBoxMetadata    UserEkBoxMetadata `codec:"userEkBoxMetadata" json:"userEkBoxMetadata"`
   126  	DeviceID             DeviceID          `codec:"deviceID" json:"deviceID"`
   127  	DeviceEkStatementSig string            `codec:"deviceEkStatementSig" json:"deviceEkStatementSig"`
   128  }
   129  
   130  func (o UserEkReboxArg) DeepCopy() UserEkReboxArg {
   131  	return UserEkReboxArg{
   132  		UserEkBoxMetadata:    o.UserEkBoxMetadata.DeepCopy(),
   133  		DeviceID:             o.DeviceID.DeepCopy(),
   134  		DeviceEkStatementSig: o.DeviceEkStatementSig,
   135  	}
   136  }
   137  
   138  type TeamEkMetadata struct {
   139  	Kid        KID          `codec:"kid" json:"team_ephemeral_dh_public"`
   140  	HashMeta   HashMeta     `codec:"hashMeta" json:"hash_meta"`
   141  	Generation EkGeneration `codec:"generation" json:"generation"`
   142  	Ctime      Time         `codec:"ctime" json:"ctime"`
   143  }
   144  
   145  func (o TeamEkMetadata) DeepCopy() TeamEkMetadata {
   146  	return TeamEkMetadata{
   147  		Kid:        o.Kid.DeepCopy(),
   148  		HashMeta:   o.HashMeta.DeepCopy(),
   149  		Generation: o.Generation.DeepCopy(),
   150  		Ctime:      o.Ctime.DeepCopy(),
   151  	}
   152  }
   153  
   154  type TeamEkStatement struct {
   155  	CurrentTeamEkMetadata TeamEkMetadata `codec:"currentTeamEkMetadata" json:"current_team_ek_metadata"`
   156  }
   157  
   158  func (o TeamEkStatement) DeepCopy() TeamEkStatement {
   159  	return TeamEkStatement{
   160  		CurrentTeamEkMetadata: o.CurrentTeamEkMetadata.DeepCopy(),
   161  	}
   162  }
   163  
   164  type TeamEkBoxed struct {
   165  	Box              string         `codec:"box" json:"box"`
   166  	UserEkGeneration EkGeneration   `codec:"userEkGeneration" json:"user_ek_generation"`
   167  	Metadata         TeamEkMetadata `codec:"metadata" json:"metadata"`
   168  }
   169  
   170  func (o TeamEkBoxed) DeepCopy() TeamEkBoxed {
   171  	return TeamEkBoxed{
   172  		Box:              o.Box,
   173  		UserEkGeneration: o.UserEkGeneration.DeepCopy(),
   174  		Metadata:         o.Metadata.DeepCopy(),
   175  	}
   176  }
   177  
   178  type TeamEkBoxMetadata struct {
   179  	Box                 string       `codec:"box" json:"box"`
   180  	RecipientGeneration EkGeneration `codec:"recipientGeneration" json:"recipient_generation"`
   181  	RecipientUID        UID          `codec:"recipientUID" json:"recipient_uid"`
   182  }
   183  
   184  func (o TeamEkBoxMetadata) DeepCopy() TeamEkBoxMetadata {
   185  	return TeamEkBoxMetadata{
   186  		Box:                 o.Box,
   187  		RecipientGeneration: o.RecipientGeneration.DeepCopy(),
   188  		RecipientUID:        o.RecipientUID.DeepCopy(),
   189  	}
   190  }
   191  
   192  type TeamEk struct {
   193  	Seed     Bytes32        `codec:"seed" json:"seed"`
   194  	Metadata TeamEkMetadata `codec:"metadata" json:"metadata"`
   195  }
   196  
   197  func (o TeamEk) DeepCopy() TeamEk {
   198  	return TeamEk{
   199  		Seed:     o.Seed.DeepCopy(),
   200  		Metadata: o.Metadata.DeepCopy(),
   201  	}
   202  }
   203  
   204  type TeambotEkMetadata struct {
   205  	Kid              KID          `codec:"kid" json:"teambot_dh_public"`
   206  	Generation       EkGeneration `codec:"generation" json:"generation"`
   207  	Uid              UID          `codec:"uid" json:"uid"`
   208  	UserEkGeneration EkGeneration `codec:"userEkGeneration" json:"user_ek_generation"`
   209  	HashMeta         HashMeta     `codec:"hashMeta" json:"hash_meta"`
   210  	Ctime            Time         `codec:"ctime" json:"ctime"`
   211  }
   212  
   213  func (o TeambotEkMetadata) DeepCopy() TeambotEkMetadata {
   214  	return TeambotEkMetadata{
   215  		Kid:              o.Kid.DeepCopy(),
   216  		Generation:       o.Generation.DeepCopy(),
   217  		Uid:              o.Uid.DeepCopy(),
   218  		UserEkGeneration: o.UserEkGeneration.DeepCopy(),
   219  		HashMeta:         o.HashMeta.DeepCopy(),
   220  		Ctime:            o.Ctime.DeepCopy(),
   221  	}
   222  }
   223  
   224  type TeambotEkBoxed struct {
   225  	Box      string            `codec:"box" json:"box"`
   226  	Metadata TeambotEkMetadata `codec:"metadata" json:"metadata"`
   227  }
   228  
   229  func (o TeambotEkBoxed) DeepCopy() TeambotEkBoxed {
   230  	return TeambotEkBoxed{
   231  		Box:      o.Box,
   232  		Metadata: o.Metadata.DeepCopy(),
   233  	}
   234  }
   235  
   236  type TeambotEk struct {
   237  	Seed     Bytes32           `codec:"seed" json:"seed"`
   238  	Metadata TeambotEkMetadata `codec:"metadata" json:"metadata"`
   239  }
   240  
   241  func (o TeambotEk) DeepCopy() TeambotEk {
   242  	return TeambotEk{
   243  		Seed:     o.Seed.DeepCopy(),
   244  		Metadata: o.Metadata.DeepCopy(),
   245  	}
   246  }
   247  
   248  type TeamEphemeralKeyType int
   249  
   250  const (
   251  	TeamEphemeralKeyType_TEAM    TeamEphemeralKeyType = 0
   252  	TeamEphemeralKeyType_TEAMBOT TeamEphemeralKeyType = 1
   253  )
   254  
   255  func (o TeamEphemeralKeyType) DeepCopy() TeamEphemeralKeyType { return o }
   256  
   257  var TeamEphemeralKeyTypeMap = map[string]TeamEphemeralKeyType{
   258  	"TEAM":    0,
   259  	"TEAMBOT": 1,
   260  }
   261  
   262  var TeamEphemeralKeyTypeRevMap = map[TeamEphemeralKeyType]string{
   263  	0: "TEAM",
   264  	1: "TEAMBOT",
   265  }
   266  
   267  func (e TeamEphemeralKeyType) String() string {
   268  	if v, ok := TeamEphemeralKeyTypeRevMap[e]; ok {
   269  		return v
   270  	}
   271  	return fmt.Sprintf("%v", int(e))
   272  }
   273  
   274  type TeamEphemeralKey struct {
   275  	KeyType__ TeamEphemeralKeyType `codec:"keyType" json:"keyType"`
   276  	Team__    *TeamEk              `codec:"team,omitempty" json:"team,omitempty"`
   277  	Teambot__ *TeambotEk           `codec:"teambot,omitempty" json:"teambot,omitempty"`
   278  }
   279  
   280  func (o *TeamEphemeralKey) KeyType() (ret TeamEphemeralKeyType, err error) {
   281  	switch o.KeyType__ {
   282  	case TeamEphemeralKeyType_TEAM:
   283  		if o.Team__ == nil {
   284  			err = errors.New("unexpected nil value for Team__")
   285  			return ret, err
   286  		}
   287  	case TeamEphemeralKeyType_TEAMBOT:
   288  		if o.Teambot__ == nil {
   289  			err = errors.New("unexpected nil value for Teambot__")
   290  			return ret, err
   291  		}
   292  	}
   293  	return o.KeyType__, nil
   294  }
   295  
   296  func (o TeamEphemeralKey) Team() (res TeamEk) {
   297  	if o.KeyType__ != TeamEphemeralKeyType_TEAM {
   298  		panic("wrong case accessed")
   299  	}
   300  	if o.Team__ == nil {
   301  		return
   302  	}
   303  	return *o.Team__
   304  }
   305  
   306  func (o TeamEphemeralKey) Teambot() (res TeambotEk) {
   307  	if o.KeyType__ != TeamEphemeralKeyType_TEAMBOT {
   308  		panic("wrong case accessed")
   309  	}
   310  	if o.Teambot__ == nil {
   311  		return
   312  	}
   313  	return *o.Teambot__
   314  }
   315  
   316  func NewTeamEphemeralKeyWithTeam(v TeamEk) TeamEphemeralKey {
   317  	return TeamEphemeralKey{
   318  		KeyType__: TeamEphemeralKeyType_TEAM,
   319  		Team__:    &v,
   320  	}
   321  }
   322  
   323  func NewTeamEphemeralKeyWithTeambot(v TeambotEk) TeamEphemeralKey {
   324  	return TeamEphemeralKey{
   325  		KeyType__: TeamEphemeralKeyType_TEAMBOT,
   326  		Teambot__: &v,
   327  	}
   328  }
   329  
   330  func (o TeamEphemeralKey) DeepCopy() TeamEphemeralKey {
   331  	return TeamEphemeralKey{
   332  		KeyType__: o.KeyType__.DeepCopy(),
   333  		Team__: (func(x *TeamEk) *TeamEk {
   334  			if x == nil {
   335  				return nil
   336  			}
   337  			tmp := (*x).DeepCopy()
   338  			return &tmp
   339  		})(o.Team__),
   340  		Teambot__: (func(x *TeambotEk) *TeambotEk {
   341  			if x == nil {
   342  				return nil
   343  			}
   344  			tmp := (*x).DeepCopy()
   345  			return &tmp
   346  		})(o.Teambot__),
   347  	}
   348  }
   349  
   350  type TeamEphemeralKeyBoxed struct {
   351  	KeyType__ TeamEphemeralKeyType `codec:"keyType" json:"keyType"`
   352  	Team__    *TeamEkBoxed         `codec:"team,omitempty" json:"team,omitempty"`
   353  	Teambot__ *TeambotEkBoxed      `codec:"teambot,omitempty" json:"teambot,omitempty"`
   354  }
   355  
   356  func (o *TeamEphemeralKeyBoxed) KeyType() (ret TeamEphemeralKeyType, err error) {
   357  	switch o.KeyType__ {
   358  	case TeamEphemeralKeyType_TEAM:
   359  		if o.Team__ == nil {
   360  			err = errors.New("unexpected nil value for Team__")
   361  			return ret, err
   362  		}
   363  	case TeamEphemeralKeyType_TEAMBOT:
   364  		if o.Teambot__ == nil {
   365  			err = errors.New("unexpected nil value for Teambot__")
   366  			return ret, err
   367  		}
   368  	}
   369  	return o.KeyType__, nil
   370  }
   371  
   372  func (o TeamEphemeralKeyBoxed) Team() (res TeamEkBoxed) {
   373  	if o.KeyType__ != TeamEphemeralKeyType_TEAM {
   374  		panic("wrong case accessed")
   375  	}
   376  	if o.Team__ == nil {
   377  		return
   378  	}
   379  	return *o.Team__
   380  }
   381  
   382  func (o TeamEphemeralKeyBoxed) Teambot() (res TeambotEkBoxed) {
   383  	if o.KeyType__ != TeamEphemeralKeyType_TEAMBOT {
   384  		panic("wrong case accessed")
   385  	}
   386  	if o.Teambot__ == nil {
   387  		return
   388  	}
   389  	return *o.Teambot__
   390  }
   391  
   392  func NewTeamEphemeralKeyBoxedWithTeam(v TeamEkBoxed) TeamEphemeralKeyBoxed {
   393  	return TeamEphemeralKeyBoxed{
   394  		KeyType__: TeamEphemeralKeyType_TEAM,
   395  		Team__:    &v,
   396  	}
   397  }
   398  
   399  func NewTeamEphemeralKeyBoxedWithTeambot(v TeambotEkBoxed) TeamEphemeralKeyBoxed {
   400  	return TeamEphemeralKeyBoxed{
   401  		KeyType__: TeamEphemeralKeyType_TEAMBOT,
   402  		Teambot__: &v,
   403  	}
   404  }
   405  
   406  func (o TeamEphemeralKeyBoxed) DeepCopy() TeamEphemeralKeyBoxed {
   407  	return TeamEphemeralKeyBoxed{
   408  		KeyType__: o.KeyType__.DeepCopy(),
   409  		Team__: (func(x *TeamEkBoxed) *TeamEkBoxed {
   410  			if x == nil {
   411  				return nil
   412  			}
   413  			tmp := (*x).DeepCopy()
   414  			return &tmp
   415  		})(o.Team__),
   416  		Teambot__: (func(x *TeambotEkBoxed) *TeambotEkBoxed {
   417  			if x == nil {
   418  				return nil
   419  			}
   420  			tmp := (*x).DeepCopy()
   421  			return &tmp
   422  		})(o.Teambot__),
   423  	}
   424  }
   425  
   426  type EphemeralInterface interface {
   427  }
   428  
   429  func EphemeralProtocol(i EphemeralInterface) rpc.Protocol {
   430  	return rpc.Protocol{
   431  		Name:    "keybase.1.ephemeral",
   432  		Methods: map[string]rpc.ServeHandlerDescription{},
   433  	}
   434  }
   435  
   436  type EphemeralClient struct {
   437  	Cli rpc.GenericClient
   438  }