Register miner address from storageminer process

This commit is contained in:
Łukasz Magiera
2019-08-20 19:19:24 +02:00
parent 82c449c047
commit eda26faf21
9 changed files with 47 additions and 16 deletions
+3 -4
View File
@@ -13,6 +13,7 @@ import (
"github.com/filecoin-project/go-lotus/api"
"github.com/filecoin-project/go-lotus/chain/types"
"github.com/filecoin-project/go-lotus/node/modules/dtypes"
"github.com/filecoin-project/go-lotus/node/repo"
)
@@ -29,13 +30,11 @@ func RecordValidator(ps peerstore.Peerstore) record.Validator {
const JWTSecretName = "auth-jwt-private"
type APIAlg jwt.HMACSHA
type jwtPayload struct {
Allow []string
}
func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*APIAlg, error) {
func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, error) {
key, err := keystore.Get(JWTSecretName)
if err != nil {
log.Warn("Generating new API secret")
@@ -69,5 +68,5 @@ func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*APIAlg, error) {
}
}
return (*APIAlg)(jwt.NewHS256(key.PrivateKey)), nil
return (*dtypes.APIAlg)(jwt.NewHS256(key.PrivateKey)), nil
}