github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/engine/device_key_test.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package engine 5 6 import ( 7 "testing" 8 9 "github.com/keybase/client/go/libkb" 10 ) 11 12 func TestDeviceKey(t *testing.T) { 13 tc := SetupEngineTest(t, "dkal") 14 defer tc.Cleanup() 15 16 fu := CreateAndSignupFakeUser(tc, "dkal") 17 18 check := func() { 19 u, err := libkb.LoadMe(libkb.NewLoadUserArg(tc.G)) 20 if err != nil { 21 t.Fatal(err) 22 } 23 if u == nil { 24 t.Fatalf("Can't load current user") 25 } 26 27 if subkey, err := u.GetDeviceSubkey(); err != nil { 28 t.Fatal(err) 29 } else if subkey == nil { 30 t.Fatalf("Failed to load device subkey right after signup") 31 } 32 } 33 check() 34 35 Logout(tc) 36 fu.LoginOrBust(tc) 37 check() 38 }