keys/keybase.go
func (kb dbKeybase) Recover(name, passphrase, seedphrase string) (Info, error) {
	words := strings.Split(strings.TrimSpace(seedphrase), " ")
	secret, err := kb.codec.WordsToBytes(words)
	if err != nil {
		return nil, err
	}

	// secret is comprised of the actual secret with the type
	// appended.
	// ie [secret] = [type] + [secret]
	typ, secret := secret[0], secret[1:]
	algo := byteToSignAlgo(typ)
	priv, err := generate(algo, secret)
	if err != nil {
		return nil, err
	}

	// encrypt and persist key.
	public := kb.writeLocalKey(priv, name, passphrase)
	return public, nil
}
func (kb dbKeybase) Recover(name, passphrase, seedphrase string) (Info, error) {
	words := strings.Split(strings.TrimSpace(seedphrase), " ")
	secret, err := kb.codec.WordsToBytes(words)
	if err != nil {
		return nil, err
	}

	// secret is comprised of the actual secret with the type
	// appended.
	// ie [secret] = [type] + [secret]
	typ, secret := secret[0], secret[1:]
	algo := byteToSignAlgo(typ)
	priv, err := generate(algo, secret)
	if err != nil {
		return nil, err
	}

	// encrypt and persist key.
	public := kb.writeLocalKey(priv, name, passphrase)
	return public, nil
}
func ( kb dbKeybase ) Recover ( name , passphrase , seedphrase string ) ( Info , error ) { words := strings . Split ( strings . TrimSpace ( seedphrase ) , " " ) secret , err := kb . codec . WordsToBytes ( words ) if err != nil { return nil , err } // secret is comprised of the actual secret with the type // appended. // ie [secret] = [type] + [secret] typ , secret := secret [ 0 ] , secret [ 1 : ] algo := byteToSignAlgo ( typ ) priv , err := generate ( algo , secret ) if err != nil { return nil , err } // encrypt and persist key. public := kb . writeLocalKey ( priv , name , passphrase ) return public , nil }
// Recover converts a seedphrase to a private key and persists it,
// encrypted with the given passphrase.  Functions like Create, but
// seedphrase is input not output.
Recover converts a seedphrase to a private key and persists it encrypted with the given passphrase . Functions like Create but seedphrase is input not output .