func()

in tuf/deployer/deployer.go [59:88]


func (d *Deployer) UpdateSecrets(tufConfig config.TUFConfig, rootKeyFile string, targetKeyFile string, snapshotKeyFile string) error {
	errorStr := make([]string, 0)
	if rootKeyFile != "" {
		err := d.uploadSecret(rootKeyFile, tufConfig, constants.RootSecretFileKey)
		if err != nil {
			errorStr = append(errorStr, err.Error())
		}
	}
	if targetKeyFile != "" {
		err := d.uploadSecret(targetKeyFile, tufConfig, constants.TargetSecretFileKey)
		if err != nil {
			errorStr = append(errorStr, err.Error())
		}
	}
	if snapshotKeyFile != "" {
		err := d.uploadSecret(snapshotKeyFile, tufConfig, constants.SnapshotSecretFileKey)
		if err != nil {
			errorStr = append(errorStr, err.Error())
		}
	}
	if len(errorStr) > 0 {
		// Exit if there were errors uploading secrets.
		return fmt.Errorf("Encountered following errors %s", strings.Join(errorStr, "\n"))
	}

	// TODO Generate all the Metadata.

	// TODO Write Consistent Snapshots
	return nil
}