Documentation ¶
Index ¶
- Constants
- Variables
- func FlipBool(cp CommitmentPayload, players []PlayerState) (bool, error)
- func FlipInt(cp CommitmentPayload, players []PlayerState, modulus int64) (int64, error)
- func FlipOneBig(cp CommitmentPayload, players []PlayerState, modulus *big.Int) (*big.Int, error)
- func FlipProtocol(i FlipInterface) rpc.Protocol
- func GenerateGameID() chat1.FlipGameID
- type AbsenteesError
- type BadChannelError
- type BadCommitmentCompleteHashError
- type BadFlipTypeError
- type BadGameIDError
- type BadLeaderClockError
- type BadLocalClockError
- type BadMessageError
- type BadMessageForStageError
- type BadRevealError
- type BadUserDeviceError
- type BadVersionError
- type Commitment
- type CommitmentComplete
- type CommitmentCompleteSortError
- type CommitmentMismatchError
- type CommitmentPayload
- type CommitmentUpdate
- type Dealer
- func (d *Dealer) HasActiveGames(ctx context.Context) bool
- func (d *Dealer) InjectIncomingChat(ctx context.Context, sender UserDevice, conversationID chat1.ConversationID, ...) error
- func (d *Dealer) IsGameActive(ctx context.Context, conversationID chat1.ConversationID, ...) bool
- func (d *Dealer) Run(ctx context.Context) error
- func (d *Dealer) StartFlip(ctx context.Context, start Start, conversationID chat1.ConversationID) (err error)
- func (d *Dealer) StartFlipWithGameID(ctx context.Context, start Start, conversationID chat1.ConversationID, ...) (err error)
- func (d *Dealer) Stop()
- func (d *Dealer) UpdateCh() <-chan GameStateUpdateMessage
- type DealersHelper
- type DuplicateCommitmentCompleteError
- type DuplicateCommitmentError
- type DuplicateRegistrationError
- type DuplicateRevealError
- type Error
- type FlipClient
- type FlipInterface
- type FlipParameters
- type FlipType
- type Game
- type GameAbortedError
- type GameAlreadyStartedError
- type GameFinishedError
- type GameHistory
- type GameHistoryPlayer
- type GameIDKey
- type GameKey
- type GameMessage
- type GameMessageBody
- func NewGameMessageBodyWithCommitment(v Commitment) GameMessageBody
- func NewGameMessageBodyWithCommitmentComplete(v CommitmentComplete) GameMessageBody
- func NewGameMessageBodyWithEnd() GameMessageBody
- func NewGameMessageBodyWithReveal(v Reveal) GameMessageBody
- func NewGameMessageBodyWithStart(v Start) GameMessageBody
- func (o GameMessageBody) Commitment() (res Commitment)
- func (o GameMessageBody) CommitmentComplete() (res CommitmentComplete)
- func (o GameMessageBody) DeepCopy() GameMessageBody
- func (b GameMessageBody) Encode(md GameMetadata) (GameMessageEncoded, error)
- func (o GameMessageBody) Reveal() (res Reveal)
- func (o GameMessageBody) Start() (res Start)
- func (m GameMessageBody) String() string
- func (o *GameMessageBody) T() (ret MessageType, err error)
- type GameMessageEncoded
- type GameMessageReplayed
- type GameMessageV1
- type GameMessageWrapped
- type GameMessageWrappedEncoded
- type GameMetadata
- type GamePlayerState
- type GameReplayError
- type GameShutdownError
- type GameStateUpdateMessage
- type GameSummary
- type Hash
- type MessageType
- type NoRevealError
- type PRNG
- type Player
- type PlayerState
- type ReplayError
- type ReplayHelper
- type Result
- type Reveal
- type RevealTooLateError
- type RevealUpdate
- type Secret
- type Stage
- type Start
- type Time
- type TimeoutError
- type UnforwardableMessageError
- type UserDevice
- type UserDeviceCommitment
- type UserDeviceKey
- type Version
- type WrongSenderError
Constants ¶
const MaxClockSkew = time.Hour * 1
Variables ¶
var DefaultCommitmentCompleteWindowMsec int64 = 15 * 1000
var DefaultCommitmentWindowMsec int64 = 3 * 1000
var DefaultRevealWindowMsec int64 = 30 * 1000
var DefaultSlackMsec int64 = 1 * 1000
var ErrBadData = errors.New("rejecting bad data, likely due to a nil field")
var FlipTypeMap = map[string]FlipType{
"BOOL": 1,
"INT": 2,
"BIG": 3,
"SHUFFLE": 4,
}
var FlipTypeRevMap = map[FlipType]string{
1: "BOOL",
2: "INT",
3: "BIG",
4: "SHUFFLE",
}
var MessageTypeMap = map[string]MessageType{
"START": 1,
"COMMITMENT": 2,
"COMMITMENT_COMPLETE": 3,
"REVEAL": 4,
"END": 5,
}
var MessageTypeRevMap = map[MessageType]string{
1: "START",
2: "COMMITMENT",
3: "COMMITMENT_COMPLETE",
4: "REVEAL",
5: "END",
}
var StageMap = map[string]Stage{
"ROUND1": 1,
"ROUND2": 2,
}
var StageRevMap = map[Stage]string{
1: "ROUND1",
2: "ROUND2",
}
var VersionMap = map[string]Version{
"V1": 1,
}
var VersionRevMap = map[Version]string{
1: "V1",
}
Functions ¶
func FlipBool ¶
func FlipBool(cp CommitmentPayload, players []PlayerState) (bool, error)
FlipOneBool takes all the completed PlayerStates, and checks them. If no error, then outputs one random bool. If there was an error in the game setup, then it will return false and the error.
func FlipInt ¶
func FlipInt(cp CommitmentPayload, players []PlayerState, modulus int64) (int64, error)
FlipOneInt takes all the completed PlayerStates, and checks them. If no error, then outputs one random number between 0 and the given modulus, a signed 64-bit int. If there was an error in the game setup, then it will return 0 and the error.
func FlipOneBig ¶
func FlipOneBig(cp CommitmentPayload, players []PlayerState, modulus *big.Int) (*big.Int, error)
FlipOneBig takes all the completed PlayerStates, and checks them. If no error, then outputs one random number between 0 and the given modulus, which is an arbitrarily big number. If there was an error in the game setup, then it will return nil and the error.
func FlipProtocol ¶
func FlipProtocol(i FlipInterface) rpc.Protocol
func GenerateGameID ¶
func GenerateGameID() chat1.FlipGameID
Types ¶
type AbsenteesError ¶
type AbsenteesError struct {
Absentees []UserDevice
}
func (AbsenteesError) Error ¶
func (l AbsenteesError) Error() string
type BadChannelError ¶
type BadChannelError struct { G GameMetadata C chat1.ConversationID }
func (BadChannelError) Error ¶
func (b BadChannelError) Error() string
type BadCommitmentCompleteHashError ¶
type BadCommitmentCompleteHashError struct { G GameMetadata U UserDevice }
func (BadCommitmentCompleteHashError) Error ¶
func (b BadCommitmentCompleteHashError) Error() string
type BadFlipTypeError ¶
type BadFlipTypeError struct { G GameMetadata T FlipType }
func (BadFlipTypeError) Error ¶
func (b BadFlipTypeError) Error() string
type BadGameIDError ¶
type BadGameIDError struct { G GameMetadata I chat1.FlipGameID }
func (BadGameIDError) Error ¶
func (b BadGameIDError) Error() string
type BadLeaderClockError ¶
type BadLeaderClockError struct {
G GameMetadata
}
func (BadLeaderClockError) Error ¶
func (b BadLeaderClockError) Error() string
type BadLocalClockError ¶
type BadLocalClockError struct {
G GameMetadata
}
func (BadLocalClockError) Error ¶
func (b BadLocalClockError) Error() string
type BadMessageError ¶
type BadMessageError struct { G GameMetadata T MessageType }
func (BadMessageError) Error ¶
func (b BadMessageError) Error() string
type BadMessageForStageError ¶
type BadMessageForStageError struct { G GameMetadata MessageType MessageType Stage Stage }
func (BadMessageForStageError) Error ¶
func (b BadMessageForStageError) Error() string
type BadRevealError ¶
type BadRevealError struct { G GameMetadata U UserDevice }
func (BadRevealError) Error ¶
func (b BadRevealError) Error() string
type BadUserDeviceError ¶
type BadUserDeviceError struct { Expected UserDevice Actual UserDevice }
func (BadUserDeviceError) Error ¶
func (b BadUserDeviceError) Error() string
type BadVersionError ¶
type BadVersionError Version
func (BadVersionError) Error ¶
func (b BadVersionError) Error() string
type Commitment ¶
type Commitment [32]byte
func (Commitment) DeepCopy ¶
func (o Commitment) DeepCopy() Commitment
func (Commitment) Eq ¶
func (c Commitment) Eq(d Commitment) bool
func (Commitment) String ¶
func (c Commitment) String() string
type CommitmentComplete ¶
type CommitmentComplete struct {
Players []UserDeviceCommitment `codec:"players" json:"players"`
}
func (CommitmentComplete) DeepCopy ¶
func (o CommitmentComplete) DeepCopy() CommitmentComplete
type CommitmentCompleteSortError ¶
type CommitmentCompleteSortError struct {
G GameMetadata
}
func (CommitmentCompleteSortError) Error ¶
func (c CommitmentCompleteSortError) Error() string
type CommitmentMismatchError ¶
type CommitmentMismatchError struct { G GameMetadata U UserDevice }
func (CommitmentMismatchError) Error ¶
func (c CommitmentMismatchError) Error() string
type CommitmentPayload ¶
type CommitmentPayload struct { V Version `codec:"v" json:"v"` U gregor1.UID `codec:"u" json:"u"` D gregor1.DeviceID `codec:"d" json:"d"` C chat1.ConversationID `codec:"c" json:"c"` G chat1.FlipGameID `codec:"i" json:"i"` S Time `codec:"s" json:"s"` // contains filtered or unexported fields }
type CommitmentUpdate ¶
type CommitmentUpdate struct { User UserDevice Commitment Commitment }
type Dealer ¶
Dealer is a peristent process that runs in the chat client that deals out a game. It can have multiple games running at once.
func NewDealer ¶
func NewDealer(dh DealersHelper) *Dealer
NewDealer makes a new Dealer with a given DealersHelper
func (*Dealer) InjectIncomingChat ¶
func (d *Dealer) InjectIncomingChat(ctx context.Context, sender UserDevice, conversationID chat1.ConversationID, gameID chat1.FlipGameID, body GameMessageEncoded, firstInConversation bool) error
InjectIncomingChat should be called whenever a new flip game comes in that's relevant for flips. Call this with the sender's information, the channel information, and the body data that came in. The last bool is true only if this is the first message in the channel. The current model is that only one "game" is allowed for each chat channel. So any prior messages in the channel mean it might be replay. This is significantly less general than an earlier model, which is why we introduced the concept of a gameID, so it might be changed in the future.
func (*Dealer) IsGameActive ¶
func (d *Dealer) IsGameActive(ctx context.Context, conversationID chat1.ConversationID, gameID chat1.FlipGameID) bool
func (*Dealer) StartFlip ¶
func (d *Dealer) StartFlip(ctx context.Context, start Start, conversationID chat1.ConversationID) (err error)
StartFlip starts a new flip. Pass it some start parameters as well as a chat conversationID that it will take place in.
func (*Dealer) StartFlipWithGameID ¶
func (d *Dealer) StartFlipWithGameID(ctx context.Context, start Start, conversationID chat1.ConversationID, gameID chat1.FlipGameID) (err error)
StartFlipWithGameID starts a new flip. Pass it some start parameters as well as a chat conversationID that it will take place in. Also takes a GameID
func (*Dealer) UpdateCh ¶
func (d *Dealer) UpdateCh() <-chan GameStateUpdateMessage
UpdateCh returns a channel that sends a sequence of GameStateUpdateMessages, each notifying the UI about changes to ongoing games.
type DealersHelper ¶
type DealersHelper interface { ReplayHelper Clock() clockwork.Clock ServerTime(context.Context) (time.Time, error) SendChat(ctx context.Context, initiatorUID gregor1.UID, ch chat1.ConversationID, gameID chat1.FlipGameID, msg GameMessageEncoded) error Me() UserDevice ShouldCommit(ctx context.Context) bool // Whether to send new commitments for games. }
DealersHelper is an interface that calling chat clients need to implement.
type DuplicateCommitmentCompleteError ¶
type DuplicateCommitmentCompleteError struct { G GameMetadata U UserDevice }
func (DuplicateCommitmentCompleteError) Error ¶
func (d DuplicateCommitmentCompleteError) Error() string
type DuplicateCommitmentError ¶
type DuplicateCommitmentError struct{}
func (DuplicateCommitmentError) Error ¶
func (d DuplicateCommitmentError) Error() string
type DuplicateRegistrationError ¶
type DuplicateRegistrationError struct { G GameMetadata U UserDevice }
func (DuplicateRegistrationError) Error ¶
func (d DuplicateRegistrationError) Error() string
type DuplicateRevealError ¶
type DuplicateRevealError struct { G GameMetadata U UserDevice }
func (DuplicateRevealError) Error ¶
func (d DuplicateRevealError) Error() string
type Error ¶
type FlipClient ¶
type FlipClient struct {
Cli rpc.GenericClient
}
type FlipInterface ¶
type FlipInterface interface { }
type FlipParameters ¶
type FlipParameters struct { T__ FlipType `codec:"t" json:"t"` Int__ *int64 `codec:"int,omitempty" json:"int,omitempty"` Big__ *[]byte `codec:"big,omitempty" json:"big,omitempty"` Shuffle__ *int64 `codec:"shuffle,omitempty" json:"shuffle,omitempty"` }
func NewFlipParametersWithBig ¶
func NewFlipParametersWithBig(v []byte) FlipParameters
func NewFlipParametersWithBool ¶
func NewFlipParametersWithBool() FlipParameters
func NewFlipParametersWithInt ¶
func NewFlipParametersWithInt(v int64) FlipParameters
func NewFlipParametersWithShuffle ¶
func NewFlipParametersWithShuffle(v int64) FlipParameters
func (FlipParameters) Big ¶
func (o FlipParameters) Big() (res []byte)
func (FlipParameters) DeepCopy ¶
func (o FlipParameters) DeepCopy() FlipParameters
func (FlipParameters) Int ¶
func (o FlipParameters) Int() (res int64)
func (FlipParameters) Shuffle ¶
func (o FlipParameters) Shuffle() (res int64)
func (FlipParameters) String ¶
func (p FlipParameters) String() string
func (*FlipParameters) T ¶
func (o *FlipParameters) T() (ret FlipType, err error)
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
func (*Game) CommitmentEndTime ¶
func (*Game) GameMetadata ¶
func (g *Game) GameMetadata() GameMetadata
func (*Game) RevealEndTime ¶
type GameAbortedError ¶
type GameAbortedError struct{}
func (GameAbortedError) Error ¶
func (g GameAbortedError) Error() string
type GameAlreadyStartedError ¶
type GameAlreadyStartedError struct {
G GameMetadata
}
func (GameAlreadyStartedError) Error ¶
func (g GameAlreadyStartedError) Error() string
type GameFinishedError ¶
type GameFinishedError struct {
G GameMetadata
}
func (GameFinishedError) Error ¶
func (g GameFinishedError) Error() string
type GameHistory ¶
type GameHistory []GameMessageReplayed
type GameHistoryPlayer ¶
type GameHistoryPlayer struct { Device UserDevice Commitment Commitment Reveal *Secret }
type GameIDKey ¶
type GameIDKey string
func GameIDToKey ¶
func GameIDToKey(g chat1.FlipGameID) GameIDKey
type GameMessage ¶
type GameMessage struct { V__ Version `codec:"v" json:"v"` V1__ *GameMessageV1 `codec:"v1,omitempty" json:"v1,omitempty"` }
func NewGameMessageDefault ¶
func NewGameMessageDefault(v Version) GameMessage
func NewGameMessageWithV1 ¶
func NewGameMessageWithV1(v GameMessageV1) GameMessage
func (GameMessage) DeepCopy ¶
func (o GameMessage) DeepCopy() GameMessage
func (*GameMessage) V ¶
func (o *GameMessage) V() (ret Version, err error)
func (GameMessage) V1 ¶
func (o GameMessage) V1() (res GameMessageV1)
type GameMessageBody ¶
type GameMessageBody struct { T__ MessageType `codec:"t" json:"t"` Start__ *Start `codec:"start,omitempty" json:"start,omitempty"` Commitment__ *Commitment `codec:"commitment,omitempty" json:"commitment,omitempty"` CommitmentComplete__ *CommitmentComplete `codec:"commitmentComplete,omitempty" json:"commitmentComplete,omitempty"` Reveal__ *Reveal `codec:"reveal,omitempty" json:"reveal,omitempty"` }
func NewGameMessageBodyWithCommitment ¶
func NewGameMessageBodyWithCommitment(v Commitment) GameMessageBody
func NewGameMessageBodyWithCommitmentComplete ¶
func NewGameMessageBodyWithCommitmentComplete(v CommitmentComplete) GameMessageBody
func NewGameMessageBodyWithEnd ¶
func NewGameMessageBodyWithEnd() GameMessageBody
func NewGameMessageBodyWithReveal ¶
func NewGameMessageBodyWithReveal(v Reveal) GameMessageBody
func NewGameMessageBodyWithStart ¶
func NewGameMessageBodyWithStart(v Start) GameMessageBody
func (GameMessageBody) Commitment ¶
func (o GameMessageBody) Commitment() (res Commitment)
func (GameMessageBody) CommitmentComplete ¶
func (o GameMessageBody) CommitmentComplete() (res CommitmentComplete)
func (GameMessageBody) DeepCopy ¶
func (o GameMessageBody) DeepCopy() GameMessageBody
func (GameMessageBody) Encode ¶
func (b GameMessageBody) Encode(md GameMetadata) (GameMessageEncoded, error)
func (GameMessageBody) Reveal ¶
func (o GameMessageBody) Reveal() (res Reveal)
func (GameMessageBody) Start ¶
func (o GameMessageBody) Start() (res Start)
func (GameMessageBody) String ¶
func (m GameMessageBody) String() string
func (*GameMessageBody) T ¶
func (o *GameMessageBody) T() (ret MessageType, err error)
type GameMessageEncoded ¶
type GameMessageEncoded string
GameMessageEncoded is a game message that is shipped over the chat channel. Inside, it's a base64-encoded msgpack object (generated via AVDL->go compiler), but it's safe to think of it just as an opaque string.
func MakeGameMessageEncoded ¶
func MakeGameMessageEncoded(s string) GameMessageEncoded
func (GameMessageEncoded) Decode ¶
func (e GameMessageEncoded) Decode() (*GameMessageV1, error)
func (GameMessageEncoded) String ¶
func (e GameMessageEncoded) String() string
type GameMessageReplayed ¶
type GameMessageReplayed struct { GameMessageWrappedEncoded Time time.Time }
type GameMessageV1 ¶
type GameMessageV1 struct { Md GameMetadata `codec:"md" json:"md"` Body GameMessageBody `codec:"body" json:"body"` }
func (GameMessageV1) DeepCopy ¶
func (o GameMessageV1) DeepCopy() GameMessageV1
func (GameMessageV1) Encode ¶
func (v GameMessageV1) Encode() (GameMessageEncoded, error)
type GameMessageWrapped ¶
type GameMessageWrapped struct { Sender UserDevice Msg GameMessageV1 Me *playerControl Forward bool FirstInConversation bool }
func (GameMessageWrapped) Encode ¶
func (m GameMessageWrapped) Encode() (GameMessageEncoded, error)
func (GameMessageWrapped) GameMetadata ¶
func (m GameMessageWrapped) GameMetadata() GameMetadata
type GameMessageWrappedEncoded ¶
type GameMessageWrappedEncoded struct { Sender UserDevice GameID chat1.FlipGameID // the game ID of this game, also specified (encoded) in GameMessageEncoded Body GameMessageEncoded // base64-encoded GameMessaageBody that comes in over chat FirstInConversation bool // on if this is the first message in the conversation }
GameMessageWrappedEncoded contains a sender, a gameID and a Body. The GameID should never be reused.
func (*GameMessageWrappedEncoded) Decode ¶
func (e *GameMessageWrappedEncoded) Decode() (*GameMessageWrapped, error)
type GameMetadata ¶
type GameMetadata struct { Initiator UserDevice `codec:"initiator" json:"initiator"` ConversationID chat1.ConversationID `codec:"conversationID" json:"conversationID"` GameID chat1.FlipGameID `codec:"gameID" json:"gameID"` }
func (GameMetadata) DeepCopy ¶
func (o GameMetadata) DeepCopy() GameMetadata
func (GameMetadata) String ¶
func (g GameMetadata) String() string
func (GameMetadata) ToKey ¶
func (g GameMetadata) ToKey() GameKey
type GamePlayerState ¶
type GamePlayerState struct {
// contains filtered or unexported fields
}
type GameReplayError ¶
type GameReplayError struct {
G chat1.FlipGameID
}
func (GameReplayError) Error ¶
func (g GameReplayError) Error() string
type GameShutdownError ¶
type GameShutdownError struct {
G GameMetadata
}
func (GameShutdownError) Error ¶
func (g GameShutdownError) Error() string
type GameStateUpdateMessage ¶
type GameStateUpdateMessage struct { Metadata GameMetadata // only one of the following will be non-nil Err error Commitment *CommitmentUpdate Reveal *RevealUpdate CommitmentComplete *CommitmentComplete Result *Result }
GameStateUpdateMessage is sent from the game dealer out to the calling chat client, to update him on changes to game state that happened. All update messages are relative to the given GameMetadata. For each update, only one of Err, Commitment, Reveal, CommitmentComplete or Result will be non-nil.
type GameSummary ¶
type GameSummary struct { Err error Players []GameHistoryPlayer Result Result }
func Replay ¶
func Replay(ctx context.Context, rh ReplayHelper, gh GameHistory) (*GameSummary, error)
type MessageType ¶
type MessageType int
const ( MessageType_START MessageType = 1 MessageType_COMMITMENT MessageType = 2 MessageType_COMMITMENT_COMPLETE MessageType = 3 MessageType_REVEAL MessageType = 4 MessageType_END MessageType = 5 )
func (MessageType) DeepCopy ¶
func (o MessageType) DeepCopy() MessageType
func (MessageType) String ¶
func (e MessageType) String() string
type NoRevealError ¶
type NoRevealError struct { G GameMetadata U UserDevice }
func (NoRevealError) Error ¶
func (n NoRevealError) Error() string
type PRNG ¶
type PRNG struct {
// contains filtered or unexported fields
}
PRNG is based on AES-CTR. The input key is a 32-byte random secret (as generated by our commitment scheme). The output is a AES(k,1), AES(k,2), AES(k,3), etc... We are relying on the fact that AES is a PRP, which is pretty widely assumed.
func Flip ¶
func Flip(cp CommitmentPayload, players []PlayerState) (*PRNG, error)
Flip takes all the completed PlayerStates from the game, makes sure they don't have an error, and if not, outputs a PRNG from which arbirarily many ints, or bools, can be deterministically plucked. If there's an error, PRNG will be nil.
func (*PRNG) Permutation ¶
Permutation runs the Fisher-Yates shuffle on the sequence [0,n). See: https://en.wikipedia.org/wiki/Fisher–Yates_shuffle Be careful for off-by-one errors in this implementation, as we have already witnessed one. We bounty bugs like these, so let us know!
type Player ¶
type Player string
Player is an identifier for a player in the flip game. It can be anything, but must be unique for the game. You can use user IDs in hex here, for instance, or possibly (userid||deviceID) since each user in Keybase will likely enter a flip multiple times (if many if his devices are on).
type PlayerState ¶
type PlayerState struct { Player Player Commitment *Commitment Reveal Secret }
PlayerState refers to all state about a player in the game. It includes the Player's name, his commitment, and his revealed preimage.
type ReplayError ¶
type ReplayError struct {
// contains filtered or unexported fields
}
func NewReplayError ¶
func NewReplayError(s string) ReplayError
func (ReplayError) Error ¶
func (r ReplayError) Error() string
type ReplayHelper ¶
ReplayHelper contains hooks needed to replay a flip.
type Reveal ¶
type RevealTooLateError ¶
type RevealTooLateError struct { G GameMetadata U UserDevice }
func (RevealTooLateError) Error ¶
func (b RevealTooLateError) Error() string
type RevealUpdate ¶
type RevealUpdate struct { User UserDevice Reveal Secret }
type Start ¶
type Start struct { StartTime Time `codec:"startTime" json:"startTime"` CommitmentWindowMsec int64 `codec:"commitmentWindowMsec" json:"commitmentWindowMsec"` RevealWindowMsec int64 `codec:"revealWindowMsec" json:"revealWindowMsec"` SlackMsec int64 `codec:"slackMsec" json:"slackMsec"` CommitmentCompleteWindowMsec int64 `codec:"commitmentCompleteWindowMsec" json:"commitmentCompleteWindowMsec"` Params FlipParameters `codec:"params" json:"params"` }
func NewStartWithBigInt ¶
NewStartWithBigInt makes new start parameters that yield a coinflip game that picks big int between 0 and mod.
func NewStartWithBool ¶
NewStartWithBool makes new start parameters that yield a coinflip game.
func NewStartWithInt ¶
NewStartWithInt makes new start parameters that yield a coinflip game that picks an int between 0 and mod.
func NewStartWithShuffle ¶
NewStartWithShuffle makes new start parameters for a coinflip that randomly permutes the numbers between 0 and n, exclusive. This can be used to shuffle an array of names.
func (Start) CommitmentWindowWithSlack ¶
func (Start) RevealWindowWithSlack ¶
type TimeoutError ¶
type TimeoutError struct { G GameMetadata Stage Stage }
func (TimeoutError) Error ¶
func (t TimeoutError) Error() string
type UnforwardableMessageError ¶
type UnforwardableMessageError struct {
G GameMetadata
}
func (UnforwardableMessageError) Error ¶
func (u UnforwardableMessageError) Error() string
type UserDevice ¶
type UserDevice struct { D gregor1.DeviceID `codec:"d" json:"d"` U gregor1.UID `codec:"u" json:"u"` }
func (UserDevice) DeepCopy ¶
func (o UserDevice) DeepCopy() UserDevice
func (UserDevice) Eq ¶
func (u UserDevice) Eq(v UserDevice) bool
func (UserDevice) LessThan ¶
func (u UserDevice) LessThan(v UserDevice) bool
func (UserDevice) ToKey ¶
func (u UserDevice) ToKey() UserDeviceKey
type UserDeviceCommitment ¶
type UserDeviceCommitment struct { Ud UserDevice `codec:"ud" json:"ud"` C Commitment `codec:"c" json:"c"` }
func (UserDeviceCommitment) DeepCopy ¶
func (o UserDeviceCommitment) DeepCopy() UserDeviceCommitment
type UserDeviceKey ¶
type UserDeviceKey string
type WrongSenderError ¶
type WrongSenderError struct { G GameMetadata Expected UserDevice Actual UserDevice }
func (WrongSenderError) Error ¶
func (w WrongSenderError) Error() string