Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
interface
Browse files Browse the repository at this point in the history
  • Loading branch information
willscott committed Apr 21, 2020
1 parent 3d56974 commit 4aef0db
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions init.go
Expand Up @@ -13,15 +13,15 @@ import (
)

func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
return InitWithOptions(out, []options.KeyGenerateOption{options.Key.Size(nBitsForKeypair)})
}

func InitWithOptions(out io.Writer, opts []options.KeyGenerateOption) (*Config, error) {
identity, err := identityConfig(out, opts)
identity, err := CreateIdentity(out, []options.KeyGenerateOption{options.Key.Size(nBitsForKeypair)})
if err != nil {
return nil, err
}

return InitWithIdentity(identity)
}

func InitWithIdentity(identity Identity) (*Config, error) {
bootstrapPeers, err := DefaultBootstrapPeers()
if err != nil {
return nil, err
Expand Down Expand Up @@ -170,8 +170,8 @@ func flatfsSpec() map[string]interface{} {
}
}

// identityConfig initializes a new identity.
func identityConfig(out io.Writer, opts []options.KeyGenerateOption) (Identity, error) {
// CreateIdentity initializes a new identity.
func CreateIdentity(out io.Writer, opts []options.KeyGenerateOption) (Identity, error) {
// TODO guard higher up
ident := Identity{}

Expand Down

0 comments on commit 4aef0db

Please sign in to comment.