/
interface.go
39 lines (34 loc) 路 1.4 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package signer
import (
"context"
"github.com/MixinNetwork/safe/messenger"
"github.com/MixinNetwork/trusted-group/mtg"
)
type Configuration struct {
StoreDir string `toml:"store-dir"`
MessengerConversationId string `toml:"messenger-conversation-id"`
MonitorConversaionId string `toml:"monitor-conversation-id"`
Threshold int `toml:"threshold"`
SharedKey string `toml:"shared-key"`
AssetId string `toml:"asset-id"`
KeeperAssetId string `toml:"keeper-asset-id"`
KeeperPublicKey string `toml:"keeper-public-key"`
SaverAPI string `toml:"saver-api"`
SaverKey string `toml:"saver-key"`
MixinRPC string `toml:"mixin-rpc"`
MTG *mtg.Configuration `toml:"mtg"`
}
func (c *Configuration) Messenger() *messenger.MixinConfiguration {
return &messenger.MixinConfiguration{
UserId: c.MTG.App.ClientId,
SessionId: c.MTG.App.SessionId,
Key: c.MTG.App.PrivateKey,
ConversationId: c.MessengerConversationId,
ReceiveBuffer: 128,
SendBuffer: 64,
}
}
type Network interface {
ReceiveMessage(context.Context) (*messenger.MixinMessage, error)
QueueMessage(ctx context.Context, receiver string, b []byte) error
}