Skip to content

Commit

Permalink
Merge branch 'PID-1235-issuer-node-on-chain-revocation-status' of git…
Browse files Browse the repository at this point in the history
…hub.com:0xPolygonID/issuer-node into PID-1235-issuer-node-on-chain-revocation-status
  • Loading branch information
martinsaporiti committed Nov 1, 2023
2 parents 79d5d7e + 91fbf7d commit 9ee0791
Show file tree
Hide file tree
Showing 21 changed files with 495 additions and 223 deletions.
3 changes: 1 addition & 2 deletions .env-issuer.sample
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ ISSUER_VAULT_USERPASS_AUTH_ENABLED=false
ISSUER_VAULT_USERPASS_AUTH_PASSWORD=password


ISSUER_CREDENTIAL_STATUS_DIRECT_URL=http://localhost:3001
ISSUER_CREDENTIAL_STATUS_ONCHAIN_TREE_STORE_SUPPORTED_CONTRACT=234152345
ISSUER_CREDENTIAL_STATUS_RHS_URL=http://localhost:3001
ISSUER_CREDENTIAL_STATUS_PUBLISHING_KEY_PATH=pbkey
ISSUER_CREDENTIAL_STATUS_RHS_MODE=<None | OffChain | OnChain >
ISSUER_CREDENTIAL_STATUS_RHS_MODE=<None | OffChain | OnChain>
ISSUER_CREDENTIAL_STATUS_RHS_CHAIN_ID=80001
4 changes: 3 additions & 1 deletion cmd/issuer_initializer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/polygonid/sh-id-platform/internal/providers"
"github.com/polygonid/sh-id-platform/internal/repositories"
"github.com/polygonid/sh-id-platform/pkg/blockchain/eth"
"github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status"
"github.com/polygonid/sh-id-platform/pkg/reverse_hash"
)

Expand Down Expand Up @@ -126,8 +127,9 @@ func main() {
}, keyStore)

rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.GetURL(), ethConn, common.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut)
revocationStatusResolver := revocation_status.NewRevocationStatusResolver(cfg.CredentialStatus)
cfg.CredentialStatus.SingleIssuer = true
identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, nil, claimsRepository, nil, nil, storage, nil, nil, nil, cfg.CredentialStatus, rhsFactory)
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),
Expand Down
7 changes: 4 additions & 3 deletions cmd/notifications/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/polygonid/sh-id-platform/internal/repositories"
"github.com/polygonid/sh-id-platform/pkg/blockchain/eth"
"github.com/polygonid/sh-id-platform/pkg/cache"
"github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status"
"github.com/polygonid/sh-id-platform/pkg/http"
"github.com/polygonid/sh-id-platform/pkg/pubsub"
"github.com/polygonid/sh-id-platform/pkg/reverse_hash"
Expand Down Expand Up @@ -150,16 +151,16 @@ func newCredentialsService(cfg *config.Configuration, storage *db.Storage, cache
}, keyStore)

rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.URL, ethConn, common.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut)

revocationStatusResolver := revocation_status.NewRevocationStatusResolver(cfg.CredentialStatus)
// TODO: Cache only if cfg.APIUI.SchemaCache == true
schemaLoader := loader.NewDocumentLoader(cfg.IPFS.GatewayURL)

mtService := services.NewIdentityMerkleTrees(mtRepository)
qrService := services.NewQrStoreService(cachex)

cfg.CredentialStatus.SingleIssuer = true
identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, nil, storage, nil, nil, ps, cfg.CredentialStatus, rhsFactory)
claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, cfg.APIUI.ServerURL, ps, cfg.IPFS.GatewayURL)
identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, nil, storage, nil, nil, ps, cfg.CredentialStatus, rhsFactory, revocationStatusResolver)
claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, cfg.APIUI.ServerURL, ps, cfg.IPFS.GatewayURL, revocationStatusResolver)

return claimsService, nil
}
6 changes: 4 additions & 2 deletions cmd/pending_publisher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/polygonid/sh-id-platform/internal/repositories"
"github.com/polygonid/sh-id-platform/pkg/blockchain/eth"
"github.com/polygonid/sh-id-platform/pkg/cache"
"github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status"
circuitLoaders "github.com/polygonid/sh-id-platform/pkg/loaders"
"github.com/polygonid/sh-id-platform/pkg/pubsub"
"github.com/polygonid/sh-id-platform/pkg/reverse_hash"
Expand Down Expand Up @@ -154,10 +155,11 @@ func main() {
}, keyStore)

