Skip to content

Commit

Permalink
[validator] removed go validator since it's causing errors on ios/and…
Browse files Browse the repository at this point in the history
…roid
  • Loading branch information
Florian Lenz committed Jun 6, 2018
1 parent 6257955 commit 36a854f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
14 changes: 2 additions & 12 deletions api/device/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"github.com/Bit-Nation/panthalassa/api/device/rpc"
log "github.com/ipfs/go-log"
valid "gopkg.in/asaskevich/govalidator.v4"
)

var logger = log.Logger("device_api")
Expand Down Expand Up @@ -37,8 +36,8 @@ func UnmarshalApiCall(call string) (ApiCall, error) {
}

type rawResponse struct {
Error string `json:"error",valid:"string,optional"`
Payload string `json:"payload",valid:"string,optional"`
Error string `json:"error"`
Payload string `json:"payload"`
}

type Response struct {
Expand Down Expand Up @@ -134,15 +133,6 @@ func (a *Api) Receive(id string, data string) error {
return err
}

// validate raw response
_, err = valid.ValidateStruct(rr)
if err != nil {
resp <- Response{
Error: err,
}
return err
}

// construct response
r := Response{
Error: err,
Expand Down
6 changes: 3 additions & 3 deletions mesh/dht_store_rpc_calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (c *DHTPutCall) Valid() error {
}

type DHTGetCall struct {
Key string `json:"key",valid:"required"`
Key string `json:"key"`
}

func (c *DHTGetCall) Type() string {
Expand All @@ -50,7 +50,7 @@ func (c *DHTGetCall) Valid() error {
}

type DHTHasCall struct {
Key string `json:"key",valid:"required"`
Key string `json:"key"`
}

func (d *DHTHasCall) Type() string {
Expand All @@ -73,7 +73,7 @@ func (d *DHTHasCall) Valid() error {
}

type DHTDeleteCall struct {
Key string `json:"key",valid:"required"`
Key string `json:"key"`
}

func (d *DHTDeleteCall) Type() string {
Expand Down
19 changes: 3 additions & 16 deletions mobile_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
"errors"

deviceApi "github.com/Bit-Nation/panthalassa/api/device"
"github.com/Bit-Nation/panthalassa/chat"
chat "github.com/Bit-Nation/panthalassa/chat"
keyManager "github.com/Bit-Nation/panthalassa/keyManager"
mesh "github.com/Bit-Nation/panthalassa/mesh"
profile "github.com/Bit-Nation/panthalassa/profile"
log "github.com/ipfs/go-log"
valid "gopkg.in/asaskevich/govalidator.v4"
)

var panthalassaInstance *Panthalassa
Expand All @@ -21,8 +20,8 @@ type UpStream interface {
}

type StartConfig struct {
EncryptedKeyManager string `valid:"required",json:"encrypted_key_manager"`
SignedProfile string `valid:"required",json:"signed_profile"`
EncryptedKeyManager string `json:"encrypted_key_manager"`
SignedProfile string `json:"signed_profile"`
}

// create a new panthalassa instance
Expand Down Expand Up @@ -91,12 +90,6 @@ func Start(config string, password string, client UpStream) error {
return err
}

// validate config
_, err := valid.ValidateStruct(c)
if err != nil {
return err
}

// open key manager with password
km, err := keyManager.OpenWithPassword(c.EncryptedKeyManager, password)
if err != nil {
Expand All @@ -115,12 +108,6 @@ func StartFromMnemonic(config string, mnemonic string, client UpStream) error {
return err
}

// validate config
_, err := valid.ValidateStruct(c)
if err != nil {
return err
}

// create key manager
km, err := keyManager.OpenWithMnemonic(c.EncryptedKeyManager, mnemonic)
if err != nil {
Expand Down

0 comments on commit 36a854f

Please sign in to comment.