storj/internal/identity/identity.go
Bryan White 2a0c4e60d2
preparing for use of customtype gogo extension with NodeID type (#693)
* preparing for use of `customtype` gogo extension with `NodeID` type

* review changes

* preparing for use of `customtype` gogo extension with `NodeID` type

* review changes

* wip

* tests passing

* wip fixing tests

* more wip test fixing

* remove NodeIDList from proto files

* linter fixes

* linter fixes

* linter/review fixes

* more freaking linter fixes

* omg just kill me - linterrrrrrrr

* travis linter, i will muder you and your family in your sleep

* goimports everything - burn in hell travis

* goimports update

* go mod tidy
2018-11-29 19:39:27 +01:00

36 lines
839 B
Go

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package testidentity
import (
"context"
"storj.io/storj/pkg/provider"
)
// NewTestIdentity is a helper function to generate new node identities with
// correct difficulty and concurrency
func NewTestIdentity() (*provider.FullIdentity, error) {
ca, err := provider.NewCA(context.Background(), provider.NewCAOptions{
Difficulty: 12,
Concurrency: 4,
})
if err != nil {
return nil, err
}
identity, err := ca.NewIdentity()
if err != nil {
return nil, err
}
return identity, err
}
// NewTestCA returns a ca with a default difficulty and concurrency for use in tests
func NewTestCA(ctx context.Context) (*provider.FullCertificateAuthority, error) {
return provider.NewCA(ctx, provider.NewCAOptions{
Difficulty: 12,
Concurrency: 4,
})
}