github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/saltpack_ui.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/saltpack_ui.avdl 3 4 package keybase1 5 6 import ( 7 "fmt" 8 "github.com/keybase/go-framed-msgpack-rpc/rpc" 9 context "golang.org/x/net/context" 10 "time" 11 ) 12 13 type SaltpackSenderType int 14 15 const ( 16 SaltpackSenderType_NOT_TRACKED SaltpackSenderType = 0 17 SaltpackSenderType_UNKNOWN SaltpackSenderType = 1 18 SaltpackSenderType_ANONYMOUS SaltpackSenderType = 2 19 SaltpackSenderType_TRACKING_BROKE SaltpackSenderType = 3 20 SaltpackSenderType_TRACKING_OK SaltpackSenderType = 4 21 SaltpackSenderType_SELF SaltpackSenderType = 5 22 SaltpackSenderType_REVOKED SaltpackSenderType = 6 23 SaltpackSenderType_EXPIRED SaltpackSenderType = 7 24 ) 25 26 func (o SaltpackSenderType) DeepCopy() SaltpackSenderType { return o } 27 28 var SaltpackSenderTypeMap = map[string]SaltpackSenderType{ 29 "NOT_TRACKED": 0, 30 "UNKNOWN": 1, 31 "ANONYMOUS": 2, 32 "TRACKING_BROKE": 3, 33 "TRACKING_OK": 4, 34 "SELF": 5, 35 "REVOKED": 6, 36 "EXPIRED": 7, 37 } 38 39 var SaltpackSenderTypeRevMap = map[SaltpackSenderType]string{ 40 0: "NOT_TRACKED", 41 1: "UNKNOWN", 42 2: "ANONYMOUS", 43 3: "TRACKING_BROKE", 44 4: "TRACKING_OK", 45 5: "SELF", 46 6: "REVOKED", 47 7: "EXPIRED", 48 } 49 50 func (e SaltpackSenderType) String() string { 51 if v, ok := SaltpackSenderTypeRevMap[e]; ok { 52 return v 53 } 54 return fmt.Sprintf("%v", int(e)) 55 } 56 57 type SaltpackSender struct { 58 Uid UID `codec:"uid" json:"uid"` 59 Username string `codec:"username" json:"username"` 60 Fullname string `codec:"fullname" json:"fullname"` 61 SenderType SaltpackSenderType `codec:"senderType" json:"senderType"` 62 } 63 64 func (o SaltpackSender) DeepCopy() SaltpackSender { 65 return SaltpackSender{ 66 Uid: o.Uid.DeepCopy(), 67 Username: o.Username, 68 Fullname: o.Fullname, 69 SenderType: o.SenderType.DeepCopy(), 70 } 71 } 72 73 type SaltpackPromptForDecryptArg struct { 74 SessionID int `codec:"sessionID" json:"sessionID"` 75 SigningKID KID `codec:"signingKID" json:"signingKID"` 76 Sender SaltpackSender `codec:"sender" json:"sender"` 77 UsedDelegateUI bool `codec:"usedDelegateUI" json:"usedDelegateUI"` 78 Signed bool `codec:"signed" json:"signed"` 79 } 80 81 type SaltpackVerifySuccessArg struct { 82 SessionID int `codec:"sessionID" json:"sessionID"` 83 SigningKID KID `codec:"signingKID" json:"signingKID"` 84 Sender SaltpackSender `codec:"sender" json:"sender"` 85 } 86 87 type SaltpackVerifyBadSenderArg struct { 88 SessionID int `codec:"sessionID" json:"sessionID"` 89 SigningKID KID `codec:"signingKID" json:"signingKID"` 90 Sender SaltpackSender `codec:"sender" json:"sender"` 91 } 92 93 type SaltpackUiInterface interface { 94 SaltpackPromptForDecrypt(context.Context, SaltpackPromptForDecryptArg) error 95 SaltpackVerifySuccess(context.Context, SaltpackVerifySuccessArg) error 96 SaltpackVerifyBadSender(context.Context, SaltpackVerifyBadSenderArg) error 97 } 98 99 func SaltpackUiProtocol(i SaltpackUiInterface) rpc.Protocol { 100 return rpc.Protocol{ 101 Name: "keybase.1.saltpackUi", 102 Methods: map[string]rpc.ServeHandlerDescription{ 103 "saltpackPromptForDecrypt": { 104 MakeArg: func() interface{} { 105 var ret [1]SaltpackPromptForDecryptArg 106 return &ret 107 }, 108 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 109 typedArgs, ok := args.(*[1]SaltpackPromptForDecryptArg) 110 if !ok { 111 err = rpc.NewTypeError((*[1]SaltpackPromptForDecryptArg)(nil), args) 112 return 113 } 114 err = i.SaltpackPromptForDecrypt(ctx, typedArgs[0]) 115 return 116 }, 117 }, 118 "saltpackVerifySuccess": { 119 MakeArg: func() interface{} { 120 var ret [1]SaltpackVerifySuccessArg 121 return &ret 122 }, 123 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 124 typedArgs, ok := args.(*[1]SaltpackVerifySuccessArg) 125 if !ok { 126 err = rpc.NewTypeError((*[1]SaltpackVerifySuccessArg)(nil), args) 127 return 128 } 129 err = i.SaltpackVerifySuccess(ctx, typedArgs[0]) 130 return 131 }, 132 }, 133 "saltpackVerifyBadSender": { 134 MakeArg: func() interface{} { 135 var ret [1]SaltpackVerifyBadSenderArg 136 return &ret 137 }, 138 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 139 typedArgs, ok := args.(*[1]SaltpackVerifyBadSenderArg) 140 if !ok { 141 err = rpc.NewTypeError((*[1]SaltpackVerifyBadSenderArg)(nil), args) 142 return 143 } 144 err = i.SaltpackVerifyBadSender(ctx, typedArgs[0]) 145 return 146 }, 147 }, 148 }, 149 } 150 } 151 152 type SaltpackUiClient struct { 153 Cli rpc.GenericClient 154 } 155 156 func (c SaltpackUiClient) SaltpackPromptForDecrypt(ctx context.Context, __arg SaltpackPromptForDecryptArg) (err error) { 157 err = c.Cli.Call(ctx, "keybase.1.saltpackUi.saltpackPromptForDecrypt", []interface{}{__arg}, nil, 0*time.Millisecond) 158 return 159 } 160 161 func (c SaltpackUiClient) SaltpackVerifySuccess(ctx context.Context, __arg SaltpackVerifySuccessArg) (err error) { 162 err = c.Cli.Call(ctx, "keybase.1.saltpackUi.saltpackVerifySuccess", []interface{}{__arg}, nil, 0*time.Millisecond) 163 return 164 } 165 166 func (c SaltpackUiClient) SaltpackVerifyBadSender(ctx context.Context, __arg SaltpackVerifyBadSenderArg) (err error) { 167 err = c.Cli.Call(ctx, "keybase.1.saltpackUi.saltpackVerifyBadSender", []interface{}{__arg}, nil, 0*time.Millisecond) 168 return 169 }