github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/ephemeral/init.go (about)

     1  package ephemeral
     2  
     3  import (
     4  	"github.com/keybase/client/go/libkb"
     5  )
     6  
     7  // Creates a ephemeral key storage and installs it into G.
     8  func NewEphemeralStorageAndInstall(mctx libkb.MetaContext) {
     9  	mctx.G().SetDeviceEKStorage(NewDeviceEKStorage(mctx))
    10  	mctx.G().SetUserEKBoxStorage(NewUserEKBoxStorage())
    11  	mctx.G().SetTeamEKBoxStorage(NewTeamEKBoxStorage(NewTeamEphemeralKeyer()))
    12  	mctx.G().SetTeambotEKBoxStorage(NewTeamEKBoxStorage(NewTeambotEphemeralKeyer()))
    13  	ekLib := NewEKLib(mctx)
    14  	mctx.G().SetEKLib(ekLib)
    15  	mctx.G().AddLoginHook(ekLib)
    16  	mctx.G().AddLogoutHook(ekLib, "ekLib")
    17  	mctx.G().AddDbNukeHook(ekLib, "ekLib")
    18  	mctx.G().PushShutdownHook(ekLib.Shutdown)
    19  }
    20  
    21  func ServiceInit(mctx libkb.MetaContext) {
    22  	NewEphemeralStorageAndInstall(mctx)
    23  }