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
372fd7b9
Commit
372fd7b9
authored
Apr 10, 2019
by
Bernardo Cardoso
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into keyLifecycle
parents
913e27cd
55b1020e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
bindings/README.md
+8
-1
8 additions, 1 deletion
bindings/README.md
bindings/client.go
+9
-2
9 additions, 2 deletions
bindings/client.go
bindings/client_test.go
+16
-3
16 additions, 3 deletions
bindings/client_test.go
cmd/root.go
+2
-9
2 additions, 9 deletions
cmd/root.go
with
35 additions
and
15 deletions
bindings/README.md
+
8
−
1
View file @
372fd7b9
...
@@ -174,5 +174,12 @@ public class PaymentReceiptListener implements Bindings.Listener {
...
@@ -174,5 +174,12 @@ public class PaymentReceiptListener implements Bindings.Listener {
}
}
```
```
After the payer's clients and payee's clients have gone through all of these steps, you'll have successfully processed a payment transaction.
### Cyclic group for registration JSON format:
```
json
{
"gen"
:
"5c7ff6b06f8f143fe8288433493e4769c4d988ace5be25a0e24809670716c613d7b0cee6932f8faa7c44d2cb24523da53fbe4f6ec3595892d1aa58c4328a06c46a15662e7eaa703a1decf8bbb2d05dbe2eb956c142a338661d10461c0d135472085057f3494309ffa73c611f78b32adbb5740c361c9f35be90997db2014e2ef5aa61782f52abeb8bd6432c4dd097bc5423b285dafb60dc364e8161f4a2a35aca3a10b1c4d203cc76a470a33afdcbdd92959859abd8b56e1725252d78eac66e71ba9ae3f1dd2487199874393cd4d832186800654760e1e34c09e4d155179f9ec0dc4473f996bdce6eed1cabed8b6f116f7ad9cf505df0f998e34ab27514b0ffe7"
,
"prime"
:
"9db6fb5951b66bb6fe1e140f1d2ce5502374161fd6538df1648218642f0b5c48c8f7a41aadfa187324b87674fa1822b00f1ecf8136943d7c55757264e5a1a44ffe012e9936e00c1d3e9310b01c7d179805d3058b2a9f4bb6f9716bfe6117c6b5b3cc4d9be341104ad4a80ad6c94e005f4b993e14f091eb51743bf33050c38de235567e1b34c3d6a5c0ceaa1a0f368213c3d19843d0b4b09dcb9fc72d39c8de41f1bf14d4bb4563ca28371621cad3324b6a2d392145bebfac748805236f5ca2fe92b871cd8f9c36d3292b5509ca8caa77a2adfc7bfd77dda6f71125a7456fea153e433256a2261c6a06ed3693797e7995fad5aabbcfbe3eda2741e375404ae25b"
,
"primeQ"
:
"f2c3119374ce76c9356990b465374a17f23f9ed35089bd969f61c6dde9998c1f"
}
```
This diff is collapsed.
Click to expand it.
bindings/client.go
+
9
−
2
View file @
372fd7b9
...
@@ -146,13 +146,20 @@ func InitClient(storage Storage, loc string) error {
...
@@ -146,13 +146,20 @@ func InitClient(storage Storage, loc string) error {
// “Jono”
// “Jono”
// OIF3OJ5I
// OIF3OJ5I
func
Register
(
registrationCode
string
,
gwAddr
string
,
numNodes
int
,
func
Register
(
registrationCode
string
,
gwAddr
string
,
numNodes
int
,
mint
bool
,
grp
*
cyclic
.
Group
)
([]
byte
,
error
)
{
mint
bool
,
grp
JSON
string
)
([]
byte
,
error
)
{
if
numNodes
<
1
{
if
numNodes
<
1
{
return
id
.
ZeroID
[
:
],
errors
.
New
(
"invalid number of nodes"
)
return
id
.
ZeroID
[
:
],
errors
.
New
(
"invalid number of nodes"
)
}
}
UID
,
err
:=
api
.
Register
(
registrationCode
,
gwAddr
,
uint
(
numNodes
),
mint
,
grp
)
// Unmarshal group JSON
var
grp
cyclic
.
Group
err
:=
grp
.
UnmarshalJSON
([]
byte
(
grpJSON
))
if
err
!=
nil
{
return
id
.
ZeroID
[
:
],
err
}
UID
,
err
:=
api
.
Register
(
registrationCode
,
gwAddr
,
uint
(
numNodes
),
mint
,
&
grp
)
if
err
!=
nil
{
if
err
!=
nil
{
return
id
.
ZeroID
[
:
],
err
return
id
.
ZeroID
[
:
],
err
...
...
This diff is collapsed.
Click to expand it.
bindings/client_test.go
+
16
−
3
View file @
372fd7b9
...
@@ -147,8 +147,12 @@ func TestRegister(t *testing.T) {
...
@@ -147,8 +147,12 @@ func TestRegister(t *testing.T) {
g
:=
large
.
NewInt
(
2
)
g
:=
large
.
NewInt
(
2
)
q
:=
large
.
NewInt
(
3
)
q
:=
large
.
NewInt
(
3
)
grp
:=
cyclic
.
NewGroup
(
p
,
g
,
q
)
grp
:=
cyclic
.
NewGroup
(
p
,
g
,
q
)
grpJSON
,
err
:=
grp
.
MarshalJSON
()
if
err
!=
nil
{
t
.
Errorf
(
"Failed to marshal group JSON: %s"
,
err
)
}
regRes
,
err
:=
Register
(
registrationCode
,
gwAddress
,
1
,
false
,
grp
)
regRes
,
err
:=
Register
(
registrationCode
,
gwAddress
,
1
,
false
,
string
(
grpJSON
)
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Registration failed: %s"
,
err
.
Error
())
t
.
Errorf
(
"Registration failed: %s"
,
err
.
Error
())
}
}
...
@@ -170,8 +174,12 @@ func TestRegisterBadNumNodes(t *testing.T) {
...
@@ -170,8 +174,12 @@ func TestRegisterBadNumNodes(t *testing.T) {
g
:=
large
.
NewInt
(
int64
(
2
))
g
:=
large
.
NewInt
(
int64
(
2
))
q
:=
large
.
NewInt
(
int64
(
3
))
q
:=
large
.
NewInt
(
int64
(
3
))
grp
:=
cyclic
.
NewGroup
(
p
,
g
,
q
)
grp
:=
cyclic
.
NewGroup
(
p
,
g
,
q
)
grpJSON
,
err
:=
grp
.
MarshalJSON
()
if
err
!=
nil
{
t
.
Errorf
(
"Failed to marshal group JSON: %s"
,
err
)
}
_
,
err
=
Register
(
registrationCode
,
gwAddress
,
0
,
false
,
grp
)
_
,
err
=
Register
(
registrationCode
,
gwAddress
,
0
,
false
,
string
(
grpJSON
)
)
if
err
==
nil
{
if
err
==
nil
{
t
.
Errorf
(
"Registration worked with bad numnodes! %s"
,
err
.
Error
())
t
.
Errorf
(
"Registration worked with bad numnodes! %s"
,
err
.
Error
())
}
}
...
@@ -202,8 +210,12 @@ func TestLoginLogout(t *testing.T) {
...
@@ -202,8 +210,12 @@ func TestLoginLogout(t *testing.T) {
g
:=
large
.
NewInt
(
2
)
g
:=
large
.
NewInt
(
2
)
q
:=
large
.
NewInt
(
3
)
q
:=
large
.
NewInt
(
3
)
grp
:=
cyclic
.
NewGroup
(
p
,
g
,
q
)
grp
:=
cyclic
.
NewGroup
(
p
,
g
,
q
)
grpJSON
,
err
:=
grp
.
MarshalJSON
()
if
err
!=
nil
{
t
.
Errorf
(
"Failed to marshal group JSON: %s"
,
err
)
}
regRes
,
err
:=
Register
(
registrationCode
,
gwAddress
,
1
,
false
,
grp
)
regRes
,
err
:=
Register
(
registrationCode
,
gwAddress
,
1
,
false
,
string
(
grpJSON
)
)
loginRes
,
err2
:=
Login
(
regRes
,
gwAddress
,
""
)
loginRes
,
err2
:=
Login
(
regRes
,
gwAddress
,
""
)
if
err2
!=
nil
{
if
err2
!=
nil
{
t
.
Errorf
(
"Login failed: %s"
,
err
.
Error
())
t
.
Errorf
(
"Login failed: %s"
,
err
.
Error
())
...
@@ -216,6 +228,7 @@ func TestLoginLogout(t *testing.T) {
...
@@ -216,6 +228,7 @@ func TestLoginLogout(t *testing.T) {
if
err3
!=
nil
{
if
err3
!=
nil
{
t
.
Errorf
(
"Logoutfailed: %s"
,
err
.
Error
())
t
.
Errorf
(
"Logoutfailed: %s"
,
err
.
Error
())
}
}
globals
.
LocalStorage
=
nil
globals
.
LocalStorage
=
nil
}
}
...
...
This diff is collapsed.
Click to expand it.
cmd/root.go
+
2
−
9
View file @
372fd7b9
...
@@ -22,7 +22,6 @@ import (
...
@@ -22,7 +22,6 @@ import (
"gitlab.com/elixxir/client/parse"
"gitlab.com/elixxir/client/parse"
"gitlab.com/elixxir/client/user"
"gitlab.com/elixxir/client/user"
"gitlab.com/elixxir/comms/connect"
"gitlab.com/elixxir/comms/connect"
"gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/elixxir/primitives/id"
"gitlab.com/elixxir/primitives/id"
"gitlab.com/elixxir/primitives/switchboard"
"gitlab.com/elixxir/primitives/switchboard"
...
@@ -122,16 +121,10 @@ func sessionInitialization() {
...
@@ -122,16 +121,10 @@ func sessionInitialization() {
// FIXME Use a different encoding for the user ID command line argument,
// FIXME Use a different encoding for the user ID command line argument,
// to allow testing with IDs that are long enough to exercise more than
// to allow testing with IDs that are long enough to exercise more than
// 64 bits
// 64 bits
grp
:=
cyclic
.
Group
{}
grpJSON
:=
viper
.
GetString
(
"group"
)
grpBuff
:=
[]
byte
(
viper
.
GetString
(
"group"
))
err
:=
grp
.
UnmarshalJSON
(
grpBuff
)
if
err
!=
nil
{
fmt
.
Printf
(
"Could Not Decode group from JSON: %s
\n
"
,
err
.
Error
())
return
}
regCode
:=
new
(
id
.
User
)
.
SetUints
(
&
[
4
]
uint64
{
0
,
0
,
0
,
userId
})
.
RegistrationCode
()
regCode
:=
new
(
id
.
User
)
.
SetUints
(
&
[
4
]
uint64
{
0
,
0
,
0
,
userId
})
.
RegistrationCode
()
_
,
err
=
bindings
.
Register
(
regCode
,
gwAddr
,
int
(
numNodes
),
mint
,
&
grp
)
_
,
err
=
bindings
.
Register
(
regCode
,
gwAddr
,
int
(
numNodes
),
mint
,
grp
JSON
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Printf
(
"Could Not Register User: %s
\n
"
,
err
.
Error
())
fmt
.
Printf
(
"Could Not Register User: %s
\n
"
,
err
.
Error
())
return
return
...
...
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