Skip to content

Commit

Permalink
Rename InfoImporter -> LegacyInfoImporter (#8739)
Browse files Browse the repository at this point in the history
Avoid namespace clash with the InfoImporter interface
that already exists in the v0.41 release series.

(cherry picked from commit 010eeef)

# Conflicts:
#	client/keys/migrate.go
#	crypto/keyring/keyring.go
  • Loading branch information
Alessio Treglia authored and mergify-bot committed Mar 1, 2021
1 parent ee90640 commit c338c76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/keys/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,15 @@ func runMigrateCmd(cmd *cobra.Command, args []string) error {
}

if keyType != keyring.TypeLocal {
<<<<<<< HEAD
pubkeyArmor, err := legacyKb.ExportPubKey(keyName)
if err != nil {
return err
=======
infoImporter, ok := migrator.(keyring.LegacyInfoImporter)
if !ok {
return fmt.Errorf("the Keyring implementation does not support import operations of Info types")
>>>>>>> 010eeef45... Rename InfoImporter -> LegacyInfoImporter (#8739)
}

if err := migrator.ImportPubKey(keyName, pubkeyArmor); err != nil {
Expand Down
10 changes: 10 additions & 0 deletions crypto/keyring/keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ type Importer interface {
ImportPubKey(uid string, armor string) error
}

<<<<<<< HEAD
=======
// LegacyInfoImporter is implemented by key stores that support import of Info types.
type LegacyInfoImporter interface {
// ImportInfo import a keyring.Info into the current keyring.
// It is used to migrate multisig, ledger, and public key Info structure.
ImportInfo(oldInfo Info) error
}

>>>>>>> 010eeef45... Rename InfoImporter -> LegacyInfoImporter (#8739)
// Exporter is implemented by key stores that support export of public and private keys.
type Exporter interface {
// Export public key
Expand Down

0 comments on commit c338c76

Please sign in to comment.