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
d26728b4
Commit
d26728b4
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add documentation for dummy name service
parent
e209e9a8
No related branches found
No related tags found
3 merge requests
!510
Release
,
!419
rewrote the health tracker to both consider if there are waiting rounds and...
,
!340
Project/channels
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
channels/dummyNameServer.go
+24
-2
24 additions, 2 deletions
channels/dummyNameServer.go
with
24 additions
and
2 deletions
channels/dummyNameServer.go
+
24
−
2
View file @
d26728b4
...
...
@@ -17,8 +17,9 @@ import (
)
// 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.
// This neither produces valid signatures nor validates passed signatures.
//
// THIS 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 "
+
...
...
@@ -45,6 +46,8 @@ func NewDummyNameService(username string, rng io.Reader) (NameService, error) {
return
dns
,
nil
}
// dummyNameService is a dummy NameService implementation. This is NOT meant
// for use in production
type
dummyNameService
struct
{
private
ed25519
.
PrivateKey
public
ed25519
.
PublicKey
...
...
@@ -53,10 +56,18 @@ type dummyNameService struct {
lease
time
.
Time
}
// GetUsername returns the username for the dummyNameService. This is what was
// passed in through NewDummyNameService.
//
// THIS IS FOR DEVELOPMENT AND DEBUGGING PURPOSES ONLY.
func
(
dns
*
dummyNameService
)
GetUsername
()
string
{
return
dns
.
username
}
// GetChannelValidationSignature will return the dummy validation signature
// generated in through the constructor, NewDummyNameService.
//
// THIS IS FOR DEVELOPMENT AND DEBUGGING PURPOSES ONLY.
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 "
+
...
...
@@ -64,10 +75,16 @@ func (dns *dummyNameService) GetChannelValidationSignature() ([]byte, time.Time)
return
dns
.
validationSig
,
dns
.
lease
}
// GetChannelPubkey returns the ed25519.PublicKey generates in the constructor,
// NewDummyNameService.
func
(
dns
*
dummyNameService
)
GetChannelPubkey
()
ed25519
.
PublicKey
{
return
dns
.
public
}
// SignChannelMessage will sign the passed in message using the
// dummyNameService's private key.
//
// THIS IS FOR DEVELOPMENT AND DEBUGGING PURPOSES ONLY.
func
(
dns
*
dummyNameService
)
SignChannelMessage
(
message
[]
byte
)
(
signature
[]
byte
,
err
error
)
{
jww
.
WARN
.
Printf
(
"SignChannelMessage called on Dummy Name Service, "
+
...
...
@@ -77,6 +94,11 @@ func (dns *dummyNameService) SignChannelMessage(message []byte) (
return
sig
,
nil
}
// ValidateChannelMessage will always return true, indicating the the channel
// message is valid. This will ignore the passed in arguments. As a result,
// these values may be dummy or precanned.
//
// THIS IS FOR DEVELOPMENT AND DEBUGGING PURPOSES ONLY.
func
(
dns
*
dummyNameService
)
ValidateChannelMessage
(
username
string
,
lease
time
.
Time
,
pubKey
ed25519
.
PublicKey
,
authorIDSignature
[]
byte
)
bool
{
//ignore the authorIDSignature
...
...
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