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
3e09c163
Unverified
Commit
3e09c163
authored
Aug 24, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3007 remove unused parameters
parent
6b72d7ca
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
16 deletions
+10
-16
SGXWalletServer.cpp
SGXWalletServer.cpp
+3
-7
SGXWalletServer.hpp
SGXWalletServer.hpp
+2
-2
abstractstubserver.h
abstractstubserver.h
+3
-3
stubclient.h
stubclient.h
+1
-3
testw.cpp
testw.cpp
+1
-1
No files found.
SGXWalletServer.cpp
View file @
3e09c163
...
@@ -165,7 +165,7 @@ int SGXWalletServer::initHttpServer() { //without ssl
...
@@ -165,7 +165,7 @@ int SGXWalletServer::initHttpServer() { //without ssl
}
}
Json
::
Value
Json
::
Value
SGXWalletServer
::
importBLSKeyShareImpl
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
t
,
int
n
)
{
SGXWalletServer
::
importBLSKeyShareImpl
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
)
{
INIT_RESULT
(
result
);
INIT_RESULT
(
result
);
result
[
"encryptedKeyShare"
]
=
""
;
result
[
"encryptedKeyShare"
]
=
""
;
...
@@ -177,10 +177,6 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
...
@@ -177,10 +177,6 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
throw
SGXException
(
INVALID_BLS_NAME
,
"Invalid BLS key name"
);
throw
SGXException
(
INVALID_BLS_NAME
,
"Invalid BLS key name"
);
}
}
if
(
!
check_n_t
(
t
,
n
))
{
throw
SGXException
(
INVALID_DKG_PARAMS
,
"Invalid t/n parameters"
);
}
encryptedKeyShareHex
=
encryptBLSKeyShare2Hex
(
&
errStatus
,
(
char
*
)
errMsg
.
data
(),
_keyShare
.
c_str
());
encryptedKeyShareHex
=
encryptBLSKeyShare2Hex
(
&
errStatus
,
(
char
*
)
errMsg
.
data
(),
_keyShare
.
c_str
());
if
(
errStatus
!=
0
)
{
if
(
errStatus
!=
0
)
{
...
@@ -670,8 +666,8 @@ Json::Value SGXWalletServer::ecdsaSignMessageHash(int _base, const string &_keyS
...
@@ -670,8 +666,8 @@ Json::Value SGXWalletServer::ecdsaSignMessageHash(int _base, const string &_keyS
}
}
Json
::
Value
Json
::
Value
SGXWalletServer
::
importBLSKeyShare
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
_t
,
int
_n
)
{
SGXWalletServer
::
importBLSKeyShare
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
)
{
return
importBLSKeyShareImpl
(
_keyShare
,
_keyShareName
,
_t
,
_n
);
return
importBLSKeyShareImpl
(
_keyShare
,
_keyShareName
);
}
}
Json
::
Value
SGXWalletServer
::
blsSignMessageHash
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
_t
,
int
_n
)
{
Json
::
Value
SGXWalletServer
::
blsSignMessageHash
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
_t
,
int
_n
)
{
...
...
SGXWalletServer.hpp
View file @
3e09c163
...
@@ -46,7 +46,7 @@ public:
...
@@ -46,7 +46,7 @@ public:
SGXWalletServer
(
AbstractServerConnector
&
_connector
,
serverVersion_t
_type
);
SGXWalletServer
(
AbstractServerConnector
&
_connector
,
serverVersion_t
_type
);
virtual
Json
::
Value
virtual
Json
::
Value
importBLSKeyShare
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
_t
,
int
_n
);
importBLSKeyShare
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
);
virtual
Json
::
Value
virtual
Json
::
Value
blsSignMessageHash
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
_t
,
int
_n
);
blsSignMessageHash
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
_t
,
int
_n
);
...
@@ -97,7 +97,7 @@ public:
...
@@ -97,7 +97,7 @@ public:
static
void
writeKeyShare
(
const
string
&
_keyShareName
,
const
string
&
_value
);
static
void
writeKeyShare
(
const
string
&
_keyShareName
,
const
string
&
_value
);
static
Json
::
Value
static
Json
::
Value
importBLSKeyShareImpl
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
t
,
int
n
);
importBLSKeyShareImpl
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
);
static
Json
::
Value
static
Json
::
Value
blsSignMessageHashImpl
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
t
,
int
n
);
blsSignMessageHashImpl
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
t
,
int
n
);
...
...
abstractstubserver.h
View file @
3e09c163
...
@@ -36,7 +36,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
...
@@ -36,7 +36,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_OBJECT
,
"keyShare"
,
jsonrpc
::
JSON_STRING
,
"keyShareName"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
importBLSKeyShareI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"importBLSKeyShare"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"keyShare"
,
jsonrpc
::
JSON_STRING
,
"keyShareName"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
importBLSKeyShareI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"blsSignMessageHash"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"keyShareName"
,
jsonrpc
::
JSON_STRING
,
"messageHash"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
blsSignMessageHashI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"blsSignMessageHash"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"keyShareName"
,
jsonrpc
::
JSON_STRING
,
"messageHash"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
blsSignMessageHashI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"importECDSAKey"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"key"
,
jsonrpc
::
JSON_STRING
,
"keyName"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
importECDSAKeyI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"importECDSAKey"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"key"
,
jsonrpc
::
JSON_STRING
,
"keyName"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
importECDSAKeyI
);
...
@@ -62,7 +62,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
...
@@ -62,7 +62,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
inline
virtual
void
importBLSKeyShareI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
inline
virtual
void
importBLSKeyShareI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
{
response
=
this
->
importBLSKeyShare
(
request
[
"keyShare"
].
asString
(),
request
[
"keyShareName"
].
asString
()
,
request
[
"t"
].
asInt
(),
request
[
"n"
].
asInt
()
);
response
=
this
->
importBLSKeyShare
(
request
[
"keyShare"
].
asString
(),
request
[
"keyShareName"
].
asString
());
}
}
inline
virtual
void
blsSignMessageHashI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
inline
virtual
void
blsSignMessageHashI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
{
...
@@ -145,7 +145,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
...
@@ -145,7 +145,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
response
=
this
->
deleteBlsKey
(
request
[
"blsKeyName"
].
asString
());
response
=
this
->
deleteBlsKey
(
request
[
"blsKeyName"
].
asString
());
}
}
virtual
Json
::
Value
importBLSKeyShare
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
importBLSKeyShare
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
)
=
0
;
virtual
Json
::
Value
blsSignMessageHash
(
const
std
::
string
&
keyShareName
,
const
std
::
string
&
messageHash
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
blsSignMessageHash
(
const
std
::
string
&
keyShareName
,
const
std
::
string
&
messageHash
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
importECDSAKey
(
const
std
::
string
&
key
,
const
std
::
string
&
keyName
)
=
0
;
virtual
Json
::
Value
importECDSAKey
(
const
std
::
string
&
key
,
const
std
::
string
&
keyName
)
=
0
;
virtual
Json
::
Value
generateECDSAKey
()
=
0
;
virtual
Json
::
Value
generateECDSAKey
()
=
0
;
...
...
stubclient.h
View file @
3e09c163
...
@@ -12,13 +12,11 @@ class StubClient : public jsonrpc::Client
...
@@ -12,13 +12,11 @@ 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
)
{}
Json
::
Value
importBLSKeyShare
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
,
int
t
,
int
n
)
Json
::
Value
importBLSKeyShare
(
const
std
::
string
&
keyShare
,
const
std
::
string
&
keyShareName
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"keyShare"
]
=
keyShare
;
p
[
"keyShare"
]
=
keyShare
;
p
[
"keyShareName"
]
=
keyShareName
;
p
[
"keyShareName"
]
=
keyShareName
;
p
[
"n"
]
=
n
;
p
[
"t"
]
=
t
;
Json
::
Value
result
=
this
->
CallMethod
(
"importBLSKeyShare"
,
p
);
Json
::
Value
result
=
this
->
CallMethod
(
"importBLSKeyShare"
,
p
);
if
(
result
.
isObject
())
if
(
result
.
isObject
())
return
result
;
return
result
;
...
...
testw.cpp
View file @
3e09c163
...
@@ -420,7 +420,7 @@ TEST_CASE_METHOD(TestFixture, "Delete Bls Key", "[delete-bls-key]") {
...
@@ -420,7 +420,7 @@ TEST_CASE_METHOD(TestFixture, "Delete Bls Key", "[delete-bls-key]") {
libff
::
alt_bn128_Fr
key
=
libff
::
alt_bn128_Fr
(
"6507625568967977077291849236396320012317305261598035438182864059942098934847"
);
libff
::
alt_bn128_Fr
key
=
libff
::
alt_bn128_Fr
(
"6507625568967977077291849236396320012317305261598035438182864059942098934847"
);
std
::
string
key_str
=
TestUtils
::
stringFromFr
(
key
);
std
::
string
key_str
=
TestUtils
::
stringFromFr
(
key
);
PRINT_SRC_LINE
PRINT_SRC_LINE
c
.
importBLSKeyShare
(
key_str
,
name
,
1
,
2
);
c
.
importBLSKeyShare
(
key_str
,
name
);
PRINT_SRC_LINE
PRINT_SRC_LINE
REQUIRE
(
c
.
deleteBlsKey
(
name
)[
"deleted"
]
==
true
);
REQUIRE
(
c
.
deleteBlsKey
(
name
)[
"deleted"
]
==
true
);
}
}
...
...
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