Skip to content

Commit

Permalink
engine: backout kex2 upgrade, but keep bugfix (keybase#20543)
Browse files Browse the repository at this point in the history
* Revert "engine: enable kex v2 passphrases (keybase#20281)"

This reverts commit 0e2ec80.

* also fix the original bug in 0e2ec80
  • Loading branch information
maxtaco authored Oct 25, 2019
1 parent d14c686 commit 080cef7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion go/engine/device_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ func (e *DeviceAdd) Run(m libkb.MetaContext) (err error) {
}
uid := m.CurrentUID()

kex2SecretTyp := libkb.Kex2SecretTypeV2
// make a new secret; continue to generate legacy Kex2 secrets for now.
kex2SecretTyp := libkb.Kex2SecretTypeV1Desktop
if provisioneeType == keybase1.DeviceType_MOBILE || m.G().GetAppType() == libkb.DeviceTypeMobile {
kex2SecretTyp = libkb.Kex2SecretTypeV1Mobile
}
m.Debug("provisionee device type: %v; uid: %s; secret type: %d", provisioneeType, uid, kex2SecretTyp)
secret, err := libkb.NewKex2SecretFromTypeAndUID(kex2SecretTyp, uid)
if err != nil {
Expand Down
9 changes: 6 additions & 3 deletions go/engine/login_provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ func (e *loginProvision) deviceWithType(m libkb.MetaContext, provisionerType key
uid := e.arg.User.GetUID()

// Continue to generate legacy Kex2 secret types
kex2SecretTyp := libkb.Kex2SecretTypeV2
kex2SecretTyp := libkb.Kex2SecretTypeV1Desktop
if e.arg.DeviceType == libkb.DeviceTypeMobile || provisionerType == keybase1.DeviceType_MOBILE {
kex2SecretTyp = libkb.Kex2SecretTypeV1Mobile
}
m.Debug("Generating Kex2 secret for uid=%s, typ=%d", uid, kex2SecretTyp)
secret, err := libkb.NewKex2SecretFromTypeAndUID(kex2SecretTyp, uid)
if err != nil {
Expand All @@ -198,7 +201,7 @@ func (e *loginProvision) deviceWithType(m libkb.MetaContext, provisionerType key
m.Debug("Failed to get salt")
return err
}
provisionee := NewKex2Provisionee(m.G(), device, secret.Secret(), e.arg.User.GetUID(), salt)
provisionee := NewKex2Provisionee(m.G(), device, secret.Secret(), uid, salt)

var canceler func()

Expand Down Expand Up @@ -274,7 +277,7 @@ func (e *loginProvision) deviceWithType(m libkb.MetaContext, provisionerType key
}

// Load me again so that keys will be up to date.
loadArg := libkb.NewLoadUserArgWithMetaContext(m).WithSelf(true).WithUID(e.arg.User.GetUID())
loadArg := libkb.NewLoadUserArgWithMetaContext(m).WithSelf(true).WithUID(uid)
e.arg.User, err = libkb.LoadUser(loadArg)
if err != nil {
return err
Expand Down

0 comments on commit 080cef7

Please sign in to comment.