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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
53837894
Commit
53837894
authored
2 years ago
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
added a dummy name server and added bindings. tests needed
parent
b15b3e39
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!510
Release
,
!419
rewrote the health tracker to both consider if there are waiting rounds and...
,
!340
Project/channels
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bindings/channels.go
+32
-0
32 additions, 0 deletions
bindings/channels.go
channels/dummyNameServer.go
+78
-0
78 additions, 0 deletions
channels/dummyNameServer.go
channels/nameService.go
+1
-1
1 addition, 1 deletion
channels/nameService.go
with
111 additions
and
1 deletion
bindings/channels.go
+
32
−
0
View file @
53837894
...
...
@@ -167,6 +167,38 @@ func NewChannelsManagerGoEventModel(e2eID, udID int,
return
channelManagerTrackerSingleton
.
make
(
m
),
nil
}
// NewChannelsManagerGoEventModelDummyNameService constructs a
// ChannelsManager. This is not compatible with GoMobile Bindings because
// it receives the go event model. This uses the dummy name service
// and is for debugging only
// Parameters:
// - e2eID - The tracked e2e object ID. This can be retrieved using
// [E2e.GetID].
// - udID - The tracked UD object ID. This can be retrieved using
// [UserDiscovery.GetID].
func
NewChannelsManagerGoEventModelDummyNameService
(
e2eID
int
,
username
string
,
goEvent
channels
.
EventModel
)
(
*
ChannelsManager
,
error
)
{
// Get user from singleton
user
,
err
:=
e2eTrackerSingleton
.
get
(
e2eID
)
if
err
!=
nil
{
return
nil
,
err
}
rng
:=
user
.
api
.
GetRng
()
.
GetStream
()
defer
rng
.
Close
()
nameService
,
err
:=
channels
.
NewDummyNameService
(
username
,
rng
)
if
err
!=
nil
{
return
nil
,
err
}
// Construct new channels manager
m
:=
channels
.
NewManager
(
user
.
api
.
GetStorage
()
.
GetKV
(),
user
.
api
.
GetCmix
(),
user
.
api
.
GetRng
(),
nameService
,
goEvent
)
// Add channel to singleton and return
return
channelManagerTrackerSingleton
.
make
(
m
),
nil
}
type
ChannelGeneration
struct
{
Channel
string
PrivateKey
string
...
...
This diff is collapsed.
Click to expand it.
channels/dummyNameServer.go
0 → 100644
+
78
−
0
View file @
53837894
package
channels
import
(
"crypto/ed25519"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/crypto/channel"
"io"
"time"
)
// NewDummyNameService returns a dummy object adhering to the name service
// This neither produces valid signatures or validates passed signature
// is is for Development and Debugging purposes only
func
NewDummyNameService
(
username
string
,
rng
io
.
Reader
)
(
NameService
,
error
)
{
jww
.
WARN
.
Printf
(
"Creating a Dummy Name Service. This is for "
+
"development and debugging only. It does not produce valid "
+
"signatures or verify passed signatures. YOU SHOULD NEVER SEE THIS "
+
"MESSAGE IN PRODUCTION"
)
dns
:=
&
dummyNameService
{
username
:
username
,
lease
:
time
.
Now
()
.
Add
(
35
*
24
*
time
.
Hour
),
}
//generate the private key
var
err
error
dns
.
public
,
dns
.
private
,
err
=
ed25519
.
GenerateKey
(
rng
)
if
err
!=
nil
{
return
nil
,
err
}
//generate a dummy user discover identity to produce a validation signature
//just sign with our own key, it wont be evaluated anyhow
dns
.
validationSig
=
channel
.
SignChannelLease
(
dns
.
public
,
dns
.
username
,
dns
.
lease
,
dns
.
private
)
return
dns
,
nil
}
type
dummyNameService
struct
{
private
ed25519
.
PrivateKey
public
ed25519
.
PublicKey
username
string
validationSig
[]
byte
lease
time
.
Time
}
func
(
dns
*
dummyNameService
)
GetUsername
()
string
{
return
dns
.
username
}
func
(
dns
*
dummyNameService
)
GetChannelValidationSignature
()
([]
byte
,
time
.
Time
)
{
jww
.
WARN
.
Printf
(
"GetChannelValidationSignature called on Dummy Name "
+
"Service, dummy signature from a random key returned - identity not "
+
"proven. YOU SHOULD NEVER SEE THIS MESSAGE IN PRODUCTION"
)
return
dns
.
validationSig
,
dns
.
lease
}
func
(
dns
*
dummyNameService
)
GetChannelPubkey
()
ed25519
.
PublicKey
{
return
dns
.
public
}
func
(
dns
*
dummyNameService
)
SignChannelMessage
(
message
[]
byte
)
(
signature
[]
byte
,
err
error
)
{
jww
.
WARN
.
Printf
(
"SignChannelMessage called on Dummy Name Service, "
+
"signature from a random key - identity not proven. YOU SHOULD "
+
"NEVER SEE THIS MESSAGE IN PRODUCTION"
)
sig
:=
ed25519
.
Sign
(
dns
.
private
,
message
)
return
sig
,
nil
}
func
(
dns
*
dummyNameService
)
ValidateChannelMessage
(
username
string
,
lease
time
.
Time
,
pubKey
ed25519
.
PublicKey
,
authorIDSignature
[]
byte
)
bool
{
//ignore the authorIDSignature
jww
.
WARN
.
Printf
(
"ValidateChannelMessage called on Dummy Name Service, "
+
"no validation done - identity not validated. YOU SHOULD NEVER SEE "
+
"THIS MESSAGE IN PRODUCTION"
)
return
true
}
This diff is collapsed.
Click to expand it.
channels/nameService.go
+
1
−
1
View file @
53837894
...
...
@@ -21,7 +21,7 @@ type NameService interface {
// GetChannelValidationSignature returns the validation
// signature and the time it was signed.
GetChannelValidationSignature
()
(
signature
[]
byte
,
lease
time
.
Time
)
GetChannelValidationSignature
()
([]
byte
,
time
.
Time
)
// GetChannelPubkey returns the user's public key.
GetChannelPubkey
()
ed25519
.
PublicKey
...
...
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