reshare

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright © 2020 AMIS Technologies

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "reshare",
	Short: "Reshare process",
	Long:  `Refresh the secret share without changing the public key.`,
	RunE: func(cmd *cobra.Command, args []string) error {
		err := initService(cmd)
		if err != nil {
			log.Crit("Failed to init", "err", err)
		}

		c, err := readReshareConfigFile(configFile)
		if err != nil {
			log.Crit("Failed to read config file", "configFile", configFile, "err", err)
		}

		host, err := peer.MakeBasicHost(c.Port)
		if err != nil {
			log.Crit("Failed to create a basic host", "err", err)
		}

		pm := peer.NewPeerManager(utils.GetPeerIDFromPort(c.Port), host, reshareProtocol)
		err = pm.AddPeers(c.Peers)
		if err != nil {
			log.Crit("Failed to add peers", "err", err)
		}

		service, err := NewService(c, pm)
		if err != nil {
			log.Crit("Failed to new service", "err", err)
		}

		host.SetStreamHandler(reshareProtocol, func(s network.Stream) {
			service.Handle(s)
		})

		pm.EnsureAllConnected()

		service.Process()

		return nil
	},
}

Functions

func NewService

func NewService(config *ReshareConfig, pm types.PeerManager) (*service, error)

Types

type ReshareConfig

type ReshareConfig struct {
	Port      int64                `yaml:"port"`
	Threshold uint32               `yaml:"threshold"`
	Share     string               `yaml:"share"`
	Pubkey    config.Pubkey        `yaml:"pubkey"`
	BKs       map[string]config.BK `yaml:"bks"`
	Peers     []int64              `yaml:"peers"`
}

type ReshareResult

type ReshareResult struct {
	Share string `yaml:"share"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL