Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
sgxwallet
Commits
1f00f276
Unverified
Commit
1f00f276
authored
Sep 08, 2019
by
kladkogex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added importBLSKeyShare
parent
d1b8fd5c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
1 deletion
+43
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+9
-0
abstractstubserver.h
abstractstubserver.h
+6
-0
spec.json
spec.json
+14
-1
stubclient.h
stubclient.h
+14
-0
No files found.
SGXWalletServer.cpp
View file @
1f00f276
...
@@ -34,6 +34,7 @@ public:
...
@@ -34,6 +34,7 @@ public:
virtual
bool
isEqual
(
const
std
::
string
&
str1
,
const
std
::
string
&
str2
);
virtual
bool
isEqual
(
const
std
::
string
&
str1
,
const
std
::
string
&
str2
);
virtual
Json
::
Value
buildObject
(
const
std
::
string
&
name
,
int
age
);
virtual
Json
::
Value
buildObject
(
const
std
::
string
&
name
,
int
age
);
virtual
std
::
string
methodWithoutParameters
();
virtual
std
::
string
methodWithoutParameters
();
virtual
bool
importBLSKeyShare
(
const
std
::
string
&
hexKeyShare
,
int
index
,
int
n
,
const
std
::
string
&
name
,
int
t
);
};
};
SGXWalletServer
::
SGXWalletServer
(
AbstractServerConnector
&
connector
,
SGXWalletServer
::
SGXWalletServer
(
AbstractServerConnector
&
connector
,
...
@@ -58,6 +59,11 @@ bool SGXWalletServer::isEqual(const string &str1, const string &str2) {
...
@@ -58,6 +59,11 @@ bool SGXWalletServer::isEqual(const string &str1, const string &str2) {
return
str1
==
str2
;
return
str1
==
str2
;
}
}
bool
SGXWalletServer
::
importBLSKeyShare
(
const
std
::
string
&
hexKeyShare
,
int
index
,
int
n
,
const
std
::
string
&
name
,
int
t
)
{
return
false
;
}
Json
::
Value
SGXWalletServer
::
buildObject
(
const
string
&
name
,
int
age
)
{
Json
::
Value
SGXWalletServer
::
buildObject
(
const
string
&
name
,
int
age
)
{
Json
::
Value
result
;
Json
::
Value
result
;
result
[
"name"
]
=
name
;
result
[
"name"
]
=
name
;
...
@@ -65,6 +71,9 @@ Json::Value SGXWalletServer::buildObject(const string &name, int age) {
...
@@ -65,6 +71,9 @@ Json::Value SGXWalletServer::buildObject(const string &name, int age) {
return
result
;
return
result
;
}
}
string
SGXWalletServer
::
methodWithoutParameters
()
{
return
"Test"
;
}
string
SGXWalletServer
::
methodWithoutParameters
()
{
return
"Test"
;
}
int
init_server
()
{
int
init_server
()
{
...
...
abstractstubserver.h
View file @
1f00f276
...
@@ -12,6 +12,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
...
@@ -12,6 +12,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
public
:
public
:
AbstractStubServer
(
jsonrpc
::
AbstractServerConnector
&
conn
,
jsonrpc
::
serverVersion_t
type
=
jsonrpc
::
JSONRPC_SERVER_V2
)
:
jsonrpc
::
AbstractServer
<
AbstractStubServer
>
(
conn
,
type
)
AbstractStubServer
(
jsonrpc
::
AbstractServerConnector
&
conn
,
jsonrpc
::
serverVersion_t
type
=
jsonrpc
::
JSONRPC_SERVER_V2
)
:
jsonrpc
::
AbstractServer
<
AbstractStubServer
>
(
conn
,
type
)
{
{
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"importBLSKeyShare"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_BOOLEAN
,
"hexKeyShare"
,
jsonrpc
::
JSON_STRING
,
"index"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
"name"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
importBLSKeyShareI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"sayHello"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_STRING
,
"name"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
sayHelloI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"sayHello"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_STRING
,
"name"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
sayHelloI
);
this
->
bindAndAddNotification
(
jsonrpc
::
Procedure
(
"notifyServer"
,
jsonrpc
::
PARAMS_BY_NAME
,
NULL
),
&
AbstractStubServer
::
notifyServerI
);
this
->
bindAndAddNotification
(
jsonrpc
::
Procedure
(
"notifyServer"
,
jsonrpc
::
PARAMS_BY_NAME
,
NULL
),
&
AbstractStubServer
::
notifyServerI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"addNumbers"
,
jsonrpc
::
PARAMS_BY_POSITION
,
jsonrpc
::
JSON_INTEGER
,
"param1"
,
jsonrpc
::
JSON_INTEGER
,
"param2"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
addNumbersI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"addNumbers"
,
jsonrpc
::
PARAMS_BY_POSITION
,
jsonrpc
::
JSON_INTEGER
,
"param1"
,
jsonrpc
::
JSON_INTEGER
,
"param2"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
addNumbersI
);
...
@@ -21,6 +22,10 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
...
@@ -21,6 +22,10 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"methodWithoutParameters"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
methodWithoutParametersI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"methodWithoutParameters"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
methodWithoutParametersI
);
}
}
inline
virtual
void
importBLSKeyShareI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
response
=
this
->
importBLSKeyShare
(
request
[
"hexKeyShare"
].
asString
(),
request
[
"index"
].
asInt
(),
request
[
"n"
].
asInt
(),
request
[
"name"
].
asString
(),
request
[
"t"
].
asInt
());
}
inline
virtual
void
sayHelloI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
inline
virtual
void
sayHelloI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
{
response
=
this
->
sayHello
(
request
[
"name"
].
asString
());
response
=
this
->
sayHello
(
request
[
"name"
].
asString
());
...
@@ -51,6 +56,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
...
@@ -51,6 +56,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
(
void
)
request
;
(
void
)
request
;
response
=
this
->
methodWithoutParameters
();
response
=
this
->
methodWithoutParameters
();
}
}
virtual
bool
importBLSKeyShare
(
const
std
::
string
&
hexKeyShare
,
int
index
,
int
n
,
const
std
::
string
&
name
,
int
t
)
=
0
;
virtual
std
::
string
sayHello
(
const
std
::
string
&
name
)
=
0
;
virtual
std
::
string
sayHello
(
const
std
::
string
&
name
)
=
0
;
virtual
void
notifyServer
()
=
0
;
virtual
void
notifyServer
()
=
0
;
virtual
int
addNumbers
(
int
param1
,
int
param2
)
=
0
;
virtual
int
addNumbers
(
int
param1
,
int
param2
)
=
0
;
...
...
spec.json
View file @
1f00f276
[
[
{
"name"
:
"importBLSKeyShare"
,
"params"
:
{
"name"
:
"Peter"
,
"n"
:
2
,
"t"
:
2
,
"index"
:
2
,
"hexKeyShare"
:
"1122334455"
},
"returns"
:
false
},
{
{
"name"
:
"sayHello"
,
"name"
:
"sayHello"
,
"params"
:
{
"params"
:
{
...
@@ -45,7 +58,7 @@
...
@@ -45,7 +58,7 @@
}
}
},
},
{
{
"name"
:
"methodWithoutParameters"
,
"name"
:
"methodWithoutParameters"
,
"returns"
:
"String"
"returns"
:
"String"
}
}
]
]
\ No newline at end of file
stubclient.h
View file @
1f00f276
...
@@ -12,6 +12,20 @@ class StubClient : public jsonrpc::Client
...
@@ -12,6 +12,20 @@ class StubClient : public jsonrpc::Client
public
:
public
:
StubClient
(
jsonrpc
::
IClientConnector
&
conn
,
jsonrpc
::
clientVersion_t
type
=
jsonrpc
::
JSONRPC_CLIENT_V2
)
:
jsonrpc
::
Client
(
conn
,
type
)
{}
StubClient
(
jsonrpc
::
IClientConnector
&
conn
,
jsonrpc
::
clientVersion_t
type
=
jsonrpc
::
JSONRPC_CLIENT_V2
)
:
jsonrpc
::
Client
(
conn
,
type
)
{}
bool
importBLSKeyShare
(
const
std
::
string
&
hexKeyShare
,
int
index
,
int
n
,
const
std
::
string
&
name
,
int
t
)
throw
(
jsonrpc
::
JsonRpcException
)
{
Json
::
Value
p
;
p
[
"hexKeyShare"
]
=
hexKeyShare
;
p
[
"index"
]
=
index
;
p
[
"n"
]
=
n
;
p
[
"name"
]
=
name
;
p
[
"t"
]
=
t
;
Json
::
Value
result
=
this
->
CallMethod
(
"importBLSKeyShare"
,
p
);
if
(
result
.
isBool
())
return
result
.
asBool
();
else
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
}
std
::
string
sayHello
(
const
std
::
string
&
name
)
throw
(
jsonrpc
::
JsonRpcException
)
std
::
string
sayHello
(
const
std
::
string
&
name
)
throw
(
jsonrpc
::
JsonRpcException
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment