本文整理汇总了Golang中github.com/keybase/client/go/libkb.PGPGenArg.AddDefaultUID方法的典型用法代码示例。如果您正苦于以下问题:Golang PGPGenArg.AddDefaultUID方法的具体用法?Golang PGPGenArg.AddDefaultUID怎么用?Golang PGPGenArg.AddDefaultUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/keybase/client/go/libkb.PGPGenArg
的用法示例。
在下文中一共展示了PGPGenArg.AddDefaultUID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: createFakeUserWithPGPOnly
// createFakeUserWithPGPOnly creates a new fake/testing user, who signed
// up on the Web site, and used the Web site to generate his/her key. They
// used triplesec-encryption and synced their key to the keybase servers.
func createFakeUserWithPGPOnly(t *testing.T, tc libkb.TestContext) *FakeUser {
fu := NewFakeUserOrBust(tc.T, "login")
secui := &libkb.TestSecretUI{Passphrase: fu.Passphrase}
ctx := &Context{
GPGUI: &gpgtestui{},
SecretUI: secui,
LogUI: tc.G.UI.GetLogUI(),
LoginUI: &libkb.TestLoginUI{Username: fu.Username},
}
s := NewSignupEngine(nil, tc.G)
f := func(a libkb.LoginContext) error {
if err := s.genPassphraseStream(a, fu.Passphrase); err != nil {
return err
}
if err := s.join(a, fu.Username, fu.Email, testInviteCode, true); err != nil {
return err
}
return s.fakeLKS()
}
if err := s.G().LoginState().ExternalFunc(f, "createFakeUserWithPGPOnly"); err != nil {
tc.T.Fatal(err)
}
// Generate a new test PGP key for the user, and specify the PushSecret
// flag so that their triplesec'ed key is pushed to the server.
gen := libkb.PGPGenArg{
PrimaryBits: 1024,
SubkeyBits: 1024,
}
gen.AddDefaultUID()
peng := NewPGPKeyImportEngine(PGPKeyImportEngineArg{
Gen: &gen,
PushSecret: true,
Lks: s.lks,
NoSave: true,
})
if err := RunEngine(peng, ctx); err != nil {
tc.T.Fatal(err)
}
var err error
fu.User, err = libkb.LoadMe(libkb.NewLoadUserPubOptionalArg(tc.G))
if err != nil {
tc.T.Fatal(err)
}
return fu
}
示例2: genPGPBatch
func (s *SignupEngine) genPGPBatch(ctx *Context) error {
gen := libkb.PGPGenArg{
PrimaryBits: 1024,
SubkeyBits: 1024,
}
gen.AddDefaultUID()
tsec := ctx.LoginContext.PassphraseStreamCache().Triplesec()
sgen := ctx.LoginContext.GetStreamGeneration()
eng := NewPGPKeyImportEngine(PGPKeyImportEngineArg{
Gen: &gen,
PushSecret: true,
Lks: s.lks,
NoSave: true,
PreloadTsec: tsec,
PreloadStreamGen: sgen,
})
return RunEngine(eng, ctx)
}