Export SignTypedData in mobile bindings (#1403)
This commit is contained in:
parent
b3e2cb2965
commit
ea19896623
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/status-im/status-go/params"
|
"github.com/status-im/status-go/params"
|
||||||
"github.com/status-im/status-go/profiling"
|
"github.com/status-im/status-go/profiling"
|
||||||
"github.com/status-im/status-go/services/personal"
|
"github.com/status-im/status-go/services/personal"
|
||||||
|
"github.com/status-im/status-go/services/typeddata"
|
||||||
"github.com/status-im/status-go/signal"
|
"github.com/status-im/status-go/signal"
|
||||||
"github.com/status-im/status-go/transactions"
|
"github.com/status-im/status-go/transactions"
|
||||||
validator "gopkg.in/go-playground/validator.v9"
|
validator "gopkg.in/go-playground/validator.v9"
|
||||||
|
@ -350,6 +351,22 @@ func SignMessage(rpcParams string) string {
|
||||||
return prepareJSONResponse(result.String(), err)
|
return prepareJSONResponse(result.String(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SignTypedData unmarshall data into TypedData, validate it and signs with selected account,
|
||||||
|
// if password matches selected account.
|
||||||
|
//export SignTypedData
|
||||||
|
func SignTypedData(data, password string) string {
|
||||||
|
var typed typeddata.TypedData
|
||||||
|
err := json.Unmarshal([]byte(data), &typed)
|
||||||
|
if err != nil {
|
||||||
|
return prepareJSONResponseWithCode(nil, err, codeFailedParseParams)
|
||||||
|
}
|
||||||
|
if err := typed.Validate(); err != nil {
|
||||||
|
return prepareJSONResponseWithCode(nil, err, codeFailedParseParams)
|
||||||
|
}
|
||||||
|
result, err := statusBackend.SignTypedData(typed, password)
|
||||||
|
return prepareJSONResponse(result.String(), err)
|
||||||
|
}
|
||||||
|
|
||||||
// Recover unmarshals rpc params {signDataString, signedData} and passes
|
// Recover unmarshals rpc params {signDataString, signedData} and passes
|
||||||
// them onto backend.
|
// them onto backend.
|
||||||
func Recover(rpcParams string) string {
|
func Recover(rpcParams string) string {
|
||||||
|
|
Loading…
Reference in New Issue