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
758e0b40
Unverified
Commit
758e0b40
authored
May 18, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2572 add api call for sgx version
parent
e86abd44
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
12 deletions
+55
-12
SGXWalletServer.cpp
SGXWalletServer.cpp
+14
-0
SGXWalletServer.hpp
SGXWalletServer.hpp
+5
-1
ServerInit.cpp
ServerInit.cpp
+0
-1
ServerInit.h
ServerInit.h
+1
-0
abstractstubserver.h
abstractstubserver.h
+8
-0
stubclient.h
stubclient.h
+20
-10
testw.cpp
testw.cpp
+7
-0
No files found.
SGXWalletServer.cpp
View file @
758e0b40
...
...
@@ -678,6 +678,15 @@ Json::Value SGXWalletServer::getServerStatusImpl() {
return
result
;
}
Json
::
Value
SGXWalletServer
::
getServerVersionImpl
()
{
INIT_RESULT
(
result
)
result
[
"version"
]
=
SGXWALLET_VERSION
;
return
result
;
}
Json
::
Value
SGXWalletServer
::
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
)
{
LOCK
(
m
)
...
...
@@ -776,6 +785,11 @@ Json::Value SGXWalletServer::getServerStatus() {
return
getServerStatusImpl
();
}
Json
::
Value
SGXWalletServer
::
getServerVersion
()
{
LOCK
(
m
)
return
getServerVersionImpl
();
}
shared_ptr
<
string
>
SGXWalletServer
::
readFromDb
(
const
string
&
name
,
const
string
&
prefix
)
{
auto
dataStr
=
LevelDB
::
getLevelDb
()
->
readString
(
prefix
+
name
);
...
...
SGXWalletServer.hpp
View file @
758e0b40
...
...
@@ -86,6 +86,8 @@ public:
virtual
Json
::
Value
getServerStatus
();
virtual
Json
::
Value
getServerVersion
();
static
shared_ptr
<
string
>
readFromDb
(
const
string
&
name
,
const
string
&
prefix
=
""
);
static
void
writeDataToDB
(
const
string
&
Name
,
const
string
&
value
);
...
...
@@ -135,6 +137,8 @@ public:
static
Json
::
Value
getServerStatusImpl
();
static
Json
::
Value
getServerVersionImpl
();
static
void
printDB
();
static
int
initHttpServer
();
...
...
@@ -142,4 +146,4 @@ public:
static
int
initHttpsServer
(
bool
_checkCerts
);
};
#endif //SGXWALLET_SGXWALLETSERVER_HPP
\ No newline at end of file
#endif //SGXWALLET_SGXWALLETSERVER_HPP
ServerInit.cpp
View file @
758e0b40
...
...
@@ -54,7 +54,6 @@
#include "BLSCrypto.h"
#include "ServerInit.h"
#include "SGXWalletServer.hpp"
#include "SGXWALLET_VERSION"
void
initUserSpace
()
{
libff
::
init_alt_bn128_params
();
...
...
ServerInit.h
View file @
758e0b40
...
...
@@ -25,6 +25,7 @@
#define SGXWALLET_SERVERINIT_H
#include "stdint.h"
#include "SGXWALLET_VERSION"
#ifdef __cplusplus
#define EXTERNC extern "C"
...
...
abstractstubserver.h
View file @
758e0b40
...
...
@@ -56,6 +56,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"isPolyExists"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
isPolyExistsI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"getServerStatus"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
NULL
),
&
AbstractStubServer
::
getServerStatusI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"getServerVersion"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
NULL
),
&
AbstractStubServer
::
getServerVersionI
);
}
inline
virtual
void
importBLSKeyShareI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
...
...
@@ -133,6 +134,12 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
response
=
this
->
getServerStatus
();
}
inline
virtual
void
getServerVersionI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
(
void
)
request
;
response
=
this
->
getServerVersion
();
}
virtual
Json
::
Value
importBLSKeyShare
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
,
int
t
,
int
n
,
int
index
)
=
0
;
virtual
Json
::
Value
blsSignMessageHash
(
const
std
::
string
&
keyShareName
,
const
std
::
string
&
messageHash
,
int
t
,
int
n
,
int
signerIndex
)
=
0
;
virtual
Json
::
Value
importECDSAKey
(
const
std
::
string
&
key
,
const
std
::
string
&
keyName
)
=
0
;
...
...
@@ -152,6 +159,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
virtual
Json
::
Value
isPolyExists
(
const
std
::
string
&
polyName
)
=
0
;
virtual
Json
::
Value
getServerStatus
()
=
0
;
virtual
Json
::
Value
getServerVersion
()
=
0
;
};
#endif //JSONRPC_CPP_STUB_ABSTRACTSTUBSERVER_H_
stubclient.h
View file @
758e0b40
...
...
@@ -249,16 +249,26 @@ class StubClient : public jsonrpc::Client
}
Json
::
Value
getServerStatus
()
{
Json
::
Value
p
;
p
=
Json
::
nullValue
;
Json
::
Value
result
=
this
->
CallMethod
(
"getServerStatus"
,
p
);
if
(
result
.
isObject
())
return
result
;
else
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
}
Json
::
Value
getServerStatus
()
{
Json
::
Value
p
;
p
=
Json
::
nullValue
;
Json
::
Value
result
=
this
->
CallMethod
(
"getServerStatus"
,
p
);
if
(
result
.
isObject
())
return
result
;
else
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
}
Json
::
Value
getServerVersion
()
{
Json
::
Value
p
;
p
=
Json
::
nullValue
;
Json
::
Value
result
=
this
->
CallMethod
(
"getServerVersion"
,
p
);
if
(
result
.
isObject
())
return
result
;
else
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
}
};
...
...
testw.cpp
View file @
758e0b40
...
...
@@ -773,6 +773,13 @@ TEST_CASE_METHOD(TestFixture, "Get ServerStatus", "[get-server-status]") {
}
TEST_CASE_METHOD
(
TestFixture
,
"Get ServerVersion"
,
"[get-server-version]"
)
{
HttpClient
client
(
RPC_ENDPOINT
);
StubClient
c
(
client
,
JSONRPC_CLIENT_V2
);
REQUIRE
(
c
.
getServerVersion
()[
"version"
]
==
SGXWALLET_VERSION
);
}
TEST_CASE_METHOD
(
TestFixtureHTTPS
,
"Cert request sign"
,
"[cert-sign]"
)
{
REQUIRE
(
SGXRegistrationServer
::
getServer
()
!=
nullptr
);
...
...
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