Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sidecar
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
link33
sidecar
Commits
789e799e
Commit
789e799e
authored
Nov 19, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cmd flag information
parent
b834c03c
Pipeline
#8274
failed with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
7 deletions
+22
-7
sidecar.go
cmd/sidecar/sidecar.go
+1
-0
tool.go
cmd/sidecar/tool.go
+19
-7
sidecar.go
internal/app/sidecar.go
+2
-0
No files found.
cmd/sidecar/sidecar.go
View file @
789e799e
...
...
@@ -7,6 +7,7 @@ import (
"github.com/fatih/color"
"github.com/urfave/cli"
_
"gitlab.33.cn/link33/sidecar/pkg/crypto/bls"
"gitlab.33.cn/link33/sidecar/pkg/log"
)
...
...
cmd/sidecar/tool.go
View file @
789e799e
...
...
@@ -6,12 +6,14 @@ import (
"encoding/pem"
"fmt"
crypto2
"github.com/libp2p/go-libp2p-core/crypto"
p2pcrypto
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/urfave/cli"
"gitlab.33.cn/link33/sidecar/internal/repo"
"gitlab.33.cn/link33/sidecar/pkg/crypto/bls"
"gitlab.33.cn/link33/sidecar/tool"
)
...
...
@@ -46,7 +48,7 @@ var toolCMD = cli.Command{
sdKey
,
err
:=
asym
.
PrivKeyToStdKey
(
k
)
tool
.
Asset
(
err
)
_
,
pk
,
err
:=
crypto2
.
KeyPairFromStdKey
(
&
sdKey
)
_
,
pk
,
err
:=
p2pcrypto
.
KeyPairFromStdKey
(
&
sdKey
)
tool
.
Asset
(
err
)
id
,
err
:=
peer
.
IDFromPublicKey
(
pk
)
tool
.
Asset
(
err
)
...
...
@@ -60,12 +62,12 @@ var toolCMD = cli.Command{
Name
:
"appchain"
,
Usage
:
"about appchain information"
,
Action
:
func
(
ctx
*
cli
.
Context
)
error
{
privKey
,
err
:=
asym
.
GenerateKeyPair
(
crypto
.
Secp256k1
)
tool
.
Asset
(
err
)
gen
:=
func
(
privKey
crypto
.
PrivateKey
)
{
dataPrivKey
,
err
:=
privKey
.
Bytes
()
tool
.
Asset
(
err
)
c
,
err
:=
asym
.
GetCrypto
(
privKey
.
Type
())
tool
.
Asset
(
err
)
fmt
.
Printf
(
"private key type: %s ----------------------------------------
\n
"
,
c
.
Name
)
fmt
.
Println
(
"--------user PrivateKey----------begin"
)
fmt
.
Println
(
hex
.
EncodeToString
(
dataPrivKey
))
fmt
.
Println
(
"--------user PrivateKey----------end
\n
"
)
...
...
@@ -84,15 +86,25 @@ var toolCMD = cli.Command{
fmt
.
Println
(
address
.
String
())
fmt
.
Println
(
"--------user Address----------end
\n
"
)
keyStore
,
err
:=
asym
.
GenKeyStore
(
privKey
,
"link33"
)
keyStore
,
err
:=
asym
.
GenKeyStore
(
privKey
,
repo
.
KeyPassword
)
data
,
err
:=
keyStore
.
Pretty
()
tool
.
Asset
(
err
)
fmt
.
Println
(
"--------user keyStore----------begin "
)
fmt
.
Println
(
data
)
fmt
.
Println
(
"--------user keyStore----------end
\n
"
)
}
pk
,
err
:=
asym
.
GenerateKeyPair
(
crypto
.
Secp256k1
)
tool
.
Asset
(
err
)
gen
(
pk
)
pk
,
err
=
asym
.
GenerateKeyPair
(
bls
.
BlsEth
)
tool
.
Asset
(
err
)
gen
(
pk
)
return
nil
},
},
},
}
//key.json -> user private key|-> id
// |-> address
internal/app/sidecar.go
View file @
789e799e
...
...
@@ -43,6 +43,7 @@ func NewSidecar(repoRoot string, config *repo.Config) (internal.Launcher, error)
store
,
err
:=
leveldb
.
New
(
filepath
.
Join
(
config
.
RepoRoot
,
"store"
))
tool
.
Asset
(
err
)
logger
:=
loggers
.
Logger
(
loggers
.
App
)
//TODO add bls sign
privateKey
,
err
:=
repo
.
LoadPrivateKey
(
repoRoot
)
tool
.
Asset
(
err
)
addr
,
err
:=
privateKey
.
PublicKey
()
.
Address
()
...
...
@@ -61,6 +62,7 @@ func NewSidecar(repoRoot string, config *repo.Config) (internal.Launcher, error)
persister
:=
manger
.
NewPersister
(
addr
.
String
(),
store
,
loggers
.
Logger
(
loggers
.
Manger
))
appchainMgr
:=
appchainmgr
.
New
(
persister
)
// TODO hub client
// privateKey DH
cryptor
:=
txcrypto
.
NewCryptor
(
nil
,
appchainMgr
,
privateKey
)
clientPort
:=
appchain
.
NewPorts
(
clients
,
cryptor
,
logger
)
r
.
Adds
(
clientPort
)
...
...
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