forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keybase_v1.go
6530 lines (5876 loc) · 199 KB
/
keybase_v1.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package keybase1
import (
rpc "github.com/keybase/go-framed-msgpack-rpc"
context "golang.org/x/net/context"
)
type GenericClient interface {
Call(ctx context.Context, s string, args interface{}, res interface{}) error
Notify(ctx context.Context, s string, args interface{}) error
}
type Feature struct {
Allow bool `codec:"allow" json:"allow"`
DefaultValue bool `codec:"defaultValue" json:"defaultValue"`
Readonly bool `codec:"readonly" json:"readonly"`
Label string `codec:"label" json:"label"`
}
type GUIEntryFeatures struct {
StoreSecret Feature `codec:"storeSecret" json:"storeSecret"`
ShowTyping Feature `codec:"showTyping" json:"showTyping"`
}
type PassphraseType int
const (
PassphraseType_NONE PassphraseType = 0
PassphraseType_PAPER_KEY PassphraseType = 1
PassphraseType_PASS_PHRASE PassphraseType = 2
PassphraseType_VERIFY_PASS_PHRASE PassphraseType = 3
)
type GUIEntryArg struct {
WindowTitle string `codec:"windowTitle" json:"windowTitle"`
Prompt string `codec:"prompt" json:"prompt"`
SubmitLabel string `codec:"submitLabel" json:"submitLabel"`
CancelLabel string `codec:"cancelLabel" json:"cancelLabel"`
RetryLabel string `codec:"retryLabel" json:"retryLabel"`
Type PassphraseType `codec:"type" json:"type"`
Features GUIEntryFeatures `codec:"features" json:"features"`
}
type GetPassphraseRes struct {
Passphrase string `codec:"passphrase" json:"passphrase"`
StoreSecret bool `codec:"storeSecret" json:"storeSecret"`
}
type PassphraseChangeArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
OldPassphrase string `codec:"oldPassphrase" json:"oldPassphrase"`
Passphrase string `codec:"passphrase" json:"passphrase"`
Force bool `codec:"force" json:"force"`
}
type PassphrasePromptArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
GuiArg GUIEntryArg `codec:"guiArg" json:"guiArg"`
}
type AccountInterface interface {
PassphraseChange(context.Context, PassphraseChangeArg) error
PassphrasePrompt(context.Context, PassphrasePromptArg) (GetPassphraseRes, error)
}
func AccountProtocol(i AccountInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.account",
Methods: map[string]rpc.ServeHandlerDescription{
"passphraseChange": {
MakeArg: func() interface{} {
ret := make([]PassphraseChangeArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]PassphraseChangeArg)
if !ok {
err = rpc.NewTypeError((*[]PassphraseChangeArg)(nil), args)
return
}
err = i.PassphraseChange(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"passphrasePrompt": {
MakeArg: func() interface{} {
ret := make([]PassphrasePromptArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]PassphrasePromptArg)
if !ok {
err = rpc.NewTypeError((*[]PassphrasePromptArg)(nil), args)
return
}
ret, err = i.PassphrasePrompt(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
},
}
}
type AccountClient struct {
Cli GenericClient
}
func (c AccountClient) PassphraseChange(ctx context.Context, __arg PassphraseChangeArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.account.passphraseChange", []interface{}{__arg}, nil)
return
}
func (c AccountClient) PassphrasePrompt(ctx context.Context, __arg PassphrasePromptArg) (res GetPassphraseRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.account.passphrasePrompt", []interface{}{__arg}, &res)
return
}
type Time int64
type StringKVPair struct {
Key string `codec:"key" json:"key"`
Value string `codec:"value" json:"value"`
}
type Status struct {
Code int `codec:"code" json:"code"`
Name string `codec:"name" json:"name"`
Desc string `codec:"desc" json:"desc"`
Fields []StringKVPair `codec:"fields" json:"fields"`
}
type UID string
type DeviceID string
type SigID string
type KID string
type Text struct {
Data string `codec:"data" json:"data"`
Markup bool `codec:"markup" json:"markup"`
}
type PGPIdentity struct {
Username string `codec:"username" json:"username"`
Comment string `codec:"comment" json:"comment"`
Email string `codec:"email" json:"email"`
}
type PublicKey struct {
KID KID `codec:"KID" json:"KID"`
PGPFingerprint string `codec:"PGPFingerprint" json:"PGPFingerprint"`
PGPIdentities []PGPIdentity `codec:"PGPIdentities" json:"PGPIdentities"`
IsSibkey bool `codec:"isSibkey" json:"isSibkey"`
IsEldest bool `codec:"isEldest" json:"isEldest"`
ParentID string `codec:"parentID" json:"parentID"`
DeviceID DeviceID `codec:"deviceID" json:"deviceID"`
DeviceDescription string `codec:"deviceDescription" json:"deviceDescription"`
DeviceType string `codec:"deviceType" json:"deviceType"`
CTime Time `codec:"cTime" json:"cTime"`
ETime Time `codec:"eTime" json:"eTime"`
}
type User struct {
Uid UID `codec:"uid" json:"uid"`
Username string `codec:"username" json:"username"`
}
type Device struct {
Type string `codec:"type" json:"type"`
Name string `codec:"name" json:"name"`
DeviceID DeviceID `codec:"deviceID" json:"deviceID"`
CTime Time `codec:"cTime" json:"cTime"`
MTime Time `codec:"mTime" json:"mTime"`
EncryptKey KID `codec:"encryptKey" json:"encryptKey"`
VerifyKey KID `codec:"verifyKey" json:"verifyKey"`
Status int `codec:"status" json:"status"`
}
type Stream struct {
Fd int `codec:"fd" json:"fd"`
}
type LogLevel int
const (
LogLevel_NONE LogLevel = 0
LogLevel_DEBUG LogLevel = 1
LogLevel_INFO LogLevel = 2
LogLevel_NOTICE LogLevel = 3
LogLevel_WARN LogLevel = 4
LogLevel_ERROR LogLevel = 5
LogLevel_CRITICAL LogLevel = 6
LogLevel_FATAL LogLevel = 7
)
type ClientType int
const (
ClientType_NONE ClientType = 0
ClientType_CLI ClientType = 1
ClientType_GUI ClientType = 2
ClientType_KBFS ClientType = 3
)
type UserVersionVector struct {
Id int64 `codec:"id" json:"id"`
SigHints int `codec:"sigHints" json:"sigHints"`
SigChain int64 `codec:"sigChain" json:"sigChain"`
CachedAt Time `codec:"cachedAt" json:"cachedAt"`
LastIdentifiedAt Time `codec:"lastIdentifiedAt" json:"lastIdentifiedAt"`
}
type UserPlusKeys struct {
Uid UID `codec:"uid" json:"uid"`
Username string `codec:"username" json:"username"`
DeviceKeys []PublicKey `codec:"deviceKeys" json:"deviceKeys"`
Keys []PublicKey `codec:"keys" json:"keys"`
Uvv UserVersionVector `codec:"uvv" json:"uvv"`
}
type BlockIdCombo struct {
BlockHash string `codec:"blockHash" json:"blockHash"`
ChargedTo UID `codec:"chargedTo" json:"chargedTo"`
}
type ChallengeInfo struct {
Now int64 `codec:"now" json:"now"`
Challenge string `codec:"challenge" json:"challenge"`
}
type GetBlockRes struct {
BlockKey string `codec:"blockKey" json:"blockKey"`
Buf []byte `codec:"buf" json:"buf"`
}
type BlockRefNonce [8]byte
type BlockReference struct {
Bid BlockIdCombo `codec:"bid" json:"bid"`
Nonce BlockRefNonce `codec:"nonce" json:"nonce"`
ChargedTo UID `codec:"chargedTo" json:"chargedTo"`
}
type GetSessionChallengeArg struct {
}
type AuthenticateSessionArg struct {
Signature string `codec:"signature" json:"signature"`
}
type PutBlockArg struct {
Bid BlockIdCombo `codec:"bid" json:"bid"`
Folder string `codec:"folder" json:"folder"`
BlockKey string `codec:"blockKey" json:"blockKey"`
Buf []byte `codec:"buf" json:"buf"`
}
type GetBlockArg struct {
Bid BlockIdCombo `codec:"bid" json:"bid"`
Folder string `codec:"folder" json:"folder"`
}
type AddReferenceArg struct {
Folder string `codec:"folder" json:"folder"`
Ref BlockReference `codec:"ref" json:"ref"`
}
type DelReferenceArg struct {
Folder string `codec:"folder" json:"folder"`
Ref BlockReference `codec:"ref" json:"ref"`
}
type ArchiveReferenceArg struct {
Folder string `codec:"folder" json:"folder"`
Refs []BlockReference `codec:"refs" json:"refs"`
}
type GetUserQuotaInfoArg struct {
}
type BlockInterface interface {
GetSessionChallenge(context.Context) (ChallengeInfo, error)
AuthenticateSession(context.Context, string) error
PutBlock(context.Context, PutBlockArg) error
GetBlock(context.Context, GetBlockArg) (GetBlockRes, error)
AddReference(context.Context, AddReferenceArg) error
DelReference(context.Context, DelReferenceArg) error
ArchiveReference(context.Context, ArchiveReferenceArg) ([]BlockReference, error)
GetUserQuotaInfo(context.Context) ([]byte, error)
}
func BlockProtocol(i BlockInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.block",
Methods: map[string]rpc.ServeHandlerDescription{
"getSessionChallenge": {
MakeArg: func() interface{} {
ret := make([]GetSessionChallengeArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
ret, err = i.GetSessionChallenge(ctx)
return
},
MethodType: rpc.MethodCall,
},
"authenticateSession": {
MakeArg: func() interface{} {
ret := make([]AuthenticateSessionArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]AuthenticateSessionArg)
if !ok {
err = rpc.NewTypeError((*[]AuthenticateSessionArg)(nil), args)
return
}
err = i.AuthenticateSession(ctx, (*typedArgs)[0].Signature)
return
},
MethodType: rpc.MethodCall,
},
"putBlock": {
MakeArg: func() interface{} {
ret := make([]PutBlockArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]PutBlockArg)
if !ok {
err = rpc.NewTypeError((*[]PutBlockArg)(nil), args)
return
}
err = i.PutBlock(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"getBlock": {
MakeArg: func() interface{} {
ret := make([]GetBlockArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]GetBlockArg)
if !ok {
err = rpc.NewTypeError((*[]GetBlockArg)(nil), args)
return
}
ret, err = i.GetBlock(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"addReference": {
MakeArg: func() interface{} {
ret := make([]AddReferenceArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]AddReferenceArg)
if !ok {
err = rpc.NewTypeError((*[]AddReferenceArg)(nil), args)
return
}
err = i.AddReference(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"delReference": {
MakeArg: func() interface{} {
ret := make([]DelReferenceArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]DelReferenceArg)
if !ok {
err = rpc.NewTypeError((*[]DelReferenceArg)(nil), args)
return
}
err = i.DelReference(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"archiveReference": {
MakeArg: func() interface{} {
ret := make([]ArchiveReferenceArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]ArchiveReferenceArg)
if !ok {
err = rpc.NewTypeError((*[]ArchiveReferenceArg)(nil), args)
return
}
ret, err = i.ArchiveReference(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"getUserQuotaInfo": {
MakeArg: func() interface{} {
ret := make([]GetUserQuotaInfoArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
ret, err = i.GetUserQuotaInfo(ctx)
return
},
MethodType: rpc.MethodCall,
},
},
}
}
type BlockClient struct {
Cli GenericClient
}
func (c BlockClient) GetSessionChallenge(ctx context.Context) (res ChallengeInfo, err error) {
err = c.Cli.Call(ctx, "keybase.1.block.getSessionChallenge", []interface{}{GetSessionChallengeArg{}}, &res)
return
}
func (c BlockClient) AuthenticateSession(ctx context.Context, signature string) (err error) {
__arg := AuthenticateSessionArg{Signature: signature}
err = c.Cli.Call(ctx, "keybase.1.block.authenticateSession", []interface{}{__arg}, nil)
return
}
func (c BlockClient) PutBlock(ctx context.Context, __arg PutBlockArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.block.putBlock", []interface{}{__arg}, nil)
return
}
func (c BlockClient) GetBlock(ctx context.Context, __arg GetBlockArg) (res GetBlockRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.block.getBlock", []interface{}{__arg}, &res)
return
}
func (c BlockClient) AddReference(ctx context.Context, __arg AddReferenceArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.block.addReference", []interface{}{__arg}, nil)
return
}
func (c BlockClient) DelReference(ctx context.Context, __arg DelReferenceArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.block.delReference", []interface{}{__arg}, nil)
return
}
func (c BlockClient) ArchiveReference(ctx context.Context, __arg ArchiveReferenceArg) (res []BlockReference, err error) {
err = c.Cli.Call(ctx, "keybase.1.block.archiveReference", []interface{}{__arg}, &res)
return
}
func (c BlockClient) GetUserQuotaInfo(ctx context.Context) (res []byte, err error) {
err = c.Cli.Call(ctx, "keybase.1.block.getUserQuotaInfo", []interface{}{GetUserQuotaInfoArg{}}, &res)
return
}
type RegisterBTCArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Address string `codec:"address" json:"address"`
Force bool `codec:"force" json:"force"`
}
type BTCInterface interface {
RegisterBTC(context.Context, RegisterBTCArg) error
}
func BTCProtocol(i BTCInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.BTC",
Methods: map[string]rpc.ServeHandlerDescription{
"registerBTC": {
MakeArg: func() interface{} {
ret := make([]RegisterBTCArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]RegisterBTCArg)
if !ok {
err = rpc.NewTypeError((*[]RegisterBTCArg)(nil), args)
return
}
err = i.RegisterBTC(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
},
}
}
type BTCClient struct {
Cli GenericClient
}
func (c BTCClient) RegisterBTC(ctx context.Context, __arg RegisterBTCArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.BTC.registerBTC", []interface{}{__arg}, nil)
return
}
type GetCurrentStatusRes struct {
Configured bool `codec:"configured" json:"configured"`
Registered bool `codec:"registered" json:"registered"`
LoggedIn bool `codec:"loggedIn" json:"loggedIn"`
User *User `codec:"user,omitempty" json:"user,omitempty"`
}
type SessionStatus struct {
SessionFor string `codec:"SessionFor" json:"SessionFor"`
Loaded bool `codec:"Loaded" json:"Loaded"`
Cleared bool `codec:"Cleared" json:"Cleared"`
SaltOnly bool `codec:"SaltOnly" json:"SaltOnly"`
Expired bool `codec:"Expired" json:"Expired"`
}
type ClientDetails struct {
Pid int `codec:"pid" json:"pid"`
ClientType ClientType `codec:"clientType" json:"clientType"`
Argv []string `codec:"argv" json:"argv"`
Desc string `codec:"desc" json:"desc"`
Version string `codec:"version" json:"version"`
}
type PlatformInfo struct {
Os string `codec:"os" json:"os"`
Arch string `codec:"arch" json:"arch"`
GoVersion string `codec:"goVersion" json:"goVersion"`
}
type ExtendedStatus struct {
Standalone bool `codec:"standalone" json:"standalone"`
PassphraseStreamCached bool `codec:"passphraseStreamCached" json:"passphraseStreamCached"`
Device *Device `codec:"device,omitempty" json:"device,omitempty"`
LogDir string `codec:"logDir" json:"logDir"`
DesktopUIConnected bool `codec:"desktopUIConnected" json:"desktopUIConnected"`
Session *SessionStatus `codec:"session,omitempty" json:"session,omitempty"`
DefaultUsername string `codec:"defaultUsername" json:"defaultUsername"`
ProvisionedUsernames []string `codec:"provisionedUsernames" json:"provisionedUsernames"`
Clients []ClientDetails `codec:"Clients" json:"Clients"`
PlatformInfo PlatformInfo `codec:"platformInfo" json:"platformInfo"`
}
type ForkType int
const (
ForkType_NONE ForkType = 0
ForkType_AUTO ForkType = 1
ForkType_WATCHDOG ForkType = 2
ForkType_LAUNCHD ForkType = 3
)
type Config struct {
ServerURI string `codec:"serverURI" json:"serverURI"`
SocketFile string `codec:"socketFile" json:"socketFile"`
Label string `codec:"label" json:"label"`
RunMode string `codec:"runMode" json:"runMode"`
GpgExists bool `codec:"gpgExists" json:"gpgExists"`
GpgPath string `codec:"gpgPath" json:"gpgPath"`
Version string `codec:"version" json:"version"`
Path string `codec:"path" json:"path"`
ConfigPath string `codec:"configPath" json:"configPath"`
VersionShort string `codec:"versionShort" json:"versionShort"`
VersionFull string `codec:"versionFull" json:"versionFull"`
IsAutoForked bool `codec:"isAutoForked" json:"isAutoForked"`
ForkType ForkType `codec:"forkType" json:"forkType"`
}
type GetCurrentStatusArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
}
type GetExtendedStatusArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
}
type GetConfigArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
}
type SetUserConfigArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Username string `codec:"username" json:"username"`
Key string `codec:"key" json:"key"`
Value string `codec:"value" json:"value"`
}
type SetPathArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Path string `codec:"path" json:"path"`
}
type HelloIAmArg struct {
Details ClientDetails `codec:"details" json:"details"`
}
type ConfigInterface interface {
GetCurrentStatus(context.Context, int) (GetCurrentStatusRes, error)
GetExtendedStatus(context.Context, int) (ExtendedStatus, error)
GetConfig(context.Context, int) (Config, error)
SetUserConfig(context.Context, SetUserConfigArg) error
SetPath(context.Context, SetPathArg) error
HelloIAm(context.Context, ClientDetails) error
}
func ConfigProtocol(i ConfigInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.config",
Methods: map[string]rpc.ServeHandlerDescription{
"getCurrentStatus": {
MakeArg: func() interface{} {
ret := make([]GetCurrentStatusArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]GetCurrentStatusArg)
if !ok {
err = rpc.NewTypeError((*[]GetCurrentStatusArg)(nil), args)
return
}
ret, err = i.GetCurrentStatus(ctx, (*typedArgs)[0].SessionID)
return
},
MethodType: rpc.MethodCall,
},
"getExtendedStatus": {
MakeArg: func() interface{} {
ret := make([]GetExtendedStatusArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]GetExtendedStatusArg)
if !ok {
err = rpc.NewTypeError((*[]GetExtendedStatusArg)(nil), args)
return
}
ret, err = i.GetExtendedStatus(ctx, (*typedArgs)[0].SessionID)
return
},
MethodType: rpc.MethodCall,
},
"getConfig": {
MakeArg: func() interface{} {
ret := make([]GetConfigArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]GetConfigArg)
if !ok {
err = rpc.NewTypeError((*[]GetConfigArg)(nil), args)
return
}
ret, err = i.GetConfig(ctx, (*typedArgs)[0].SessionID)
return
},
MethodType: rpc.MethodCall,
},
"setUserConfig": {
MakeArg: func() interface{} {
ret := make([]SetUserConfigArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]SetUserConfigArg)
if !ok {
err = rpc.NewTypeError((*[]SetUserConfigArg)(nil), args)
return
}
err = i.SetUserConfig(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"setPath": {
MakeArg: func() interface{} {
ret := make([]SetPathArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]SetPathArg)
if !ok {
err = rpc.NewTypeError((*[]SetPathArg)(nil), args)
return
}
err = i.SetPath(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"helloIAm": {
MakeArg: func() interface{} {
ret := make([]HelloIAmArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]HelloIAmArg)
if !ok {
err = rpc.NewTypeError((*[]HelloIAmArg)(nil), args)
return
}
err = i.HelloIAm(ctx, (*typedArgs)[0].Details)
return
},
MethodType: rpc.MethodCall,
},
},
}
}
type ConfigClient struct {
Cli GenericClient
}
func (c ConfigClient) GetCurrentStatus(ctx context.Context, sessionID int) (res GetCurrentStatusRes, err error) {
__arg := GetCurrentStatusArg{SessionID: sessionID}
err = c.Cli.Call(ctx, "keybase.1.config.getCurrentStatus", []interface{}{__arg}, &res)
return
}
func (c ConfigClient) GetExtendedStatus(ctx context.Context, sessionID int) (res ExtendedStatus, err error) {
__arg := GetExtendedStatusArg{SessionID: sessionID}
err = c.Cli.Call(ctx, "keybase.1.config.getExtendedStatus", []interface{}{__arg}, &res)
return
}
func (c ConfigClient) GetConfig(ctx context.Context, sessionID int) (res Config, err error) {
__arg := GetConfigArg{SessionID: sessionID}
err = c.Cli.Call(ctx, "keybase.1.config.getConfig", []interface{}{__arg}, &res)
return
}
func (c ConfigClient) SetUserConfig(ctx context.Context, __arg SetUserConfigArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.config.setUserConfig", []interface{}{__arg}, nil)
return
}
func (c ConfigClient) SetPath(ctx context.Context, __arg SetPathArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.config.setPath", []interface{}{__arg}, nil)
return
}
func (c ConfigClient) HelloIAm(ctx context.Context, details ClientDetails) (err error) {
__arg := HelloIAmArg{Details: details}
err = c.Cli.Call(ctx, "keybase.1.config.helloIAm", []interface{}{__arg}, nil)
return
}
type StatusCode int
const (
StatusCode_SCOk StatusCode = 0
StatusCode_SCLoginRequired StatusCode = 201
StatusCode_SCBadSession StatusCode = 202
StatusCode_SCBadLoginUserNotFound StatusCode = 203
StatusCode_SCBadLoginPassword StatusCode = 204
StatusCode_SCNotFound StatusCode = 205
StatusCode_SCGeneric StatusCode = 218
StatusCode_SCAlreadyLoggedIn StatusCode = 235
StatusCode_SCCanceled StatusCode = 237
StatusCode_SCInputCanceled StatusCode = 239
StatusCode_SCReloginRequired StatusCode = 274
StatusCode_SCResolutionFailed StatusCode = 275
StatusCode_SCProfileNotPublic StatusCode = 276
StatusCode_SCIdentifyFailed StatusCode = 277
StatusCode_SCTrackingBroke StatusCode = 278
StatusCode_SCWrongCryptoFormat StatusCode = 279
StatusCode_SCBadSignupUsernameTaken StatusCode = 701
StatusCode_SCMissingResult StatusCode = 801
StatusCode_SCKeyNotFound StatusCode = 901
StatusCode_SCKeyInUse StatusCode = 907
StatusCode_SCKeyBadGen StatusCode = 913
StatusCode_SCKeyNoSecret StatusCode = 914
StatusCode_SCKeyBadUIDs StatusCode = 915
StatusCode_SCKeyNoActive StatusCode = 916
StatusCode_SCKeyNoSig StatusCode = 917
StatusCode_SCKeyBadSig StatusCode = 918
StatusCode_SCKeyBadEldest StatusCode = 919
StatusCode_SCKeyNoEldest StatusCode = 920
StatusCode_SCKeyDuplicateUpdate StatusCode = 921
StatusCode_SCSibkeyAlreadyExists StatusCode = 922
StatusCode_SCDecryptionKeyNotFound StatusCode = 924
StatusCode_SCKeyNoPGPEncryption StatusCode = 927
StatusCode_SCKeyNoNaClEncryption StatusCode = 928
StatusCode_SCKeySyncedPGPNotFound StatusCode = 929
StatusCode_SCBadTrackSession StatusCode = 1301
StatusCode_SCDeviceNotFound StatusCode = 1409
StatusCode_SCDeviceMismatch StatusCode = 1410
StatusCode_SCDeviceRequired StatusCode = 1411
StatusCode_SCStreamExists StatusCode = 1501
StatusCode_SCStreamNotFound StatusCode = 1502
StatusCode_SCStreamWrongKind StatusCode = 1503
StatusCode_SCStreamEOF StatusCode = 1504
StatusCode_SCAPINetworkError StatusCode = 1601
StatusCode_SCTimeout StatusCode = 1602
StatusCode_SCProofError StatusCode = 1701
StatusCode_SCIdentificationExpired StatusCode = 1702
StatusCode_SCSelfNotFound StatusCode = 1703
StatusCode_SCBadKexPhrase StatusCode = 1704
StatusCode_SCNoUIDelegation StatusCode = 1705
StatusCode_SCNoUI StatusCode = 1706
StatusCode_SCInvalidVersionError StatusCode = 1800
StatusCode_SCOldVersionError StatusCode = 1801
StatusCode_SCInvalidLocationError StatusCode = 1802
StatusCode_SCServiceStatusError StatusCode = 1803
StatusCode_SCInstallError StatusCode = 1804
)
type ConstantsInterface interface {
}
func ConstantsProtocol(i ConstantsInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.constants",
Methods: map[string]rpc.ServeHandlerDescription{},
}
}
type ConstantsClient struct {
Cli GenericClient
}
type ED25519PublicKey [32]byte
type ED25519Signature [64]byte
type ED25519SignatureInfo struct {
Sig ED25519Signature `codec:"sig" json:"sig"`
PublicKey ED25519PublicKey `codec:"publicKey" json:"publicKey"`
}
type Bytes32 [32]byte
type EncryptedBytes32 [48]byte
type BoxNonce [24]byte
type BoxPublicKey [32]byte
type CiphertextBundle struct {
Kid KID `codec:"kid" json:"kid"`
Ciphertext EncryptedBytes32 `codec:"ciphertext" json:"ciphertext"`
Nonce BoxNonce `codec:"nonce" json:"nonce"`
PublicKey BoxPublicKey `codec:"publicKey" json:"publicKey"`
}
type UnboxAnyRes struct {
Kid KID `codec:"kid" json:"kid"`
Plaintext Bytes32 `codec:"plaintext" json:"plaintext"`
Index int `codec:"index" json:"index"`
}
type SignED25519Arg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Msg []byte `codec:"msg" json:"msg"`
Reason string `codec:"reason" json:"reason"`
}
type SignToStringArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Msg []byte `codec:"msg" json:"msg"`
Reason string `codec:"reason" json:"reason"`
}
type UnboxBytes32Arg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
EncryptedBytes32 EncryptedBytes32 `codec:"encryptedBytes32" json:"encryptedBytes32"`
Nonce BoxNonce `codec:"nonce" json:"nonce"`
PeersPublicKey BoxPublicKey `codec:"peersPublicKey" json:"peersPublicKey"`
Reason string `codec:"reason" json:"reason"`
}
type UnboxBytes32AnyArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Bundles []CiphertextBundle `codec:"bundles" json:"bundles"`
Reason string `codec:"reason" json:"reason"`
PromptPaper bool `codec:"promptPaper" json:"promptPaper"`
}
type CryptoInterface interface {
SignED25519(context.Context, SignED25519Arg) (ED25519SignatureInfo, error)
SignToString(context.Context, SignToStringArg) (string, error)
UnboxBytes32(context.Context, UnboxBytes32Arg) (Bytes32, error)
UnboxBytes32Any(context.Context, UnboxBytes32AnyArg) (UnboxAnyRes, error)
}
func CryptoProtocol(i CryptoInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.crypto",
Methods: map[string]rpc.ServeHandlerDescription{
"signED25519": {
MakeArg: func() interface{} {
ret := make([]SignED25519Arg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]SignED25519Arg)
if !ok {
err = rpc.NewTypeError((*[]SignED25519Arg)(nil), args)
return
}
ret, err = i.SignED25519(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"signToString": {
MakeArg: func() interface{} {
ret := make([]SignToStringArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]SignToStringArg)
if !ok {
err = rpc.NewTypeError((*[]SignToStringArg)(nil), args)
return
}
ret, err = i.SignToString(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"unboxBytes32": {
MakeArg: func() interface{} {
ret := make([]UnboxBytes32Arg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]UnboxBytes32Arg)
if !ok {
err = rpc.NewTypeError((*[]UnboxBytes32Arg)(nil), args)
return
}
ret, err = i.UnboxBytes32(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"unboxBytes32Any": {
MakeArg: func() interface{} {
ret := make([]UnboxBytes32AnyArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]UnboxBytes32AnyArg)
if !ok {
err = rpc.NewTypeError((*[]UnboxBytes32AnyArg)(nil), args)
return
}
ret, err = i.UnboxBytes32Any(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
},
}
}
type CryptoClient struct {
Cli GenericClient
}
func (c CryptoClient) SignED25519(ctx context.Context, __arg SignED25519Arg) (res ED25519SignatureInfo, err error) {
err = c.Cli.Call(ctx, "keybase.1.crypto.signED25519", []interface{}{__arg}, &res)
return
}
func (c CryptoClient) SignToString(ctx context.Context, __arg SignToStringArg) (res string, err error) {
err = c.Cli.Call(ctx, "keybase.1.crypto.signToString", []interface{}{__arg}, &res)
return
}
func (c CryptoClient) UnboxBytes32(ctx context.Context, __arg UnboxBytes32Arg) (res Bytes32, err error) {
err = c.Cli.Call(ctx, "keybase.1.crypto.unboxBytes32", []interface{}{__arg}, &res)
return
}
func (c CryptoClient) UnboxBytes32Any(ctx context.Context, __arg UnboxBytes32AnyArg) (res UnboxAnyRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.crypto.unboxBytes32Any", []interface{}{__arg}, &res)
return
}
type ExitCode int
const (
ExitCode_OK ExitCode = 0
ExitCode_NOTOK ExitCode = 2
ExitCode_RESTART ExitCode = 4
)
type StopArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
ExitCode ExitCode `codec:"exitCode" json:"exitCode"`
}
type LogRotateArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
}
type ReloadArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
}
type DbNukeArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`