Example #1
0
// RunClient runs the command in client/server mode.
func (c *CmdDeviceAdd) Run() error {
	var err error
	cli, err := GetDeviceClient()
	if err != nil {
		return err
	}
	protocols := []rpc.Protocol{
		NewProvisionUIProtocol(c.G(), libkb.KexRoleProvisioner),
		NewSecretUIProtocol(c.G()),
	}
	if err := RegisterProtocols(protocols); err != nil {
		return err
	}

	return cli.DeviceAdd(context.TODO(), 0)
}
// RunClient runs the command in client/server mode.
func (c *CmdDeviceAdd) Run() error {
	var err error
	c.sessionID, err = libkb.RandInt()
	if err != nil {
		return err
	}
	cli, err := GetDeviceClient()
	if err != nil {
		return err
	}
	protocols := []rpc.Protocol{
		NewSecretUIProtocol(G),
		NewLocksmithUIProtocol(),
	}
	if err := RegisterProtocols(protocols); err != nil {
		return err
	}

	return cli.DeviceAdd(context.TODO(), keybase1.DeviceAddArg{SecretPhrase: c.phrase, SessionID: c.sessionID})
}