/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/protocol/keybase1/rekey.go
369 строк
10 KB
chrisnojima-zoom
Version 670 - clean2 (#29122)
08 июн 2026, 19:31
Не верифицирован
08 июн 2026, 19:31
1943197
Код
Авторство
О чём код?
// Code generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler). DO NOT EDIT. // Input file: avdl/keybase1/rekey.avdl package keybase1 import ( "context" "fmt" "time" "github.com/keybase/go-framed-msgpack-rpc/rpc" ) type TLF struct { Id TLFID `codec:"id" json:"id"` Name string `codec:"name" json:"name"` Writers []string `codec:"writers" json:"writers"` Readers []string `codec:"readers" json:"readers"` IsPrivate bool `codec:"isPrivate" json:"isPrivate"` } func (o TLF) DeepCopy() TLF { return TLF{ Id: o.Id.DeepCopy(), Name: o.Name, Writers: (func(x []string) []string { if x == nil { return nil } ret := make([]string, len(x)) for i, v := range x { vCopy := v ret[i] = vCopy } return ret })(o.Writers), Readers: (func(x []string) []string { if x == nil { return nil } ret := make([]string, len(x)) for i, v := range x { vCopy := v ret[i] = vCopy } return ret })(o.Readers), IsPrivate: o.IsPrivate, } } type ProblemTLF struct { Tlf TLF `codec:"tlf" json:"tlf"` Score int `codec:"score" json:"score"` Solution_kids []KID `codec:"solution_kids" json:"solution_kids"` } func (o ProblemTLF) DeepCopy() ProblemTLF { return ProblemTLF{ Tlf: o.Tlf.DeepCopy(), Score: o.Score, Solution_kids: (func(x []KID) []KID { if x == nil { return nil } ret := make([]KID, len(x)) for i, v := range x { vCopy := v.DeepCopy() ret[i] = vCopy } return ret })(o.Solution_kids), } } // ProblemSet is for a particular (user,kid) that initiated a rekey problem. // This problem consists of one or more problem TLFs, which are individually scored // and have attendant solutions --- devices that if they came online can rekey and // solve the ProblemTLF. type ProblemSet struct { User User `codec:"user" json:"user"` Kid KID `codec:"kid" json:"kid"` Tlfs []ProblemTLF `codec:"tlfs" json:"tlfs"` } func (o ProblemSet) DeepCopy() ProblemSet { return ProblemSet{ User: o.User.DeepCopy(), Kid: o.Kid.DeepCopy(), Tlfs: (func(x []ProblemTLF) []ProblemTLF { if x == nil { return nil } ret := make([]ProblemTLF, len(x)) for i, v := range x { vCopy := v.DeepCopy() ret[i] = vCopy } return ret })(o.Tlfs), } } type ProblemSetDevices struct { ProblemSet ProblemSet `codec:"problemSet" json:"problemSet"` Devices []Device `codec:"devices" json:"devices"` } func (o ProblemSetDevices) DeepCopy() ProblemSetDevices { return ProblemSetDevices{ ProblemSet: o.ProblemSet.DeepCopy(), Devices: (func(x []Device) []Device { if x == nil { return nil } ret := make([]Device, len(x)) for i, v := range x { vCopy := v.DeepCopy() ret[i] = vCopy } return ret })(o.Devices), } } type Outcome int const ( Outcome_NONE Outcome = 0 Outcome_FIXED Outcome = 1 Outcome_IGNORED Outcome = 2 ) func (o Outcome) DeepCopy() Outcome { return o } var OutcomeMap = map[string]Outcome{ "NONE": 0, "FIXED": 1, "IGNORED": 2, } var OutcomeRevMap = map[Outcome]string{ 0: "NONE", 1: "FIXED", 2: "IGNORED", } func (o Outcome) String() string { if v, ok := OutcomeRevMap[o]; ok { return v } return fmt.Sprintf("%v", int(o)) } type RevokeWarning struct { EndangeredTLFs []TLF `codec:"endangeredTLFs" json:"endangeredTLFs"` } func (o RevokeWarning) DeepCopy() RevokeWarning { return RevokeWarning{ EndangeredTLFs: (func(x []TLF) []TLF { if x == nil { return nil } ret := make([]TLF, len(x)) for i, v := range x { vCopy := v.DeepCopy() ret[i] = vCopy } return ret })(o.EndangeredTLFs), } } type ShowPendingRekeyStatusArg struct { SessionID int `codec:"sessionID" json:"sessionID"` } type GetPendingRekeyStatusArg struct { SessionID int `codec:"sessionID" json:"sessionID"` } type DebugShowRekeyStatusArg struct { SessionID int `codec:"sessionID" json:"sessionID"` } type RekeyStatusFinishArg struct { SessionID int `codec:"sessionID" json:"sessionID"` } type RekeySyncArg struct { SessionID int `codec:"sessionID" json:"sessionID"` Force bool `codec:"force" json:"force"` } type GetRevokeWarningArg struct { SessionID int `codec:"sessionID" json:"sessionID"` ActingDevice DeviceID `codec:"actingDevice" json:"actingDevice"` TargetDevice DeviceID `codec:"targetDevice" json:"targetDevice"` } type RekeyInterface interface { // ShowPendingRekeyStatus shows either pending gregor-initiated rekey harassments // or nothing if none were pending. ShowPendingRekeyStatus(context.Context, int) error // GetPendingRekeyStatus returns the pending ProblemSetDevices. GetPendingRekeyStatus(context.Context, int) (ProblemSetDevices, error) // DebugShowRekeyStatus is used by the CLI to kick off a "ShowRekeyStatus" window for // the current user. DebugShowRekeyStatus(context.Context, int) error // RekeyStatusFinish is called when work is completed on a given RekeyStatus window. The Outcome // can be Fixed or Ignored. RekeyStatusFinish(context.Context, int) (Outcome, error) // RekeySync flushes the current rekey loop and gets to a good stopping point // to assert state. Good for race-free testing, not very useful in production. // Force overrides a long-snooze. RekeySync(context.Context, RekeySyncArg) error // GetRevokeWarning computes the TLFs that will be endangered if actingDevice // revokes targetDevice. GetRevokeWarning(context.Context, GetRevokeWarningArg) (RevokeWarning, error) } func RekeyProtocol(i RekeyInterface) rpc.Protocol { return rpc.Protocol{ Name: "keybase.1.rekey", Methods: map[string]rpc.ServeHandlerDescription{ "showPendingRekeyStatus": { MakeArg: func() any { var ret [1]ShowPendingRekeyStatusArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]ShowPendingRekeyStatusArg) if !ok { err = rpc.NewTypeError((*[1]ShowPendingRekeyStatusArg)(nil), args) return } err = i.ShowPendingRekeyStatus(ctx, typedArgs[0].SessionID) return }, }, "getPendingRekeyStatus": { MakeArg: func() any { var ret [1]GetPendingRekeyStatusArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]GetPendingRekeyStatusArg) if !ok { err = rpc.NewTypeError((*[1]GetPendingRekeyStatusArg)(nil), args) return } ret, err = i.GetPendingRekeyStatus(ctx, typedArgs[0].SessionID) return }, }, "debugShowRekeyStatus": { MakeArg: func() any { var ret [1]DebugShowRekeyStatusArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]DebugShowRekeyStatusArg) if !ok { err = rpc.NewTypeError((*[1]DebugShowRekeyStatusArg)(nil), args) return } err = i.DebugShowRekeyStatus(ctx, typedArgs[0].SessionID) return }, }, "rekeyStatusFinish": { MakeArg: func() any { var ret [1]RekeyStatusFinishArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]RekeyStatusFinishArg) if !ok { err = rpc.NewTypeError((*[1]RekeyStatusFinishArg)(nil), args) return } ret, err = i.RekeyStatusFinish(ctx, typedArgs[0].SessionID) return }, }, "rekeySync": { MakeArg: func() any { var ret [1]RekeySyncArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]RekeySyncArg) if !ok { err = rpc.NewTypeError((*[1]RekeySyncArg)(nil), args) return } err = i.RekeySync(ctx, typedArgs[0]) return }, }, "getRevokeWarning": { MakeArg: func() any { var ret [1]GetRevokeWarningArg return &ret }, Handler: func(ctx context.Context, args any) (ret any, err error) { typedArgs, ok := args.(*[1]GetRevokeWarningArg) if !ok { err = rpc.NewTypeError((*[1]GetRevokeWarningArg)(nil), args) return } ret, err = i.GetRevokeWarning(ctx, typedArgs[0]) return }, }, }, } } type RekeyClient struct { Cli rpc.GenericClient } // ShowPendingRekeyStatus shows either pending gregor-initiated rekey harassments // or nothing if none were pending. func (c RekeyClient) ShowPendingRekeyStatus(ctx context.Context, sessionID int) (err error) { __arg := ShowPendingRekeyStatusArg{SessionID: sessionID} err = c.Cli.Call(ctx, "keybase.1.rekey.showPendingRekeyStatus", []any{__arg}, nil, 0*time.Millisecond) return } // GetPendingRekeyStatus returns the pending ProblemSetDevices. func (c RekeyClient) GetPendingRekeyStatus(ctx context.Context, sessionID int) (res ProblemSetDevices, err error) { __arg := GetPendingRekeyStatusArg{SessionID: sessionID} err = c.Cli.Call(ctx, "keybase.1.rekey.getPendingRekeyStatus", []any{__arg}, &res, 0*time.Millisecond) return } // DebugShowRekeyStatus is used by the CLI to kick off a "ShowRekeyStatus" window for // the current user. func (c RekeyClient) DebugShowRekeyStatus(ctx context.Context, sessionID int) (err error) { __arg := DebugShowRekeyStatusArg{SessionID: sessionID} err = c.Cli.Call(ctx, "keybase.1.rekey.debugShowRekeyStatus", []any{__arg}, nil, 0*time.Millisecond) return } // RekeyStatusFinish is called when work is completed on a given RekeyStatus window. The Outcome // can be Fixed or Ignored. func (c RekeyClient) RekeyStatusFinish(ctx context.Context, sessionID int) (res Outcome, err error) { __arg := RekeyStatusFinishArg{SessionID: sessionID} err = c.Cli.Call(ctx, "keybase.1.rekey.rekeyStatusFinish", []any{__arg}, &res, 0*time.Millisecond) return } // RekeySync flushes the current rekey loop and gets to a good stopping point // to assert state. Good for race-free testing, not very useful in production. // Force overrides a long-snooze. func (c RekeyClient) RekeySync(ctx context.Context, __arg RekeySyncArg) (err error) { err = c.Cli.Call(ctx, "keybase.1.rekey.rekeySync", []any{__arg}, nil, 0*time.Millisecond) return } // GetRevokeWarning computes the TLFs that will be endangered if actingDevice // revokes targetDevice. func (c RekeyClient) GetRevokeWarning(ctx context.Context, __arg GetRevokeWarningArg) (res RevokeWarning, err error) { err = c.Cli.Call(ctx, "keybase.1.rekey.getRevokeWarning", []any{__arg}, &res, 0*time.Millisecond) return }