status-go/sign/request.go
Igor Mandrigin a9eb5a7d2b Generalize signing requests.
We need to be able to sign more than just transactions to make DApps
work properly. This change separates signing requests from the
transactions and make it more general to prepare to intoduce different
types of signing requests.

This change is designed to preserve status APIs, so it is
backward-comparible with the current API bindings.
2018-04-09 20:48:00 +02:00

37 lines
879 B
Go

package sign
import (
"context"
"github.com/ethereum/go-ethereum/common"
"github.com/pborman/uuid"
"github.com/status-im/status-go/geth/account"
)
type completeFunc func(*account.SelectedExtKey) (common.Hash, error)
// Meta represents any metadata that could be attached to a signing request.
// It will be JSON-serialized and used in notifications to the API consumer.
type Meta interface{}
// Request is a single signing request.
type Request struct {
ID string
Meta Meta
context context.Context
locked bool
completeFunc completeFunc
result chan Result
}
func newRequest(ctx context.Context, meta Meta, completeFunc completeFunc) *Request {
return &Request{
ID: uuid.New(),
Meta: meta,
context: ctx,
locked: false,
completeFunc: completeFunc,
result: make(chan Result, 1),
}
}