本文整理汇总了Golang中github.com/keybase/client/go/libkb.PGPGenArg类的典型用法代码示例。如果您正苦于以下问题:Golang PGPGenArg类的具体用法?Golang PGPGenArg怎么用?Golang PGPGenArg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PGPGenArg类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ParseArgv
func (v *CmdPGPGen) ParseArgv(ctx *cli.Context) (err error) {
nargs := len(ctx.Args())
if nargs != 0 {
err = fmt.Errorf("pgp gen takes 0 args")
} else {
g := libkb.PGPGenArg{}
g.PGPUids = ctx.StringSlice("pgp-uid")
v.arg.DoExport = !ctx.Bool("no-export")
v.arg.AllowMulti = ctx.Bool("multi")
if ctx.Bool("debug") {
g.PrimaryBits = SmallKey
g.SubkeyBits = SmallKey
}
v.arg.Gen = &g
}
return err
}
示例3: ParseArgv
func (v *CmdPGPGen) ParseArgv(ctx *cli.Context) (err error) {
nargs := len(ctx.Args())
if nargs != 0 {
err = fmt.Errorf("pgp gen takes 0 args")
} else {
g := libkb.PGPGenArg{}
g.PGPUids = ctx.StringSlice("pgp-uid")
g.NoDefPGPUid = ctx.Bool("no-default-pgp-uid")
v.arg.AllowMulti = ctx.Bool("multi")
v.arg.DoExport = !ctx.Bool("no-export")
if g.NoDefPGPUid && len(g.PGPUids) == 0 {
err = fmt.Errorf("if you don't want the default PGP uid, you must supply a PGP uid with the --pgp-uid option")
}
if ctx.Bool("debug") {
g.PrimaryBits = SmallKey
g.SubkeyBits = SmallKey
}
v.arg.Gen = &g
}
return err
}
示例4: 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)
}