github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/pgp.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/pgp.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 SignMode int
    14  
    15  const (
    16  	SignMode_ATTACHED SignMode = 0
    17  	SignMode_DETACHED SignMode = 1
    18  	SignMode_CLEAR    SignMode = 2
    19  )
    20  
    21  func (o SignMode) DeepCopy() SignMode { return o }
    22  
    23  var SignModeMap = map[string]SignMode{
    24  	"ATTACHED": 0,
    25  	"DETACHED": 1,
    26  	"CLEAR":    2,
    27  }
    28  
    29  var SignModeRevMap = map[SignMode]string{
    30  	0: "ATTACHED",
    31  	1: "DETACHED",
    32  	2: "CLEAR",
    33  }
    34  
    35  func (e SignMode) String() string {
    36  	if v, ok := SignModeRevMap[e]; ok {
    37  		return v
    38  	}
    39  	return fmt.Sprintf("%v", int(e))
    40  }
    41  
    42  type PGPSignOptions struct {
    43  	KeyQuery  string   `codec:"keyQuery" json:"keyQuery"`
    44  	Mode      SignMode `codec:"mode" json:"mode"`
    45  	BinaryIn  bool     `codec:"binaryIn" json:"binaryIn"`
    46  	BinaryOut bool     `codec:"binaryOut" json:"binaryOut"`
    47  }
    48  
    49  func (o PGPSignOptions) DeepCopy() PGPSignOptions {
    50  	return PGPSignOptions{
    51  		KeyQuery:  o.KeyQuery,
    52  		Mode:      o.Mode.DeepCopy(),
    53  		BinaryIn:  o.BinaryIn,
    54  		BinaryOut: o.BinaryOut,
    55  	}
    56  }
    57  
    58  type PGPEncryptOptions struct {
    59  	Recipients []string `codec:"recipients" json:"recipients"`
    60  	NoSign     bool     `codec:"noSign" json:"noSign"`
    61  	NoSelf     bool     `codec:"noSelf" json:"noSelf"`
    62  	BinaryOut  bool     `codec:"binaryOut" json:"binaryOut"`
    63  	KeyQuery   string   `codec:"keyQuery" json:"keyQuery"`
    64  }
    65  
    66  func (o PGPEncryptOptions) DeepCopy() PGPEncryptOptions {
    67  	return PGPEncryptOptions{
    68  		Recipients: (func(x []string) []string {
    69  			if x == nil {
    70  				return nil
    71  			}
    72  			ret := make([]string, len(x))
    73  			for i, v := range x {
    74  				vCopy := v
    75  				ret[i] = vCopy
    76  			}
    77  			return ret
    78  		})(o.Recipients),
    79  		NoSign:    o.NoSign,
    80  		NoSelf:    o.NoSelf,
    81  		BinaryOut: o.BinaryOut,
    82  		KeyQuery:  o.KeyQuery,
    83  	}
    84  }
    85  
    86  // PGPSigVerification is returned by pgpDecrypt and pgpVerify with information
    87  // about the signature verification. If isSigned is false, there was no
    88  // signature, and the rest of the fields should be ignored.
    89  type PGPSigVerification struct {
    90  	IsSigned bool      `codec:"isSigned" json:"isSigned"`
    91  	Verified bool      `codec:"verified" json:"verified"`
    92  	Signer   User      `codec:"signer" json:"signer"`
    93  	SignKey  PublicKey `codec:"signKey" json:"signKey"`
    94  	Warnings []string  `codec:"warnings" json:"warnings"`
    95  }
    96  
    97  func (o PGPSigVerification) DeepCopy() PGPSigVerification {
    98  	return PGPSigVerification{
    99  		IsSigned: o.IsSigned,
   100  		Verified: o.Verified,
   101  		Signer:   o.Signer.DeepCopy(),
   102  		SignKey:  o.SignKey.DeepCopy(),
   103  		Warnings: (func(x []string) []string {
   104  			if x == nil {
   105  				return nil
   106  			}
   107  			ret := make([]string, len(x))
   108  			for i, v := range x {
   109  				vCopy := v
   110  				ret[i] = vCopy
   111  			}
   112  			return ret
   113  		})(o.Warnings),
   114  	}
   115  }
   116  
   117  type PGPDecryptOptions struct {
   118  	AssertSigned bool   `codec:"assertSigned" json:"assertSigned"`
   119  	SignedBy     string `codec:"signedBy" json:"signedBy"`
   120  }
   121  
   122  func (o PGPDecryptOptions) DeepCopy() PGPDecryptOptions {
   123  	return PGPDecryptOptions{
   124  		AssertSigned: o.AssertSigned,
   125  		SignedBy:     o.SignedBy,
   126  	}
   127  }
   128  
   129  type PGPVerifyOptions struct {
   130  	SignedBy  string `codec:"signedBy" json:"signedBy"`
   131  	Signature []byte `codec:"signature" json:"signature"`
   132  }
   133  
   134  func (o PGPVerifyOptions) DeepCopy() PGPVerifyOptions {
   135  	return PGPVerifyOptions{
   136  		SignedBy: o.SignedBy,
   137  		Signature: (func(x []byte) []byte {
   138  			if x == nil {
   139  				return nil
   140  			}
   141  			return append([]byte{}, x...)
   142  		})(o.Signature),
   143  	}
   144  }
   145  
   146  type KeyInfo struct {
   147  	Fingerprint string `codec:"fingerprint" json:"fingerprint"`
   148  	Key         string `codec:"key" json:"key"`
   149  	Desc        string `codec:"desc" json:"desc"`
   150  }
   151  
   152  func (o KeyInfo) DeepCopy() KeyInfo {
   153  	return KeyInfo{
   154  		Fingerprint: o.Fingerprint,
   155  		Key:         o.Key,
   156  		Desc:        o.Desc,
   157  	}
   158  }
   159  
   160  type PGPQuery struct {
   161  	Secret     bool   `codec:"secret" json:"secret"`
   162  	Query      string `codec:"query" json:"query"`
   163  	ExactMatch bool   `codec:"exactMatch" json:"exactMatch"`
   164  }
   165  
   166  func (o PGPQuery) DeepCopy() PGPQuery {
   167  	return PGPQuery{
   168  		Secret:     o.Secret,
   169  		Query:      o.Query,
   170  		ExactMatch: o.ExactMatch,
   171  	}
   172  }
   173  
   174  type PGPCreateUids struct {
   175  	UseDefault bool          `codec:"useDefault" json:"useDefault"`
   176  	Ids        []PGPIdentity `codec:"ids" json:"ids"`
   177  }
   178  
   179  func (o PGPCreateUids) DeepCopy() PGPCreateUids {
   180  	return PGPCreateUids{
   181  		UseDefault: o.UseDefault,
   182  		Ids: (func(x []PGPIdentity) []PGPIdentity {
   183  			if x == nil {
   184  				return nil
   185  			}
   186  			ret := make([]PGPIdentity, len(x))
   187  			for i, v := range x {
   188  				vCopy := v.DeepCopy()
   189  				ret[i] = vCopy
   190  			}
   191  			return ret
   192  		})(o.Ids),
   193  	}
   194  }
   195  
   196  // Export all pgp keys in lksec, then if doPurge is true, remove the keys from lksec.
   197  type PGPPurgeRes struct {
   198  	Filenames []string `codec:"filenames" json:"filenames"`
   199  }
   200  
   201  func (o PGPPurgeRes) DeepCopy() PGPPurgeRes {
   202  	return PGPPurgeRes{
   203  		Filenames: (func(x []string) []string {
   204  			if x == nil {
   205  				return nil
   206  			}
   207  			ret := make([]string, len(x))
   208  			for i, v := range x {
   209  				vCopy := v
   210  				ret[i] = vCopy
   211  			}
   212  			return ret
   213  		})(o.Filenames),
   214  	}
   215  }
   216  
   217  type PGPSignArg struct {
   218  	SessionID int            `codec:"sessionID" json:"sessionID"`
   219  	Source    Stream         `codec:"source" json:"source"`
   220  	Sink      Stream         `codec:"sink" json:"sink"`
   221  	Opts      PGPSignOptions `codec:"opts" json:"opts"`
   222  }
   223  
   224  type PGPPullArg struct {
   225  	SessionID   int      `codec:"sessionID" json:"sessionID"`
   226  	UserAsserts []string `codec:"userAsserts" json:"userAsserts"`
   227  }
   228  
   229  type PGPEncryptArg struct {
   230  	SessionID int               `codec:"sessionID" json:"sessionID"`
   231  	Source    Stream            `codec:"source" json:"source"`
   232  	Sink      Stream            `codec:"sink" json:"sink"`
   233  	Opts      PGPEncryptOptions `codec:"opts" json:"opts"`
   234  }
   235  
   236  type PGPDecryptArg struct {
   237  	SessionID int               `codec:"sessionID" json:"sessionID"`
   238  	Source    Stream            `codec:"source" json:"source"`
   239  	Sink      Stream            `codec:"sink" json:"sink"`
   240  	Opts      PGPDecryptOptions `codec:"opts" json:"opts"`
   241  }
   242  
   243  type PGPVerifyArg struct {
   244  	SessionID int              `codec:"sessionID" json:"sessionID"`
   245  	Source    Stream           `codec:"source" json:"source"`
   246  	Opts      PGPVerifyOptions `codec:"opts" json:"opts"`
   247  }
   248  
   249  type PGPImportArg struct {
   250  	SessionID  int    `codec:"sessionID" json:"sessionID"`
   251  	Key        []byte `codec:"key" json:"key"`
   252  	PushSecret bool   `codec:"pushSecret" json:"pushSecret"`
   253  }
   254  
   255  type PGPExportArg struct {
   256  	SessionID int      `codec:"sessionID" json:"sessionID"`
   257  	Options   PGPQuery `codec:"options" json:"options"`
   258  	Encrypted bool     `codec:"encrypted" json:"encrypted"`
   259  }
   260  
   261  type PGPExportByFingerprintArg struct {
   262  	SessionID int      `codec:"sessionID" json:"sessionID"`
   263  	Options   PGPQuery `codec:"options" json:"options"`
   264  	Encrypted bool     `codec:"encrypted" json:"encrypted"`
   265  }
   266  
   267  type PGPExportByKIDArg struct {
   268  	SessionID int      `codec:"sessionID" json:"sessionID"`
   269  	Options   PGPQuery `codec:"options" json:"options"`
   270  	Encrypted bool     `codec:"encrypted" json:"encrypted"`
   271  }
   272  
   273  type PGPKeyGenArg struct {
   274  	SessionID       int           `codec:"sessionID" json:"sessionID"`
   275  	PrimaryBits     int           `codec:"primaryBits" json:"primaryBits"`
   276  	SubkeyBits      int           `codec:"subkeyBits" json:"subkeyBits"`
   277  	CreateUids      PGPCreateUids `codec:"createUids" json:"createUids"`
   278  	AllowMulti      bool          `codec:"allowMulti" json:"allowMulti"`
   279  	DoExport        bool          `codec:"doExport" json:"doExport"`
   280  	ExportEncrypted bool          `codec:"exportEncrypted" json:"exportEncrypted"`
   281  	PushSecret      bool          `codec:"pushSecret" json:"pushSecret"`
   282  }
   283  
   284  type PGPKeyGenDefaultArg struct {
   285  	SessionID  int           `codec:"sessionID" json:"sessionID"`
   286  	CreateUids PGPCreateUids `codec:"createUids" json:"createUids"`
   287  }
   288  
   289  type PGPDeletePrimaryArg struct {
   290  	SessionID int `codec:"sessionID" json:"sessionID"`
   291  }
   292  
   293  type PGPSelectArg struct {
   294  	SessionID        int    `codec:"sessionID" json:"sessionID"`
   295  	FingerprintQuery string `codec:"fingerprintQuery" json:"fingerprintQuery"`
   296  	AllowMulti       bool   `codec:"allowMulti" json:"allowMulti"`
   297  	SkipImport       bool   `codec:"skipImport" json:"skipImport"`
   298  	OnlyImport       bool   `codec:"onlyImport" json:"onlyImport"`
   299  }
   300  
   301  type PGPUpdateArg struct {
   302  	SessionID    int      `codec:"sessionID" json:"sessionID"`
   303  	All          bool     `codec:"all" json:"all"`
   304  	Fingerprints []string `codec:"fingerprints" json:"fingerprints"`
   305  }
   306  
   307  type PGPPurgeArg struct {
   308  	SessionID int  `codec:"sessionID" json:"sessionID"`
   309  	DoPurge   bool `codec:"doPurge" json:"doPurge"`
   310  }
   311  
   312  type PGPStorageDismissArg struct {
   313  	SessionID int `codec:"sessionID" json:"sessionID"`
   314  }
   315  
   316  type PGPPushPrivateArg struct {
   317  	SessionID    int              `codec:"sessionID" json:"sessionID"`
   318  	Fingerprints []PGPFingerprint `codec:"fingerprints" json:"fingerprints"`
   319  }
   320  
   321  type PGPPullPrivateArg struct {
   322  	SessionID    int              `codec:"sessionID" json:"sessionID"`
   323  	Fingerprints []PGPFingerprint `codec:"fingerprints" json:"fingerprints"`
   324  }
   325  
   326  type PGPInterface interface {
   327  	PGPSign(context.Context, PGPSignArg) error
   328  	// Download PGP keys for tracked users and update the local GPG keyring.
   329  	// If usernames is nonempty, update only those users.
   330  	PGPPull(context.Context, PGPPullArg) error
   331  	PGPEncrypt(context.Context, PGPEncryptArg) error
   332  	PGPDecrypt(context.Context, PGPDecryptArg) (PGPSigVerification, error)
   333  	PGPVerify(context.Context, PGPVerifyArg) (PGPSigVerification, error)
   334  	PGPImport(context.Context, PGPImportArg) error
   335  	// Exports active PGP keys. Only allows armored export.
   336  	PGPExport(context.Context, PGPExportArg) ([]KeyInfo, error)
   337  	PGPExportByFingerprint(context.Context, PGPExportByFingerprintArg) ([]KeyInfo, error)
   338  	PGPExportByKID(context.Context, PGPExportByKIDArg) ([]KeyInfo, error)
   339  	PGPKeyGen(context.Context, PGPKeyGenArg) error
   340  	PGPKeyGenDefault(context.Context, PGPKeyGenDefaultArg) error
   341  	PGPDeletePrimary(context.Context, int) error
   342  	// Select an existing key and add to Keybase.
   343  	PGPSelect(context.Context, PGPSelectArg) error
   344  	// Push updated key(s) to the server.
   345  	PGPUpdate(context.Context, PGPUpdateArg) error
   346  	PGPPurge(context.Context, PGPPurgeArg) (PGPPurgeRes, error)
   347  	// Dismiss the PGP unlock via secret_store_file notification.
   348  	PGPStorageDismiss(context.Context, int) error
   349  	// push the PGP key that matches the given fingerprints from GnuPG to KBFS. If it is empty, then
   350  	// push all matching PGP keys in the user's sigchain.
   351  	PGPPushPrivate(context.Context, PGPPushPrivateArg) error
   352  	// pull the given PGP keys from KBFS to the local GnuPG keychain. If it is empty, then
   353  	// attempt to pull all matching PGP keys in the user's sigchain.
   354  	PGPPullPrivate(context.Context, PGPPullPrivateArg) error
   355  }
   356  
   357  func PGPProtocol(i PGPInterface) rpc.Protocol {
   358  	return rpc.Protocol{
   359  		Name: "keybase.1.pgp",
   360  		Methods: map[string]rpc.ServeHandlerDescription{
   361  			"pgpSign": {
   362  				MakeArg: func() interface{} {
   363  					var ret [1]PGPSignArg
   364  					return &ret
   365  				},
   366  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   367  					typedArgs, ok := args.(*[1]PGPSignArg)
   368  					if !ok {
   369  						err = rpc.NewTypeError((*[1]PGPSignArg)(nil), args)
   370  						return
   371  					}
   372  					err = i.PGPSign(ctx, typedArgs[0])
   373  					return
   374  				},
   375  			},
   376  			"pgpPull": {
   377  				MakeArg: func() interface{} {
   378  					var ret [1]PGPPullArg
   379  					return &ret
   380  				},
   381  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   382  					typedArgs, ok := args.(*[1]PGPPullArg)
   383  					if !ok {
   384  						err = rpc.NewTypeError((*[1]PGPPullArg)(nil), args)
   385  						return
   386  					}
   387  					err = i.PGPPull(ctx, typedArgs[0])
   388  					return
   389  				},
   390  			},
   391  			"pgpEncrypt": {
   392  				MakeArg: func() interface{} {
   393  					var ret [1]PGPEncryptArg
   394  					return &ret
   395  				},
   396  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   397  					typedArgs, ok := args.(*[1]PGPEncryptArg)
   398  					if !ok {
   399  						err = rpc.NewTypeError((*[1]PGPEncryptArg)(nil), args)
   400  						return
   401  					}
   402  					err = i.PGPEncrypt(ctx, typedArgs[0])
   403  					return
   404  				},
   405  			},
   406  			"pgpDecrypt": {
   407  				MakeArg: func() interface{} {
   408  					var ret [1]PGPDecryptArg
   409  					return &ret
   410  				},
   411  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   412  					typedArgs, ok := args.(*[1]PGPDecryptArg)
   413  					if !ok {
   414  						err = rpc.NewTypeError((*[1]PGPDecryptArg)(nil), args)
   415  						return
   416  					}
   417  					ret, err = i.PGPDecrypt(ctx, typedArgs[0])
   418  					return
   419  				},
   420  			},
   421  			"pgpVerify": {
   422  				MakeArg: func() interface{} {
   423  					var ret [1]PGPVerifyArg
   424  					return &ret
   425  				},
   426  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   427  					typedArgs, ok := args.(*[1]PGPVerifyArg)
   428  					if !ok {
   429  						err = rpc.NewTypeError((*[1]PGPVerifyArg)(nil), args)
   430  						return
   431  					}
   432  					ret, err = i.PGPVerify(ctx, typedArgs[0])
   433  					return
   434  				},
   435  			},
   436  			"pgpImport": {
   437  				MakeArg: func() interface{} {
   438  					var ret [1]PGPImportArg
   439  					return &ret
   440  				},
   441  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   442  					typedArgs, ok := args.(*[1]PGPImportArg)
   443  					if !ok {
   444  						err = rpc.NewTypeError((*[1]PGPImportArg)(nil), args)
   445  						return
   446  					}
   447  					err = i.PGPImport(ctx, typedArgs[0])
   448  					return
   449  				},
   450  			},
   451  			"pgpExport": {
   452  				MakeArg: func() interface{} {
   453  					var ret [1]PGPExportArg
   454  					return &ret
   455  				},
   456  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   457  					typedArgs, ok := args.(*[1]PGPExportArg)
   458  					if !ok {
   459  						err = rpc.NewTypeError((*[1]PGPExportArg)(nil), args)
   460  						return
   461  					}
   462  					ret, err = i.PGPExport(ctx, typedArgs[0])
   463  					return
   464  				},
   465  			},
   466  			"pgpExportByFingerprint": {
   467  				MakeArg: func() interface{} {
   468  					var ret [1]PGPExportByFingerprintArg
   469  					return &ret
   470  				},
   471  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   472  					typedArgs, ok := args.(*[1]PGPExportByFingerprintArg)
   473  					if !ok {
   474  						err = rpc.NewTypeError((*[1]PGPExportByFingerprintArg)(nil), args)
   475  						return
   476  					}
   477  					ret, err = i.PGPExportByFingerprint(ctx, typedArgs[0])
   478  					return
   479  				},
   480  			},
   481  			"pgpExportByKID": {
   482  				MakeArg: func() interface{} {
   483  					var ret [1]PGPExportByKIDArg
   484  					return &ret
   485  				},
   486  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   487  					typedArgs, ok := args.(*[1]PGPExportByKIDArg)
   488  					if !ok {
   489  						err = rpc.NewTypeError((*[1]PGPExportByKIDArg)(nil), args)
   490  						return
   491  					}
   492  					ret, err = i.PGPExportByKID(ctx, typedArgs[0])
   493  					return
   494  				},
   495  			},
   496  			"pgpKeyGen": {
   497  				MakeArg: func() interface{} {
   498  					var ret [1]PGPKeyGenArg
   499  					return &ret
   500  				},
   501  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   502  					typedArgs, ok := args.(*[1]PGPKeyGenArg)
   503  					if !ok {
   504  						err = rpc.NewTypeError((*[1]PGPKeyGenArg)(nil), args)
   505  						return
   506  					}
   507  					err = i.PGPKeyGen(ctx, typedArgs[0])
   508  					return
   509  				},
   510  			},
   511  			"pgpKeyGenDefault": {
   512  				MakeArg: func() interface{} {
   513  					var ret [1]PGPKeyGenDefaultArg
   514  					return &ret
   515  				},
   516  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   517  					typedArgs, ok := args.(*[1]PGPKeyGenDefaultArg)
   518  					if !ok {
   519  						err = rpc.NewTypeError((*[1]PGPKeyGenDefaultArg)(nil), args)
   520  						return
   521  					}
   522  					err = i.PGPKeyGenDefault(ctx, typedArgs[0])
   523  					return
   524  				},
   525  			},
   526  			"pgpDeletePrimary": {
   527  				MakeArg: func() interface{} {
   528  					var ret [1]PGPDeletePrimaryArg
   529  					return &ret
   530  				},
   531  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   532  					typedArgs, ok := args.(*[1]PGPDeletePrimaryArg)
   533  					if !ok {
   534  						err = rpc.NewTypeError((*[1]PGPDeletePrimaryArg)(nil), args)
   535  						return
   536  					}
   537  					err = i.PGPDeletePrimary(ctx, typedArgs[0].SessionID)
   538  					return
   539  				},
   540  			},
   541  			"pgpSelect": {
   542  				MakeArg: func() interface{} {
   543  					var ret [1]PGPSelectArg
   544  					return &ret
   545  				},
   546  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   547  					typedArgs, ok := args.(*[1]PGPSelectArg)
   548  					if !ok {
   549  						err = rpc.NewTypeError((*[1]PGPSelectArg)(nil), args)
   550  						return
   551  					}
   552  					err = i.PGPSelect(ctx, typedArgs[0])
   553  					return
   554  				},
   555  			},
   556  			"pgpUpdate": {
   557  				MakeArg: func() interface{} {
   558  					var ret [1]PGPUpdateArg
   559  					return &ret
   560  				},
   561  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   562  					typedArgs, ok := args.(*[1]PGPUpdateArg)
   563  					if !ok {
   564  						err = rpc.NewTypeError((*[1]PGPUpdateArg)(nil), args)
   565  						return
   566  					}
   567  					err = i.PGPUpdate(ctx, typedArgs[0])
   568  					return
   569  				},
   570  			},
   571  			"pgpPurge": {
   572  				MakeArg: func() interface{} {
   573  					var ret [1]PGPPurgeArg
   574  					return &ret
   575  				},
   576  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   577  					typedArgs, ok := args.(*[1]PGPPurgeArg)
   578  					if !ok {
   579  						err = rpc.NewTypeError((*[1]PGPPurgeArg)(nil), args)
   580  						return
   581  					}
   582  					ret, err = i.PGPPurge(ctx, typedArgs[0])
   583  					return
   584  				},
   585  			},
   586  			"pgpStorageDismiss": {
   587  				MakeArg: func() interface{} {
   588  					var ret [1]PGPStorageDismissArg
   589  					return &ret
   590  				},
   591  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   592  					typedArgs, ok := args.(*[1]PGPStorageDismissArg)
   593  					if !ok {
   594  						err = rpc.NewTypeError((*[1]PGPStorageDismissArg)(nil), args)
   595  						return
   596  					}
   597  					err = i.PGPStorageDismiss(ctx, typedArgs[0].SessionID)
   598  					return
   599  				},
   600  			},
   601  			"pgpPushPrivate": {
   602  				MakeArg: func() interface{} {
   603  					var ret [1]PGPPushPrivateArg
   604  					return &ret
   605  				},
   606  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   607  					typedArgs, ok := args.(*[1]PGPPushPrivateArg)
   608  					if !ok {
   609  						err = rpc.NewTypeError((*[1]PGPPushPrivateArg)(nil), args)
   610  						return
   611  					}
   612  					err = i.PGPPushPrivate(ctx, typedArgs[0])
   613  					return
   614  				},
   615  			},
   616  			"pgpPullPrivate": {
   617  				MakeArg: func() interface{} {
   618  					var ret [1]PGPPullPrivateArg
   619  					return &ret
   620  				},
   621  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   622  					typedArgs, ok := args.(*[1]PGPPullPrivateArg)
   623  					if !ok {
   624  						err = rpc.NewTypeError((*[1]PGPPullPrivateArg)(nil), args)
   625  						return
   626  					}
   627  					err = i.PGPPullPrivate(ctx, typedArgs[0])
   628  					return
   629  				},
   630  			},
   631  		},
   632  	}
   633  }
   634  
   635  type PGPClient struct {
   636  	Cli rpc.GenericClient
   637  }
   638  
   639  func (c PGPClient) PGPSign(ctx context.Context, __arg PGPSignArg) (err error) {
   640  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpSign", []interface{}{__arg}, nil, 0*time.Millisecond)
   641  	return
   642  }
   643  
   644  // Download PGP keys for tracked users and update the local GPG keyring.
   645  // If usernames is nonempty, update only those users.
   646  func (c PGPClient) PGPPull(ctx context.Context, __arg PGPPullArg) (err error) {
   647  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpPull", []interface{}{__arg}, nil, 0*time.Millisecond)
   648  	return
   649  }
   650  
   651  func (c PGPClient) PGPEncrypt(ctx context.Context, __arg PGPEncryptArg) (err error) {
   652  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpEncrypt", []interface{}{__arg}, nil, 0*time.Millisecond)
   653  	return
   654  }
   655  
   656  func (c PGPClient) PGPDecrypt(ctx context.Context, __arg PGPDecryptArg) (res PGPSigVerification, err error) {
   657  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpDecrypt", []interface{}{__arg}, &res, 0*time.Millisecond)
   658  	return
   659  }
   660  
   661  func (c PGPClient) PGPVerify(ctx context.Context, __arg PGPVerifyArg) (res PGPSigVerification, err error) {
   662  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpVerify", []interface{}{__arg}, &res, 0*time.Millisecond)
   663  	return
   664  }
   665  
   666  func (c PGPClient) PGPImport(ctx context.Context, __arg PGPImportArg) (err error) {
   667  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpImport", []interface{}{__arg}, nil, 0*time.Millisecond)
   668  	return
   669  }
   670  
   671  // Exports active PGP keys. Only allows armored export.
   672  func (c PGPClient) PGPExport(ctx context.Context, __arg PGPExportArg) (res []KeyInfo, err error) {
   673  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpExport", []interface{}{__arg}, &res, 0*time.Millisecond)
   674  	return
   675  }
   676  
   677  func (c PGPClient) PGPExportByFingerprint(ctx context.Context, __arg PGPExportByFingerprintArg) (res []KeyInfo, err error) {
   678  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpExportByFingerprint", []interface{}{__arg}, &res, 0*time.Millisecond)
   679  	return
   680  }
   681  
   682  func (c PGPClient) PGPExportByKID(ctx context.Context, __arg PGPExportByKIDArg) (res []KeyInfo, err error) {
   683  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpExportByKID", []interface{}{__arg}, &res, 0*time.Millisecond)
   684  	return
   685  }
   686  
   687  func (c PGPClient) PGPKeyGen(ctx context.Context, __arg PGPKeyGenArg) (err error) {
   688  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpKeyGen", []interface{}{__arg}, nil, 0*time.Millisecond)
   689  	return
   690  }
   691  
   692  func (c PGPClient) PGPKeyGenDefault(ctx context.Context, __arg PGPKeyGenDefaultArg) (err error) {
   693  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpKeyGenDefault", []interface{}{__arg}, nil, 0*time.Millisecond)
   694  	return
   695  }
   696  
   697  func (c PGPClient) PGPDeletePrimary(ctx context.Context, sessionID int) (err error) {
   698  	__arg := PGPDeletePrimaryArg{SessionID: sessionID}
   699  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpDeletePrimary", []interface{}{__arg}, nil, 0*time.Millisecond)
   700  	return
   701  }
   702  
   703  // Select an existing key and add to Keybase.
   704  func (c PGPClient) PGPSelect(ctx context.Context, __arg PGPSelectArg) (err error) {
   705  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpSelect", []interface{}{__arg}, nil, 0*time.Millisecond)
   706  	return
   707  }
   708  
   709  // Push updated key(s) to the server.
   710  func (c PGPClient) PGPUpdate(ctx context.Context, __arg PGPUpdateArg) (err error) {
   711  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpUpdate", []interface{}{__arg}, nil, 0*time.Millisecond)
   712  	return
   713  }
   714  
   715  func (c PGPClient) PGPPurge(ctx context.Context, __arg PGPPurgeArg) (res PGPPurgeRes, err error) {
   716  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpPurge", []interface{}{__arg}, &res, 0*time.Millisecond)
   717  	return
   718  }
   719  
   720  // Dismiss the PGP unlock via secret_store_file notification.
   721  func (c PGPClient) PGPStorageDismiss(ctx context.Context, sessionID int) (err error) {
   722  	__arg := PGPStorageDismissArg{SessionID: sessionID}
   723  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpStorageDismiss", []interface{}{__arg}, nil, 0*time.Millisecond)
   724  	return
   725  }
   726  
   727  // push the PGP key that matches the given fingerprints from GnuPG to KBFS. If it is empty, then
   728  // push all matching PGP keys in the user's sigchain.
   729  func (c PGPClient) PGPPushPrivate(ctx context.Context, __arg PGPPushPrivateArg) (err error) {
   730  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpPushPrivate", []interface{}{__arg}, nil, 0*time.Millisecond)
   731  	return
   732  }
   733  
   734  // pull the given PGP keys from KBFS to the local GnuPG keychain. If it is empty, then
   735  // attempt to pull all matching PGP keys in the user's sigchain.
   736  func (c PGPClient) PGPPullPrivate(ctx context.Context, __arg PGPPullPrivateArg) (err error) {
   737  	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpPullPrivate", []interface{}{__arg}, nil, 0*time.Millisecond)
   738  	return
   739  }