From 150c5c620566b48796bb75f29f9495c48bf502d0 Mon Sep 17 00:00:00 2001 From: Martin Saporiti Date: Tue, 17 Oct 2023 10:25:02 -0300 Subject: [PATCH] chore: ethereum identities (#505) * chore: add eth identities * chore: remove topup endpoint * chore: improvements * chore: improve api spec * chore: update tests --- .env-api.sample | 1 + .env-issuer.sample | 4 +- .golangci.yml | 2 +- api/api.yaml | 50 ++ cmd/issuer_initializer/main.go | 21 +- cmd/notifications/main.go | 12 +- cmd/pending_publisher/main.go | 16 +- cmd/platform/main.go | 20 +- cmd/platform_ui/main.go | 16 +- go.mod | 79 ++- go.sum | 287 +++-------- internal/api/api.gen.go | 138 ++++- internal/api/main_test.go | 18 +- internal/api/server.go | 90 +++- internal/api/server_test.go | 179 ++++--- internal/api_ui/server_test.go | 173 ++++--- internal/common/util.go | 32 ++ internal/config/config.go | 43 +- internal/core/domain/claim.go | 52 ++ internal/core/domain/identity.go | 35 +- internal/core/domain/schema.go | 1 + internal/core/ports/account_service.go | 13 + internal/core/ports/identity_service.go | 10 +- .../ports/{ZKGenerator.go => zk_generator.go} | 4 +- internal/core/services/account.go | 64 +++ internal/core/services/claims.go | 20 +- internal/core/services/identity.go | 474 ++++++++++++++---- internal/core/services/proof.go | 7 +- internal/core/services/tests/identity_test.go | 19 +- internal/core/services/tests/link_test.go | 13 +- internal/core/services/tests/main_test.go | 13 + .../core/services/tests/notification_test.go | 7 +- internal/core/services/zk_native.go | 25 +- ...02310090829241_update_identities_table.sql | 14 + internal/gateways/prover.go | 8 +- internal/gateways/publisher.go | 110 ++-- internal/gateways/publisher_gateway.go | 194 ++++--- internal/kms/main_test.go | 14 +- internal/kms/vaultPluginIden3KeyProvider.go | 13 +- internal/kms/vault_eth_key_provider.go | 212 ++++++++ internal/kms/vault_eth_key_provider_test.go | 80 +++ internal/loader/loader.go | 3 +- internal/loader/w3c_loader.go | 241 +++++++++ internal/providers/blockchain/eth.go | 11 +- internal/repositories/identity.go | 7 +- pkg/blockchain/eth/client.go | 117 ++++- pkg/protocol/packagemanager.go | 2 + pkg/reverse_hash/reverse_hash.go | 30 ++ pkg/schema/schema.go | 7 +- 49 files changed, 2244 insertions(+), 757 deletions(-) create mode 100644 internal/core/ports/account_service.go rename internal/core/ports/{ZKGenerator.go => zk_generator.go} (64%) create mode 100644 internal/core/services/account.go create mode 100644 internal/db/schema/migrations/202310090829241_update_identities_table.sql create mode 100644 internal/kms/vault_eth_key_provider.go create mode 100644 internal/kms/vault_eth_key_provider_test.go create mode 100644 internal/loader/w3c_loader.go diff --git a/.env-api.sample b/.env-api.sample index f697cc8f1..a08ee23e6 100644 --- a/.env-api.sample +++ b/.env-api.sample @@ -9,4 +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_ENVIRONMENT=local diff --git a/.env-issuer.sample b/.env-issuer.sample index ac50b4f28..de583d0ed 100644 --- a/.env-issuer.sample +++ b/.env-issuer.sample @@ -26,6 +26,9 @@ ISSUER_ETHEREUM_RPC_RESPONSE_TIMEOUT=5s ISSUER_ETHEREUM_WAIT_RECEIPT_CYCLE_TIME=30s ISSUER_ETHEREUM_WAIT_BLOCK_CYCLE_TIME=30s ISSUER_ETHEREUM_RESOLVER_PREFIX=polygon:mumbai +ISSUER_ETHEREUM_INTERNAL_TRANSFER_AMOUNT_WEI=1000000000000000000 +ISSUER_ETHEREUM_TRANSFER_ACCOUNT_KEY_PATH=pbkey + ISSUER_PROVER_SERVER_URL=http://localhost:8002 ISSUER_PROVER_TIMEOUT=600s ISSUER_CIRCUIT_PATH=./pkg/credentials/circuits @@ -35,4 +38,3 @@ ISSUER_SCHEMA_CACHE=false ISSUER_VAULT_USERPASS_AUTH_ENABLED=false ISSUER_VAULT_USERPASS_AUTH_PASSWORD=password - diff --git a/.golangci.yml b/.golangci.yml index 338838cfd..6c66e8ddb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -62,7 +62,7 @@ linters-settings: gofumpt: lang-version: "1.18" gocognit: - min-complexity: 38 + min-complexity: 40 gocyclo: min-complexity: 35 revive: diff --git a/api/api.yaml b/api/api.yaml index 856d0ecf1..9ae074c46 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -125,6 +125,30 @@ paths: '500': $ref: '#/components/responses/500' + /v1/identities/{identifier}/details: + get: + summary: Identity Detail + operationId: GetIdentityDetails + description: Endpoint to get an identity details + tags: + - Identity + security: + - basicAuth: [ ] + parameters: + - $ref: '#/components/parameters/pathIdentifier' + responses: + '200': + description: Identity top up successfully + content: + application/json: + schema: + $ref: '#/components/schemas/GetIdentityDetailsResponse' + '400': + $ref: '#/components/responses/400' + '401': + $ref: '#/components/responses/401' + '500': + $ref: '#/components/responses/500' /v1/{identifier}/state/retry: post: @@ -480,6 +504,7 @@ components: - method - blockchain - network + - type properties: method: type: string @@ -493,6 +518,12 @@ components: type: string x-omitempty: false example: "mumbai" + type: + type: string + x-omitempty: false + example: "BJJ" + enum: [BJJ, ETH] + CreateIdentityResponse: type: object @@ -504,6 +535,25 @@ components: type: string state: $ref: '#/components/schemas/IdentityState' + address: + type: string + x-omitempty: false + + GetIdentityDetailsResponse: + type: object + required: + - identity + - status + properties: + identifier: + type: string + state: + $ref: '#/components/schemas/IdentityState' + address: + type: string + balance: + type: string + IdentityState: type: object diff --git a/cmd/issuer_initializer/main.go b/cmd/issuer_initializer/main.go index a75ebc51f..f2ddcaf6e 100644 --- a/cmd/issuer_initializer/main.go +++ b/cmd/issuer_initializer/main.go @@ -7,9 +7,11 @@ import ( "time" vault "github.com/hashicorp/vault/api" + core "github.com/iden3/go-iden3-core/v2" "github.com/polygonid/sh-id-platform/internal/buildinfo" "github.com/polygonid/sh-id-platform/internal/config" + "github.com/polygonid/sh-id-platform/internal/core/ports" "github.com/polygonid/sh-id-platform/internal/core/services" "github.com/polygonid/sh-id-platform/internal/db" "github.com/polygonid/sh-id-platform/internal/kms" @@ -99,9 +101,24 @@ func main() { // services initialization mtService := services.NewIdentityMerkleTrees(mtRepository) - identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, nil, claimsRepository, nil, nil, storage, nil, nil, nil, pubsub.NewMock()) - identity, err := identityService.Create(ctx, cfg.APIUI.IdentityMethod, cfg.APIUI.IdentityBlockchain, cfg.APIUI.IdentityNetwork, cfg.ServerUrl) + revocationSettings := services.CredentialRevocationSettings{ + RHSEnabled: cfg.ReverseHashService.Enabled, + RHSUrl: cfg.ReverseHashService.URL, + Host: cfg.ServerUrl, + AgentIden3Enabled: false, + } + + identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, nil, claimsRepository, nil, nil, storage, nil, nil, nil, pubsub.NewMock(), revocationSettings) + + 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), + } + + identity, err := identityService.Create(ctx, cfg.ServerUrl, didCreationOptions) if err != nil { log.Error(ctx, "error creating identifier", err) return diff --git a/cmd/notifications/main.go b/cmd/notifications/main.go index f4e4bbb62..63f78883f 100644 --- a/cmd/notifications/main.go +++ b/cmd/notifications/main.go @@ -135,8 +135,16 @@ func newCredentialsService(cfg *config.Configuration, storage *db.Storage, cache mtService := services.NewIdentityMerkleTrees(mtRepository) qrService := services.NewQrStoreService(cachex) - identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, nil, storage, rhsp, nil, nil, ps) - claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, services.ClaimCfg{ + + revocationSettings := services.CredentialRevocationSettings{ + RHSEnabled: cfg.ReverseHashService.Enabled, + RHSUrl: cfg.ReverseHashService.URL, + Host: cfg.ServerUrl, + AgentIden3Enabled: false, + } + + identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, nil, storage, rhsp, nil, nil, ps, revocationSettings) + claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, services.CredentialRevocationSettings{ RHSEnabled: cfg.ReverseHashService.Enabled, RHSUrl: cfg.ReverseHashService.URL, Host: cfg.ServerUrl, diff --git a/cmd/pending_publisher/main.go b/cmd/pending_publisher/main.go index c97e0add3..d5460a8e9 100644 --- a/cmd/pending_publisher/main.go +++ b/cmd/pending_publisher/main.go @@ -136,8 +136,18 @@ func main() { rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsService := services.NewClaim(claimsRepo, identityService, qrService, mtService, identityStateRepo, schemaLoader, storage, services.ClaimCfg{ + + // TODO: Review this + revocationSettings := services.CredentialRevocationSettings{ + RHSEnabled: cfg.ReverseHashService.Enabled, + RHSUrl: cfg.ReverseHashService.URL, + Host: cfg.ServerUrl, + AgentIden3Enabled: false, + AgentIden3URL: "", + } + + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), revocationSettings) + claimsService := services.NewClaim(claimsRepo, identityService, qrService, mtService, identityStateRepo, schemaLoader, storage, services.CredentialRevocationSettings{ RHSEnabled: cfg.ReverseHashService.Enabled, RHSUrl: cfg.ReverseHashService.URL, Host: cfg.ServerUrl, @@ -158,7 +168,7 @@ func main() { RPCResponseTimeout: cfg.Ethereum.RPCResponseTimeout, WaitReceiptCycleTime: cfg.Ethereum.WaitReceiptCycleTime, WaitBlockCycleTime: cfg.Ethereum.WaitBlockCycleTime, - }) + }, keyStore) circuitsLoaderService := circuitLoaders.NewCircuits(cfg.Circuit.Path) proofService := initProofService(ctx, cfg, circuitsLoaderService) diff --git a/cmd/platform/main.go b/cmd/platform/main.go index 323655718..7812b53dc 100644 --- a/cmd/platform/main.go +++ b/cmd/platform/main.go @@ -101,7 +101,7 @@ func main() { return } - ethereumClient, err := blockchain.Open(cfg) + ethereumClient, err := blockchain.Open(cfg, keyStore) if err != nil { log.Error(ctx, "error dialing with ethereum client", "err", err) return @@ -113,7 +113,7 @@ func main() { return } - ethConn, err := blockchain.InitEthConnect(cfg.Ethereum) + ethConn, err := blockchain.InitEthConnect(cfg.Ethereum, keyStore) if err != nil { log.Error(ctx, "failed init ethereum connect", "err", err) return @@ -139,8 +139,17 @@ func main() { // services initialization mtService := services.NewIdentityMerkleTrees(mtRepository) qrService := services.NewQrStoreService(cachex) - identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, nil, storage, rhsp, nil, nil, ps) - claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, services.ClaimCfg{ + + revocationSettings := services.CredentialRevocationSettings{ + RHSEnabled: cfg.ReverseHashService.Enabled, + RHSUrl: cfg.ReverseHashService.URL, + Host: cfg.ServerUrl, + AgentIden3Enabled: false, + } + + identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, nil, storage, rhsp, nil, nil, ps, revocationSettings) + + claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, services.CredentialRevocationSettings{ RHSEnabled: cfg.ReverseHashService.Enabled, RHSUrl: cfg.ReverseHashService.URL, Host: cfg.ServerUrl, @@ -168,6 +177,7 @@ func main() { return } + accountService := services.NewAccountService(cfg.Ethereum, keyStore) serverHealth := health.New(health.Monitors{ "postgres": storage.Ping, "redis": func(rdb *redis2.Client) health.Pinger { @@ -186,7 +196,7 @@ func main() { ) api.HandlerFromMux( api.NewStrictHandlerWithOptions( - api.NewServer(cfg, identityService, claimsService, qrService, publisher, packageManager, serverHealth), + api.NewServer(cfg, identityService, accountService, claimsService, qrService, publisher, packageManager, serverHealth), middlewares(ctx, cfg.HTTPBasicAuth), api.StrictHTTPServerOptions{ RequestErrorHandlerFunc: errors.RequestErrorHandlerFunc, diff --git a/cmd/platform_ui/main.go b/cmd/platform_ui/main.go index d671c3d8f..ebd367e63 100644 --- a/cmd/platform_ui/main.go +++ b/cmd/platform_ui/main.go @@ -114,7 +114,7 @@ func main() { return } - ethereumClient, err := blockchain.Open(cfg) + ethereumClient, err := blockchain.Open(cfg, keyStore) if err != nil { log.Error(ctx, "error dialing with ethereum client", "err", err) return @@ -126,7 +126,7 @@ func main() { return } - ethConn, err := blockchain.InitEthConnect(cfg.Ethereum) + ethConn, err := blockchain.InitEthConnect(cfg.Ethereum, keyStore) if err != nil { log.Error(ctx, "failed init ethereum connect", "err", err) return @@ -171,9 +171,17 @@ func main() { // services initialization mtService := services.NewIdentityMerkleTrees(mtRepository) qrService := services.NewQrStoreService(cachex) - identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, connectionsRepository, storage, rhsp, verifier, sessionRepository, ps) + + revocationSettings := services.CredentialRevocationSettings{ + RHSEnabled: cfg.ReverseHashService.Enabled, + RHSUrl: cfg.ReverseHashService.URL, + Host: cfg.APIUI.ServerURL, + AgentIden3Enabled: false, + } + + identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, connectionsRepository, storage, rhsp, verifier, sessionRepository, ps, revocationSettings) schemaService := services.NewSchema(schemaRepository, schemaLoader) - claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, services.ClaimCfg{ + claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, services.CredentialRevocationSettings{ RHSEnabled: cfg.ReverseHashService.Enabled, RHSUrl: cfg.ReverseHashService.URL, Host: cfg.APIUI.ServerURL, diff --git a/go.mod b/go.mod index 61790a4ce..3f5eb7084 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/alicebob/miniredis/v2 v2.30.5 github.com/deepmap/oapi-codegen v1.15.0 - github.com/ethereum/go-ethereum v1.13.0 + github.com/ethereum/go-ethereum v1.13.2 github.com/getkin/kin-openapi v0.120.0 github.com/go-chi/chi/v5 v5.0.10 github.com/go-chi/cors v1.2.1 @@ -25,7 +25,9 @@ require ( github.com/iden3/go-merkletree-sql/db/pgx/v2 v2.0.5 github.com/iden3/go-merkletree-sql/v2 v2.0.6 github.com/iden3/go-rapidsnark/prover v0.0.10 - github.com/iden3/go-rapidsnark/witness v0.0.6 + github.com/iden3/go-rapidsnark/types v0.0.3 + github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 + github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e github.com/iden3/go-schema-processor v1.3.1 github.com/iden3/go-schema-processor/v2 v2.0.1 github.com/iden3/iden3comm/v2 v2.0.0 @@ -45,10 +47,10 @@ require ( github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f github.com/pkg/errors v0.9.1 github.com/pressly/goose/v3 v3.15.0 - github.com/spf13/viper v1.16.0 + github.com/spf13/viper v1.17.0 github.com/stretchr/testify v1.8.4 - golang.org/x/crypto v0.13.0 - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 + golang.org/x/crypto v0.14.0 + golang.org/x/exp v0.0.0-20231006140011-7918f672742d ) require ( @@ -59,7 +61,7 @@ require ( github.com/Antonboom/errname v0.1.12 // indirect github.com/Antonboom/nilnil v0.1.7 // indirect github.com/BurntSushi/toml v1.3.2 // indirect - github.com/DataDog/zstd v1.5.2 // indirect + github.com/DataDog/zstd v1.5.5 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect @@ -75,7 +77,7 @@ require ( github.com/ashanbrown/makezero v1.1.1 // indirect github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.5.0 // indirect + github.com/bits-and-blooms/bitset v1.9.0 // indirect github.com/bkielbasa/cyclop v1.2.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect @@ -90,19 +92,19 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.1.0 // indirect - github.com/cockroachdb/errors v1.9.1 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 // indirect - github.com/cockroachdb/redact v1.1.3 // indirect + github.com/cockroachdb/redact v1.1.5 // indirect github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.10.0 // indirect + github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/daixiang0/gci v0.11.1 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dchest/blake512 v1.0.0 // indirect - github.com/deckarep/golang-set/v2 v2.3.0 // indirect + github.com/deckarep/golang-set/v2 v2.3.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect @@ -115,10 +117,10 @@ require ( github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/getsentry/sentry-go v0.19.0 // indirect + github.com/getsentry/sentry-go v0.25.0 // indirect github.com/go-critic/go-critic v0.9.0 // indirect github.com/go-jose/go-jose/v3 v3.0.0 // indirect - github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-openapi/jsonpointer v0.20.0 // indirect github.com/go-openapi/swag v0.22.4 // indirect github.com/go-stack/stack v1.8.1 // indirect @@ -154,26 +156,21 @@ require ( github.com/gostaticanalysis/nilerr v0.1.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-hclog v1.4.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect - github.com/hashicorp/go-sockaddr v1.0.2 // indirect + github.com/hashicorp/go-sockaddr v1.0.5 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.3 // indirect github.com/iden3/go-iden3-core v1.0.2 // indirect - github.com/iden3/go-rapidsnark/types v0.0.3 // indirect github.com/iden3/go-rapidsnark/verifier v0.0.5 // indirect - github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 // indirect - github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e // indirect - github.com/iden3/wasmer-go v0.0.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/invopop/yaml v0.2.0 // indirect - github.com/ipfs/boxo v0.12.0 // indirect + github.com/ipfs/boxo v0.13.1 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgio v1.0.0 // indirect @@ -189,7 +186,7 @@ require ( github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect - github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect @@ -199,15 +196,15 @@ require ( github.com/ldez/gomoddirectives v0.2.3 // indirect github.com/ldez/tagliatelle v0.5.0 // indirect github.com/leonklingele/grouper v1.1.1 // indirect - github.com/lestrrat-go/blackmagic v1.0.1 // indirect + github.com/lestrrat-go/blackmagic v1.0.2 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect github.com/lestrrat-go/httprc v1.0.4 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect - github.com/lestrrat-go/jwx/v2 v2.0.12 // indirect + github.com/lestrrat-go/jwx/v2 v2.0.13 // indirect github.com/lestrrat-go/option v1.0.1 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-flow-metrics v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.29.2 // indirect + github.com/libp2p/go-libp2p v0.31.0 // indirect github.com/lufeee/execinquery v1.2.1 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -231,7 +228,7 @@ require ( github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect github.com/multiformats/go-multihash v0.2.3 // indirect - github.com/multiformats/go-multistream v0.4.1 // indirect + github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.11.0 // indirect @@ -240,13 +237,13 @@ require ( github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polyfloyd/go-errorlint v1.4.4 // indirect - github.com/pquerna/cachecontrol v0.1.0 // indirect - github.com/prometheus/client_golang v1.16.0 // indirect - github.com/prometheus/client_model v0.4.0 // indirect + github.com/pquerna/cachecontrol v0.2.0 // indirect + github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.11.1 // indirect + github.com/prometheus/procfs v0.12.0 // indirect github.com/quasilyte/go-ruleguard v0.4.0 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect @@ -256,8 +253,10 @@ require ( github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect + github.com/sagikazarmark/locafero v0.3.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect - github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 // indirect + github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect github.com/securego/gosec/v2 v2.17.0 // indirect @@ -269,12 +268,12 @@ require ( github.com/sivchari/nosnakecase v1.7.0 // indirect github.com/sivchari/tenv v1.7.1 // indirect github.com/sonatard/noctx v0.0.2 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/spf13/afero v1.9.5 // indirect + github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/spf13/cobra v1.7.0 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect @@ -298,7 +297,7 @@ require ( github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect github.com/vmihailenco/go-tinylfu v0.2.2 // indirect - github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.0 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect @@ -311,13 +310,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.25.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/mod v0.13.0 // indirect + golang.org/x/net v0.16.0 // indirect + golang.org/x/sync v0.4.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/tools v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index 0d4e6364c..8bc9fb47b 100644 --- a/go.sum +++ b/go.sum @@ -44,7 +44,6 @@ github.com/4meepo/tagalign v1.3.2 h1:1idD3yxlRGV18VjqtDbqYvQ5pXqQS0wO2dn6M3XstvI github.com/4meepo/tagalign v1.3.2/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= github.com/Abirdcfly/dupword v0.0.12 h1:56NnOyrXzChj07BDFjeRA+IUzSz01jmzEq+G4kEgFhc= github.com/Abirdcfly/dupword v0.0.12/go.mod h1:+us/TGct/nI9Ndcbcp3rgNcQzctTj68pq7TcgNpLfdI= -github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/Antonboom/errname v0.1.12 h1:oh9ak2zUtsLp5oaEd/erjB4GPu9w19NyoIskZClDcQY= github.com/Antonboom/errname v0.1.12/go.mod h1:bK7todrzvlaZoQagP1orKzWXv59X/x0W0Io2XT1Ssro= github.com/Antonboom/nilnil v0.1.7 h1:ofgL+BA7vlA1K2wNQOsHzLJ2Pw5B5DpWRLdDAVvvTow= @@ -54,14 +53,12 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8 github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= -github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= -github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= -github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 h1:3ZBs7LAezy8gh0uECsA6CGU43FF3zsx5f4eah5FxTMA= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0/go.mod h1:rZLTje5A9kFBe0pzhpe2TdhRniBF++PRHQuRpR8esVc= -github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= @@ -70,10 +67,8 @@ github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5 github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= -github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= -github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -93,13 +88,11 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8gerOIVIY= github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= -github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -107,8 +100,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8= -github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bits-and-blooms/bitset v1.9.0 h1:g1YivPG8jOtrN013Fe8OBXubkiTwvm7/vG2vXz03ANU= +github.com/bits-and-blooms/bitset v1.9.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bkielbasa/cyclop v1.2.1 h1:AeF71HZDob1P2/pRm1so9cd1alZnrpyc4q2uP2l0gJY= github.com/bkielbasa/cyclop v1.2.1/go.mod h1:K/dT/M0FPAiYjBgQGau7tz+3TMh4FWAEqlMhzFWCrgM= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= @@ -138,6 +131,7 @@ github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTx github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= @@ -156,29 +150,23 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/datadriven v1.0.3-0.20230801171734-e384cf455877 h1:1MLK4YpFtIEo3ZtMA5C795Wtv5VuUnrXX7mQG+aHg6o= -github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= -github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= -github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 h1:T+Np/xtzIjYM/P5NAw0e2Rf1FGvzDau1h54MKvx8G7w= github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06/go.mod h1:bynZ3gvVyhlvjLI7PT6dmZ7g76xzJ7HpxfjgkzCGz6s= -github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= -github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.10.0 h1:zRh22SR7o4K35SoNqouS9J/TKHTyU2QWaj5ldehyXtA= -github.com/consensys/gnark-crypto v0.10.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= +github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= @@ -192,12 +180,13 @@ github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT8 github.com/daixiang0/gci v0.11.1 h1:7UWAchVmYRlULYrkjQUaXX6mpigekVid20xaGo1vKLc= github.com/daixiang0/gci v0.11.1/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/blake512 v1.0.0 h1:oDFEQFIqFSeuA34xLtXZ/rWxCXdSjirjzPhey5EUvmA= github.com/dchest/blake512 v1.0.0/go.mod h1:FV1x7xPPLWukZlpDpWQ88rF/SFwZ5qbskrzhLMB92JI= -github.com/deckarep/golang-set/v2 v2.3.0 h1:qs18EKUfHm2X9fA50Mr/M5hccg2tNnVqsiBImnyDs0g= -github.com/deckarep/golang-set/v2 v2.3.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= +github.com/deckarep/golang-set/v2 v2.3.1 h1:vjmkvJt/IV27WXPyYQpAh4bRyWJc5Y435D17XQ9QU5A= +github.com/deckarep/golang-set/v2 v2.3.1/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= @@ -206,11 +195,8 @@ github.com/deepmap/oapi-codegen v1.15.0 h1:SQqViaeb4k2vMul8gx12oDOIadEtoRqTdLkxj github.com/deepmap/oapi-codegen v1.15.0/go.mod h1:a6KoHV7lMRwsPoEg2C6NDHiXYV3EQfiFocOlJ8dgJQE= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= -github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564 h1:I6KUy4CI6hHjqnyJLNCEi7YHVMkwwtfSr2k9splgdSM= github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564/go.mod h1:yekO+3ZShy19S+bsmnERmznGy9Rfg6dWWWpiGJjNAz8= @@ -220,20 +206,16 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= -github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.13.0 h1:dZALM0PlDTtNITTECPiqSrFo0iEYVDfby+mSVc0LxIs= -github.com/ethereum/go-ethereum v1.13.0/go.mod h1:0TDsBNJ7j8jR01vKpk4j2zfVKyAbQuKzy6wLwb5ZMuU= +github.com/ethereum/go-ethereum v1.13.2 h1:g9mCpfPWqCA1OL4e6C98PeVttb0HadfBRuKTGvMnOvw= +github.com/ethereum/go-ethereum v1.13.2/go.mod h1:gkQ5Ygi64ZBh9M/4iXY1R8WqoNCx1Ey0CkYn2BD4/fw= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= -github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= @@ -249,23 +231,17 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/getkin/kin-openapi v0.120.0 h1:MqJcNJFrMDFNc07iwE8iFC5eT2k/NPUFDIpNeiZv8Jg= github.com/getkin/kin-openapi v0.120.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= -github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c= -github.com/getsentry/sentry-go v0.19.0 h1:BcCH3CN5tXt5aML+gwmbFwVptLLQA+eT866fCO9wVOM= -github.com/getsentry/sentry-go v0.19.0/go.mod h1:y3+lGEFEFexZtpbG1GUE2WD/f9zGyKYwpEqryTOC/nE= -github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= +github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI= +github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-critic/go-critic v0.9.0 h1:Pmys9qvU3pSML/3GEQ2Xd9RZ/ip+aXHKILuxczKGV/U= github.com/go-critic/go-critic v0.9.0/go.mod h1:5P8tdXL7m/6qnyG6oRAlYLORvoXH0WDypYgAEmagT40= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -278,10 +254,12 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= -github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= @@ -300,6 +278,7 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg78 github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= +github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= @@ -321,9 +300,6 @@ github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80 github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= @@ -331,10 +307,8 @@ github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14j github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid/v5 v5.0.0 h1:p544++a97kEL+svbcFbCQVM9KFu0Yo25UoISXGNNH9M= -github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= @@ -394,7 +368,6 @@ github.com/golangci/revgrep v0.5.0 h1:GGBqHFtFOeHiSUQtFVZXPJtVZYOGB4iVlAjaoFRBQv github.com/golangci/revgrep v0.5.0/go.mod h1:bjAMA+Sh/QUfTDcHzxfyHxr4xKvllVr/0sCv2e7jJHA= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= -github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -412,7 +385,6 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -427,7 +399,7 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 h1:n6vlPhxsA+BW/XsS5+uqi7GyzaLa5MH7qlSLBZtRdiA= +github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f h1:pDhu5sgp8yJlEF/g6osliIIpF9K4F5jvkULXa4daRDQ= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -436,10 +408,9 @@ github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 h1:mrEEilTAUmaAORhssPPkxj84TsHrPMLBGW2Z4SoTxm8= github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= @@ -462,8 +433,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I= -github.com/hashicorp/go-hclog v1.4.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= @@ -478,9 +448,9 @@ github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3 github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U= github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= -github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-sockaddr v1.0.5 h1:dvk7TIXCZpmfOlM+9mlcrWmWjw/wlKT+VDq2wMvfPJU= +github.com/hashicorp/go-sockaddr v1.0.5/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -501,7 +471,6 @@ github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= -github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/iden3/contracts-abi/state/go/abi v1.0.1 h1:FsaLJSy3NSyJl5k1yfDxc5DhUHRY7Z/UCj0/1YueMrY= @@ -528,8 +497,6 @@ github.com/iden3/go-rapidsnark/types v0.0.3 h1:f0s1Qdut1qHe1O67+m+xUVRBPwSXnq5j0 github.com/iden3/go-rapidsnark/types v0.0.3/go.mod h1:ApgcaUxKIgSRA6fAeFxK7p+lgXXfG4oA2HN5DhFlfF4= github.com/iden3/go-rapidsnark/verifier v0.0.5 h1:J7y0ovrEjDQoWtZmlrp4tgGng1A9faMeYsQH4igAEqA= github.com/iden3/go-rapidsnark/verifier v0.0.5/go.mod h1:KgL3Yr9NehlFDI4EIWVLE3UDUi8ulyjbp7HcXSBfiGI= -github.com/iden3/go-rapidsnark/witness v0.0.6 h1:p+6QBymSV3XWm1kB2PL2vlXxKXJN8GyWuqNJv/0PGGU= -github.com/iden3/go-rapidsnark/witness v0.0.6/go.mod h1:57IHQpnvx0CeS6cAT07oN/lqwT5LRc4zicYoZ1cnAPE= github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 h1:mkY6VDfwKVJc83QGKmwVXY2LYepidPrFAxskrjr8UCs= github.com/iden3/go-rapidsnark/witness/v2 v2.0.0/go.mod h1:3JRjqUfW1hgI9hzLDO0v8z/DUkR0ZUehhYLlnIfRxnA= github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e h1:WeiFCrpj5pLRtSA4Mg03yTrSZhHHqN/k5b6bwxd9/tY= @@ -542,25 +509,16 @@ github.com/iden3/iden3comm/v2 v2.0.0 h1:cFDfF6aJ589ENg5zlTBEPK6Qqv4I11C/gliAWZOR github.com/iden3/iden3comm/v2 v2.0.0/go.mod h1:wrXoxi8eoQSLopatRW5+hYF9lDRvzGL2As9ZE88q/kA= github.com/iden3/merkletree-proof v0.0.3 h1:01fSpjv2JIwVBYqV7ugLm0gjF+yo0aw41zDTWP5+81s= github.com/iden3/merkletree-proof v0.0.3/go.mod h1:cNPG00p4ALlIXnRFmM1T2zy4547jV8cgyOZsObDrORg= -github.com/iden3/wasmer-go v0.0.1 h1:TZKh8Se8B/73PvWrcu+FTU9L1k5XYAmtFbioj7l0Uog= -github.com/iden3/wasmer-go v0.0.1/go.mod h1:ZnZBAO012M7o+Q1INXLRIxKQgEcH2FuwL0Iga8A4ufg= -github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= -github.com/ipfs/boxo v0.12.0 h1:AXHg/1ONZdRQHQLgG5JHsSC3XoE4DjCAMgK+asZvUcQ= -github.com/ipfs/boxo v0.12.0/go.mod h1:xAnfiU6PtxWCnRqu7dcXQ10bB5/kvI1kXRotuGqGBhg= +github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= +github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/ipfs/go-ipfs-api v0.7.0 h1:CMBNCUl0b45coC+lQCXEVpMhwoqjiaCwUIrM+coYW2Q= github.com/ipfs/go-ipfs-api v0.7.0/go.mod h1:AIxsTNB0+ZhkqIfTZpdZ0VR/cpX5zrXjATa3prSay3g= -github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= -github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= -github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk= -github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= -github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= @@ -626,24 +584,16 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= -github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= -github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= -github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= -github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM8= @@ -652,12 +602,9 @@ github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= -github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= +github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -681,8 +628,6 @@ github.com/kunwardeep/paralleltest v1.0.8/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= -github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= @@ -692,16 +637,16 @@ github.com/ldez/tagliatelle v0.5.0/go.mod h1:rj1HmWiL1MiKQuOONhd09iySTEkUuE/8+5j github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= -github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80= -github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= +github.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N+AkAr5k= +github.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8= github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.0.12 h1:3d589+5w/b9b7S3DneICPW16AqTyYXB7VRjgluSDWeA= -github.com/lestrrat-go/jwx/v2 v2.0.12/go.mod h1:Mq4KN1mM7bp+5z/W5HS8aCNs5RKZ911G/0y2qUjAQuQ= +github.com/lestrrat-go/jwx/v2 v2.0.13 h1:XdxzJbudGaHEoNmyJACAT8aFCB+DmviiaiMoZwuJoUo= +github.com/lestrrat-go/jwx/v2 v2.0.13/go.mod h1:UzXMzcV99p9/xe1JsIb336NJDGXLsleR+Qj3ucEDtfI= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= @@ -715,11 +660,10 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6 github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.29.2 h1:uPw/c8hOxoLP/KhFnzlc5Ejqf+OmAL1dwIsqE31WBtY= -github.com/libp2p/go-libp2p v0.29.2/go.mod h1:OU7nSq0aEZMsV2wY8nXn1+XNNt9q2UiR8LjW3Kmp2UE= +github.com/libp2p/go-libp2p v0.31.0 h1:LFShhP8F6xthWiBBq3euxbKjZsoRajVEyBS9snfHxYg= +github.com/libp2p/go-libp2p v0.31.0/go.mod h1:W/FEK1c/t04PbRH3fA9i5oucu5YcgrG0JVoBWT1B7Eg= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -734,20 +678,15 @@ github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= @@ -759,23 +698,20 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= github.com/mgechev/revive v1.3.3 h1:GUWzV3g185agbHN4ZdaQvR6zrLVYTUSA2ktvIinivK0= github.com/mgechev/revive v1.3.3/go.mod h1:NhpOtVtDbjYNDj697eDUBTobijCDHQKar4HDKc0TuTo= -github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -792,7 +728,6 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= -github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= @@ -807,17 +742,14 @@ github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3 github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= -github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= -github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= +github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf/QGkvOGQAyiE= +github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8pzda2l0= github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= @@ -834,7 +766,6 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/olomix/go-test-pg v1.0.2 h1:4ey3mFBhPx93PdgyshOJI1WrQzqzkWEnb0wL/7UbFMI= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= @@ -852,7 +783,6 @@ github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT9 github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= @@ -867,13 +797,14 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/polyfloyd/go-errorlint v1.4.4 h1:A9gytp+p6TYqeALTYRoxJESYP8wJRETRX2xzGWFsEBU= github.com/polyfloyd/go-errorlint v1.4.4/go.mod h1:ry5NqF7l9Q77V+XqAfUg1zfryrEtyac3G5+WVpIK0xU= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/pquerna/cachecontrol v0.1.0 h1:yJMy84ti9h/+OEWa752kBTKv4XC30OtVVHYv/8cTqKc= -github.com/pquerna/cachecontrol v0.1.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI= +github.com/pquerna/cachecontrol v0.2.0 h1:vBXSNuE5MYP9IJ5kjsdo8uq+w41jSPgvba2DEnkRx9k= +github.com/pquerna/cachecontrol v0.2.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI= github.com/pressly/goose/v3 v3.15.0 h1:6tY5aDqFknY6VZkorFGgZtWygodZQxfmmEF4rqyJW9k= github.com/pressly/goose/v3 v3.15.0/go.mod h1:LlIo3zGccjb/YUgG+Svdb9Er14vefRdlDI7URCDrwYo= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -881,14 +812,14 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= @@ -900,8 +831,8 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= -github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/quasilyte/go-ruleguard v0.4.0 h1:DyM6r+TKL+xbKB4Nm7Afd1IQh9kEUKQs2pboWGKtvQo= github.com/quasilyte/go-ruleguard v0.4.0/go.mod h1:Eu76Z/R8IXtViWUIHkE3p8gdH3/PKk1eh3YGfaEof10= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= @@ -916,7 +847,6 @@ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= @@ -924,8 +854,6 @@ github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJHMLuTw= @@ -935,10 +863,14 @@ github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDj github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= +github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= -github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 h1:uIkTLo0AGRc8l7h5l9r+GcYi9qfVPt6lD4/bhmzfiKo= -github.com/santhosh-tekuri/jsonschema/v5 v5.3.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= +github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= +github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.24.0 h1:MKNzmXtGh5N0y74Z/CIaJh4GlB364l0K1RUT08WSWAc= @@ -949,7 +881,6 @@ github.com/securego/gosec/v2 v2.17.0 h1:ZpAStTDKY39insEG9OH6kV3IkhQZPTq9a9eGOLOj github.com/securego/gosec/v2 v2.17.0/go.mod h1:lt+mgC91VSmriVoJLentrMkRCYs+HLTBnUFUBuhV2hc= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= @@ -959,7 +890,6 @@ github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -972,32 +902,24 @@ github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= -github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= +github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= -github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= +github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= +github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= @@ -1018,7 +940,6 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= @@ -1055,52 +976,38 @@ github.com/tomarrell/wrapcheck/v2 v2.8.1/go.mod h1:/n2Q3NZ4XFT50ho6Hbxg+RV1uyo2U github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/urfave/cli/v2 v2.24.1 h1:/QYYr7g0EhwXEML8jO+8OYt5trPnLHS0p3mrgExJ5NU= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/uudashr/gocognit v1.0.7 h1:e9aFXgKgUJrQ5+bs61zBigmj7bFJ/5cC6HmMahVzuDo= github.com/uudashr/gocognit v1.0.7/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/vmihailenco/go-tinylfu v0.2.2 h1:H1eiG6HM36iniK6+21n9LLpzx1G9R3DJa2UjUjbynsI= github.com/vmihailenco/go-tinylfu v0.2.2/go.mod h1:CutYi2Q9puTxfcolkliPq4npPuofg9N9t8JVrjzwa3Q= github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/msgpack/v5 v5.4.0 h1:hRM0digJwyR6vll33NNAwCFguy5JuBD6jxDmQP3l608= +github.com/vmihailenco/msgpack/v5 v5.4.0/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= -github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= github.com/ykadowak/zerologlint v0.1.3 h1:TLy1dTW3Nuc+YE3bYRPToG1Q9Ej78b5UUN6bjbGdxPE= github.com/ykadowak/zerologlint v0.1.3/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= -github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= -github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1141,19 +1048,15 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c= go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -1161,9 +1064,9 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1174,8 +1077,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230905200255-921286631fa9 h1:j3D9DvWRpUfIyFfDPws7LoIZ2MAI1OJHdQXtTnYtN+k= @@ -1212,17 +1115,15 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -1232,7 +1133,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1257,7 +1157,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -1267,8 +1166,8 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1292,14 +1191,13 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1311,7 +1209,6 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1352,7 +1249,6 @@ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1360,14 +1256,11 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1381,8 +1274,9 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1391,40 +1285,34 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1485,7 +1373,6 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= @@ -1495,8 +1382,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1529,7 +1416,6 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1566,8 +1452,6 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1584,7 +1468,6 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1604,17 +1487,14 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-jose/go-jose.v2 v2.6.1 h1:qEzJlIDmG9q5VO0M/o8tGS65QMHMS1w01TQJB1VPJ4U= gopkg.in/go-jose/go-jose.v2 v2.6.1/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -1625,7 +1505,6 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/api/api.gen.go b/internal/api/api.gen.go index e57a1c210..f37886e6d 100644 --- a/internal/api/api.gen.go +++ b/internal/api/api.gen.go @@ -21,6 +21,12 @@ const ( BasicAuthScopes = "basicAuth.Scopes" ) +// Defines values for CreateIdentityRequestDidMetadataType. +const ( + BJJ CreateIdentityRequestDidMetadataType = "BJJ" + ETH CreateIdentityRequestDidMetadataType = "ETH" +) + // AgentResponse defines model for AgentResponse. type AgentResponse struct { Body interface{} `json:"body"` @@ -55,14 +61,19 @@ type CreateClaimResponse struct { // CreateIdentityRequest defines model for CreateIdentityRequest. type CreateIdentityRequest struct { DidMetadata struct { - Blockchain string `json:"blockchain"` - Method string `json:"method"` - Network string `json:"network"` + Blockchain string `json:"blockchain"` + Method string `json:"method"` + Network string `json:"network"` + Type CreateIdentityRequestDidMetadataType `json:"type"` } `json:"didMetadata"` } +// CreateIdentityRequestDidMetadataType defines model for CreateIdentityRequest.DidMetadata.Type. +type CreateIdentityRequestDidMetadataType string + // CreateIdentityResponse defines model for CreateIdentityResponse. type CreateIdentityResponse struct { + Address *string `json:"address"` Identifier *string `json:"identifier,omitempty"` State *IdentityState `json:"state,omitempty"` } @@ -112,6 +123,14 @@ type GetClaimResponse struct { // GetClaimsResponse defines model for GetClaimsResponse. type GetClaimsResponse = []GetClaimResponse +// GetIdentityDetailsResponse defines model for GetIdentityDetailsResponse. +type GetIdentityDetailsResponse struct { + Address *string `json:"address,omitempty"` + Balance *string `json:"balance,omitempty"` + Identifier *string `json:"identifier,omitempty"` + State *IdentityState `json:"state,omitempty"` +} + // Health defines model for Health. type Health map[string]bool @@ -268,6 +287,9 @@ type ServerInterface interface { // Create Identity // (POST /v1/identities) CreateIdentity(w http.ResponseWriter, r *http.Request) + // Identity Detail + // (GET /v1/identities/{identifier}/details) + GetIdentityDetails(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) // QrCode body // (GET /v1/qr-store) GetQrFromStore(w http.ResponseWriter, r *http.Request, params GetQrFromStoreParams) @@ -349,6 +371,12 @@ func (_ Unimplemented) CreateIdentity(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotImplemented) } +// Identity Detail +// (GET /v1/identities/{identifier}/details) +func (_ Unimplemented) GetIdentityDetails(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) { + w.WriteHeader(http.StatusNotImplemented) +} + // QrCode body // (GET /v1/qr-store) func (_ Unimplemented) GetQrFromStore(w http.ResponseWriter, r *http.Request, params GetQrFromStoreParams) { @@ -538,6 +566,34 @@ func (siw *ServerInterfaceWrapper) CreateIdentity(w http.ResponseWriter, r *http handler.ServeHTTP(w, r.WithContext(ctx)) } +// GetIdentityDetails operation middleware +func (siw *ServerInterfaceWrapper) GetIdentityDetails(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + + var err error + + // ------------- Path parameter "identifier" ------------- + var identifier PathIdentifier + + err = runtime.BindStyledParameterWithLocation("simple", false, "identifier", runtime.ParamLocationPath, chi.URLParam(r, "identifier"), &identifier) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) + return + } + + ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetIdentityDetails(w, r, identifier) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r.WithContext(ctx)) +} + // GetQrFromStore operation middleware func (siw *ServerInterfaceWrapper) GetQrFromStore(w http.ResponseWriter, r *http.Request) { ctx := r.Context() @@ -1020,6 +1076,9 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl r.Group(func(r chi.Router) { r.Post(options.BaseURL+"/v1/identities", wrapper.CreateIdentity) }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/v1/identities/{identifier}/details", wrapper.GetIdentityDetails) + }) r.Group(func(r chi.Router) { r.Get(options.BaseURL+"/v1/qr-store", wrapper.GetQrFromStore) }) @@ -1275,6 +1334,50 @@ func (response CreateIdentity500JSONResponse) VisitCreateIdentityResponse(w http return json.NewEncoder(w).Encode(response) } +type GetIdentityDetailsRequestObject struct { + Identifier PathIdentifier `json:"identifier"` +} + +type GetIdentityDetailsResponseObject interface { + VisitGetIdentityDetailsResponse(w http.ResponseWriter) error +} + +type GetIdentityDetails200JSONResponse GetIdentityDetailsResponse + +func (response GetIdentityDetails200JSONResponse) VisitGetIdentityDetailsResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + +type GetIdentityDetails400JSONResponse struct{ N400JSONResponse } + +func (response GetIdentityDetails400JSONResponse) VisitGetIdentityDetailsResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type GetIdentityDetails401JSONResponse struct{ N401JSONResponse } + +func (response GetIdentityDetails401JSONResponse) VisitGetIdentityDetailsResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + + return json.NewEncoder(w).Encode(response) +} + +type GetIdentityDetails500JSONResponse struct{ N500JSONResponse } + +func (response GetIdentityDetails500JSONResponse) VisitGetIdentityDetailsResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + + return json.NewEncoder(w).Encode(response) +} + type GetQrFromStoreRequestObject struct { Params GetQrFromStoreParams } @@ -1721,6 +1824,9 @@ type StrictServerInterface interface { // Create Identity // (POST /v1/identities) CreateIdentity(ctx context.Context, request CreateIdentityRequestObject) (CreateIdentityResponseObject, error) + // Identity Detail + // (GET /v1/identities/{identifier}/details) + GetIdentityDetails(ctx context.Context, request GetIdentityDetailsRequestObject) (GetIdentityDetailsResponseObject, error) // QrCode body // (GET /v1/qr-store) GetQrFromStore(ctx context.Context, request GetQrFromStoreRequestObject) (GetQrFromStoreResponseObject, error) @@ -1986,6 +2092,32 @@ func (sh *strictHandler) CreateIdentity(w http.ResponseWriter, r *http.Request) } } +// GetIdentityDetails operation middleware +func (sh *strictHandler) GetIdentityDetails(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) { + var request GetIdentityDetailsRequestObject + + request.Identifier = identifier + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.GetIdentityDetails(ctx, request.(GetIdentityDetailsRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "GetIdentityDetails") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(GetIdentityDetailsResponseObject); ok { + if err := validResponse.VisitGetIdentityDetailsResponse(w); err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } + } else if response != nil { + sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("unexpected response type: %T", response)) + } +} + // GetQrFromStore operation middleware func (sh *strictHandler) GetQrFromStore(w http.ResponseWriter, r *http.Request, params GetQrFromStoreParams) { var request GetQrFromStoreRequestObject diff --git a/internal/api/main_test.go b/internal/api/main_test.go index 6bb028f70..b707b32cb 100644 --- a/internal/api/main_test.go +++ b/internal/api/main_test.go @@ -48,6 +48,9 @@ func TestMain(m *testing.M) { URL: conn, }, KeyStore: config.VaultTest(), + Ethereum: config.Ethereum{ + URL: "https://polygon-mumbai.g.alchemy.com/v2/xaP2_", + }, } s, teardown, err := tests.NewTestStorage(&cfgForTesting) defer teardown() @@ -73,16 +76,27 @@ func TestMain(m *testing.M) { log.Error(ctx, "failed to create Iden3 Key Provider", "err", err) os.Exit(1) } + ethKeyProvider, err := kms.NewVaultPluginIden3KeyProvider(vaultCli, cfgForTesting.KeyStore.PluginIden3MountPath, kms.KeyTypeEthereum) + if err != nil { + log.Error(ctx, "failed to create Iden3 Key Provider", "err", err) + os.Exit(1) + } keyStore = kms.NewKMS() err = keyStore.RegisterKeyProvider(kms.KeyTypeBabyJubJub, bjjKeyProvider) if err != nil { - log.Error(ctx, "failed to register Key Provider", "err", err) + log.Error(ctx, "failed to register bjj Key Provider", "err", err) os.Exit(1) } - cfg.ServerUrl = "https://testing.env/" + err = keyStore.RegisterKeyProvider(kms.KeyTypeEthereum, ethKeyProvider) + if err != nil { + log.Error(ctx, "failed to register eth Key Provider", "err", err) + os.Exit(1) + } + cfg.ServerUrl = "https://testing.env/" + cfg.Ethereum = cfgForTesting.Ethereum schemaLoader = loader.NewDocumentLoader(ipfsGatewayURL) m.Run() diff --git a/internal/api/server.go b/internal/api/server.go index 25c88a525..d624ac2fc 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -11,6 +11,7 @@ import ( "github.com/go-chi/chi/v5" "github.com/google/uuid" + core "github.com/iden3/go-iden3-core/v2" "github.com/iden3/go-iden3-core/v2/w3c" "github.com/iden3/go-schema-processor/v2/verifiable" "github.com/iden3/iden3comm/v2" @@ -24,6 +25,7 @@ import ( "github.com/polygonid/sh-id-platform/internal/core/services" "github.com/polygonid/sh-id-platform/internal/gateways" "github.com/polygonid/sh-id-platform/internal/health" + "github.com/polygonid/sh-id-platform/internal/kms" "github.com/polygonid/sh-id-platform/internal/log" "github.com/polygonid/sh-id-platform/internal/repositories" "github.com/polygonid/sh-id-platform/pkg/schema" @@ -39,10 +41,11 @@ type Server struct { publisherGateway ports.Publisher packageManager *iden3comm.PackageManager health *health.Status + accountService ports.AccountService } // NewServer is a Server constructor -func NewServer(cfg *config.Configuration, identityService ports.IdentityService, claimsService ports.ClaimsService, qrService ports.QrStoreService, publisherGateway ports.Publisher, packageManager *iden3comm.PackageManager, health *health.Status) *Server { +func NewServer(cfg *config.Configuration, identityService ports.IdentityService, accountService ports.AccountService, claimsService ports.ClaimsService, qrService ports.QrStoreService, publisherGateway ports.Publisher, packageManager *iden3comm.PackageManager, health *health.Status) *Server { return &Server{ cfg: cfg, identityService: identityService, @@ -51,6 +54,7 @@ func NewServer(cfg *config.Configuration, identityService ports.IdentityService, publisherGateway: publisherGateway, packageManager: packageManager, health: health, + accountService: accountService, } } @@ -81,8 +85,22 @@ func (s *Server) CreateIdentity(ctx context.Context, request CreateIdentityReque method := request.Body.DidMetadata.Method blockchain := request.Body.DidMetadata.Blockchain network := request.Body.DidMetadata.Network + keyType := request.Body.DidMetadata.Type - identity, err := s.identityService.Create(ctx, method, blockchain, network, s.cfg.ServerUrl) + if keyType != "BJJ" && keyType != "ETH" { + return CreateIdentity400JSONResponse{ + N400JSONResponse{ + Message: "Type must be BJJ or ETH", + }, + }, nil + } + + identity, err := s.identityService.Create(ctx, s.cfg.ServerUrl, &ports.DIDCreationOptions{ + Method: core.DIDMethod(method), + Network: core.NetworkID(network), + Blockchain: core.Blockchain(blockchain), + KeyType: kms.KeyType(keyType), + }) if err != nil { if errors.Is(err, services.ErrWrongDIDMetada) { return CreateIdentity400JSONResponse{ @@ -109,6 +127,7 @@ func (s *Server) CreateIdentity(ctx context.Context, request CreateIdentityReque Status: string(identity.State.Status), TxID: identity.State.TxID, }, + Address: identity.Address, }, nil } @@ -148,6 +167,9 @@ func (s *Server) CreateClaim(ctx context.Context, request CreateClaimRequestObje if errors.Is(err, services.ErrLoadingSchema) { return CreateClaim400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil } + if errors.Is(err, services.ErrAssigningMTPProof) { + return CreateClaim400JSONResponse{N400JSONResponse{Message: err.Error()}}, nil + } return CreateClaim500JSONResponse{N500JSONResponse{Message: err.Error()}}, nil } return CreateClaim201JSONResponse{Id: resp.ID.String()}, nil @@ -436,6 +458,70 @@ func (s *Server) GetQrFromStore(ctx context.Context, request GetQrFromStoreReque return NewQrContentResponse(body), nil } +// GetIdentityDetails is the controller to get identity details +func (s *Server) GetIdentityDetails(ctx context.Context, request GetIdentityDetailsRequestObject) (GetIdentityDetailsResponseObject, error) { + userDID, err := w3c.ParseDID(request.Identifier) + if err != nil { + log.Error(ctx, "get identity details. Parsing did", "err", err) + return GetIdentityDetails400JSONResponse{ + N400JSONResponse{ + Message: "invalid did", + }, + }, err + } + + identity, err := s.identityService.GetByDID(ctx, *userDID) + if err != nil { + log.Error(ctx, "get identity details. Getting identity", "err", err) + return GetIdentityDetails500JSONResponse{ + N500JSONResponse{ + Message: err.Error(), + }, + }, err + } + + if identity.KeyType == string(kms.KeyTypeEthereum) { + did, err := w3c.ParseDID(identity.Identifier) + if err != nil { + log.Error(ctx, "get identity details. Parsing did", "err", err) + return GetIdentityDetails400JSONResponse{N400JSONResponse{Message: "invalid did"}}, nil + } + balance, err := s.accountService.GetBalanceByDID(ctx, did) + if err != nil { + log.Error(ctx, "get identity details. Getting balance", "err", err) + return GetIdentityDetails500JSONResponse{N500JSONResponse{Message: err.Error()}}, nil + } + identity.Balance = balance + } + + response := GetIdentityDetails200JSONResponse{ + Identifier: &identity.Identifier, + State: &IdentityState{ + BlockNumber: identity.State.BlockNumber, + BlockTimestamp: identity.State.BlockTimestamp, + ClaimsTreeRoot: identity.State.ClaimsTreeRoot, + CreatedAt: identity.State.CreatedAt, + ModifiedAt: identity.State.ModifiedAt, + PreviousState: identity.State.PreviousState, + RevocationTreeRoot: identity.State.RevocationTreeRoot, + RootOfRoots: identity.State.RootOfRoots, + State: identity.State.State, + Status: string(identity.State.Status), + TxID: identity.State.TxID, + }, + } + + if identity.Address != nil && *identity.Address != "" { + response.Address = identity.Address + } + + if identity.Balance != nil { + response.Balance = common.ToPointer(identity.Balance.String()) + } + + return response, nil +} + // RegisterStatic add method to the mux that are not documented in the API. func RegisterStatic(mux *chi.Mux) { mux.Get("/", documentation) diff --git a/internal/api/server_test.go b/internal/api/server_test.go index e3e94566f..49eb9de5b 100644 --- a/internal/api/server_test.go +++ b/internal/api/server_test.go @@ -38,6 +38,8 @@ func TestServer_CreateIdentity(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" + ETH = "ETH" ) identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() @@ -47,14 +49,19 @@ func TestServer_CreateIdentity(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + revocationSettings := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "host", } - claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) - server := NewServer(&cfg, identityService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), revocationSettings) + claimsConf := services.CredentialRevocationSettings{ + RHSEnabled: false, + Host: "host", + } + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) + accountService := services.NewAccountService(cfg.Ethereum, keyStore) + server := NewServer(&cfg, identityService, accountService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) handler := getHandler(context.Background(), server) type expected struct { @@ -77,14 +84,31 @@ func TestServer_CreateIdentity(t *testing.T) { }, }, { - name: "should create an identity", + name: "should create a BJJ identity", auth: authOk, input: CreateIdentityRequest{ DidMetadata: struct { - Blockchain string `json:"blockchain"` - Method string `json:"method"` - Network string `json:"network"` - }{Blockchain: blockchain, Method: method, Network: network}, + Blockchain string `json:"blockchain"` + Method string `json:"method"` + Network string `json:"network"` + Type CreateIdentityRequestDidMetadataType `json:"type"` + }{Blockchain: blockchain, Method: method, Network: network, Type: BJJ}, + }, + expected: expected{ + httpCode: 201, + message: nil, + }, + }, + { + name: "should create a ETH identity", + auth: authOk, + input: CreateIdentityRequest{ + DidMetadata: struct { + Blockchain string `json:"blockchain"` + Method string `json:"method"` + Network string `json:"network"` + Type CreateIdentityRequestDidMetadataType `json:"type"` + }{Blockchain: blockchain, Method: method, Network: network, Type: ETH}, }, expected: expected{ httpCode: 201, @@ -96,14 +120,15 @@ func TestServer_CreateIdentity(t *testing.T) { auth: authOk, input: CreateIdentityRequest{ DidMetadata: struct { - Blockchain string `json:"blockchain"` - Method string `json:"method"` - Network string `json:"network"` - }{Blockchain: blockchain, Method: method, Network: "mynetwork"}, + Blockchain string `json:"blockchain"` + Method string `json:"method"` + Network string `json:"network"` + Type CreateIdentityRequestDidMetadataType `json:"type"` + }{Blockchain: blockchain, Method: method, Network: "mynetwork", Type: BJJ}, }, expected: expected{ httpCode: 400, - message: common.ToPointer("cannot create identity: wrong DID Metadata"), + message: common.ToPointer("cannot create identity: can't add genesis claims to tree: wrong DID Metadata"), }, }, { @@ -111,14 +136,15 @@ func TestServer_CreateIdentity(t *testing.T) { auth: authOk, input: CreateIdentityRequest{ DidMetadata: struct { - Blockchain string `json:"blockchain"` - Method string `json:"method"` - Network string `json:"network"` - }{Blockchain: blockchain, Method: "my method", Network: network}, + Blockchain string `json:"blockchain"` + Method string `json:"method"` + Network string `json:"network"` + Type CreateIdentityRequestDidMetadataType `json:"type"` + }{Blockchain: blockchain, Method: "my method", Network: network, Type: BJJ}, }, expected: expected{ httpCode: 400, - message: common.ToPointer("cannot create identity: wrong DID Metadata"), + message: common.ToPointer("cannot create identity: can't add genesis claims to tree: wrong DID Metadata"), }, }, { @@ -126,14 +152,31 @@ func TestServer_CreateIdentity(t *testing.T) { auth: authOk, input: CreateIdentityRequest{ DidMetadata: struct { - Blockchain string `json:"blockchain"` - Method string `json:"method"` - Network string `json:"network"` - }{Blockchain: "my blockchain", Method: method, Network: network}, + Blockchain string `json:"blockchain"` + Method string `json:"method"` + Network string `json:"network"` + Type CreateIdentityRequestDidMetadataType `json:"type"` + }{Blockchain: "my blockchain", Method: method, Network: network, Type: BJJ}, + }, + expected: expected{ + httpCode: 400, + message: common.ToPointer("cannot create identity: can't add genesis claims to tree: wrong DID Metadata"), + }, + }, + { + name: "should return an error wrong type", + auth: authOk, + input: CreateIdentityRequest{ + DidMetadata: struct { + Blockchain string `json:"blockchain"` + Method string `json:"method"` + Network string `json:"network"` + Type CreateIdentityRequestDidMetadataType `json:"type"` + }{Blockchain: "my blockchain", Method: method, Network: network, Type: "a wrong type"}, }, expected: expected{ httpCode: 400, - message: common.ToPointer("cannot create identity: wrong DID Metadata"), + message: common.ToPointer("Type must be BJJ or ETH"), }, }, } { @@ -142,20 +185,23 @@ func TestServer_CreateIdentity(t *testing.T) { req, err := http.NewRequest("POST", "/v1/identities", tests.JSONBody(t, tc.input)) req.SetBasicAuth(tc.auth()) require.NoError(t, err) - handler.ServeHTTP(rr, req) - require.Equal(t, tc.expected.httpCode, rr.Code) switch tc.expected.httpCode { case http.StatusCreated: var response CreateIdentityResponse require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) - assert.NotNil(t, *response.State.ClaimsTreeRoot) assert.NotNil(t, response.State.CreatedAt) assert.NotNil(t, response.State.ModifiedAt) assert.NotNil(t, response.State.State) assert.NotNil(t, response.State.Status) assert.NotNil(t, *response.Identifier) + if tc.input.DidMetadata.Type == BJJ { + assert.NotNil(t, *response.State.ClaimsTreeRoot) + } + if tc.input.DidMetadata.Type == ETH { + assert.NotNil(t, *response.Address) + } case http.StatusBadRequest: var response CreateIdentity400JSONResponse assert.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) @@ -174,14 +220,18 @@ func TestServer_RevokeClaim(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + revocationSettings := services.CredentialRevocationSettings{ + RHSEnabled: false, + Host: "host", + } + identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), revocationSettings) + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "host", } claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) - - server := NewServer(&cfg, identityService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) + accountService := services.NewAccountService(cfg.Ethereum, keyStore) + server := NewServer(&cfg, identityService, accountService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) idStr := "did:polygonid:polygon:mumbai:2qM77fA6NGGWL9QEeb1dv2VA6wz5svcohgv61LZ7wB" identity := &domain.Identity{ @@ -314,6 +364,7 @@ func TestServer_CreateClaim(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -325,19 +376,19 @@ func TestServer_CreateClaim(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - - claimsConf := services.ClaimCfg{ + claimCfg := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } - pubSub := pubsub.NewMock() - claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubSub, ipfsGatewayURL) - server := NewServer(&cfg, identityService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimCfg) + pubSub := pubsub.NewMock() + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimCfg, pubSub, ipfsGatewayURL) + accountService := services.NewAccountService(cfg.Ethereum, keyStore) + server := NewServer(&cfg, identityService, accountService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) handler := getHandler(ctx, server) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "http://polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did := iden.Identifier @@ -371,8 +422,8 @@ func TestServer_CreateClaim(t *testing.T) { CredentialSchema: "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json", Type: "KYCAgeCredential", CredentialSubject: map[string]any{ - "id": "did:polygonid:polygon:mumbai:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ", - "birthday": 19960424, + "id": "did:polygonid:polygon:mumbai:2qFDkNkWePjd6URt6kGQX14a7wVKhBZt8bpy7HZJZi", + "birthday": 19960425, "documentType": 2, }, Expiration: common.ToPointer(time.Now().Unix()), @@ -391,7 +442,7 @@ func TestServer_CreateClaim(t *testing.T) { CredentialSchema: "ipfs://QmQVeb5dkz5ekDqBrYVVxBFQZoCbzamnmMUn9B8twCEgDL", Type: "testNewType", CredentialSubject: map[string]any{ - "id": "did:polygonid:polygon:mumbai:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ", + "id": "did:polygonid:polygon:mumbai:2qFDkNkWePjd6URt6kGQX14a7wVKhBZt8bpy7HZJZi", "testNewTypeInt": 1234, }, Expiration: common.ToPointer(time.Now().Unix()), @@ -484,13 +535,15 @@ func TestServer_GetIdentities(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "host", } + identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) - server := NewServer(&cfg, identityService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) + accountService := services.NewAccountService(cfg.Ethereum, keyStore) + server := NewServer(&cfg, identityService, accountService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) handler := getHandler(context.Background(), server) idStr1 := "did:polygonid:polygon:mumbai:2qE1ZT16aqEWhh9mX9aqM2pe2ZwV995dTkReeKwCaQ" @@ -557,14 +610,15 @@ func TestServer_GetClaimQrCode(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "host", } + identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + idStr := "did:polygonid:polygon:mumbai:2qPrv5Yx8s1qAmEnPym68LfT7gTbASGampiGU7TseL" idNoClaims := "did:polygonid:polygon:mumbai:2qGjTUuxZKqKS4Q8UmxHUPw55g15QgEVGnj6Wkq8Vk" - + accountService := services.NewAccountService(cfg.Ethereum, keyStore) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) identity := &domain.Identity{ @@ -577,7 +631,7 @@ func TestServer_GetClaimQrCode(t *testing.T) { claim := fixture.NewClaim(t, identity.Identifier) fixture.CreateClaim(t, claim) - server := NewServer(&cfg, identityService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) + server := NewServer(&cfg, identityService, accountService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) handler := getHandler(context.Background(), server) type expected struct { @@ -703,15 +757,15 @@ func TestServer_GetClaim(t *testing.T) { revocationRepository := repositories.NewRevocation() connectionsRepository := repositories.NewConnections() rhsp := reverse_hash.NewRhsPublisher(nil, false) - identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "host", } + identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) - server := NewServer(&cfg, identityService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) + accountService := services.NewAccountService(cfg.Ethereum, keyStore) + server := NewServer(&cfg, identityService, accountService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) idStr := "did:polygonid:polygon:mumbai:2qLduMv2z7hnuhzkcTWesCUuJKpRVDEThztM4tsJUj" idStrWithoutClaims := "did:polygonid:polygon:mumbai:2qGjTUuxZKqKS4Q8UmxHUPw55g15QgEVGnj6Wkq8Vk" @@ -866,6 +920,7 @@ func TestServer_GetClaims(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) identityRepo := repositories.NewIdentity() claimsRepo := repositories.NewClaims() @@ -875,18 +930,20 @@ func TestServer_GetClaims(t *testing.T) { mtService := services.NewIdentityMerkleTrees(mtRepo) rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) fixture := tests.NewFixture(storage) - server := NewServer(&cfg, identityService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) + + accountService := services.NewAccountService(cfg.Ethereum, keyStore) + server := NewServer(&cfg, identityService, accountService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) ctx := context.Background() - identityMultipleClaims, err := server.identityService.Create(ctx, method, blockchain, network, "https://localhost.com") + identityMultipleClaims, err := server.identityService.Create(ctx, "https://localhost.com", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) claim := fixture.NewClaim(t, identityMultipleClaims.Identifier) @@ -1191,6 +1248,7 @@ func TestServer_GetRevocationStatus(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := context.Background() identityRepo := repositories.NewIdentity() @@ -1201,16 +1259,17 @@ func TestServer_GetRevocationStatus(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "https://host.com", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) - identity, err := identityService.Create(ctx, method, blockchain, network, "http://localhost:3001") + identity, err := identityService.Create(ctx, "http://localhost:3001", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) assert.NoError(t, err) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) - server := NewServer(&cfg, identityService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) + accountService := services.NewAccountService(cfg.Ethereum, keyStore) + server := NewServer(&cfg, identityService, accountService, claimsService, nil, NewPublisherMock(), NewPackageManagerMock(), nil) handler := getHandler(context.Background(), server) schema := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" diff --git a/internal/api_ui/server_test.go b/internal/api_ui/server_test.go index 73316bfd7..39bd1df23 100644 --- a/internal/api_ui/server_test.go +++ b/internal/api_ui/server_test.go @@ -45,13 +45,13 @@ func TestServer_CheckStatus(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - schemaService := services.NewSchema(repositories.NewSchema(*storage), schemaLoader) - - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "host", } + identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + schemaService := services.NewSchema(repositories.NewSchema(*storage), schemaLoader) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) server := NewServer(&cfg, identityService, claimsService, schemaService, NewConnectionsMock(), NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), &health.Status{}) @@ -129,8 +129,11 @@ func TestServer_AuthQRCode(t *testing.T) { rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() sessionRepository := repositories.NewSessionCached(cachex) - - identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, sessionRepository, pubsub.NewMock()) + claimsConf := services.CredentialRevocationSettings{ + RHSEnabled: false, + Host: "host", + } + identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, sessionRepository, pubsub.NewMock(), claimsConf) server := NewServer(&cfg, identityService, NewClaimsMock(), NewSchemaMock(), NewConnectionsMock(), NewLinkMock(), qrService, NewPublisherMock(), NewPackageManagerMock(), nil) issuerDID, err := w3c.ParseDID("did:polygonid:polygon:mumbai:2qE1BZ7gcmEoP2KppvFPCZqyzyb5tK9T6Gec5HFANQ") require.NoError(t, err) @@ -639,6 +642,7 @@ func TestServer_DeleteConnection(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -649,15 +653,16 @@ func TestServer_DeleteConnection(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) issuerDID, err := w3c.ParseDID(iden.Identifier) @@ -890,6 +895,7 @@ func TestServer_RevokeConnectionCredentials(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -900,15 +906,16 @@ func TestServer_RevokeConnectionCredentials(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) issuerDID, err := w3c.ParseDID(iden.Identifier) @@ -1003,6 +1010,7 @@ func TestServer_CreateCredential(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -1013,15 +1021,15 @@ func TestServer_CreateCredential(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) pubSub := pubsub.NewMock() claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubSub, ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -1065,6 +1073,7 @@ func TestServer_CreateCredential(t *testing.T) { }, Expiration: common.ToPointer(time.Now()), SignatureProof: common.ToPointer(true), + MtProof: common.ToPointer(true), }, expected: expected{ response: CreateCredential201JSONResponse{}, @@ -1192,11 +1201,11 @@ func TestServer_DeleteCredential(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) server := NewServer(&cfg, NewIdentityMock(), claimsService, NewSchemaMock(), NewConnectionsMock(), NewLinkMock(), nil, NewPublisherMock(), NewPackageManagerMock(), nil) @@ -1287,6 +1296,7 @@ func TestServer_GetCredential(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -1297,14 +1307,15 @@ func TestServer_GetCredential(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -1480,6 +1491,7 @@ func TestServer_GetCredentials(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -1491,15 +1503,16 @@ func TestServer_GetCredentials(t *testing.T) { schemaRepository := repositories.NewSchema(*storage) rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) schemaService := services.NewSchema(schemaRepository, schemaLoader) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -1760,6 +1773,7 @@ func TestServer_GetCredentialQrCode(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -1771,14 +1785,15 @@ func TestServer_GetCredentialQrCode(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, qrService, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -1887,6 +1902,7 @@ func TestServer_GetConnection(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -1897,15 +1913,15 @@ func TestServer_GetConnection(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -2074,6 +2090,7 @@ func TestServer_GetConnections(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -2084,15 +2101,16 @@ func TestServer_GetConnections(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -2529,6 +2547,7 @@ func TestServer_RevokeCredential(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -2539,16 +2558,17 @@ func TestServer_RevokeCredential(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "host", } + identityService := services.NewIdentity(&KMSMock{}, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) fixture := tests.NewFixture(storage) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -2666,6 +2686,7 @@ func TestServer_CreateLink(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) @@ -2681,16 +2702,17 @@ func TestServer_CreateLink(t *testing.T) { linkRepository := repositories.NewLink(*storage) schemaRespository := repositories.NewSchema(*storage) sessionRepository := repositories.NewSessionCached(cachex) - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + pubSub := pubsub.NewMock() claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubSub, ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRespository, schemaLoader, sessionRepository, pubSub, ipfsGatewayURL) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -2894,6 +2916,7 @@ func TestServer_ActivateLink(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) @@ -2909,15 +2932,15 @@ func TestServer_ActivateLink(t *testing.T) { linkRepository := repositories.NewLink(*storage) schemaRepository := repositories.NewSchema(*storage) sessionRepository := repositories.NewSessionCached(cachex) - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -3045,6 +3068,7 @@ func TestServer_GetLink(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) @@ -3060,15 +3084,15 @@ func TestServer_GetLink(t *testing.T) { linkRepository := repositories.NewLink(*storage) schemaRepository := repositories.NewSchema(*storage) sessionRepository := repositories.NewSessionCached(cachex) - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -3216,6 +3240,7 @@ func TestServer_GetAllLinks(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" sUrl = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) @@ -3231,15 +3256,15 @@ func TestServer_GetAllLinks(t *testing.T) { linkRepository := repositories.NewLink(*storage) schemaRepository := repositories.NewSchema(*storage) sessionRepository := repositories.NewSessionCached(cachex) - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -3431,6 +3456,7 @@ func TestServer_DeleteLink(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) @@ -3446,15 +3472,16 @@ func TestServer_DeleteLink(t *testing.T) { connectionsRepository := repositories.NewConnections() linkRepository := repositories.NewLink(*storage) sessionRepository := repositories.NewSessionCached(cachex) - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -3548,6 +3575,7 @@ func TestServer_DeleteLinkForDifferentDID(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) @@ -3563,18 +3591,18 @@ func TestServer_DeleteLinkForDifferentDID(t *testing.T) { linkRepository := repositories.NewLink(*storage) schemaRepository := repositories.NewSchema(*storage) sessionRepository := repositories.NewSessionCached(cachex) - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) - iden2, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden2, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -3662,6 +3690,7 @@ func TestServer_CreateLinkQRCode(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) @@ -3678,15 +3707,16 @@ func TestServer_CreateLinkQRCode(t *testing.T) { linkRepository := repositories.NewLink(*storage) schemaRepository := repositories.NewSchema(*storage) sessionRepository := repositories.NewSessionCached(cachex) - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, qrService, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) linkService := services.NewLinkService(storage, claimsService, qrService, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -3812,6 +3842,7 @@ func TestServer_GetLinkQRCode(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" schemaType = "KYCCountryOfResidenceCredential" ) @@ -3827,15 +3858,16 @@ func TestServer_GetLinkQRCode(t *testing.T) { linkRepository := repositories.NewLink(*storage) schemaRepository := repositories.NewSchema(*storage) sessionRepository := repositories.NewSessionCached(cachex) - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) linkService := services.NewLinkService(storage, claimsService, nil, claimsRepo, linkRepository, schemaRepository, schemaLoader, sessionRepository, pubsub.NewMock(), ipfsGatewayURL) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -3988,6 +4020,7 @@ func TestServer_GetStateStatus(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -3998,11 +4031,11 @@ func TestServer_GetStateStatus(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) schema := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" @@ -4013,7 +4046,7 @@ func TestServer_GetStateStatus(t *testing.T) { } typeC := "KYCAgeCredential" merklizedRootPosition := "index" - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -4094,6 +4127,7 @@ func TestServer_GetStateTransactions(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -4104,14 +4138,14 @@ func TestServer_GetStateTransactions(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubsub.NewMock(), ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) @@ -4182,6 +4216,7 @@ func TestServer_GetRevocationStatus(t *testing.T) { method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) ctx := log.NewContext(context.Background(), log.LevelDebug, log.OutputText, os.Stdout) identityRepo := repositories.NewIdentity() @@ -4192,15 +4227,15 @@ func TestServer_GetRevocationStatus(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) pubSub := pubsub.NewMock() claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, schemaLoader, storage, claimsConf, pubSub, ipfsGatewayURL) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) diff --git a/internal/common/util.go b/internal/common/util.go index 1108c2185..eb933065c 100644 --- a/internal/common/util.go +++ b/internal/common/util.go @@ -142,6 +142,38 @@ func ArrayStringToBigInt(s []string) ([]*big.Int, error) { return o, nil } +// ArrayOfStringArraysToBigInt converts array of string arrays to array of +// big int arrays +func ArrayOfStringArraysToBigInt(s [][]string) ([][]*big.Int, error) { + var o [][]*big.Int + for i := 0; i < len(s); i++ { + si, err := ArrayStringToBigInt(s[i]) + if err != nil { + return o, nil + } + o = append(o, si) + } + return o, nil +} + +// CheckEthIdentityByDID returns true and address if DID is ETH identity. +func CheckEthIdentityByDID(did *w3c.DID) (isEthIdentity bool, address string, err error) { + id, err := core.IDFromDID(*did) + if err != nil { + return false, "", err + } + // if err nil - ETH identity + addr, err := core.EthAddressFromID(id) + if err == nil { + // ETH identity + addressString := fmt.Sprintf("%x", addr) + return true, addressString, nil + } else if err.Error() != "can't get Ethereum address: high bytes of genesis are not zero" { + return false, "", err + } + return false, "", nil +} + func stringToBigInt(s string) (*big.Int, error) { base := 10 if bytes.HasPrefix([]byte(s), []byte("0x")) { diff --git a/internal/config/config.go b/internal/config/config.go index c61a53c3d..0cc0d0400 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -72,18 +72,20 @@ type ReverseHashService struct { // Ethereum struct type Ethereum struct { - URL string `tip:"Ethereum url"` - ContractAddress string `tip:"Contract Address"` - DefaultGasLimit int `tip:"Default Gas Limit"` - ConfirmationTimeout time.Duration `tip:"Confirmation timeout"` - ConfirmationBlockCount int64 `tip:"Confirmation block count"` - ReceiptTimeout time.Duration `tip:"Receipt timeout"` - MinGasPrice int `tip:"Minimum Gas Price"` - MaxGasPrice int `tip:"The Datasource name locator"` - RPCResponseTimeout time.Duration `tip:"RPC Response timeout"` - WaitReceiptCycleTime time.Duration `tip:"Wait Receipt Cycle Time"` - WaitBlockCycleTime time.Duration `tip:"Wait Block Cycle Time"` - ResolverPrefix string `tip:"blockchain:network e.g polygon:mumbai"` + URL string `tip:"Ethereum url"` + ContractAddress string `tip:"Contract Address"` + DefaultGasLimit int `tip:"Default Gas Limit"` + ConfirmationTimeout time.Duration `tip:"Confirmation timeout"` + ConfirmationBlockCount int64 `tip:"Confirmation block count"` + ReceiptTimeout time.Duration `tip:"Receipt timeout"` + MinGasPrice int `tip:"Minimum Gas Price"` + MaxGasPrice int `tip:"The Datasource name locator"` + RPCResponseTimeout time.Duration `tip:"RPC Response timeout"` + WaitReceiptCycleTime time.Duration `tip:"Wait Receipt Cycle Time"` + WaitBlockCycleTime time.Duration `tip:"Wait Block Cycle Time"` + ResolverPrefix string `tip:"blockchain:network e.g polygon:mumbai"` + InternalTransferAmountWei int64 `tip:"Internal transfer amount in wei"` + TransferAccountKeyPath string `tip:"Transfer account key path"` } // Prover struct @@ -143,6 +145,7 @@ type APIUI struct { IdentityMethod string `mapstructure:"IdentityMethod" tip:"Server UI API backend Identity Method"` IdentityBlockchain string `mapstructure:"IdentityBlockchain" tip:"Server UI API backend Identity Blockchain"` IdentityNetwork string `mapstructure:"IdentityNetwork" tip:"Server UI API backend Identity Network"` + KeyType string `mapstructure:"KeyType" tip:"Server UI API backend Key Type"` } // APIUIAuth configuration. Some of the UI API endpoints are protected with basic http auth. Here you can set the @@ -279,7 +282,7 @@ func Load(fileName string) (*Configuration, error) { // VaultTest returns the vault configuration to be used in tests. // The vault token is obtained from environment vars. -// If there is not env var, it will try to parse the init.out file +// If there is no env var, it will try to parse the init.out file // created by local docker image provided for TESTING purposes. func VaultTest() KeyStore { return KeyStore{ @@ -360,6 +363,8 @@ func bindEnv() { _ = viper.BindEnv("Ethereum.WaitReceiptCycleTime", "ISSUER_ETHEREUM_WAIT_RECEIPT_CYCLE_TIME") _ = viper.BindEnv("Ethereum.WaitBlockCycleTime", "ISSUER_ETHEREUM_WAIT_BLOCK_CYCLE_TIME") _ = viper.BindEnv("Ethereum.ResolverPrefix", "ISSUER_ETHEREUM_RESOLVER_PREFIX") + _ = viper.BindEnv("Ethereum.InternalTransferAmountWei", "ISSUER_INTERNAL_TRANSFER_AMOUNT_WEI") + _ = viper.BindEnv("Ethereum.TransferAccountKeyPath", "ISSUER_ETHEREUM_TRANSFER_ACCOUNT_KEY_PATH") _ = viper.BindEnv("Prover.ServerURL", "ISSUER_PROVER_SERVER_URL") _ = viper.BindEnv("Prover.ResponseTimeout", "ISSUER_PROVER_TIMEOUT") @@ -369,6 +374,9 @@ func bindEnv() { _ = viper.BindEnv("Cache.RedisUrl", "ISSUER_REDIS_URL") _ = viper.BindEnv("SchemaCache", "ISSUER_SCHEMA_CACHE") + _ = viper.BindEnv("VaultUserPassAuthEnabled", "ISSUER_VAULT_USERPASS_AUTH_ENABLED") + _ = viper.BindEnv("VaultUserPassAuthPassword", "ISSUER_VAULT_USERPASS_AUTH_PASSWORD") + _ = viper.BindEnv("APIUI.ServerPort", "ISSUER_API_UI_SERVER_PORT") _ = viper.BindEnv("APIUI.ServerURL", "ISSUER_API_UI_SERVER_URL") _ = viper.BindEnv("APIUI.APIUIAuth.User", "ISSUER_API_UI_AUTH_USER") @@ -380,9 +388,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("VaultUserPassAuthEnabled", "ISSUER_VAULT_USERPASS_AUTH_ENABLED") - _ = viper.BindEnv("VaultUserPassAuthPassword", "ISSUER_VAULT_USERPASS_AUTH_PASSWORD") + _ = viper.BindEnv("APIUI.KeyType", "ISSUER_API_KEY_TYPE") viper.AutomaticEnv() } @@ -503,6 +509,11 @@ func checkEnvVars(ctx context.Context, cfg *Configuration) { cfg.SchemaCache = common.ToPointer(false) } + if cfg.APIUI.KeyType == "" { + log.Info(ctx, "ISSUER_KEY_TYPE is missing and the server set up it as BJJ") + cfg.APIUI.KeyType = "BJJ" + } + if cfg.APIUI.ServerPort == 0 { log.Info(ctx, "ISSUER_API_UI_SERVER_PORT value is missing") } diff --git a/internal/core/domain/claim.go b/internal/core/domain/claim.go index 9dc611dca..0b661fd02 100644 --- a/internal/core/domain/claim.go +++ b/internal/core/domain/claim.go @@ -4,12 +4,14 @@ import ( "database/sql/driver" "encoding/hex" "encoding/json" + "errors" "fmt" "time" "github.com/google/uuid" "github.com/iden3/go-circuits/v2" core "github.com/iden3/go-iden3-core/v2" + "github.com/iden3/go-iden3-core/v2/w3c" "github.com/iden3/go-schema-processor/v2/verifiable" "github.com/jackc/pgtype" @@ -170,3 +172,53 @@ func (c *Claim) GetCircuitIncProof() (circuits.MTProof, error) { }, }, nil } + +// NewClaimModel creates domain.Claim with common fields filled from core.Claim +func NewClaimModel(jsonSchemaURL string, credentialType string, coreClaim core.Claim, did *w3c.DID) (*Claim, error) { + hindex, err := coreClaim.HIndex() + if err != nil { + return nil, errors.Join(err) + } + + schemaHash := coreClaim.GetSchemaHash() + + claimModel := Claim{ + SchemaHash: hex.EncodeToString(schemaHash[:]), + SchemaURL: jsonSchemaURL, + SchemaType: credentialType, + Updatable: coreClaim.GetFlagUpdatable(), + Version: coreClaim.GetVersion(), + RevNonce: RevNonceUint64(coreClaim.GetRevocationNonce()), + CoreClaim: CoreClaim(coreClaim), + HIndex: hindex.String(), + } + + if did != nil { + var claimID, id core.ID + id, err = core.IDFromDID(*did) + if err != nil { + return nil, err + } + + claimID, err = coreClaim.GetID() + if err != nil { + return nil, nil + } + + if claimID != id { + return nil, errors.New("claim has ID, but it's not match with DID") + } + claimModel.OtherIdentifier = did.String() + } else { + _, err = coreClaim.GetID() + if !errors.Is(err, core.ErrNoID) { + return nil, errors.New("claim has ID, but no DID") + } + } + + if expDate, ok := coreClaim.GetExpirationDate(); ok { + claimModel.Expiration = expDate.Unix() + } + + return &claimModel, nil +} diff --git a/internal/core/domain/identity.go b/internal/core/domain/identity.go index 2e7122681..64b94f46e 100644 --- a/internal/core/domain/identity.go +++ b/internal/core/domain/identity.go @@ -1,20 +1,45 @@ package domain -import "github.com/iden3/go-iden3-core/v2/w3c" +import ( + "math/big" + + "github.com/iden3/go-iden3-core/v2/w3c" + + "github.com/polygonid/sh-id-platform/internal/common" + "github.com/polygonid/sh-id-platform/internal/kms" +) // Identity struct type Identity struct { Identifier string State IdentityState + Relay string `json:"relay"` + Immutable bool `json:"immutable"` + KeyType string `json:"keyType"` + Address *string `json:"address"` + Balance *big.Int `json:"balance"` } // NewIdentityFromIdentifier default identity model from identity and root state -func NewIdentityFromIdentifier(id *w3c.DID, rootState string) *Identity { +func NewIdentityFromIdentifier(did *w3c.DID, rootState string) (*Identity, error) { + keyType := string(kms.KeyTypeBabyJubJub) + isEthIdentity, address, err := common.CheckEthIdentityByDID(did) + if err != nil { + return nil, err + } + if isEthIdentity { + keyType = string(kms.KeyTypeEthereum) + } + return &Identity{ - Identifier: id.String(), + Identifier: did.String(), + Relay: "", + Immutable: false, + KeyType: keyType, + Address: &address, State: IdentityState{ - Identifier: id.String(), + Identifier: did.String(), State: &rootState, }, - } + }, nil } diff --git a/internal/core/domain/schema.go b/internal/core/domain/schema.go index 5e241d3c8..43978042a 100644 --- a/internal/core/domain/schema.go +++ b/internal/core/domain/schema.go @@ -17,6 +17,7 @@ const ( AuthBJJCredentialSchemaType = "https://schema.iden3.io/core/jsonld/auth.jsonld#AuthBJJCredential" AuthBJJCredentialJSONLDContext = "https://schema.iden3.io/core/jsonld/auth.jsonld" + AuthBJJCredentialTypeID = "https://schema.iden3.io/core/jsonld/auth.jsonld#AuthBJJCredential" ) // SchemaFormat type diff --git a/internal/core/ports/account_service.go b/internal/core/ports/account_service.go new file mode 100644 index 000000000..ee166ad37 --- /dev/null +++ b/internal/core/ports/account_service.go @@ -0,0 +1,13 @@ +package ports + +import ( + "context" + "math/big" + + "github.com/iden3/go-iden3-core/v2/w3c" +) + +// AccountService is a service for account operations +type AccountService interface { + GetBalanceByDID(ctx context.Context, did *w3c.DID) (*big.Int, error) +} diff --git a/internal/core/ports/identity_service.go b/internal/core/ports/identity_service.go index e625a8846..b4559450c 100644 --- a/internal/core/ports/identity_service.go +++ b/internal/core/ports/identity_service.go @@ -13,10 +13,18 @@ import ( "github.com/polygonid/sh-id-platform/internal/kms" ) +// DIDCreationOptions represents options for DID creation +type DIDCreationOptions struct { + Method core.DIDMethod `json:"method"` + Blockchain core.Blockchain `json:"blockchain"` + Network core.NetworkID `json:"network"` + KeyType kms.KeyType `json:"keyType"` +} + // IdentityService is the interface implemented by the identity service type IdentityService interface { GetByDID(ctx context.Context, identifier w3c.DID) (*domain.Identity, error) - Create(ctx context.Context, DIDMethod string, Blockchain, NetworkID, hostURL string) (*domain.Identity, error) + Create(ctx context.Context, hostURL string, didOptions *DIDCreationOptions) (*domain.Identity, error) SignClaimEntry(ctx context.Context, authClaim *domain.Claim, claimEntry *core.Claim) (*verifiable.BJJSignatureProof2021, error) Get(ctx context.Context) (identities []string, err error) UpdateState(ctx context.Context, did w3c.DID) (*domain.IdentityState, error) diff --git a/internal/core/ports/ZKGenerator.go b/internal/core/ports/zk_generator.go similarity index 64% rename from internal/core/ports/ZKGenerator.go rename to internal/core/ports/zk_generator.go index 8e3a8eff2..c8c2afa73 100644 --- a/internal/core/ports/ZKGenerator.go +++ b/internal/core/ports/zk_generator.go @@ -4,10 +4,10 @@ import ( "context" "encoding/json" - "github.com/polygonid/sh-id-platform/internal/core/domain" + "github.com/iden3/go-rapidsnark/types" ) // ZKGenerator interface type ZKGenerator interface { - Generate(ctx context.Context, inputs json.RawMessage, circuitName string) (*domain.FullProof, error) + Generate(ctx context.Context, inputs json.RawMessage, circuitName string) (*types.ZKProof, error) } diff --git a/internal/core/services/account.go b/internal/core/services/account.go new file mode 100644 index 000000000..082c6b353 --- /dev/null +++ b/internal/core/services/account.go @@ -0,0 +1,64 @@ +package services + +import ( + "context" + "math/big" + + ethCommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" + core "github.com/iden3/go-iden3-core/v2" + "github.com/iden3/go-iden3-core/v2/w3c" + + "github.com/polygonid/sh-id-platform/internal/config" + "github.com/polygonid/sh-id-platform/internal/kms" + "github.com/polygonid/sh-id-platform/internal/log" + "github.com/polygonid/sh-id-platform/pkg/blockchain/eth" +) + +// AccountService is a service for account operations +type AccountService struct { + rpcURL string + kms *kms.KMS + ethClient *eth.Client +} + +// NewAccountService returns new account service +func NewAccountService(ethConfig config.Ethereum, keyStore *kms.KMS) *AccountService { + commonClient, err := ethclient.Dial(ethConfig.URL) + if err != nil { + log.Warn(context.Background(), "cannot init eth client", "err", err) + } + ethClient := eth.NewClient(commonClient, ð.ClientConfig{ + DefaultGasLimit: ethConfig.DefaultGasLimit, + ConfirmationTimeout: ethConfig.ConfirmationTimeout, + ConfirmationBlockCount: ethConfig.ConfirmationBlockCount, + ReceiptTimeout: ethConfig.ReceiptTimeout, + MinGasPrice: big.NewInt(int64(ethConfig.MinGasPrice)), + MaxGasPrice: big.NewInt(int64(ethConfig.MaxGasPrice)), + RPCResponseTimeout: ethConfig.RPCResponseTimeout, + WaitReceiptCycleTime: ethConfig.WaitReceiptCycleTime, + WaitBlockCycleTime: ethConfig.WaitBlockCycleTime, + }, keyStore) + + return &AccountService{ + rpcURL: ethConfig.URL, + kms: keyStore, + ethClient: ethClient, + } +} + +// GetBalanceByDID returns balance by DID +func (as *AccountService) GetBalanceByDID(ctx context.Context, did *w3c.DID) (*big.Int, error) { + id, err := core.IDFromDID(*did) + if err != nil { + log.Error(ctx, "cannot get id from DID", "err", err) + return nil, err + } + ethAddress, err := core.EthAddressFromID(id) + if err != nil { + log.Error(ctx, "cannot get eth address from id", "err", err) + return nil, err + } + commonAddress := ethCommon.BytesToAddress(ethAddress[:]) + return as.ethClient.BalanceAt(ctx, commonAddress) +} diff --git a/internal/core/services/claims.go b/internal/core/services/claims.go index 0a1d36ffe..211b09b1d 100644 --- a/internal/core/services/claims.go +++ b/internal/core/services/claims.go @@ -48,15 +48,17 @@ var ( ErrInvalidCredentialSubject = errors.New("credential subject does not match the provided schema") // ErrInvalidCredentialSubject means the credentialSubject does not match the schema provided ) -// ClaimCfg claim service configuration -type ClaimCfg struct { - RHSEnabled bool // ReverseHash Enabled - RHSUrl string - Host string +// CredentialRevocationSettings claim service configuration +type CredentialRevocationSettings struct { + RHSEnabled bool // ReverseHash Enabled + RHSUrl string + Host string + AgentIden3URL string + AgentIden3Enabled bool } type claim struct { - cfg ClaimCfg + cfg CredentialRevocationSettings icRepo ports.ClaimsRepository identitySrv ports.IdentityService mtService ports.MtService @@ -69,9 +71,9 @@ type claim struct { } // NewClaim creates a new claim service -func NewClaim(repo ports.ClaimsRepository, idenSrv ports.IdentityService, qrService ports.QrStoreService, mtService ports.MtService, identityStateRepository ports.IdentityStateRepository, ld loader.DocumentLoader, storage *db.Storage, cfg ClaimCfg, ps pubsub.Publisher, ipfsGatewayURL string) ports.ClaimsService { +func NewClaim(repo ports.ClaimsRepository, idenSrv ports.IdentityService, qrService ports.QrStoreService, mtService ports.MtService, identityStateRepository ports.IdentityStateRepository, ld loader.DocumentLoader, storage *db.Storage, cfg CredentialRevocationSettings, ps pubsub.Publisher, ipfsGatewayURL string) ports.ClaimsService { s := &claim{ - cfg: ClaimCfg{ + cfg: CredentialRevocationSettings{ RHSEnabled: cfg.RHSEnabled, RHSUrl: cfg.RHSUrl, Host: cfg.Host, @@ -173,7 +175,7 @@ func (c *claim) CreateCredential(ctx context.Context, req *ports.CreateClaimRequ Updatable: false, } if c.ipfsClient != nil { - opts.MerklizerOpts = []merklize.MerklizeOption{merklize.WithIPFSClient(c.ipfsClient)} + opts.MerklizerOpts = []merklize.MerklizeOption{merklize.WithDocumentLoader(c.loader)} } coreClaim, err := schemaPkg.Process(ctx, c.loader, req.Schema, vc, opts) diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index ef884bfdd..2e019ddc5 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -3,6 +3,7 @@ package services import ( "bytes" "context" + "crypto/ecdsa" "encoding/hex" "encoding/json" "errors" @@ -12,6 +13,7 @@ import ( "strings" "time" + "github.com/ethereum/go-ethereum/crypto" "github.com/google/uuid" auth "github.com/iden3/go-iden3-auth/v2" "github.com/iden3/go-iden3-auth/v2/pubsignals" @@ -22,6 +24,7 @@ import ( "github.com/iden3/go-schema-processor/v2/verifiable" "github.com/iden3/iden3comm/v2/packers" "github.com/iden3/iden3comm/v2/protocol" + mtproof "github.com/iden3/merkletree-proof" "github.com/jackc/pgx/v4" "github.com/polygonid/sh-id-platform/internal/common" @@ -47,7 +50,10 @@ const ( // ErrWrongDIDMetada - represents an error in the identity metadata var ( + // ErrWrongDIDMetada - represents an error in the identity metadata ErrWrongDIDMetada = errors.New("wrong DID Metadata") + // ErrAssigningMTPProof - represents an error in the identity metadata + ErrAssigningMTPProof = errors.New("error assigning the MTP Proof from Auth Claim. If this identity has keyType=ETH you must to publish the state first") ) type identity struct { @@ -67,10 +73,12 @@ type identity struct { ignoreRHSErrors bool rhsPublisher reverse_hash.RhsPublisher pubsub pubsub.Publisher + claimCfg CredentialRevocationSettings } // NewIdentity creates a new identity -func NewIdentity(kms kms.KMSType, identityRepository ports.IndentityRepository, imtRepository ports.IdentityMerkleTreeRepository, identityStateRepository ports.IdentityStateRepository, mtservice ports.MtService, qrService ports.QrStoreService, claimsRepository ports.ClaimsRepository, revocationRepository ports.RevocationRepository, connectionsRepository ports.ConnectionsRepository, storage *db.Storage, rhsPublisher reverse_hash.RhsPublisher, verifier *auth.Verifier, sessionRepository ports.SessionRepository, ps pubsub.Client) ports.IdentityService { +// nolint +func NewIdentity(kms kms.KMSType, identityRepository ports.IndentityRepository, imtRepository ports.IdentityMerkleTreeRepository, identityStateRepository ports.IdentityStateRepository, mtservice ports.MtService, qrService ports.QrStoreService, claimsRepository ports.ClaimsRepository, revocationRepository ports.RevocationRepository, connectionsRepository ports.ConnectionsRepository, storage *db.Storage, rhsPublisher reverse_hash.RhsPublisher, verifier *auth.Verifier, sessionRepository ports.SessionRepository, ps pubsub.Client, claimCfg CredentialRevocationSettings) ports.IdentityService { return &identity{ identityRepository: identityRepository, imtRepository: imtRepository, @@ -87,6 +95,7 @@ func NewIdentity(kms kms.KMSType, identityRepository ports.IndentityRepository, rhsPublisher: rhsPublisher, verifier: verifier, pubsub: ps, + claimCfg: claimCfg, } } @@ -94,20 +103,27 @@ func (i *identity) GetByDID(ctx context.Context, identifier w3c.DID) (*domain.Id return i.identityRepository.GetByID(ctx, i.storage.Pgx, identifier) } -func (i *identity) Create(ctx context.Context, DIDMethod string, blockchain, networkID, hostURL string) (*domain.Identity, error) { +func (i *identity) Create(ctx context.Context, hostURL string, didOptions *ports.DIDCreationOptions) (*domain.Identity, error) { var identifier *w3c.DID var err error err = i.storage.Pgx.BeginFunc(ctx, func(tx pgx.Tx) error { - identifier, _, err = i.createIdentity(ctx, tx, DIDMethod, blockchain, networkID, hostURL) - if err != nil { - if errors.Is(err, ErrWrongDIDMetada) { - return err - } - return fmt.Errorf("can't create identity: %w", err) + var keyType kms.KeyType + if didOptions == nil || didOptions.KeyType == "" { + keyType = kms.KeyTypeBabyJubJub + } else { + keyType = didOptions.KeyType } - return nil + switch keyType { + case kms.KeyTypeEthereum: + identifier, _, err = i.createEthIdentity(ctx, tx, hostURL, didOptions) + case kms.KeyTypeBabyJubJub: + identifier, _, err = i.createIdentity(ctx, tx, hostURL, didOptions) + default: + return fmt.Errorf("unsupported key type: %s", keyType) + } + return err }) if err != nil { @@ -143,7 +159,8 @@ func (i *identity) SignClaimEntry(ctx context.Context, authClaim *domain.Claim, var issuerMTP verifiable.Iden3SparseMerkleTreeProof err = authClaim.MTPProof.AssignTo(&issuerMTP) if err != nil { - return nil, err + log.Error(ctx, "assigning to issuerMTP", "err", err) + return nil, ErrAssigningMTPProof } signtureBytes, err := circuitSigner.Sign(ctx, babyjubjub.SignatureType, claimEntry) @@ -531,187 +548,219 @@ func populateIdentityState(ctx context.Context, trees *domain.IdentityMerkleTree return nil } -func (i *identity) createIdentity(ctx context.Context, tx db.Querier, DIDMethod string, blockchain, networkID, hostURL string) (*w3c.DID, *big.Int, error) { +func (i *identity) createEthIdentity(ctx context.Context, tx db.Querier, hostURL string, didOptions *ports.DIDCreationOptions) (*w3c.DID, *big.Int, error) { mts, err := i.mtService.CreateIdentityMerkleTrees(ctx, tx) if err != nil { - return nil, nil, fmt.Errorf("can't create identity markle tree: %w", err) + log.Error(ctx, "creating identity markle tree", "err", err) + return nil, nil, err } - key, err := i.kms.CreateKey(kms.KeyTypeBabyJubJub, nil) + var key kms.KeyID + key, err = i.kms.CreateKey(kms.KeyTypeEthereum, nil) if err != nil { - return nil, nil, fmt.Errorf("can't create babyJubJub key: %w", err) + return nil, nil, err } - pubKey, err := bjjPubKey(i.kms, key) + identity, did, err := i.createEthIdentityFromKeyID(ctx, mts, &key, didOptions, tx) if err != nil { - return nil, nil, fmt.Errorf("can't get babyJubJub public key: %w", err) + return nil, nil, err } - authClaim, err := newAuthClaim(pubKey) - if err != nil { - return nil, nil, fmt.Errorf("can't create auth claim: %w", err) + if err = i.identityRepository.Save(ctx, tx, identity); err != nil { + log.Error(ctx, "saving identity", "err", err) + return nil, nil, errors.Join(err, errors.New("can't save identity")) } - var revNonce uint64 = 0 - authClaim.SetRevocationNonce(revNonce) - entry := common.TreeEntryFromCoreClaim(*authClaim) - err = mts.AddEntry(ctx, &entry) + identity.State.Status = domain.StatusConfirmed + err = i.identityStateRepository.Save(ctx, tx, identity.State) if err != nil { - return nil, nil, fmt.Errorf("can't add entry to merkle tree: %w", err) + log.Error(ctx, "saving identity state", "err", err) + return nil, nil, errors.Join(err, errors.New("can't save identity state")) } - claimsTree, err := mts.ClaimsTree() + // add auth claim + bjjKey, err := i.kms.CreateKey(kms.KeyTypeBabyJubJub, did) if err != nil { - return nil, nil, fmt.Errorf("can't get claims tree: %w", err) + return nil, nil, err } - currentState, err := merkletree.HashElems(claimsTree.Root().BigInt(), merkletree.HashZero.BigInt(), merkletree.HashZero.BigInt()) + bjjPubKey, err := bjjPubKey(i.kms, bjjKey) if err != nil { - return nil, nil, fmt.Errorf("can't add get current state from merkle tree: %w", err) + return nil, nil, err } - // TODO: add config options for blockchain and network - didType, err := core.BuildDIDType(core.DIDMethod(DIDMethod), core.Blockchain(blockchain), core.NetworkID(networkID)) + authClaim, err := newAuthClaim(bjjPubKey) if err != nil { - return nil, nil, ErrWrongDIDMetada + return nil, nil, errors.Join(err, errors.New("can't create auth claim")) } + var revNonce uint64 = 0 + authClaim.SetRevocationNonce(revNonce) - identifier, err := core.NewIDFromIdenState(didType, currentState.BigInt()) + claimsTree, err := mts.ClaimsTree() if err != nil { - return nil, nil, fmt.Errorf("can't genesis from state: %w", err) + return nil, nil, err } - did, err := core.ParseDIDFromID(*identifier) + authClaimModel, err := i.authClaimToModel(ctx, did, identity, authClaim, claimsTree, bjjPubKey, hostURL, false) if err != nil { - return nil, nil, fmt.Errorf("can't parse did: %w", err) + log.Error(ctx, "auth claim to model", "err", err) + return nil, nil, err } - err = mts.BindToIdentifier(tx, did) + _, err = i.claimsRepository.Save(ctx, tx, authClaimModel) if err != nil { - return nil, nil, fmt.Errorf("can't bind identifier to merkle tree: %w", err) + return nil, nil, errors.Join(err, errors.New("can't save auth claim")) } - for _, mt := range mts.GetMtModels() { - err := i.imtRepository.UpdateByID(ctx, tx, mt) - if err != nil { - return nil, nil, fmt.Errorf("can't update merkle tree: %w", err) + return did, identity.State.TreeState().State.BigInt(), nil +} + +func (i *identity) createIdentity(ctx context.Context, tx db.Querier, hostURL string, didOptions *ports.DIDCreationOptions) (*w3c.DID, *big.Int, error) { + if didOptions == nil { + // nolint : it's a right assignment + didOptions = &ports.DIDCreationOptions{ + Method: core.DIDMethodIden3, + Blockchain: core.NoChain, + Network: core.NoNetwork, + KeyType: kms.KeyTypeBabyJubJub, } } - _, err = i.kms.LinkToIdentity(ctx, key, *did) + mts, err := i.mtService.CreateIdentityMerkleTrees(ctx, tx) if err != nil { - return nil, nil, fmt.Errorf("can't link to identity: %w", err) + return nil, nil, fmt.Errorf("can't create identity markle tree: %w", err) } - identity := domain.NewIdentityFromIdentifier(did, currentState.Hex()) - claimsTreeHex := claimsTree.Root().Hex() - identity.State.ClaimsTreeRoot = &claimsTreeHex - - claimData := make(map[string]interface{}) - claimData["x"] = pubKey.X.String() - claimData["y"] = pubKey.Y.String() - - marshalledClaimData, err := json.Marshal(claimData) + key, err := i.kms.CreateKey(kms.KeyTypeBabyJubJub, nil) if err != nil { - return nil, nil, fmt.Errorf("can't marshal claim data: %w", err) + return nil, nil, fmt.Errorf("can't create babyJubJub key: %w", err) } - jsonLdContext := domain.AuthBJJCredentialJSONLDContext - - cr := common.CredentialRequest{ - CredentialSchema: domain.AuthBJJCredentialJSONSchemaURL, - Type: domain.AuthBJJCredential, - CredentialSubject: marshalledClaimData, - Version: 0, - RevNonce: &revNonce, - LDContext: jsonLdContext, + pubKey, err := bjjPubKey(i.kms, key) + if err != nil { + return nil, nil, fmt.Errorf("can't get babyJubJub public key: %w", err) } - exp, ok := authClaim.GetExpirationDate() - if !ok { - cr.Expiration = 0 - } else { - cr.Expiration = exp.Unix() + authClaim, err := newAuthClaim(pubKey) + if err != nil { + return nil, nil, fmt.Errorf("can't create auth claim: %w", err) } - credentialType := fmt.Sprintf("%s#%s", jsonLdContext, domain.AuthBJJCredential) - claimID, err := uuid.NewUUID() + var revNonce uint64 = 0 + authClaim.SetRevocationNonce(revNonce) + + identity, did, err := i.addGenesisClaimsToTree(ctx, mts, &key, authClaim, didOptions, tx) if err != nil { - return nil, nil, fmt.Errorf("can't crate uuid: %w", err) + log.Error(ctx, "adding genesis claims to tree", "err", err) + return nil, nil, fmt.Errorf("can't add genesis claims to tree: %w", err) } - cred, err := common.CreateCredential(did, cr) + claimsTree, err := mts.ClaimsTree() + if err != nil { + return nil, nil, err + } + + authClaimModel, err := i.authClaimToModel( + ctx, + did, + identity, + authClaim, + claimsTree, + pubKey, + hostURL, + true, + ) if err != nil { - return nil, nil, fmt.Errorf("can't create credential: %w", err) + log.Error(ctx, "auth claim to model", "err", err) + return nil, nil, err } - cred.ID = fmt.Sprintf("%s/v1/%s/claims/%s", strings.TrimSuffix(hostURL, "/"), identifier, claimID) - cs := &verifiable.CredentialStatus{ - ID: fmt.Sprintf("%s/v1/%s/claims/revocation/status/%d", - hostURL, url.QueryEscape(did.String()), revNonce), - RevocationNonce: revNonce, - Type: verifiable.SparseMerkleTreeProof, + _, err = i.claimsRepository.Save(ctx, tx, authClaimModel) + if err != nil { + return nil, nil, fmt.Errorf("can't save auth claim: %w", err) } - cred.CredentialStatus = cs + if err = i.identityRepository.Save(ctx, tx, identity); err != nil { + return nil, nil, fmt.Errorf("can't save identity: %w", err) + } - marshaledCredential, err := json.Marshal(cred) - if err != nil { - return nil, nil, fmt.Errorf("can't marshal credential: %w", err) + // TODO: Review this part + if i.rhsPublisher != nil { + err = i.rhsPublisher.PublishNodesToRHS(ctx, []mtproof.Node{ + { + Hash: identity.State.TreeState().State, + Children: []*merkletree.Hash{ + claimsTree.Root(), + &merkletree.HashZero, + &merkletree.HashZero, + }, + }, + }) + if err != nil { + log.Error(ctx, "publishing state to RHS", "err", err) + return nil, nil, err + } } - authClaimModel, err := domain.FromClaimer(authClaim, domain.AuthBJJCredentialJSONSchemaURL, credentialType) + identity.State.Status = domain.StatusConfirmed + err = i.identityStateRepository.Save(ctx, tx, identity.State) if err != nil { - return nil, nil, fmt.Errorf("can't create authClaimModel: %w", err) + log.Error(ctx, "saving identity state", "err", err) + return nil, nil, fmt.Errorf("can't save identity state: %w", err) } - mtpProof, err := i.getAuthClaimMtpProof(ctx, claimsTree, currentState, authClaim, did) + return did, identity.State.TreeState().State.BigInt(), nil +} + +func (i *identity) createEthIdentityFromKeyID(ctx context.Context, mts *domain.IdentityMerkleTrees, key *kms.KeyID, didOptions *ports.DIDCreationOptions, tx db.Querier) (*domain.Identity, *w3c.DID, error) { + pubKey, err := ethPubKey(i.kms, *key) if err != nil { - return nil, nil, fmt.Errorf("can't add get current state from merkle tree: %w", err) + return nil, nil, err } + address := crypto.PubkeyToAddress(*pubKey) + var ethAddr [20]byte + copy(ethAddr[:], address.Bytes()) - err = authClaimModel.Data.Set(marshaledCredential) + currentState := core.GenesisFromEthAddress(ethAddr) if err != nil { - return nil, nil, fmt.Errorf("can't set data to auth claim: %w", err) + return nil, nil, err } - err = authClaimModel.CredentialStatus.Set(cs) + didType, err := core.BuildDIDType(didOptions.Method, didOptions.Blockchain, didOptions.Network) if err != nil { - return nil, nil, fmt.Errorf("can't set credential status to auth claim: %w", err) + return nil, nil, err } - jsonProof, err := json.Marshal(mtpProof) + did, err := core.NewDID(didType, currentState) if err != nil { - return nil, nil, fmt.Errorf("can't marshal proof: %w", err) + return nil, nil, err } - err = authClaimModel.MTPProof.Set(jsonProof) + err = mts.BindToIdentifier(tx, did) if err != nil { - return nil, nil, fmt.Errorf("can't set mtp proof to auth claim: %w", err) + return nil, nil, err } - authClaimModel.Issuer = did.String() - - if err = i.identityRepository.Save(ctx, tx, identity); err != nil { - return nil, nil, fmt.Errorf("can't save identity: %w", err) + for _, mt := range mts.GetMtModels() { + err := i.imtRepository.UpdateByID(ctx, tx, mt) + if err != nil { + return nil, nil, fmt.Errorf("can't update merkle tree: %w", err) + } } - // mark genesis state like `confirmed` state. - identity.State.Status = domain.StatusConfirmed - err = i.identityStateRepository.Save(ctx, tx, identity.State) + //nolint:ineffassign,staticcheck // old key ID is invalid after this operation, + // override it if somebody would try to use it in the future + // to prevent possible errors. + _, err = i.kms.LinkToIdentity(ctx, *key, *did) if err != nil { - return nil, nil, fmt.Errorf("can't save identity state: %w", err) + return nil, nil, err } - - authClaimModel.IdentityState = identity.State.State - authClaimModel.Identifier = &identity.Identifier - authClaimModel.MtProof = true - _, err = i.claimsRepository.Save(ctx, tx, authClaimModel) + // empty genesis state for eth identity + identity, err := domain.NewIdentityFromIdentifier(did, merkletree.HashZero.Hex()) if err != nil { - return nil, nil, fmt.Errorf("can't save auth claim: %w", err) + return nil, nil, err } - - return did, currentState.BigInt(), nil + return identity, did, nil } func (i *identity) getAuthClaimMtpProof(ctx context.Context, claimsTree *merkletree.MerkleTree, currentState *merkletree.Hash, authClaim *core.Claim, did *w3c.DID) (verifiable.Iden3SparseMerkleTreeProof, error) { @@ -799,6 +848,191 @@ func (i *identity) GetFailedState(ctx context.Context, identifier w3c.DID) (*dom return nil, nil } +// GetCredentialStatus - returns credential status +func (i *identity) GetCredentialStatus(ctx context.Context, issuerDID w3c.DID, nonce uint64, issuerState string) (*verifiable.CredentialStatus, error) { + if i.claimCfg.RHSEnabled { + return &verifiable.CredentialStatus{ + ID: buildRHSRevocationURL(i.claimCfg.RHSUrl, issuerState), + Type: verifiable.Iden3ReverseSparseMerkleTreeProof, + RevocationNonce: nonce, + StatusIssuer: &verifiable.CredentialStatus{ + ID: buildDirectRevocationURL(i.claimCfg.Host, issuerDID.String(), nonce), + Type: verifiable.SparseMerkleTreeProof, + RevocationNonce: nonce, + }, + }, nil + } + if i.claimCfg.AgentIden3Enabled { + return &verifiable.CredentialStatus{ + ID: i.claimCfg.AgentIden3URL, + Type: verifiable.Iden3commRevocationStatusV1, + RevocationNonce: nonce, + }, nil + } + return &verifiable.CredentialStatus{ + ID: buildDirectRevocationURL(i.claimCfg.Host, issuerDID.String(), nonce), + Type: verifiable.SparseMerkleTreeProof, + RevocationNonce: nonce, + }, nil +} + +func (i *identity) addGenesisClaimsToTree(ctx context.Context, + mts *domain.IdentityMerkleTrees, + key *kms.KeyID, + authClaim *core.Claim, + didOptions *ports.DIDCreationOptions, + tx db.Querier, +) (*domain.Identity, *w3c.DID, error) { + entry := common.TreeEntryFromCoreClaim(*authClaim) + err := mts.AddEntry(ctx, &entry) + if err != nil { + return nil, nil, fmt.Errorf("can't add entry to merkle tree: %w", err) + } + + claimsTree, err := mts.ClaimsTree() + if err != nil { + return nil, nil, fmt.Errorf("can't get claims tree: %w", err) + } + + currentState, err := merkletree.HashElems(claimsTree.Root().BigInt(), merkletree.HashZero.BigInt(), merkletree.HashZero.BigInt()) + if err != nil { + return nil, nil, fmt.Errorf("can't add get current state from merkle tree: %w", err) + } + + // TODO: add config options for blockchain and network + didType, err := core.BuildDIDType(didOptions.Method, didOptions.Blockchain, didOptions.Network) + if err != nil { + return nil, nil, ErrWrongDIDMetada + } + + did, err := core.NewDIDFromIdenState(didType, currentState.BigInt()) + if err != nil { + return nil, nil, fmt.Errorf("can't genesis from state: %w", err) + } + + err = mts.BindToIdentifier(tx, did) + if err != nil { + return nil, nil, fmt.Errorf("can't bind identifier to merkle tree: %w", err) + } + + for _, mt := range mts.GetMtModels() { + err := i.imtRepository.UpdateByID(ctx, tx, mt) + if err != nil { + return nil, nil, fmt.Errorf("can't update merkle tree: %w", err) + } + } + + _, err = i.kms.LinkToIdentity(ctx, *key, *did) + if err != nil { + return nil, nil, fmt.Errorf("can't link to identity: %w", err) + } + + identity, err := domain.NewIdentityFromIdentifier(did, currentState.Hex()) + if err != nil { + log.Error(ctx, "can't create identity from identifier", "err", err) + return nil, nil, err + } + claimsTreeHex := claimsTree.Root().Hex() + identity.State.ClaimsTreeRoot = &claimsTreeHex + + return identity, did, nil +} + +func (i *identity) authClaimToModel(ctx context.Context, did *w3c.DID, identity *domain.Identity, authClaim *core.Claim, claimsTree *merkletree.MerkleTree, pubKey *babyjub.PublicKey, hostURL string, isAuthInGenesis bool) (*domain.Claim, error) { + authClaimData := make(map[string]interface{}) + authClaimData["x"] = pubKey.X.String() + authClaimData["y"] = pubKey.Y.String() + + authMarshalledClaimData, err := json.Marshal(authClaimData) + if err != nil { + return nil, err + } + + revNonce := authClaim.GetRevocationNonce() + + authCredReq := common.CredentialRequest{ + CredentialSchema: domain.AuthBJJCredentialJSONSchemaURL, + Type: domain.AuthBJJCredential, + CredentialSubject: authMarshalledClaimData, + Version: 0, + RevNonce: &revNonce, + LDContext: domain.AuthBJJCredentialJSONLDContext, + } + exp, ok := authClaim.GetExpirationDate() + if !ok { + authCredReq.Expiration = 0 + } else { + authCredReq.Expiration = exp.Unix() + } + + authClaimID, err := uuid.NewUUID() + if err != nil { + return nil, err + } + + authCred, err := common.CreateCredential(did, authCredReq) + if err != nil { + return nil, err + } + + authCred.ID = fmt.Sprintf("%s/api/v1/claim/%s", strings.TrimSuffix(hostURL, "/"), authClaimID) + cs, err := i.GetCredentialStatus(ctx, *did, revNonce, *identity.State.State) + if err != nil { + log.Error(ctx, "get credential status", "err", err) + return nil, err + } + + authCred.CredentialStatus = cs + + authMarshaledCredential, err := json.Marshal(authCred) + if err != nil { + log.Error(ctx, "marshal auth credential", "err", err) + return nil, err + } + + authClaimModel, err := domain.NewClaimModel(domain.AuthBJJCredentialJSONSchemaURL, domain.AuthBJJCredentialTypeID, *authClaim, nil) + if err != nil { + log.Error(ctx, "can't create auth claim model", "err", err) + return nil, err + } + + if isAuthInGenesis { + authMtpProof, err := i.getAuthClaimMtpProof(ctx, claimsTree, identity.State.TreeState().State, authClaim, did) + if err != nil { + return nil, err + } + + authJSONProof, err := json.Marshal(authMtpProof) + if err != nil { + return nil, errors.Join(err, errors.New("can't marshal proof")) + } + + err = authClaimModel.MTPProof.Set(authJSONProof) + if err != nil { + return nil, errors.Join(err, errors.New("failed set mtp proof to auth claim")) + } + } + + err = authClaimModel.Data.Set(authMarshaledCredential) + if err != nil { + return nil, errors.Join(err, errors.New("failed set auth claim data")) + } + + err = authClaimModel.CredentialStatus.Set(cs) + if err != nil { + return nil, errors.Join(err, errors.New("failed set auth revocation status")) + } + + authClaimModel.Issuer = did.String() + if isAuthInGenesis { + authClaimModel.IdentityState = identity.State.State + } + + authClaimModel.Identifier = &identity.Identifier + authClaimModel.MtProof = true + return authClaimModel, nil +} + // newAuthClaim generate BabyJubKeyTypeAuthorizeKSign claimL func newAuthClaim(key *babyjub.PublicKey) (*core.Claim, error) { revNonce, err := common.RandInt64() @@ -837,3 +1071,23 @@ func sanitizeIssuerDoc(issDoc []byte) []byte { str := strings.Replace(string(issDoc), "\\u0000", "", -1) return []byte(str) } + +func buildRHSRevocationURL(host, issuerState string) string { + if issuerState == "" { + return host + } + return fmt.Sprintf("%s/node?state=%s", host, issuerState) +} + +func buildDirectRevocationURL(host, issuerDID string, nonce uint64) string { + return fmt.Sprintf("%s/api/v1/identities/%s/claims/revocation/status/%d", + host, url.QueryEscape(issuerDID), nonce) +} + +func ethPubKey(keyMS kms.KMSType, keyID kms.KeyID) (*ecdsa.PublicKey, error) { + keyBytes, err := keyMS.PublicKey(keyID) + if err != nil { + return nil, err + } + return kms.DecodeETHPubKey(keyBytes) +} diff --git a/internal/core/services/proof.go b/internal/core/services/proof.go index 7b38f980a..1d1616dfd 100644 --- a/internal/core/services/proof.go +++ b/internal/core/services/proof.go @@ -56,10 +56,14 @@ type Proof struct { storage *db.Storage stateContract *abi.State schemaLoader loader.DocumentLoader + merklizeOptions []merklize.MerklizeOption } // NewProofService init proof service func NewProofService(claimSrv ports.ClaimsService, revocationSrv ports.RevocationService, identitySrv ports.IdentityService, mtService ports.MtService, claimsRepository ports.ClaimsRepository, keyProvider *kms.KMS, storage *db.Storage, stateContract *abi.State, ld ld.DocumentLoader) ports.ProofService { + merklizeOptions := []merklize.MerklizeOption{ + merklize.WithDocumentLoader(ld), + } return &Proof{ claimSrv: claimSrv, revocationSrv: revocationSrv, @@ -70,6 +74,7 @@ func NewProofService(claimSrv ports.ClaimsService, revocationSrv ports.Revocatio storage: storage, stateContract: stateContract, schemaLoader: ld, + merklizeOptions: merklizeOptions, } } @@ -408,7 +413,7 @@ func (p *Proof) prepareMerklizedQuery(ctx context.Context, claim domain.Claim, q return circuits.Query{}, err } - mk, err := vc.Merklize(ctx) + mk, err := vc.Merklize(ctx, p.merklizeOptions...) if err != nil { return circuits.Query{}, err } diff --git a/internal/core/services/tests/identity_test.go b/internal/core/services/tests/identity_test.go index a67b05554..7907c1caa 100644 --- a/internal/core/services/tests/identity_test.go +++ b/internal/core/services/tests/identity_test.go @@ -22,6 +22,7 @@ const ( method = "polygonid" blockchain = "polygon" network = "mumbai" + BJJ = "BJJ" ) func Test_identity_UpdateState(t *testing.T) { @@ -34,18 +35,17 @@ func Test_identity_UpdateState(t *testing.T) { mtService := services.NewIdentityMerkleTrees(mtRepo) rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "https://host.com", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, docLoader, storage, claimsConf, pubsub.NewMock(), ipfsGateway) - identity, err := identityService.Create(ctx, method, blockchain, network, "http://localhost:3001") + identity, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) - identity2, err := identityService.Create(ctx, method, blockchain, network, "http://localhost:3001") + identity2, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) schema := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" @@ -121,9 +121,12 @@ func Test_identity_GetByDID(t *testing.T) { mtService := services.NewIdentityMerkleTrees(mtRepo) rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - - identity, err := identityService.Create(ctx, method, blockchain, network, "http://localhost:3001") + claimsConf := services.CredentialRevocationSettings{ + RHSEnabled: false, + Host: "https://host.com", + } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + identity, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) assert.NoError(t, err) did, err := w3c.ParseDID(identity.Identifier) diff --git a/internal/core/services/tests/link_test.go b/internal/core/services/tests/link_test.go index 217cb98ef..5157b5dd0 100644 --- a/internal/core/services/tests/link_test.go +++ b/internal/core/services/tests/link_test.go @@ -32,19 +32,20 @@ func Test_link_issueClaim(t *testing.T) { mtService := services.NewIdentityMerkleTrees(mtRepo) rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - sessionRepository := repositories.NewSessionCached(cachex) - schemaService := services.NewSchema(schemaRepository, docLoader) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "https://host.com", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) + sessionRepository := repositories.NewSessionCached(cachex) + schemaService := services.NewSchema(schemaRepository, docLoader) + claimsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, docLoader, storage, claimsConf, pubsub.NewMock(), ipfsGateway) - identity, err := identityService.Create(ctx, method, blockchain, network, "http://localhost:3001") + identity, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) assert.NoError(t, err) - identity2, err := identityService.Create(ctx, method, blockchain, network, "http://localhost:3001") + identity2, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) assert.NoError(t, err) schemaUrl := "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" diff --git a/internal/core/services/tests/main_test.go b/internal/core/services/tests/main_test.go index d7a486792..72c97f835 100644 --- a/internal/core/services/tests/main_test.go +++ b/internal/core/services/tests/main_test.go @@ -66,12 +66,25 @@ func TestMain(m *testing.M) { os.Exit(1) } + ethKeyProvider, err := kms.NewVaultPluginIden3KeyProvider(vaultCli, cfgForTesting.KeyStore.PluginIden3MountPath, kms.KeyTypeEthereum) + if err != nil { + log.Error(ctx, "failed to create Iden3 Key Provider", "err", err) + os.Exit(1) + } + keyStore = kms.NewKMS() err = keyStore.RegisterKeyProvider(kms.KeyTypeBabyJubJub, bjjKeyProvider) if err != nil { log.Error(ctx, "failed to register Key Provider", "err", err) os.Exit(1) } + + err = keyStore.RegisterKeyProvider(kms.KeyTypeEthereum, ethKeyProvider) + if err != nil { + log.Error(ctx, "failed to register eth Key Provider", "err", err) + os.Exit(1) + } + cachex = cache.NewMemoryCache() docLoader = loader.NewDocumentLoader(ipfsGatewayURL) diff --git a/internal/core/services/tests/notification_test.go b/internal/core/services/tests/notification_test.go index 38fb7790e..8d7f60916 100644 --- a/internal/core/services/tests/notification_test.go +++ b/internal/core/services/tests/notification_test.go @@ -13,6 +13,7 @@ import ( "github.com/polygonid/sh-id-platform/internal/common" "github.com/polygonid/sh-id-platform/internal/core/domain" "github.com/polygonid/sh-id-platform/internal/core/event" + "github.com/polygonid/sh-id-platform/internal/core/ports" "github.com/polygonid/sh-id-platform/internal/core/services" "github.com/polygonid/sh-id-platform/internal/db/tests" "github.com/polygonid/sh-id-platform/internal/gateways" @@ -38,14 +39,14 @@ func TestNotification_SendNotification(t *testing.T) { revocationRepository := repositories.NewRevocation() rhsp := reverse_hash.NewRhsPublisher(nil, false) connectionsRepository := repositories.NewConnections() - identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock()) - claimsConf := services.ClaimCfg{ + claimsConf := services.CredentialRevocationSettings{ RHSEnabled: false, Host: "http://host", } + identityService := services.NewIdentity(keyStore, identityRepo, mtRepo, identityStateRepo, mtService, nil, claimsRepo, revocationRepository, connectionsRepository, storage, rhsp, nil, nil, pubsub.NewMock(), claimsConf) credentialsService := services.NewClaim(claimsRepo, identityService, nil, mtService, identityStateRepo, docLoader, storage, claimsConf, pubsub.NewMock(), ipfsGateway) connectionsService := services.NewConnection(connectionsRepository, storage) - iden, err := identityService.Create(ctx, method, blockchain, network, "polygon-test") + iden, err := identityService.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) require.NoError(t, err) did, err := w3c.ParseDID(iden.Identifier) diff --git a/internal/core/services/zk_native.go b/internal/core/services/zk_native.go index 1043114de..217e7f8d3 100644 --- a/internal/core/services/zk_native.go +++ b/internal/core/services/zk_native.go @@ -7,9 +7,10 @@ import ( "github.com/iden3/go-circuits/v2" "github.com/iden3/go-rapidsnark/prover" - "github.com/iden3/go-rapidsnark/witness" + "github.com/iden3/go-rapidsnark/types" + "github.com/iden3/go-rapidsnark/witness/v2" + "github.com/iden3/go-rapidsnark/witness/wazero" - "github.com/polygonid/sh-id-platform/internal/core/domain" "github.com/polygonid/sh-id-platform/internal/log" "github.com/polygonid/sh-id-platform/pkg/loaders" ) @@ -30,13 +31,13 @@ func NewNativeProverService(config *NativeProverConfig) *NativeProverService { } // Generate calls prover-server for proof generation -func (s *NativeProverService) Generate(ctx context.Context, inputs json.RawMessage, circuitName string) (*domain.FullProof, error) { +func (s *NativeProverService) Generate(ctx context.Context, inputs json.RawMessage, circuitName string) (*types.ZKProof, error) { wasm, err := s.config.CircuitsLoader.LoadWasm(circuits.CircuitID(circuitName)) if err != nil { return nil, err } - calc, err := witness.NewCircom2WitnessCalculator(wasm, true) + calc, err := witness.NewCalculator(wasm, witness.WithWasmEngine(wazero.NewCircom2WZWitnessCalculator)) if err != nil { log.Error(ctx, "can't create witness calculator", "err", err) return nil, fmt.Errorf("can't create witness calculator: %w", err) @@ -57,19 +58,11 @@ func (s *NativeProverService) Generate(ctx context.Context, inputs json.RawMessa if err != nil { return nil, err } + p, err := prover.Groth16Prover(provingKey, wtnsBytes) if err != nil { - log.Error(ctx, "can't generate proof", "err", err) - return nil, fmt.Errorf("can't generate proof: %w", err) + log.Error(ctx, "can't create prover", "err", err) + return nil, fmt.Errorf("can't create prover: %w", err) } - // TODO: get rid of models.Proof structure - return &domain.FullProof{ - Proof: &domain.ZKProof{ - A: p.Proof.A, - B: p.Proof.B, - C: p.Proof.C, - Protocol: p.Proof.Protocol, - }, - PubSignals: p.PubSignals, - }, nil + return p, nil } diff --git a/internal/db/schema/migrations/202310090829241_update_identities_table.sql b/internal/db/schema/migrations/202310090829241_update_identities_table.sql new file mode 100644 index 000000000..dec8a1ddd --- /dev/null +++ b/internal/db/schema/migrations/202310090829241_update_identities_table.sql @@ -0,0 +1,14 @@ +-- +goose Up +-- +goose StatementBegin +ALTER TABLE identities + ADD COLUMN address TEXT, + ADD COLUMN keyType TEXT; + +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +ALTER TABLE identities +DROP COLUMN address, + DROP COLUMN keyType; +-- +goose StatementEnd \ No newline at end of file diff --git a/internal/gateways/prover.go b/internal/gateways/prover.go index 47df8422a..0f2ff4d83 100644 --- a/internal/gateways/prover.go +++ b/internal/gateways/prover.go @@ -6,6 +6,8 @@ import ( "net/http" "time" + "github.com/iden3/go-rapidsnark/types" + "github.com/polygonid/sh-id-platform/internal/config" "github.com/polygonid/sh-id-platform/internal/core/domain" "github.com/polygonid/sh-id-platform/internal/core/ports" @@ -86,10 +88,8 @@ func (s *ProverService) Verify(ctx context.Context, zkp *domain.FullProof, circu } // Generate calls prover-server for proof generation -func (s *ProverService) Generate(ctx context.Context, inputs json.RawMessage, circuitName string) (*domain.FullProof, - error, -) { - var zkp domain.FullProof +func (s *ProverService) Generate(ctx context.Context, inputs json.RawMessage, circuitName string) (*types.ZKProof, error) { + var zkp types.ZKProof r := struct { Inputs json.RawMessage `json:"inputs"` diff --git a/internal/gateways/publisher.go b/internal/gateways/publisher.go index 4a623875a..d9585781a 100644 --- a/internal/gateways/publisher.go +++ b/internal/gateways/publisher.go @@ -14,6 +14,7 @@ import ( "github.com/iden3/go-iden3-core/v2/w3c" "github.com/iden3/go-iden3-crypto/poseidon" "github.com/iden3/go-merkletree-sql/v2" + rstypes "github.com/iden3/go-rapidsnark/types" "github.com/jackc/pgx/v4" "github.com/polygonid/sh-id-platform/internal/core/domain" @@ -45,7 +46,7 @@ const ( // PublisherGateway - Define the interface for publishers. type PublisherGateway interface { - PublishState(ctx context.Context, identifier *w3c.DID, latestState *merkletree.Hash, newState *merkletree.Hash, isOldStateGenesis bool, proof *domain.ZKProof) (*string, error) + PublishState(ctx context.Context, identifier *w3c.DID, latestState *merkletree.Hash, newState *merkletree.Hash, isOldStateGenesis bool, proof *rstypes.ProofData, identity *domain.Identity) (*string, error) } type publisher struct { @@ -188,6 +189,11 @@ func (p *publisher) publishProof(ctx context.Context, identifier *w3c.DID, newSt return nil, err } + identity, err := p.identityService.GetByDID(ctx, *did) + if err != nil { + return nil, err + } + // 1. Get latest transacted state latestState, err := p.identityService.GetLatestStateByID(ctx, *did) if err != nil { @@ -210,76 +216,82 @@ func (p *publisher) publishProof(ctx context.Context, identifier *w3c.DID, newSt return nil, err } - authClaim, err := p.claimService.GetAuthClaimForPublishing(ctx, did, *newState.State) + oldTreeState, err := latestState.ToTreeState() if err != nil { return nil, err } - claimKeyID, err := p.identityService.GetKeyIDFromAuthClaim(ctx, authClaim) + hashOldAndNewStates, err := poseidon.Hash([]*big.Int{oldTreeState.State.BigInt(), newStateHash.BigInt()}) if err != nil { return nil, err } - oldTreeState, err := latestState.ToTreeState() - if err != nil { - return nil, err - } + isLatestStateGenesis := latestState.PreviousState == nil - circuitAuthClaim, circuitAuthClaimNewStateIncProof, err := p.fillAuthClaimData(ctx, did, authClaim, newState) - if err != nil { - return nil, err - } + var zkProofData *rstypes.ProofData - hashOldAndNewStates, err := poseidon.Hash([]*big.Int{oldTreeState.State.BigInt(), newStateHash.BigInt()}) - if err != nil { - return nil, err - } + if identity.KeyType == string(kms.KeyTypeBabyJubJub) { + id, err := core.IDFromDID(*did) + if err != nil { + return nil, err + } - sigDigest := kms.BJJDigest(hashOldAndNewStates) - sigBytes, err := p.kms.Sign(ctx, claimKeyID, sigDigest) - if err != nil { - return nil, err - } + authClaim, err := p.claimService.GetAuthClaimForPublishing(ctx, did, *newState.State) + if err != nil { + return nil, err + } - signature, err := kms.DecodeBJJSignature(sigBytes) - if err != nil { - return nil, err - } + circuitAuthClaim, circuitAuthClaimNewStateIncProof, err := p.fillAuthClaimData(ctx, did, authClaim, newState) + if err != nil { + return nil, err + } - id, err := core.IDFromDID(*did) - if err != nil { - return nil, err - } + claimKeyID, err := p.identityService.GetKeyIDFromAuthClaim(ctx, authClaim) + if err != nil { + return nil, err + } - isLatestStateGenesis := latestState.PreviousState == nil - stateTransitionInputs := circuits.StateTransitionInputs{ - ID: &id, - NewTreeState: newTreeState, - OldTreeState: oldTreeState, - IsOldStateGenesis: isLatestStateGenesis, + sigDigest := kms.BJJDigest(hashOldAndNewStates) + sigBytes, err := p.kms.Sign(ctx, claimKeyID, sigDigest) + if err != nil { + return nil, err + } + signature, err := kms.DecodeBJJSignature(sigBytes) + if err != nil { + return nil, err + } - AuthClaim: circuitAuthClaim.Claim, - AuthClaimIncMtp: circuitAuthClaim.IncProof.Proof, - AuthClaimNonRevMtp: circuitAuthClaim.NonRevProof.Proof, + stateTransitionInputs := circuits.StateTransitionInputs{ + ID: &id, + OldTreeState: oldTreeState, + NewTreeState: newTreeState, + IsOldStateGenesis: isLatestStateGenesis, - AuthClaimNewStateIncMtp: circuitAuthClaimNewStateIncProof, - Signature: signature, - } + AuthClaim: circuitAuthClaim.Claim, + AuthClaimIncMtp: circuitAuthClaim.IncProof.Proof, + AuthClaimNonRevMtp: circuitAuthClaim.NonRevProof.Proof, - jsonInputs, err := stateTransitionInputs.InputsMarshal() - if err != nil { - return nil, err - } + AuthClaimNewStateIncMtp: circuitAuthClaimNewStateIncProof, - // TODO: Integrate when it's finished - fullProof, err := p.zkService.Generate(ctx, jsonInputs, string(circuits.StateTransitionCircuitID)) - if err != nil { - return nil, err + Signature: signature, + } + + jsonInputs, err := stateTransitionInputs.InputsMarshal() + if err != nil { + return nil, err + } + + zkProof, err := p.zkService.Generate(ctx, jsonInputs, string(circuits.StateTransitionCircuitID)) + if err != nil { + return nil, err + } + + zkProofData = zkProof.Proof } // 7. Publish state and receive txID - txID, err := p.publisherGateway.PublishState(ctx, did, latestStateHash, newStateHash, isLatestStateGenesis, fullProof.Proof) + txID, err := p.publisherGateway.PublishState(ctx, did, latestStateHash, newStateHash, isLatestStateGenesis, zkProofData, identity) if err != nil { return nil, err } diff --git a/internal/gateways/publisher_gateway.go b/internal/gateways/publisher_gateway.go index 88e53e200..4171f42ef 100644 --- a/internal/gateways/publisher_gateway.go +++ b/internal/gateways/publisher_gateway.go @@ -2,19 +2,18 @@ package gateways import ( "context" - "crypto/ecdsa" "errors" - "fmt" "math/big" "sync" + "time" ethCommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" "github.com/iden3/contracts-abi/state/go/abi" core "github.com/iden3/go-iden3-core/v2" "github.com/iden3/go-iden3-core/v2/w3c" "github.com/iden3/go-merkletree-sql/v2" + rstypes "github.com/iden3/go-rapidsnark/types" "github.com/polygonid/sh-id-platform/internal/common" "github.com/polygonid/sh-id-platform/internal/core/domain" @@ -25,32 +24,45 @@ import ( // PublisherEthGateway interact with blockchain type PublisherEthGateway struct { - rw *sync.RWMutex - client *eth.Client - contract ethCommon.Address - kms *kms.KMS - publishingKeyID kms.KeyID + rw *sync.RWMutex + client *eth.Client + kms *kms.KMS + publishingKeyID kms.KeyID + ethRPCResponseTimeout time.Duration + contractBinding *abi.State } +const rpcTimeout = 10 * time.Second + // NewPublisherEthGateway creates new instance of publishing service func NewPublisherEthGateway(_client *eth.Client, contract ethCommon.Address, keyStore *kms.KMS, publishingKeyPath string) (*PublisherEthGateway, error) { - if publishingKeyPath == "" { - return nil, errors.New("publishing key path is required") + // TODO: make timeout configurable + return newStateService(_client, contract, rpcTimeout, keyStore, kms.KeyID{ + Type: kms.KeyTypeEthereum, + ID: publishingKeyPath, + }) +} + +func newStateService(client *eth.Client, addr ethCommon.Address, to time.Duration, kServ *kms.KMS, kPath kms.KeyID) (*PublisherEthGateway, error) { + c := client.GetEthereumClient() + + binding, err := abi.NewState(addr, c) + if err != nil { + return nil, err } + return &PublisherEthGateway{ - client: _client, - contract: contract, - rw: &sync.RWMutex{}, - kms: keyStore, - publishingKeyID: kms.KeyID{ - Type: kms.KeyTypeEthereum, - ID: publishingKeyPath, - }, + client: client, + contractBinding: binding, + rw: &sync.RWMutex{}, + kms: kServ, + publishingKeyID: kPath, + ethRPCResponseTimeout: to, }, nil } // PublishState creates or updates state in the blockchain -func (pb *PublisherEthGateway) PublishState(ctx context.Context, identifier *w3c.DID, latestState, newState *merkletree.Hash, isOldStateGenesis bool, proof *domain.ZKProof) (*string, error) { +func (pb *PublisherEthGateway) PublishState(ctx context.Context, identifier *w3c.DID, latestState, newState *merkletree.Hash, isOldStateGenesis bool, proof *rstypes.ProofData, identity *domain.Identity) (*string, error) { pb.rw.Lock() defer pb.rw.Unlock() @@ -58,107 +70,87 @@ func (pb *PublisherEthGateway) PublishState(ctx context.Context, identifier *w3c return nil, errors.New("state hasn't been changed") } - fromAddress, err := pb.getAddressForTxInitiator() - if err != nil { - return nil, err - } + var tx *types.Transaction - payload, err := pb.getStatePayload(identifier, latestState, newState, isOldStateGenesis, proof) - if err != nil { - return nil, err - } - - txParams := eth.TransactionParams{ - FromAddress: fromAddress, - ToAddress: pb.contract, - Payload: payload, - } - tx, err := pb.client.CreateRawTx(ctx, txParams) - if err != nil { - return nil, err - } - - cid, err := pb.client.ChainID(ctx) - if err != nil { - return nil, err - } - - s := types.LatestSignerForChainID(cid) - - h := s.Hash(tx) - sig, err := pb.kms.Sign(ctx, pb.publishingKeyID, h[:]) + id, err := core.IDFromDID(*identifier) if err != nil { return nil, err } - signedTx, err := tx.WithSignature(s, sig) - if err != nil { - return nil, fmt.Errorf("failed sign transaction: %w", err) - } - - err = pb.client.SendRawTx(ctx, signedTx) - if err != nil { - return nil, err + switch identity.KeyType { + case string(kms.KeyTypeEthereum): + keyIDs, err := pb.kms.KeysByIdentity(ctx, *identifier) + if err != nil { + return nil, err + } + + var sigKeyID kms.KeyID + for _, v := range keyIDs { + if v.Type == kms.KeyTypeEthereum { + sigKeyID = v + break + } + } + + ctxWT, cancel := context.WithTimeout(ctx, pb.ethRPCResponseTimeout) + defer cancel() + opts, err := pb.client.CreateTxOpts(ctxWT, sigKeyID) + if err != nil { + log.Error(ctx, "failed to create tx opts", "err", err) + return nil, err + } + + tx, err = pb.contractBinding.TransitStateGeneric(opts, id.BigInt(), latestState.BigInt(), newState.BigInt(), isOldStateGenesis, big.NewInt(1), []byte{}) + if err != nil { + return nil, err + } + + case string(kms.KeyTypeBabyJubJub): + ctxWT, cancel := context.WithTimeout(ctx, pb.ethRPCResponseTimeout) + defer cancel() + opts, err := pb.client.CreateTxOpts(ctxWT, pb.publishingKeyID) + if err != nil { + log.Error(ctx, "failed to create tx opts", "err", err) + return nil, err + } + + a, b, c, err := pb.adaptProofToAbi(proof) + if err != nil { + return nil, err + } + + tx, err = pb.contractBinding.TransitState(opts, id.BigInt(), latestState.BigInt(), newState.BigInt(), isOldStateGenesis, a, b, c) + if err != nil { + return nil, err + } + default: + return nil, errors.New("unsupported key type for publishing") } - txID := signedTx.Hash().Hex() + txID := tx.Hash().Hex() - var ( - gasTip = signedTx.GasTipCap() - maxGasPricePerFee = signedTx.GasFeeCap() - baseFee = big.NewInt(0).Sub(maxGasPricePerFee, gasTip) - ) - log.Debug(ctx, "Prices for tx", "txID", txID, "Basefee", baseFee, "Tip", gasTip, "MaxPrice", maxGasPricePerFee) return &txID, nil } -func (pb *PublisherEthGateway) getAddressForTxInitiator() (ethCommon.Address, error) { - bytesPubKey, err := pb.kms.PublicKey(pb.publishingKeyID) +func (pb *PublisherEthGateway) adaptProofToAbi(proof *rstypes.ProofData) (proofA [2]*big.Int, proofB [2][2]*big.Int, proofC [2]*big.Int, err error) { + a, err := common.ArrayStringToBigInt(proof.A) if err != nil { - return ethCommon.Address{}, err - } - var pubKey *ecdsa.PublicKey - bytesPubKeyLen := 33 - switch len(bytesPubKey) { - case bytesPubKeyLen: - pubKey, err = crypto.DecompressPubkey(bytesPubKey) - default: - pubKey, err = crypto.UnmarshalPubkey(bytesPubKey) + return } + b, err := common.ArrayOfStringArraysToBigInt(proof.B) if err != nil { - return ethCommon.Address{}, err + return } - fromAddress := crypto.PubkeyToAddress(*pubKey) - return fromAddress, nil -} - -func (pb *PublisherEthGateway) getStatePayload(identifier *w3c.DID, latestState, newState *merkletree.Hash, isOldStateGenesis bool, proof *domain.ZKProof) ([]byte, error) { - a, b, c, err := proof.ProofToBigInts() + c, err := common.ArrayStringToBigInt(proof.C) if err != nil { - return nil, err + return } - proofA := [2]*big.Int{a[0], a[1]} - proofB := [2][2]*big.Int{ + proofA = [2]*big.Int{a[0], a[1]} + proofB = [2][2]*big.Int{ {b[0][1], b[0][0]}, {b[1][1], b[1][0]}, } - proofC := [2]*big.Int{c[0], c[1]} - - ab, err := abi.StateMetaData.GetAbi() - if err != nil { - return nil, err - } - - id, err := core.IDFromDID(*identifier) - if err != nil { - return nil, err - } - - payload, err := ab.Pack("transitState", id.BigInt(), latestState.BigInt(), newState.BigInt(), isOldStateGenesis, - proofA, proofB, proofC) - if err != nil { - return nil, err - } + proofC = [2]*big.Int{c[0], c[1]} - return payload, nil + return } diff --git a/internal/kms/main_test.go b/internal/kms/main_test.go index d1bf9bf51..77c156916 100644 --- a/internal/kms/main_test.go +++ b/internal/kms/main_test.go @@ -16,10 +16,10 @@ import ( var cfg config.KeyStore type TestKMS struct { - KMS *KMS - VaultCli *api.Client - writenIDs []KeyID - t testing.TB + KMS *KMS + VaultCli *api.Client + writtenIDs []KeyID + t testing.TB } func TestMain(m *testing.M) { @@ -45,8 +45,8 @@ func testKMSSetup(t testing.TB) TestKMS { k.KMS = NewKMS() - // err = k.KMS.RegisterKeyProvider(KeyTypeEthereum, NewVaultEthProvider(k.VaultCli, KeyTypeEthereum)) - // require.NoError(t, err) + err = k.KMS.RegisterKeyProvider(KeyTypeEthereum, NewVaultEthProvider(k.VaultCli, KeyTypeEthereum)) + require.NoError(t, err) err = k.KMS.RegisterKeyProvider(KeyTypeBabyJubJub, NewVaultBJJKeyProvider(k.VaultCli, KeyTypeBabyJubJub)) require.NoError(t, err) @@ -57,7 +57,7 @@ func testKMSSetup(t testing.TB) TestKMS { // Close cleans up Vault on test complete. func (tk *TestKMS) Close() { - for _, k := range tk.writenIDs { + for _, k := range tk.writtenIDs { _, err := tk.VaultCli.Logical().Delete(absVaultSecretPath(k.ID)) assert.NoError(tk.t, err) } diff --git a/internal/kms/vaultPluginIden3KeyProvider.go b/internal/kms/vaultPluginIden3KeyProvider.go index 1278ee431..facbe96d3 100644 --- a/internal/kms/vaultPluginIden3KeyProvider.go +++ b/internal/kms/vaultPluginIden3KeyProvider.go @@ -108,20 +108,17 @@ func (v *vaultPluginIden3KeyProvider) ListByIdentity(_ context.Context, identity return nil, err } - result := make([]KeyID, len(entries)) - ln := 0 - for i, k := range entries { + result := make([]KeyID, 0) + for _, k := range entries { if !v.keyNameRE.MatchString(k) { // ignore unknown keys continue } - - result[i].Type = v.keyType - result[i].ID = path.Join(identityKeysPath.keyID, k) - ln++ + keyID := KeyID{Type: v.keyType, ID: path.Join(identityKeysPath.keyID, k)} + result = append(result, keyID) } - return result[:ln], nil + return result, nil } func (v *vaultPluginIden3KeyProvider) PublicKey(keyID KeyID) ([]byte, error) { diff --git a/internal/kms/vault_eth_key_provider.go b/internal/kms/vault_eth_key_provider.go new file mode 100644 index 000000000..e0bdc6cc9 --- /dev/null +++ b/internal/kms/vault_eth_key_provider.go @@ -0,0 +1,212 @@ +package kms + +import ( + "context" + "crypto/ecdsa" + "encoding/hex" + "regexp" + + "github.com/ethereum/go-ethereum/crypto" + "github.com/hashicorp/vault/api" + "github.com/iden3/go-iden3-core/v2/w3c" + "github.com/pkg/errors" +) + +type vaultETHKeyProvider struct { + keyType KeyType + vaultCli *api.Client + reIdenKeyPathHex *regexp.Regexp +} + +func (v *vaultETHKeyProvider) LinkToIdentity(ctx context.Context, keyID KeyID, identity w3c.DID) (KeyID, error) { + return keyID, errors.New("Ethereum keys does not support binding") +} + +// nolint +func (v *vaultETHKeyProvider) privateKey(keyID KeyID) ([]byte, error) { + if keyID.Type != v.keyType { + return nil, errors.WithStack(ErrIncorrectKeyType) + } + + if keyID.ID == "" { + return nil, errors.New("key ID is empty") + } + + path := absVaultSecretPath(keyID.ID) + secret, err := v.vaultCli.Logical().Read(path) + if err != nil { + return nil, errors.WithStack(err) + } + + secData, err := getKVv2SecretData(secret) + if err != nil { + return nil, err + } + + var keyHexI interface{} + + ss := v.reIdenKeyPathHex.FindStringSubmatch(keyID.ID) + if len(ss) == 2 { + // key stored for identity in format + // key_type: type + // key_data: private_key + keyTypeI, ok := secData[jsonKeyType] + if !ok { + return nil, errors.New("key type not found") + } + keyType, ok := keyTypeI.(string) + if !ok { + return nil, errors.New("unexpected format of key type") + } + if KeyType(keyType) != v.keyType { + return nil, errors.WithStack(ErrIncorrectKeyType) + } + keyHexI, ok = secData[jsonKeyData] + if !ok { + return nil, errors.New("key data not found") + } + } else { + // key is stored in root directory + var ok bool + keyHexI, ok = secData[keyID.ID] + if !ok { + return nil, errors.New("private key not found") + } + } + + keyHex, ok := keyHexI.(string) + if !ok { + return nil, errors.New("unexpected format for private key") + } + val, err := hex.DecodeString(keyHex) + if err != nil { + return nil, errors.WithStack(err) + } + if len(val) != 32 { + return nil, errors.New("incorrect private key") + } + + return val, nil +} + +func (v *vaultETHKeyProvider) Sign(_ context.Context, keyID KeyID, data []byte) ([]byte, error) { + privKeyData, err := v.privateKey(keyID) + if err != nil { + return nil, err + } + + privKey, err := decodeETHPrivateKey(privKeyData) + if err != nil { + return nil, err + } + + sig, err := crypto.Sign(data, privKey) + return sig, errors.WithStack(err) +} + +func (v *vaultETHKeyProvider) ListByIdentity(_ context.Context, identity w3c.DID) ([]KeyID, error) { + path := identityPath(&identity) + entries, err := listDirectoryEntries(v.vaultCli, path) + if err != nil { + return nil, err + } + + reVaultKeyHex, err := regexp.Compile("^(?i)" + + regexp.QuoteMeta(string(v.keyType)) + ":([a-f0-9]{66})$") + if err != nil { + return nil, errors.WithStack(err) + } + + var result []KeyID //nolint:prealloc // result may be empty + for _, k := range entries { + if !reVaultKeyHex.MatchString(k) { + // ignore unknown keys + continue + } + + result = append(result, KeyID{ + Type: v.keyType, + ID: path + "/" + k, + }) + } + return result, nil +} + +// nolint +func (v *vaultETHKeyProvider) PublicKey(keyID KeyID) ([]byte, error) { + if keyID.Type != v.keyType { + return nil, errors.New("incorrect key type") + } + + ss := v.reIdenKeyPathHex.FindStringSubmatch(keyID.ID) + if len(ss) != 2 { + // if not found. try get public key from private key. + pkBytes, err := v.privateKey(keyID) + if err != nil { + return nil, errors.New("unable to get private key for build public key") + } + pk, err := decodeETHPrivateKey(pkBytes) + if err != nil { + return nil, err + } + switch v := pk.Public().(type) { + case *ecdsa.PublicKey: + return crypto.FromECDSAPub(v), nil + default: + return nil, errors.New("unable to get public key from key ID") + } + } + + val, err := hex.DecodeString(ss[1]) + return val, errors.WithStack(err) +} + +func (v *vaultETHKeyProvider) New(identity *w3c.DID) (KeyID, error) { + keyID := KeyID{Type: v.keyType} + + if identity == nil { + return keyID, errors.New( + "Ethereum keys can be created only for non-nil identities") + } + + ethPrivKey, err := crypto.GenerateKey() + if err != nil { + return keyID, errors.WithStack(err) + } + + keyMaterial := map[string]string{ + jsonKeyType: string(KeyTypeEthereum), + jsonKeyData: hex.EncodeToString(crypto.FromECDSA(ethPrivKey)), + } + + pubKey, ok := ethPrivKey.Public().(*ecdsa.PublicKey) + if !ok { + return keyID, errors.New("unexpected public key type") + } + pubKeyBytes := crypto.CompressPubkey(pubKey) + pubKeyHex := hex.EncodeToString(pubKeyBytes) + keyID.ID = keyPath(identity, v.keyType, pubKeyHex) + + return keyID, saveKeyMaterial(v.vaultCli, keyID.ID, keyMaterial) +} + +// NewVaultEthProvider creates new provider for Ethereum keys stored in vault +func NewVaultEthProvider(valutCli *api.Client, keyType KeyType) KeyProvider { + reIdenKeyPathHex := regexp.MustCompile("^(?i).*/" + + regexp.QuoteMeta(string(keyType)) + ":([a-f0-9]{66})$") + return &vaultETHKeyProvider{keyType, valutCli, reIdenKeyPathHex} +} + +// DecodeETHPubKey is a helper method to convert byte representation of public +// key to *ecdsa.PublicKey +func DecodeETHPubKey(key []byte) (*ecdsa.PublicKey, error) { + pubKey, err := crypto.DecompressPubkey(key) + return pubKey, errors.WithStack(err) +} + +// decodeETHPrivateKey is a helper method to convert byte representation of +// private key to *ecdsa.PrivateKey +func decodeETHPrivateKey(key []byte) (*ecdsa.PrivateKey, error) { + privKey, err := crypto.ToECDSA(key) + return privKey, errors.WithStack(err) +} diff --git a/internal/kms/vault_eth_key_provider_test.go b/internal/kms/vault_eth_key_provider_test.go new file mode 100644 index 000000000..34e716b10 --- /dev/null +++ b/internal/kms/vault_eth_key_provider_test.go @@ -0,0 +1,80 @@ +package kms + +import ( + "context" + "strings" + "testing" + + "github.com/ethereum/go-ethereum/crypto" + core "github.com/iden3/go-iden3-core/v2" + "github.com/stretchr/testify/require" +) + +func TestEthKeyProvider(t *testing.T) { + k := testKMSSetup(t) + + _, err := k.KMS.CreateKey(KeyTypeEthereum, nil) + require.EqualError(t, err, + "Ethereum keys can be created only for non-nil identities") + + identity, err := core.IDFromString("x2Uw18ATvY7mEsgfrrDipBmQQdPWAao4NmF56wGvp") + require.NoError(t, err) + + did, err := core.ParseDIDFromID(identity) + require.NoError(t, err) + + keyID, err := k.KMS.CreateKey(KeyTypeEthereum, did) + require.NoError(t, err) + require.Equal(t, KeyTypeEthereum, keyID.Type) + + sec, err := k.VaultCli.Logical().Read("secret/data/" + keyID.ID) + require.NoError(t, err) + require.Len(t, sec.Data["data"], 2) + + keyType, ok := sec.Data["data"].(map[string]interface{})[jsonKeyType].(string) + require.True(t, ok) + require.Equal(t, string(KeyTypeEthereum), keyType) + + privKeyHex, ok := sec.Data["data"].(map[string]interface{})[jsonKeyData].(string) + require.True(t, ok) + privKey, err := crypto.HexToECDSA(privKeyHex) + require.NoError(t, err) + + pubKeyBytes, err := k.KMS.PublicKey(keyID) + require.NoError(t, err) + pubKey, err := DecodeETHPubKey(pubKeyBytes) + require.NoError(t, err) + + require.True(t, privKey.PublicKey.Equal(pubKey)) + + // Test listing + keys, err := k.KMS.KeysByIdentity(context.Background(), *did) + require.NoError(t, err) + found := false + for _, k := range keys { + if k.Type != KeyTypeEthereum { + continue + } + require.True(t, + strings.HasPrefix(k.ID, keysPathPrefix+did.String()+"/")) + if k == keyID { + found = true + break + } + } + require.True(t, found) + + // Test signature + text := []byte("abc") + digest := crypto.Keccak256(text) + sig, err := k.KMS.Sign(context.Background(), keyID, digest) + require.NoError(t, err) + require.True(t, crypto.VerifySignature(pubKeyBytes, digest, sig[:64])) + + sigPublicKeyECDSA, err := crypto.SigToPub(digest, sig) + require.NoError(t, err) + require.True(t, sigPublicKeyECDSA.Equal(pubKey)) + + _, err = k.VaultCli.Logical().Delete("secret/data/" + keyID.ID) + require.NoError(t, err) +} diff --git a/internal/loader/loader.go b/internal/loader/loader.go index e74342155..164450601 100644 --- a/internal/loader/loader.go +++ b/internal/loader/loader.go @@ -2,7 +2,6 @@ package loader import ( "github.com/iden3/go-schema-processor/processor" - "github.com/iden3/go-schema-processor/v2/loaders" "github.com/piprate/json-gold/ld" ) @@ -19,5 +18,5 @@ type Factory func(url string) Loader // NewDocumentLoader returns a new ld.DocumentLoader that will use http ipfs gateway to download documents func NewDocumentLoader(ipfsGateway string) ld.DocumentLoader { - return loaders.NewDocumentLoader(nil, ipfsGateway) + return NewW3CDocumentLoader(nil, ipfsGateway) } diff --git a/internal/loader/w3c_loader.go b/internal/loader/w3c_loader.go new file mode 100644 index 000000000..8aba952f6 --- /dev/null +++ b/internal/loader/w3c_loader.go @@ -0,0 +1,241 @@ +package loader + +import ( + "strings" + + "github.com/iden3/go-schema-processor/v2/loaders" + shell "github.com/ipfs/go-ipfs-api" + "github.com/piprate/json-gold/ld" +) + +// W3CDocumentLoader is a document loader for w3c documents +type W3CDocumentLoader struct { + l ld.DocumentLoader +} + +// NewW3CDocumentLoader creates a new document loader with a predefined http schema +func NewW3CDocumentLoader(ipfsCli *shell.Shell, ipfsGW string) ld.DocumentLoader { + return &W3CDocumentLoader{ + l: loaders.NewDocumentLoader(ipfsCli, ipfsGW), + } +} + +// LoadDocument loads a document from a url +func (d *W3CDocumentLoader) LoadDocument(u string) (doc *ld.RemoteDocument, err error) { + if u == W3CCredential2018ContextURL { + w3cDoc, errIn := ld.DocumentFromReader(strings.NewReader(W3CCredential2018ContextDocument)) + if errIn != nil { + return nil, errIn + } + return &ld.RemoteDocument{ + DocumentURL: u, + Document: w3cDoc, + ContextURL: u, + }, nil + } + return d.l.LoadDocument(u) +} + +// W3CCredential2018ContextURL is w3c context url +// +//nolint:golint,gosec //reason: not credentials +const W3CCredential2018ContextURL = "https://www.w3.org/2018/credentials/v1" + +// W3CCredential2018ContextDocument is w3c context file +// +//nolint:golint,gosec //reason: not credentials +const W3CCredential2018ContextDocument string = `{ + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "VerifiableCredential": { + "@id": "https://www.w3.org/2018/credentials#VerifiableCredential", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "cred": "https://www.w3.org/2018/credentials#", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "credentialSchema": { + "@id": "cred:credentialSchema", + "@type": "@id", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "cred": "https://www.w3.org/2018/credentials#", + "JsonSchemaValidator2018": "cred:JsonSchemaValidator2018" + } + }, + "credentialStatus": {"@id": "cred:credentialStatus", "@type": "@id"}, + "credentialSubject": {"@id": "cred:credentialSubject", "@type": "@id"}, + "evidence": {"@id": "cred:evidence", "@type": "@id"}, + "expirationDate": {"@id": "cred:expirationDate", "@type": "xsd:dateTime"}, + "holder": {"@id": "cred:holder", "@type": "@id"}, + "issued": {"@id": "cred:issued", "@type": "xsd:dateTime"}, + "issuer": {"@id": "cred:issuer", "@type": "@id"}, + "issuanceDate": {"@id": "cred:issuanceDate", "@type": "xsd:dateTime"}, + "proof": {"@id": "sec:proof", "@type": "@id", "@container": "@graph"}, + "refreshService": { + "@id": "cred:refreshService", + "@type": "@id", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "cred": "https://www.w3.org/2018/credentials#", + "ManualRefreshService2018": "cred:ManualRefreshService2018" + } + }, + "termsOfUse": {"@id": "cred:termsOfUse", "@type": "@id"}, + "validFrom": {"@id": "cred:validFrom", "@type": "xsd:dateTime"}, + "validUntil": {"@id": "cred:validUntil", "@type": "xsd:dateTime"} + } + }, + "VerifiablePresentation": { + "@id": "https://www.w3.org/2018/credentials#VerifiablePresentation", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "cred": "https://www.w3.org/2018/credentials#", + "sec": "https://w3id.org/security#", + "holder": {"@id": "cred:holder", "@type": "@id"}, + "proof": {"@id": "sec:proof", "@type": "@id", "@container": "@graph"}, + "verifiableCredential": {"@id": "cred:verifiableCredential", "@type": "@id", "@container": "@graph"} + } + }, + "EcdsaSecp256k1Signature2019": { + "@id": "https://w3id.org/security#EcdsaSecp256k1Signature2019", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "challenge": "sec:challenge", + "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"}, + "domain": "sec:domain", + "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"}, + "jws": "sec:jws", + "nonce": "sec:nonce", + "proofPurpose": { + "@id": "sec:proofPurpose", + "@type": "@vocab", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "sec": "https://w3id.org/security#", + "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"}, + "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"} + } + }, + "proofValue": "sec:proofValue", + "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"} + } + }, + "EcdsaSecp256r1Signature2019": { + "@id": "https://w3id.org/security#EcdsaSecp256r1Signature2019", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "challenge": "sec:challenge", + "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"}, + "domain": "sec:domain", + "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"}, + "jws": "sec:jws", + "nonce": "sec:nonce", + "proofPurpose": { + "@id": "sec:proofPurpose", + "@type": "@vocab", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "sec": "https://w3id.org/security#", + "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"}, + "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"} + } + }, + "proofValue": "sec:proofValue", + "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"} + } + }, + "Ed25519Signature2018": { + "@id": "https://w3id.org/security#Ed25519Signature2018", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "sec": "https://w3id.org/security#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "challenge": "sec:challenge", + "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"}, + "domain": "sec:domain", + "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"}, + "jws": "sec:jws", + "nonce": "sec:nonce", + "proofPurpose": { + "@id": "sec:proofPurpose", + "@type": "@vocab", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "sec": "https://w3id.org/security#", + "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"}, + "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"} + } + }, + "proofValue": "sec:proofValue", + "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"} + } + }, + "RsaSignature2018": { + "@id": "https://w3id.org/security#RsaSignature2018", + "@context": { + "@version": 1.1, + "@protected": true, + "challenge": "sec:challenge", + "created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"}, + "domain": "sec:domain", + "expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"}, + "jws": "sec:jws", + "nonce": "sec:nonce", + "proofPurpose": { + "@id": "sec:proofPurpose", + "@type": "@vocab", + "@context": { + "@version": 1.1, + "@protected": true, + "id": "@id", + "type": "@type", + "sec": "https://w3id.org/security#", + "assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"}, + "authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"} + } + }, + "proofValue": "sec:proofValue", + "verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"} + } + }, + "proof": {"@id": "https://w3id.org/security#proof", "@type": "@id", "@container": "@graph"} + } +}` diff --git a/internal/providers/blockchain/eth.go b/internal/providers/blockchain/eth.go index d26c1fc92..1d0314041 100644 --- a/internal/providers/blockchain/eth.go +++ b/internal/providers/blockchain/eth.go @@ -9,6 +9,7 @@ import ( "github.com/iden3/contracts-abi/state/go/abi" "github.com/polygonid/sh-id-platform/internal/config" + "github.com/polygonid/sh-id-platform/internal/kms" "github.com/polygonid/sh-id-platform/pkg/blockchain/eth" ) @@ -27,7 +28,7 @@ func InitEthClient(ethURL, contractAddress string) (*abi.State, error) { } // InitEthConnect opens a new eth connection -func InitEthConnect(cfg config.Ethereum) (*eth.Client, error) { +func InitEthConnect(cfg config.Ethereum, kms *kms.KMS) (*eth.Client, error) { commonClient, err := ethclient.Dial(cfg.URL) if err != nil { return nil, err @@ -43,13 +44,15 @@ func InitEthConnect(cfg config.Ethereum) (*eth.Client, error) { RPCResponseTimeout: cfg.RPCResponseTimeout, WaitReceiptCycleTime: cfg.WaitReceiptCycleTime, WaitBlockCycleTime: cfg.WaitBlockCycleTime, - }) + }, + kms, + ) return cl, nil } // Open returns an initialized eth Client with the given configuration -func Open(cfg *config.Configuration) (*eth.Client, error) { +func Open(cfg *config.Configuration, kms *kms.KMS) (*eth.Client, error) { ethClient, err := ethclient.Dial(cfg.Ethereum.URL) if err != nil { return nil, err @@ -65,5 +68,5 @@ func Open(cfg *config.Configuration) (*eth.Client, error) { RPCResponseTimeout: cfg.Ethereum.RPCResponseTimeout, WaitReceiptCycleTime: cfg.Ethereum.WaitReceiptCycleTime, WaitBlockCycleTime: cfg.Ethereum.WaitBlockCycleTime, - }), nil + }, kms), nil } diff --git a/internal/repositories/identity.go b/internal/repositories/identity.go index be8510828..ac01fe1ce 100644 --- a/internal/repositories/identity.go +++ b/internal/repositories/identity.go @@ -18,8 +18,9 @@ func NewIdentity() ports.IndentityRepository { return &identity{} } +// Save - Create new identity func (i *identity) Save(ctx context.Context, conn db.Querier, identity *domain.Identity) error { - _, err := conn.Exec(ctx, `INSERT INTO identities (identifier) VALUES ($1)`, identity.Identifier) + _, err := conn.Exec(ctx, `INSERT INTO identities (identifier, address, keyType) VALUES ($1, $2, $3)`, identity.Identifier, identity.Address, identity.KeyType) return err } @@ -29,6 +30,8 @@ func (i *identity) GetByID(ctx context.Context, conn db.Querier, identifier w3c. } row := conn.QueryRow(ctx, `SELECT identities.identifier, + identities.keyType, + identities.address, state_id, state, root_of_roots, @@ -50,6 +53,8 @@ func (i *identity) GetByID(ctx context.Context, conn db.Querier, identifier w3c. ORDER BY state_id DESC LIMIT 1`, identifier.String()) err := row.Scan(&identity.Identifier, + &identity.KeyType, + &identity.Address, &identity.State.StateID, &identity.State.State, &identity.State.RootOfRoots, diff --git a/pkg/blockchain/eth/client.go b/pkg/blockchain/eth/client.go index 40c24106a..ef1525724 100644 --- a/pkg/blockchain/eth/client.go +++ b/pkg/blockchain/eth/client.go @@ -15,10 +15,12 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/misc/eip1559" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/params" "github.com/iden3/contracts-abi/state/go/abi" + "github.com/polygonid/sh-id-platform/internal/kms" "github.com/polygonid/sh-id-platform/internal/log" ) @@ -44,12 +46,15 @@ var ( ErrReceiptNotReceived = errors.New("receipt not available") // ErrTransactionNotFound transaction doesn't exist on blockchain ErrTransactionNotFound = errors.New("transaction not found") + // CompressedPublicKeyLength is the length of a compressed public key + CompressedPublicKeyLength = 33 ) // Client is an ethereum client to call Smart Contract methods. type Client struct { client *ethclient.Client Config *ClientConfig + kms *kms.KMS } // ClientConfig eth client config @@ -66,8 +71,17 @@ type ClientConfig struct { } // NewClient creates a Client instance. -func NewClient(client *ethclient.Client, c *ClientConfig) *Client { - return &Client{client: client, Config: c} +func NewClient(client *ethclient.Client, c *ClientConfig, kms *kms.KMS) *Client { + return &Client{ + client: client, + Config: c, + kms: kms, + } +} + +// GetEthereumClient returns the underlying ethereum client +func (c *Client) GetEthereumClient() *ethclient.Client { + return c.client } // BalanceAt retrieves information about the default account @@ -294,6 +308,32 @@ func (c *Client) GetTransactionByID(ctx context.Context, txID string) (*types.Tr return c.client.TransactionByHash(ctx, common.HexToHash(txID)) } +// CreateTxOpts creates a new transaction signer +func (c *Client) CreateTxOpts(ctx context.Context, kmsKey kms.KeyID) (*bind.TransactOpts, error) { + addr, err := c.getAddress(kmsKey) + if err != nil { + return nil, err + } + + sigFn := c.signerFnFactory(ctx, kmsKey) + + tip, err := c.suggestGasTipCap(ctx) + if err != nil { + return nil, err + } + + opts := &bind.TransactOpts{ + From: addr, + Signer: sigFn, + GasTipCap: tip, // The only option we need to set is gasTipCap as some Ethereum nodes don't support eth_maxPriorityFeePerGas + GasLimit: 0, // go-ethereum library will estimate gas limit automatically if it is 0 + Context: ctx, + NoSend: false, + } + + return opts, nil +} + // TransactionParams settings for transaction. type TransactionParams struct { BaseFee *big.Int @@ -302,6 +342,7 @@ type TransactionParams struct { FromAddress common.Address ToAddress common.Address Payload []byte + Value *big.Int } // CreateRawTx raw transaction. @@ -318,11 +359,14 @@ func (c *Client) CreateRawTx(ctx context.Context, txParams TransactionParams) (* _ctx2, cancel2 := context.WithTimeout(ctx, c.Config.RPCResponseTimeout) defer cancel2() + if txParams.Value == nil { + txParams.Value = big.NewInt(0) + } gasLimit, err := c.client.EstimateGas(_ctx2, ethereum.CallMsg{ From: txParams.FromAddress, // the sender of the 'transaction' To: &txParams.ToAddress, - Gas: 0, // wei <-> gas exchange ratio - Value: big.NewInt(0), // amount of wei sent along with the call + Gas: 0, // wei <-> gas exchange ratio + Value: txParams.Value, // amount of wei sent along with the call Data: txParams.Payload, }) if err != nil { @@ -366,7 +410,7 @@ func (c *Client) CreateRawTx(ctx context.Context, txParams TransactionParams) (* To: &txParams.ToAddress, Nonce: *txParams.Nonce, Gas: gasLimit, - Value: big.NewInt(0), + Value: txParams.Value, Data: txParams.Payload, GasTipCap: txParams.GasTips, GasFeeCap: maxGasPricePerFee, @@ -428,3 +472,66 @@ func (c *Client) getGasPrice(ctx context.Context) (*big.Int, error) { return gasPrice, err } + +// getAddress - get address by keyID +func (c *Client) getAddress(k kms.KeyID) (common.Address, error) { + if c.kms == nil { + return common.Address{}, errors.Join(errors.New("the signer is read-only")) + } + bytesPubKey, err := c.kms.PublicKey(k) + if err != nil { + return common.Address{}, err + } + var pubKey *ecdsa.PublicKey + switch len(bytesPubKey) { + case CompressedPublicKeyLength: + pubKey, err = crypto.DecompressPubkey(bytesPubKey) + default: + pubKey, err = crypto.UnmarshalPubkey(bytesPubKey) + } + if err != nil { + return common.Address{}, err + } + fromAddress := crypto.PubkeyToAddress(*pubKey) + return fromAddress, nil +} + +func (c *Client) signerFnFactory(ctx context.Context, signingKeyID kms.KeyID) func(address common.Address, tx *types.Transaction) (*types.Transaction, error) { + return func(address common.Address, tx *types.Transaction) (*types.Transaction, error) { + if c.kms == nil { + return nil, errors.Join(errors.New("the signer is read-only")) + } + + ch, err := c.ChainID(ctx) + if err != nil { + return nil, err + } + + signer := types.LatestSignerForChainID(ch) + h := signer.Hash(tx) + + sig, err := c.kms.Sign(ctx, signingKeyID, h[:]) + if err != nil { + return nil, err + } + + return tx.WithSignature(signer, sig) + } +} + +func (c *Client) suggestGasTipCap(ctx context.Context) (*big.Int, error) { + ctxWT, cancel3 := context.WithTimeout(ctx, c.Config.RPCResponseTimeout) + defer cancel3() + + tip, err := c.client.SuggestGasTipCap(ctxWT) + // since hardhat doesn't support 'eth_maxPriorityFeePerGas' rpc call. + // we should hard code 0 as a mainer tips. More information: https://github.com/NomicFoundation/hardhat/issues/1664#issuecomment-1149006010 + if err != nil && strings.Contains(err.Error(), "eth_maxPriorityFeePerGas not found") { + log.Info(ctx, "failed get suggest gas tip: %s. use 0 instead", "err", err) + tip = big.NewInt(0) + } else if err != nil { + return nil, errors.Join(err, errors.New("failed get suggest gas tip")) + } + + return tip, nil +} diff --git a/pkg/protocol/packagemanager.go b/pkg/protocol/packagemanager.go index b8ecf598e..35dc29846 100644 --- a/pkg/protocol/packagemanager.go +++ b/pkg/protocol/packagemanager.go @@ -42,6 +42,8 @@ func InitPackageManager(ctx context.Context, stateContract *abi.State, zkProofSe verifications, ) + // TODO: Why jwsPacker is not defined here? + packageManager := iden3comm.NewPackageManager() err = packageManager.RegisterPackers(zkpPackerV2, &packers.PlainMessagePacker{}) diff --git a/pkg/reverse_hash/reverse_hash.go b/pkg/reverse_hash/reverse_hash.go index b322337a7..51fb9db13 100644 --- a/pkg/reverse_hash/reverse_hash.go +++ b/pkg/reverse_hash/reverse_hash.go @@ -26,6 +26,7 @@ type stateHashes struct { // RhsPublisher defines reverse hash publisher functions. type RhsPublisher interface { PushHashesToRHS(ctx context.Context, newState, prevState *domain.IdentityState, revocations []*domain.Revocation, trees *domain.IdentityMerkleTrees) error + PublishNodesToRHS(ctx context.Context, nodes []proof.Node) error } type rhsPublisher struct { @@ -97,7 +98,36 @@ func (rhsp *rhsPublisher) PushHashesToRHS(ctx context.Context, newState, prevSta return err } +// PublishNodesToRHS pushes nodes to reverse hash service. +func (rhsp *rhsPublisher) PublishNodesToRHS(ctx context.Context, nodes []proof.Node) error { + // if Reverse-Hash-Service is not configure, do nothing. + if rhsp.rhsCli == nil { + log.Error(ctx, "Reverse-Hash-Service is not configured") + return nil + } + if len(nodes) > 0 { + log.Info(ctx, "new state nodes", nodes) + err := rhsp.rhsCli.SaveNodes(ctx, nodes) + if err != nil { + if rhsp.ignoreRHSErrors { + log.Error(ctx, "failed to push nodes to RHS", err) + return nil + } + return err + } + } + return nil +} + func newStateHashesFromModel(inState *domain.IdentityState) (stateHashes, error) { + if *inState.State == merkletree.HashZero.Hex() { + return stateHashes{ + State: merkletree.HashZero, + Claims: merkletree.HashZero, + Rev: merkletree.HashZero, + Roots: merkletree.HashZero, + }, nil + } if inState == nil { return stateHashes{}, errors.New("nil state") } diff --git a/pkg/schema/schema.go b/pkg/schema/schema.go index b439501d7..7a3abca30 100644 --- a/pkg/schema/schema.go +++ b/pkg/schema/schema.go @@ -16,6 +16,7 @@ import ( "github.com/polygonid/sh-id-platform/internal/core/domain" "github.com/polygonid/sh-id-platform/internal/jsonschema" "github.com/polygonid/sh-id-platform/internal/loader" + "github.com/polygonid/sh-id-platform/internal/log" ) var ( @@ -95,8 +96,8 @@ func FromClaimsModelToW3CCredential(credentials domain.Credentials) ([]*verifiab func Process(ctx context.Context, loader loader.DocumentLoader, schemaURL string, credential verifiable.W3CCredential, options *processor.CoreClaimOptions) (*core.Claim, error) { var parser processor.Parser var validator processor.Validator - pr := &processor.Processor{} + pr := &processor.Processor{} validator = jsonSuite.Validator{} parser = jsonSuite.Parser{} @@ -108,21 +109,25 @@ func Process(ctx context.Context, loader loader.DocumentLoader, schemaURL string schema, err := pr.Load(ctx, schemaURL) if err != nil { + log.Error(ctx, "error loading schema", "err", err) return nil, ErrLoadSchema } jsonCredential, err := json.Marshal(credential) if err != nil { + log.Error(ctx, "error marshalling credential", "err", err) return nil, err } err = pr.ValidateData(jsonCredential, schema) if err != nil { + log.Error(ctx, "error validating claim data", "err", err) return nil, ErrValidateData } claim, err := pr.ParseClaim(ctx, credential, options) if err != nil { + log.Error(ctx, "error parsing claim", "err", err) return nil, ErrParseClaim } return claim, nil