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
57115e88
Commit
57115e88
authored
3 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add TEMPORARY printing of protoUser JSON
parent
d95902f2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!67
Release
,
!47
Modify Login_Unsafe for pregenerated user JSON
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/permissioning.go
+50
-0
50 additions, 0 deletions
api/permissioning.go
with
50 additions
and
0 deletions
api/permissioning.go
+
50
−
0
View file @
57115e88
...
...
@@ -8,7 +8,10 @@
package
api
import
(
"encoding/json"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/interfaces/user"
"gitlab.com/elixxir/client/storage"
)
...
...
@@ -39,6 +42,13 @@ func (c *Client) registerWithPermissioning() error {
userData
.
SetReceptionRegistrationValidationSignature
(
receptionRegValidationSignature
)
userData
.
SetRegistrationTimestamp
(
registrationTimestamp
)
err
=
c
.
printProtoUser
(
regCode
,
transmissionRegValidationSignature
,
receptionRegValidationSignature
)
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
"failed to print proto user"
)
}
//update the registration state
err
=
c
.
storage
.
ForwardRegistrationStatus
(
storage
.
PermissioningComplete
)
if
err
!=
nil
{
...
...
@@ -47,3 +57,43 @@ func (c *Client) registerWithPermissioning() error {
}
return
nil
}
// todo: remove once deploy has been tested
func
(
c
*
Client
)
printProtoUser
(
regCode
string
,
transmissionRegValidationSignature
,
receptionRegValidationSignature
[]
byte
)
error
{
// todo: remove this once proto has been generated
username
,
err
:=
c
.
GetStorage
()
.
User
()
.
GetUsername
()
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
"failed to register with "
+
"permissioning"
)
}
Usr
:=
user
.
Proto
{
TransmissionID
:
c
.
GetUser
()
.
TransmissionID
,
TransmissionSalt
:
c
.
GetUser
()
.
TransmissionSalt
,
TransmissionRSA
:
c
.
GetUser
()
.
TransmissionRSA
,
ReceptionID
:
c
.
GetUser
()
.
ReceptionID
,
ReceptionSalt
:
c
.
GetUser
()
.
ReceptionSalt
,
ReceptionRSA
:
c
.
GetUser
()
.
ReceptionRSA
,
Precanned
:
c
.
GetUser
()
.
Precanned
,
RegistrationTimestamp
:
c
.
GetUser
()
.
RegistrationTimestamp
,
Username
:
username
,
RegCode
:
regCode
,
TransmissionRegValidationSig
:
transmissionRegValidationSignature
,
ReceptionRegValidationSig
:
receptionRegValidationSignature
,
CmixDhPrivateKey
:
c
.
GetStorage
()
.
Cmix
()
.
GetDHPrivateKey
(),
CmixDhPublicKey
:
c
.
GetStorage
()
.
Cmix
()
.
GetDHPublicKey
(),
E2eDhPrivateKey
:
c
.
GetStorage
()
.
E2e
()
.
GetDHPrivateKey
(),
E2eDhPublicKey
:
c
.
GetStorage
()
.
E2e
()
.
GetDHPublicKey
(),
}
jsonBytes
,
err
:=
json
.
Marshal
(
Usr
)
if
err
!=
nil
{
return
errors
.
WithMessage
(
err
,
"failed to register with "
+
"permissioning"
)
}
jww
.
INFO
.
Printf
(
"PROTO USER JSON:
\n
%s"
,
string
(
jsonBytes
))
return
nil
}
\ No newline at end of file
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