Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
3d5ccc0f
Commit
3d5ccc0f
authored
Apr 13, 2022
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
first pass WIP api conversion
parent
918cce0a
No related branches found
No related tags found
4 merge requests
!510
Release
,
!207
WIP: Client Restructure
,
!203
Symmetric broadcast
,
!197
WIP: Convert API to use new restructure
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
api/auth.go
+27
-63
27 additions, 63 deletions
api/auth.go
api/client.go
+2
-2
2 additions, 2 deletions
api/client.go
api/permissioning.go
+19
-15
19 additions, 15 deletions
api/permissioning.go
api/send.go
+4
-5
4 additions, 5 deletions
api/send.go
auth/interface.go
+8
-0
8 additions, 0 deletions
auth/interface.go
with
60 additions
and
85 deletions
api/auth.go
+
27
−
63
View file @
3d5ccc0f
...
@@ -11,14 +11,11 @@ import (
...
@@ -11,14 +11,11 @@ import (
"encoding/binary"
"encoding/binary"
"math/rand"
"math/rand"
"gitlab.com/elixxir/client/catalog"
"github.com/cloudflare/circl/dh/sidh"
"github.com/cloudflare/circl/dh/sidh"
"github.com/pkg/errors"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/auth"
"gitlab.com/elixxir/client/auth"
"gitlab.com/elixxir/client/interfaces"
"gitlab.com/elixxir/client/e2e/ratchet/partner/session"
"gitlab.com/elixxir/client/storage/edge"
util
"gitlab.com/elixxir/client/storage/utility"
util
"gitlab.com/elixxir/client/storage/utility"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/primitives/fact"
"gitlab.com/elixxir/primitives/fact"
...
@@ -37,13 +34,12 @@ func (c *Client) RequestAuthenticatedChannel(recipient, me contact.Contact,
...
@@ -37,13 +34,12 @@ func (c *Client) RequestAuthenticatedChannel(recipient, me contact.Contact,
message
string
)
(
id
.
Round
,
error
)
{
message
string
)
(
id
.
Round
,
error
)
{
jww
.
INFO
.
Printf
(
"RequestAuthenticatedChannel(%s)"
,
recipient
.
ID
)
jww
.
INFO
.
Printf
(
"RequestAuthenticatedChannel(%s)"
,
recipient
.
ID
)
if
!
c
.
network
.
HealthTracker
()
.
IsHealthy
()
{
if
!
c
.
network
.
IsHealthy
()
{
return
0
,
errors
.
New
(
"Cannot request authenticated channel "
+
return
0
,
errors
.
New
(
"Cannot request authenticated channel "
+
"creation when the network is not healthy"
)
"creation when the network is not healthy"
)
}
}
return
auth
.
RequestAuth
(
recipient
,
me
,
c
.
rng
.
GetStream
(),
return
c
.
auth
.
Request
(
recipient
,
c
.
GetUser
()
.
GetContact
()
.
Facts
)
c
.
storage
,
c
.
network
)
}
}
// ResetSession resets an authenticate channel that already exists
// ResetSession resets an authenticate channel that already exists
...
@@ -51,18 +47,17 @@ func (c *Client) ResetSession(recipient, me contact.Contact,
...
@@ -51,18 +47,17 @@ func (c *Client) ResetSession(recipient, me contact.Contact,
message
string
)
(
id
.
Round
,
error
)
{
message
string
)
(
id
.
Round
,
error
)
{
jww
.
INFO
.
Printf
(
"ResetSession(%s)"
,
recipient
.
ID
)
jww
.
INFO
.
Printf
(
"ResetSession(%s)"
,
recipient
.
ID
)
if
!
c
.
network
.
GetHealthTracker
()
.
IsHealthy
()
{
if
!
c
.
network
.
IsHealthy
()
{
return
0
,
errors
.
New
(
"Cannot request authenticated channel "
+
return
0
,
errors
.
New
(
"Cannot request authenticated channel "
+
"creation when the network is not healthy"
)
"creation when the network is not healthy"
)
}
}
return
auth
.
ResetSession
(
recipient
,
me
,
c
.
rng
.
GetStream
(),
return
c
.
auth
.
Reset
(
recipient
)
c
.
storage
,
c
.
network
)
}
}
// GetAuthRegistrar gets the object which allows the registration of auth
// GetAuthRegistrar gets the object which allows the registration of auth
// callbacks
// callbacks
func
(
c
*
Client
)
GetAuthRegistrar
()
interfaces
.
Auth
{
func
(
c
*
Client
)
GetAuthRegistrar
()
auth
.
State
{
jww
.
INFO
.
Printf
(
"GetAuthRegistrar(...)"
)
jww
.
INFO
.
Printf
(
"GetAuthRegistrar(...)"
)
return
c
.
auth
return
c
.
auth
...
@@ -73,7 +68,7 @@ func (c *Client) GetAuthRegistrar() interfaces.Auth {
...
@@ -73,7 +68,7 @@ func (c *Client) GetAuthRegistrar() interfaces.Auth {
func
(
c
*
Client
)
GetAuthenticatedChannelRequest
(
partner
*
id
.
ID
)
(
contact
.
Contact
,
error
)
{
func
(
c
*
Client
)
GetAuthenticatedChannelRequest
(
partner
*
id
.
ID
)
(
contact
.
Contact
,
error
)
{
jww
.
INFO
.
Printf
(
"GetAuthenticatedChannelRequest(%s)"
,
partner
)
jww
.
INFO
.
Printf
(
"GetAuthenticatedChannelRequest(%s)"
,
partner
)
return
c
.
storage
.
A
uth
()
.
GetReceivedRequest
Data
(
partner
)
return
c
.
a
uth
.
GetReceivedRequest
(
partner
)
}
}
// ConfirmAuthenticatedChannel creates an authenticated channel out of a valid
// ConfirmAuthenticatedChannel creates an authenticated channel out of a valid
...
@@ -87,7 +82,7 @@ func (c *Client) GetAuthenticatedChannelRequest(partner *id.ID) (contact.Contact
...
@@ -87,7 +82,7 @@ func (c *Client) GetAuthenticatedChannelRequest(partner *id.ID) (contact.Contact
func
(
c
*
Client
)
ConfirmAuthenticatedChannel
(
recipient
contact
.
Contact
)
(
id
.
Round
,
error
)
{
func
(
c
*
Client
)
ConfirmAuthenticatedChannel
(
recipient
contact
.
Contact
)
(
id
.
Round
,
error
)
{
jww
.
INFO
.
Printf
(
"ConfirmAuthenticatedChannel(%s)"
,
recipient
.
ID
)
jww
.
INFO
.
Printf
(
"ConfirmAuthenticatedChannel(%s)"
,
recipient
.
ID
)
if
!
c
.
network
.
GetHealthTracker
()
.
IsHealthy
()
{
if
!
c
.
network
.
IsHealthy
()
{
return
0
,
errors
.
New
(
"Cannot request authenticated channel "
+
return
0
,
errors
.
New
(
"Cannot request authenticated channel "
+
"creation when the network is not healthy"
)
"creation when the network is not healthy"
)
}
}
...
@@ -100,18 +95,19 @@ func (c *Client) ConfirmAuthenticatedChannel(recipient contact.Contact) (id.Roun
...
@@ -100,18 +95,19 @@ func (c *Client) ConfirmAuthenticatedChannel(recipient contact.Contact) (id.Roun
func
(
c
*
Client
)
VerifyOwnership
(
received
,
verified
contact
.
Contact
)
bool
{
func
(
c
*
Client
)
VerifyOwnership
(
received
,
verified
contact
.
Contact
)
bool
{
jww
.
INFO
.
Printf
(
"VerifyOwnership(%s)"
,
received
.
ID
)
jww
.
INFO
.
Printf
(
"VerifyOwnership(%s)"
,
received
.
ID
)
return
auth
.
VerifyOwnership
(
received
,
verified
,
c
.
storag
e
)
return
c
.
auth
.
VerifyOwnership
(
received
,
verified
,
c
.
e2
e
)
}
}
// HasAuthenticatedChannel returns true if an authenticated channel exists for
// HasAuthenticatedChannel returns true if an authenticated channel exists for
// the partner
// the partner
func
(
c
*
Client
)
HasAuthenticatedChannel
(
partner
*
id
.
ID
)
bool
{
func
(
c
*
Client
)
HasAuthenticatedChannel
(
partner
*
id
.
ID
)
bool
{
m
,
err
:=
c
.
storage
.
E2e
()
.
GetPartner
(
partner
)
m
,
err
:=
c
.
e2e
.
GetPartner
(
partner
)
return
m
!=
nil
&&
err
==
nil
return
m
!=
nil
&&
err
==
nil
}
}
// Create an insecure e2e relationship with a precanned user
// Create an insecure e2e relationship with a precanned user
func
(
c
*
Client
)
MakePrecannedAuthenticatedChannel
(
precannedID
uint
)
(
contact
.
Contact
,
error
)
{
func
(
c
*
Client
)
MakePrecannedAuthenticatedChannel
(
precannedID
uint
)
(
contact
.
Contact
,
error
)
{
precan
:=
c
.
MakePrecannedContact
(
precannedID
)
precan
:=
c
.
MakePrecannedContact
(
precannedID
)
...
@@ -136,49 +132,15 @@ func (c *Client) MakePrecannedAuthenticatedChannel(precannedID uint) (contact.Co
...
@@ -136,49 +132,15 @@ func (c *Client) MakePrecannedAuthenticatedChannel(precannedID uint) (contact.Co
mySIDHPrivKey
.
GeneratePublicKey
(
mySIDHPubKey
)
mySIDHPrivKey
.
GeneratePublicKey
(
mySIDHPubKey
)
// add the precanned user as a e2e contact
// add the precanned user as a e2e contact
sesParam
:=
c
.
parameters
.
E2EParams
// FIXME: these params need to be threaded through...
err
:=
c
.
storage
.
E2e
()
.
AddPartner
(
precan
.
ID
,
precan
.
DhPubKey
,
sesParam
:=
session
.
GetDefaultParams
()
c
.
storage
.
E2e
()
.
GetDHPrivateKey
(),
theirSIDHPubKey
,
_
,
err
:=
c
.
e2e
.
AddPartner
(
precan
.
ID
,
precan
.
DhPubKey
,
c
.
e2e
.
GetHistoricalDHPrivkey
(),
theirSIDHPubKey
,
mySIDHPrivKey
,
sesParam
,
sesParam
)
mySIDHPrivKey
,
sesParam
,
sesParam
)
// check garbled messages in case any messages arrived before creating
// check garbled messages in case any messages arrived before creating
// the channel
// the channel
c
.
network
.
CheckGarbledMessages
()
c
.
network
.
CheckInProgressMessages
()
//add the e2e and rekey firngeprints
//e2e
sessionPartner
,
err
:=
c
.
storage
.
E2e
()
.
GetPartner
(
precan
.
ID
)
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Cannot find %s right after creating: %+v"
,
precan
.
ID
,
err
)
}
me
:=
c
.
storage
.
GetUser
()
.
ReceptionID
c
.
storage
.
GetEdge
()
.
Add
(
edge
.
Preimage
{
Data
:
sessionPartner
.
GetE2EPreimage
(),
Type
:
catalog
.
E2e
,
Source
:
precan
.
ID
[
:
],
},
me
)
// slient (rekey)
c
.
storage
.
GetEdge
()
.
Add
(
edge
.
Preimage
{
Data
:
sessionPartner
.
GetSilentPreimage
(),
Type
:
catalog
.
Silent
,
Source
:
precan
.
ID
[
:
],
},
me
)
// File transfer end
c
.
storage
.
GetEdge
()
.
Add
(
edge
.
Preimage
{
Data
:
sessionPartner
.
GetFileTransferPreimage
(),
Type
:
catalog
.
EndFT
,
Source
:
precan
.
ID
[
:
],
},
me
)
// group request
c
.
storage
.
GetEdge
()
.
Add
(
edge
.
Preimage
{
Data
:
sessionPartner
.
GetGroupRequestPreimage
(),
Type
:
catalog
.
GroupRq
,
Source
:
precan
.
ID
[
:
],
},
me
)
return
precan
,
err
return
precan
,
err
}
}
...
@@ -186,14 +148,14 @@ func (c *Client) MakePrecannedAuthenticatedChannel(precannedID uint) (contact.Co
...
@@ -186,14 +148,14 @@ func (c *Client) MakePrecannedAuthenticatedChannel(precannedID uint) (contact.Co
// Create an insecure e2e contact object for a precanned user
// Create an insecure e2e contact object for a precanned user
func
(
c
*
Client
)
MakePrecannedContact
(
precannedID
uint
)
contact
.
Contact
{
func
(
c
*
Client
)
MakePrecannedContact
(
precannedID
uint
)
contact
.
Contact
{
e2eGrp
:=
c
.
storage
.
E2e
()
.
GetGroup
()
e2eGrp
:=
c
.
storage
.
Get
E2E
Group
()
// get the user definition
precanned
:=
createPrecannedUser
(
precannedID
,
c
.
rng
.
GetStream
(),
precanned
:=
createPrecannedUser
(
precannedID
,
c
.
rng
.
GetStream
(),
c
.
storage
.
Cmix
()
.
Get
Group
(),
e2eGrp
)
c
.
storage
.
Get
CmixGroup
(),
e2eGrp
)
// compute their public e2e key
// compute their public e2e key
partnerPubKey
:=
e2eGrp
.
ExpG
(
precanned
.
E2eDhPrivateKey
,
e2eGrp
.
NewInt
(
1
))
partnerPubKey
:=
e2eGrp
.
ExpG
(
precanned
.
E2eDhPrivateKey
,
e2eGrp
.
NewInt
(
1
))
return
contact
.
Contact
{
return
contact
.
Contact
{
ID
:
precanned
.
ReceptionID
,
ID
:
precanned
.
ReceptionID
,
...
@@ -207,12 +169,14 @@ func (c *Client) MakePrecannedContact(precannedID uint) contact.Contact {
...
@@ -207,12 +169,14 @@ func (c *Client) MakePrecannedContact(precannedID uint) contact.Contact {
// E2E relationship. An error is returned if no relationship with the partner
// E2E relationship. An error is returned if no relationship with the partner
// is found.
// is found.
func
(
c
*
Client
)
GetRelationshipFingerprint
(
partner
*
id
.
ID
)
(
string
,
error
)
{
func
(
c
*
Client
)
GetRelationshipFingerprint
(
partner
*
id
.
ID
)
(
string
,
error
)
{
m
,
err
:=
c
.
storage
.
E2e
()
.
GetPartner
(
partner
)
m
,
err
:=
c
.
e2e
.
GetPartner
(
partner
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
errors
.
Errorf
(
"could not get partner %s: %+v"
,
partner
,
err
)
return
""
,
errors
.
Errorf
(
"could not get partner %s: %+v"
,
partner
,
err
)
}
else
if
m
==
nil
{
}
else
if
m
==
nil
{
return
""
,
errors
.
Errorf
(
"manager for partner %s is nil."
,
partner
)
return
""
,
errors
.
Errorf
(
"manager for partner %s is nil."
,
partner
)
}
}
return
m
.
Get
Relationship
Fingerprint
(),
nil
return
m
.
Get
Connection
Fingerprint
(),
nil
}
}
This diff is collapsed.
Click to expand it.
api/client.go
+
2
−
2
View file @
3d5ccc0f
...
@@ -51,8 +51,8 @@ type Client struct {
...
@@ -51,8 +51,8 @@ type Client struct {
//object used for communications
//object used for communications
comms
*
client
.
Comms
comms
*
client
.
Comms
// Network parameters
// Network parameters
, note e2e params wrap CMIXParams
parameters
cmix
.
Params
parameters
e2e
.
Params
network
cmix
.
Client
network
cmix
.
Client
//object used to register and communicate with permissioning
//object used to register and communicate with permissioning
...
...
This diff is collapsed.
Click to expand it.
api/permissioning.go
+
19
−
15
View file @
3d5ccc0f
...
@@ -9,17 +9,18 @@ package api
...
@@ -9,17 +9,18 @@ package api
import
(
import
(
"encoding/json"
"encoding/json"
"github.com/pkg/errors"
"github.com/pkg/errors"
"gitlab.com/elixxir/client/interfaces/user"
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/storage"
"gitlab.com/elixxir/client/storage/user"
)
)
// Returns an error if registration fails.
// Returns an error if registration fails.
func
(
c
*
Client
)
registerWithPermissioning
()
error
{
func
(
c
*
Client
)
registerWithPermissioning
()
error
{
userData
:=
c
.
s
tora
ge
.
User
()
userData
:=
c
.
userState
.
Cryp
to
g
ra
phicIdentity
//get the users public key
//get the users public key
transmissionPubKey
:=
userData
.
GetCryptographicIdentity
()
.
GetTransmissionRSA
()
.
GetPublic
()
transmissionPubKey
:=
userData
.
GetTransmissionRSA
()
.
GetPublic
()
receptionPubKey
:=
userData
.
GetCryptographicIdentity
()
.
GetReceptionRSA
()
.
GetPublic
()
receptionPubKey
:=
userData
.
GetReceptionRSA
()
.
GetPublic
()
//load the registration code
//load the registration code
regCode
,
err
:=
c
.
storage
.
GetRegCode
()
regCode
,
err
:=
c
.
storage
.
GetRegCode
()
...
@@ -30,16 +31,19 @@ func (c *Client) registerWithPermissioning() error {
...
@@ -30,16 +31,19 @@ func (c *Client) registerWithPermissioning() error {
//register with registration
//register with registration
transmissionRegValidationSignature
,
receptionRegValidationSignature
,
transmissionRegValidationSignature
,
receptionRegValidationSignature
,
registrationTimestamp
,
err
:=
c
.
permissioning
.
Register
(
transmissionPubKey
,
receptionPubKey
,
regCode
)
registrationTimestamp
,
err
:=
c
.
permissioning
.
Register
(
transmissionPubKey
,
receptionPubKey
,
regCode
)
if
err
!=
nil
{
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
"failed to register with "
+
return
errors
.
WithMessage
(
err
,
"failed to register with "
+
"permissioning"
)
"permissioning"
)
}
}
//store the signature
//store the signature
userData
.
SetTransmissionRegistrationValidationSignature
(
transmissionRegValidationSignature
)
c
.
storage
.
SetTransmissionRegistrationValidationSignature
(
userData
.
SetReceptionRegistrationValidationSignature
(
receptionRegValidationSignature
)
transmissionRegValidationSignature
)
userData
.
SetRegistrationTimestamp
(
registrationTimestamp
)
c
.
storage
.
SetReceptionRegistrationValidationSignature
(
receptionRegValidationSignature
)
c
.
storage
.
SetRegistrationTimestamp
(
registrationTimestamp
)
//update the registration state
//update the registration state
err
=
c
.
storage
.
ForwardRegistrationStatus
(
storage
.
PermissioningComplete
)
err
=
c
.
storage
.
ForwardRegistrationStatus
(
storage
.
PermissioningComplete
)
...
@@ -50,9 +54,9 @@ func (c *Client) registerWithPermissioning() error {
...
@@ -50,9 +54,9 @@ func (c *Client) registerWithPermissioning() error {
return
nil
return
nil
}
}
// ConstructProtoUerFile is a helper function which is used for proto
client testing.
// ConstructProtoU
s
erFile is a helper function which is used for proto
// This is used for development testing.
//
client testing.
This is used for development testing.
func
(
c
*
Client
)
ConstructProtoUerFile
()
([]
byte
,
error
)
{
func
(
c
*
Client
)
ConstructProtoU
s
erFile
()
([]
byte
,
error
)
{
//load the registration code
//load the registration code
regCode
,
err
:=
c
.
storage
.
GetRegCode
()
regCode
,
err
:=
c
.
storage
.
GetRegCode
()
...
@@ -71,10 +75,10 @@ func (c *Client) ConstructProtoUerFile() ([]byte, error) {
...
@@ -71,10 +75,10 @@ func (c *Client) ConstructProtoUerFile() ([]byte, error) {
Precanned
:
c
.
GetUser
()
.
Precanned
,
Precanned
:
c
.
GetUser
()
.
Precanned
,
RegistrationTimestamp
:
c
.
GetUser
()
.
RegistrationTimestamp
,
RegistrationTimestamp
:
c
.
GetUser
()
.
RegistrationTimestamp
,
RegCode
:
regCode
,
RegCode
:
regCode
,
TransmissionRegValidationSig
:
c
.
storage
.
User
()
.
GetTransmissionRegistrationValidationSignature
(),
TransmissionRegValidationSig
:
c
.
storage
.
GetTransmissionRegistrationValidationSignature
(),
ReceptionRegValidationSig
:
c
.
storage
.
User
()
.
GetReceptionRegistrationValidationSignature
(),
ReceptionRegValidationSig
:
c
.
storage
.
GetReceptionRegistrationValidationSignature
(),
E2eDhPrivateKey
:
c
.
GetStorage
()
.
E2e
()
.
Get
DHPriv
ateK
ey
(),
E2eDhPrivateKey
:
c
.
e2e
.
GetHistorical
DHPriv
k
ey
(),
E2eDhPublicKey
:
c
.
GetStorage
()
.
E2e
()
.
Get
DHPub
licK
ey
(),
E2eDhPublicKey
:
c
.
e2e
.
GetHistorical
DHPub
k
ey
(),
}
}
jsonBytes
,
err
:=
json
.
Marshal
(
Usr
)
jsonBytes
,
err
:=
json
.
Marshal
(
Usr
)
...
...
This diff is collapsed.
Click to expand it.
api/send.go
+
4
−
5
View file @
3d5ccc0f
...
@@ -16,7 +16,6 @@ import (
...
@@ -16,7 +16,6 @@ import (
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix/message"
"gitlab.com/elixxir/client/cmix/message"
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/interfaces/params"
e2eCrypto
"gitlab.com/elixxir/crypto/e2e"
e2eCrypto
"gitlab.com/elixxir/crypto/e2e"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id"
...
@@ -64,16 +63,16 @@ func (c *Client) SendCMIX(msg format.Message, recipientID *id.ID,
...
@@ -64,16 +63,16 @@ func (c *Client) SendCMIX(msg format.Message, recipientID *id.ID,
// SendManyCMIX sends many "raw" CMIX message payloads to each of the
// SendManyCMIX sends many "raw" CMIX message payloads to each of the
// provided recipients. Used for group chat functionality. Returns the
// provided recipients. Used for group chat functionality. Returns the
// round ID of the round the payload was sent or an error if it fails.
// round ID of the round the payload was sent or an error if it fails.
func
(
c
*
Client
)
SendManyCMIX
(
messages
[]
message
.
TargetedCmixMessage
,
func
(
c
*
Client
)
SendManyCMIX
(
messages
[]
cmix
.
TargetedCmixMessage
,
params
params
.
CMIX
)
(
id
.
Round
,
[]
ephemeral
.
Id
,
error
)
{
params
cmix
.
CMIXParams
)
(
id
.
Round
,
[]
ephemeral
.
Id
,
error
)
{
return
c
.
network
.
SendMany
CMIX
(
messages
,
params
)
return
c
.
network
.
SendMany
(
messages
,
params
)
}
}
// NewCMIXMessage Creates a new cMix message with the right properties
// NewCMIXMessage Creates a new cMix message with the right properties
// for the current cMix network.
// for the current cMix network.
// FIXME: this is weird and shouldn't be necessary, but it is.
// FIXME: this is weird and shouldn't be necessary, but it is.
func
(
c
*
Client
)
NewCMIXMessage
(
contents
[]
byte
)
(
format
.
Message
,
error
)
{
func
(
c
*
Client
)
NewCMIXMessage
(
contents
[]
byte
)
(
format
.
Message
,
error
)
{
primeSize
:=
len
(
c
.
storage
.
Cmix
()
.
Get
Group
()
.
GetPBytes
())
primeSize
:=
len
(
c
.
storage
.
Get
CmixGroup
()
.
GetPBytes
())
msg
:=
format
.
NewMessage
(
primeSize
)
msg
:=
format
.
NewMessage
(
primeSize
)
if
len
(
contents
)
>
msg
.
ContentsSize
()
{
if
len
(
contents
)
>
msg
.
ContentsSize
()
{
return
format
.
Message
{},
errors
.
New
(
"Contents to long for cmix"
)
return
format
.
Message
{},
errors
.
New
(
"Contents to long for cmix"
)
...
...
This diff is collapsed.
Click to expand it.
auth/interface.go
+
8
−
0
View file @
3d5ccc0f
package
auth
package
auth
import
(
import
(
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/primitives/fact"
"gitlab.com/elixxir/primitives/fact"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id"
...
@@ -75,4 +76,11 @@ type State interface {
...
@@ -75,4 +76,11 @@ type State interface {
// DeleteReceiveRequests clears all received requests from client's auth
// DeleteReceiveRequests clears all received requests from client's auth
// storage.
// storage.
DeleteReceiveRequests
()
error
DeleteReceiveRequests
()
error
// GetReceivedRequest returns a contact if there's a received
// request for it.
GetReceivedRequest
(
partner
*
id
.
ID
)
(
contact
.
Contact
,
error
)
// VerifyOwnership checks if the received ownership proof is valid
VerifyOwnership
(
received
,
verified
contact
.
Contact
,
e2e
e2e
.
Handler
)
bool
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment