github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/engine/engine_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  	"crypto/rand"
     8  	"encoding/hex"
     9  	"fmt"
    10  
    11  	"github.com/keybase/client/go/libkb"
    12  )
    13  
    14  func fakeUser(tb libkb.TestingTB, prefix string) (username, email string) {
    15  	buf := make([]byte, 5)
    16  	if _, err := rand.Read(buf); err != nil {
    17  		tb.Fatal(err)
    18  	}
    19  	username = fmt.Sprintf("%s_%s", prefix, hex.EncodeToString(buf))
    20  	email = fmt.Sprintf("test+%s@keybase.io", username)
    21  	return username, email
    22  }
    23  
    24  func fakePassphrase(t libkb.TestingTB) string {
    25  	buf := make([]byte, 12)
    26  	if _, err := rand.Read(buf); err != nil {
    27  		t.Fatal(err)
    28  	}
    29  	return hex.EncodeToString(buf)
    30  }