Skip to content

Commit

Permalink
Merge pull request #522 from 0xPolygonID/fix_did_initializer_for_rhs
Browse files Browse the repository at this point in the history
fix: did_initializer
  • Loading branch information
martinsaporiti authored Nov 8, 2023
2 parents ed5e0b9 + 21285c0 commit c36aec6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env-api.sample
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ ISSUER_API_UI_SCHEMA_CACHE=false
ISSUER_API_IDENTITY_METHOD=polygonid
ISSUER_API_IDENTITY_BLOCKCHAIN=polygon
ISSUER_API_IDENTITY_NETWORK=mumbai
ISSUER_API_KEY_TYPE=BJJ
ISSUER_API_UI_KEY_TYPE=BJJ
ISSUER_API_ENVIRONMENT=local
10 changes: 6 additions & 4 deletions cmd/issuer_initializer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
vault "github.com/hashicorp/vault/api"
core "github.com/iden3/go-iden3-core/v2"
"github.com/iden3/go-schema-processor/v2/verifiable"

"github.com/polygonid/sh-id-platform/internal/buildinfo"
"github.com/polygonid/sh-id-platform/internal/config"
Expand Down Expand Up @@ -131,10 +132,11 @@ func main() {
identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, nil, claimsRepository, nil, nil, storage, nil, nil, nil, cfg.CredentialStatus, rhsFactory, revocationStatusResolver)

didCreationOptions := &ports.DIDCreationOptions{
Method: core.DIDMethod(cfg.APIUI.IdentityMethod),
Network: core.NetworkID(cfg.APIUI.IdentityNetwork),
Blockchain: core.Blockchain(cfg.APIUI.IdentityBlockchain),
KeyType: kms.KeyType(cfg.APIUI.KeyType),
Method: core.DIDMethod(cfg.APIUI.IdentityMethod),
Network: core.NetworkID(cfg.APIUI.IdentityNetwork),
Blockchain: core.Blockchain(cfg.APIUI.IdentityBlockchain),
KeyType: kms.KeyType(cfg.APIUI.KeyType),
AuthBJJCredentialStatus: verifiable.CredentialStatusType(cfg.CredentialStatus.CredentialStatusType),
}

identity, err := identityService.Create(ctx, cfg.ServerUrl, didCreationOptions)
Expand Down
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func bindEnv() {
_ = viper.BindEnv("APIUI.IdentityMethod", "ISSUER_API_IDENTITY_METHOD")
_ = viper.BindEnv("APIUI.IdentityBlockchain", "ISSUER_API_IDENTITY_BLOCKCHAIN")
_ = viper.BindEnv("APIUI.IdentityNetwork", "ISSUER_API_IDENTITY_NETWORK")
_ = viper.BindEnv("APIUI.KeyType", "ISSUER_API_KEY_TYPE")
_ = viper.BindEnv("APIUI.KeyType", "ISSUER_API_UI_KEY_TYPE")

viper.AutomaticEnv()
}
Expand Down Expand Up @@ -568,7 +568,7 @@ func checkEnvVars(ctx context.Context, cfg *Configuration) {
}

if cfg.APIUI.KeyType == "" {
log.Info(ctx, "ISSUER_KEY_TYPE is missing and the server set up it as BJJ")
log.Info(ctx, "ISSUER_API_UI_KEY_TYPE is missing and the server set up it as BJJ")
cfg.APIUI.KeyType = "BJJ"
}

Expand Down

0 comments on commit c36aec6

Please sign in to comment.