rhsFactory := reverse_hash.NewFactory(cfg.CredentialStatus.RHS.GetURL(), cl, common.HexToAddress(cfg.CredentialStatus.OnchainTreeStore.SupportedTreeStoreContract), reverse_hash.DefaultRHSTimeOut)
revocationStatusResolver := revocation_status.NewRevocationStatusResolver(cfg.CredentialStatus)

cfg.CredentialStatus.SingleIssuer = true
identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory)
claimsService := services.NewClaim(claimsRepo, identityService, qrService, mtService, identityStateRepo, schemaLoader, storage, cfg.APIUI.ServerURL, ps, cfg.IPFS.GatewayURL)
identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, nil, nil, pubsub.NewMock(), cfg.CredentialStatus, rhsFactory, revocationStatusResolver)
claimsService := services.NewClaim(claimsRepo, identityService, qrService, mtService, identityStateRepo, schemaLoader, storage, cfg.APIUI.ServerURL, ps, cfg.IPFS.GatewayURL, revocationStatusResolver)

circuitsLoaderService := circuitLoaders.NewCircuits(cfg.Circuit.Path)
proofService := initProofService(ctx, cfg, circuitsLoaderService)
Expand Down
6 changes: 4 additions & 2 deletions cmd/platform/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/polygonid/sh-id-platform/internal/repositories"
"github.com/polygonid/sh-id-platform/pkg/blockchain/eth"
"github.com/polygonid/sh-id-platform/pkg/cache"
"github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status"
circuitLoaders "github.com/polygonid/sh-id-platform/pkg/loaders"
"github.com/polygonid/sh-id-platform/pkg/protocol"
"github.com/polygonid/sh-id-platform/pkg/pubsub"
Expand Down Expand Up @@ -135,8 +136,9 @@ func main() {
qrService := services.NewQrStoreService(cachex)

cfg.CredentialStatus.SingleIssuer = false
identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, nil, storage, nil, nil, ps, cfg.CredentialStatus, rhsFactory)
claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, cfg.ServerUrl, ps, cfg.IPFS.GatewayURL)
revocationStatusResolver := revocation_status.NewRevocationStatusResolver(cfg.CredentialStatus)
identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, nil, storage, nil, nil, ps, cfg.CredentialStatus, rhsFactory, revocationStatusResolver)
claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, cfg.ServerUrl, ps, cfg.IPFS.GatewayURL, revocationStatusResolver)
proofService := gateways.NewProver(ctx, cfg, circuitsLoaderService)

stateService, err := eth.NewStateService(eth.StateServiceConfig{
Expand Down
6 changes: 4 additions & 2 deletions cmd/platform_ui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/polygonid/sh-id-platform/internal/repositories"
"github.com/polygonid/sh-id-platform/pkg/blockchain/eth"
"github.com/polygonid/sh-id-platform/pkg/cache"
"github.com/polygonid/sh-id-platform/pkg/credentials/revocation_status"
circuitLoaders "github.com/polygonid/sh-id-platform/pkg/loaders"
"github.com/polygonid/sh-id-platform/pkg/protocol"
"github.com/polygonid/sh-id-platform/pkg/pubsub"
Expand Down Expand Up @@ -166,9 +167,10 @@ func main() {
qrService := services.NewQrStoreService(cachex)

cfg.CredentialStatus.SingleIssuer = true
identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, connectionsRepository, storage, verifier, sessionRepository, ps, cfg.CredentialStatus, rhsFactory)
revocationStatusResolver := revocation_status.NewRevocationStatusResolver(cfg.CredentialStatus)
identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, connectionsRepository, storage, verifier, sessionRepository, ps, cfg.CredentialStatus, rhsFactory, revocationStatusResolver)
schemaService := services.NewSchema(schemaRepository, schemaLoader)
claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, cfg.APIUI.ServerURL, ps, cfg.IPFS.GatewayURL)
claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, cfg.APIUI.ServerURL, ps, cfg.IPFS.GatewayURL, revocationStatusResolver)
connectionsService := services.NewConnection(connectionsRepository, storage)
linkService := services.NewLinkService(storage, claimsService, qrService, claimsRepository, linkRepository, schemaRepository, schemaLoader, sessionRepository, ps, cfg.IPFS.GatewayURL)

Expand Down
Loading

0 comments on commit 9ee0791

Please sign in to comment.