github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/secretkeys.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/secretkeys.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     8  	context "golang.org/x/net/context"
     9  	"time"
    10  )
    11  
    12  type NaclSigningKeyPublic [32]byte
    13  
    14  func (o NaclSigningKeyPublic) DeepCopy() NaclSigningKeyPublic {
    15  	var ret NaclSigningKeyPublic
    16  	copy(ret[:], o[:])
    17  	return ret
    18  }
    19  
    20  type NaclSigningKeyPrivate [64]byte
    21  
    22  func (o NaclSigningKeyPrivate) DeepCopy() NaclSigningKeyPrivate {
    23  	var ret NaclSigningKeyPrivate
    24  	copy(ret[:], o[:])
    25  	return ret
    26  }
    27  
    28  type NaclDHKeyPublic [32]byte
    29  
    30  func (o NaclDHKeyPublic) DeepCopy() NaclDHKeyPublic {
    31  	var ret NaclDHKeyPublic
    32  	copy(ret[:], o[:])
    33  	return ret
    34  }
    35  
    36  type NaclDHKeyPrivate [32]byte
    37  
    38  func (o NaclDHKeyPrivate) DeepCopy() NaclDHKeyPrivate {
    39  	var ret NaclDHKeyPrivate
    40  	copy(ret[:], o[:])
    41  	return ret
    42  }
    43  
    44  type SecretKeys struct {
    45  	Signing    NaclSigningKeyPrivate `codec:"signing" json:"signing"`
    46  	Encryption NaclDHKeyPrivate      `codec:"encryption" json:"encryption"`
    47  }
    48  
    49  func (o SecretKeys) DeepCopy() SecretKeys {
    50  	return SecretKeys{
    51  		Signing:    o.Signing.DeepCopy(),
    52  		Encryption: o.Encryption.DeepCopy(),
    53  	}
    54  }
    55  
    56  type GetSecretKeysArg struct {
    57  	SessionID int `codec:"sessionID" json:"sessionID"`
    58  }
    59  
    60  type SecretKeysInterface interface {
    61  	GetSecretKeys(context.Context, int) (SecretKeys, error)
    62  }
    63  
    64  func SecretKeysProtocol(i SecretKeysInterface) rpc.Protocol {
    65  	return rpc.Protocol{
    66  		Name: "keybase.1.SecretKeys",
    67  		Methods: map[string]rpc.ServeHandlerDescription{
    68  			"getSecretKeys": {
    69  				MakeArg: func() interface{} {
    70  					var ret [1]GetSecretKeysArg
    71  					return &ret
    72  				},
    73  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    74  					typedArgs, ok := args.(*[1]GetSecretKeysArg)
    75  					if !ok {
    76  						err = rpc.NewTypeError((*[1]GetSecretKeysArg)(nil), args)
    77  						return
    78  					}
    79  					ret, err = i.GetSecretKeys(ctx, typedArgs[0].SessionID)
    80  					return
    81  				},
    82  			},
    83  		},
    84  	}
    85  }
    86  
    87  type SecretKeysClient struct {
    88  	Cli rpc.GenericClient
    89  }
    90  
    91  func (c SecretKeysClient) GetSecretKeys(ctx context.Context, sessionID int) (res SecretKeys, err error) {
    92  	__arg := GetSecretKeysArg{SessionID: sessionID}
    93  	err = c.Cli.Call(ctx, "keybase.1.SecretKeys.getSecretKeys", []interface{}{__arg}, &res, 0*time.Millisecond)
    94  	return
    95  }