diff --git a/.env-issuer.sample b/.env-issuer.sample index 6e3a435e0..be391482f 100644 --- a/.env-issuer.sample +++ b/.env-issuer.sample @@ -77,4 +77,10 @@ ISSUER_RESOLVER_PATH=./resolvers_settings.yaml # if you want, you can specify the content of the resolvers encoded in base64. In this case ISSUER_RESOLVER_PATH have to be empty ISSUER_RESOLVER_FILE= -ISSUER_UNIVERSAL_LINKS_BASE_URL=https://wallet.privado.id \ No newline at end of file +ISSUER_UNIVERSAL_LINKS_BASE_URL=https://wallet.privado.id + +#Payments configuration +# ISSUER_PAYMENTS_SETTINGS_PATH is the configutation file for payments. +# You can use another file by specifying the path. Be Sure to the file is mounted in the container (docker compose files) +ISSUER_PAYMENTS_SETTINGS_PATH=./payment_settings.yaml +# \ No newline at end of file diff --git a/.gitignore b/.gitignore index 81510db82..8690a5e32 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ bin/ .env-issuer .env-ui resolvers_settings.yaml +payment_settings.yaml infrastructure/local/.vault/data infrastructure/local/.vault/plugins diff --git a/.golangci.yml b/.golangci.yml index b6d06142d..e84a7033b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -66,6 +66,7 @@ linters-settings: min-complexity: 35 revive: enable-all-rules: false + rules: - name: argument-limit severity: warning @@ -74,6 +75,7 @@ linters-settings: - name: exported severity: warning disabled: false + arguments: [ "disableChecksOnConstants", "disableChecksOnVariables" ] issues: diff --git a/Dockerfile b/Dockerfile index d3d3095a7..e2ec1c282 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,4 +26,5 @@ RUN apk add curl COPY --from=base ./service/api ./api COPY --from=base ./service/bin/* ./ COPY --from=base ./service/pkg/credentials ./pkg/credentials -COPY --from=base ./service/resolvers_settings.* ./ \ No newline at end of file +COPY --from=base ./service/resolvers_settings.* ./ +COPY --from=base ./service/payment_settings.* ./ \ No newline at end of file diff --git a/README.md b/README.md index 1d947b24b..35ed86fb5 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,8 @@ a4a1d3ec9159 redis:6-alpine "docker-entrypoint.s…" 38 sec make private_key= import-private-key-to-kms ``` +**_TODO_**: Add section to configure payments + then visit: * http://localhost:8088/ to access the UI (default username / password are: user-ui, password-ui). You can set them using env [vars](.env-ui.sample). * :3001/ to access the API. (default username / password are: user-issuer, password-issuer) @@ -139,6 +141,8 @@ then modify the file with the proper values. The most important fields to run th In this file you can define customizations for each type of blockchain and network. For this example, we only need to define the RPCs. that will use. +**_TODO_**: Add section to configure payments**** + 4. Copy .env-ui sample file and fill the needed env variables: ```bash diff --git a/api/api.yaml b/api/api.yaml index 04f331c1e..b67e56ff6 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -1690,6 +1690,197 @@ paths: + /v2/identities/{identifier}/payment-request: + post: + summary: Create Payment Request + operationId: CreatePaymentRequest + description: Create a payment request for the provided identity. + tags: + - Payment + security: + - basicAuth: [ ] + parameters: + - $ref: '#/components/parameters/pathIdentifier' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePaymentRequest' + responses: + '201': + description: Payment Request Created + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePaymentRequestResponse' + '400': + $ref: '#/components/responses/400' + '401': + $ref: '#/components/responses/401' + '500': + $ref: '#/components/responses/500' + + /v2/payment/settings: + get: + summary: Payments Configuration + operationId: GetPaymentSettings + description: Returns the server payments configuration + tags: + - Payment + security: + - basicAuth: [ ] + responses: + '200': + description: Payment settings + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentsConfiguration' + + /v2/identities/{identifier}/payment/options: + get: + summary: Get Payment Options + operationId: GetPaymentOptions + description: Get the payment options for the provided identity. + tags: + - Payment + security: + - basicAuth: [ ] + parameters: + - $ref: '#/components/parameters/pathIdentifier' + responses: + '200': + description: Payment options + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentOptionsPaginated' + '400': + $ref: '#/components/responses/400' + '401': + $ref: '#/components/responses/401' + '500': + $ref: '#/components/responses/500' + post: + summary: Create Payment Option + operationId: CreatePaymentOption + description: Create a payment option for the provided identity. + tags: + - Payment + security: + - basicAuth: [ ] + parameters: + - $ref: '#/components/parameters/pathIdentifier' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentOptionRequest' + responses: + '201': + description: Payment Option Created + content: + application/json: + schema: + $ref: '#/components/schemas/UUIDResponse' + '400': + $ref: '#/components/responses/400' + '401': + $ref: '#/components/responses/401' + '500': + $ref: '#/components/responses/500' + + /v2/identities/{identifier}/payment/options/{id}: + get: + summary: Get Payment Option + operationId: GetPaymentOption + description: Get a specific payment option for the provided identity. + tags: + - Payment + security: + - basicAuth: [ ] + parameters: + - $ref: '#/components/parameters/pathIdentifier' + - $ref: '#/components/parameters/id' + responses: + '200': + description: Payment option + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentOption' + '400': + $ref: '#/components/responses/400' + '404': + $ref: '#/components/responses/404' + '500': + $ref: '#/components/responses/500' + delete: + summary: Delete Payment Option + operationId: DeletePaymentOption + description: Remove a specific payment option for the provided identity. + tags: + - Payment + security: + - basicAuth: [ ] + parameters: + - $ref: '#/components/parameters/pathIdentifier' + - $ref: '#/components/parameters/id' + responses: + '200': + description: Payment option deleted + content: + application/json: + schema: + $ref: '#/components/schemas/GenericMessage' + '400': + $ref: '#/components/responses/400' + '500': + $ref: '#/components/responses/500' + + + /v2/identities/{identifier}/payment/verify/{nonce}: + post: + summary: Verify Payment + operationId: VerifyPayment + description: Verify a payment by nonce. + tags: + - Payment + security: + - basicAuth: [ ] + parameters: + - name: identifier + schema: + type: string + required: true + in: path + - name: nonce + schema: + type: string + in: path + required: true + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentVerifyRequest' + responses: + '200': + description: Payment verified + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentStatus' + '400': + $ref: '#/components/responses/400' + '401': + $ref: '#/components/responses/401' + '500': + $ref: '#/components/responses/500' + components: securitySchemes: basicAuth: @@ -2083,6 +2274,7 @@ components: - bigInt - url - type + - contextURL - createdAt - version properties: @@ -2106,6 +2298,8 @@ components: type: string x-omitempty: false example: KYCCountryOfResidenceCredential + contextURL: + type: string createdAt: $ref: '#/components/schemas/TimeUTC' x-omitempty: false @@ -2361,8 +2555,16 @@ components: value: type: string - #Agent - AgentResponse: + PaymentVerifyRequest: + type: object + required: + - txHash + properties: + txHash: + type: string + example: "0x8f271174b45ba7892d83..." + + BasicMessage: type: object required: - body @@ -2388,6 +2590,167 @@ components: to: type: string + AgentResponse: + $ref: '#/components/schemas/BasicMessage' + + PaymentOptionsPaginated: + type: object + required: [ items, meta ] + properties: + items: + $ref: '#/components/schemas/PaymentOptions' + meta: + $ref: '#/components/schemas/PaginatedMetadata' + + PaymentOptions: + type: array + items: + $ref: '#/components/schemas/PaymentOption' + + PaymentStatus: + type: object + required: + - status + properties: + status: + type: string + enum: [ success, failed, pending, canceled ] + + PaymentsConfiguration: + type: object + x-go-type: payments.Config + x-go-type-import: + name: payments + path: github.com/polygonid/sh-id-platform/internal/payments + + PaymentOption: + type: object + required: + - id + - issuerDID + - name + - description + - config + - modifiedAt + - createdAt + properties: + id: + type: string + x-go-type: uuid.UUID + x-go-type-import: + name: uuid + path: github.com/google/uuid + issuerDID: + type: string + name: + type: string + description: + type: string + config: + $ref: '#/components/schemas/PaymentOptionConfig' + modifiedAt: + $ref: '#/components/schemas/TimeUTC' + createdAt: + $ref: '#/components/schemas/TimeUTC' + + PaymentOptionConfig: + type: array + items: + $ref: '#/components/schemas/PaymentOptionConfigItem' + + PaymentOptionConfigItem: + type: object + required: + - paymentOptionID + - amount + - recipient + - signingKeyID + properties: + paymentOptionID: + type: integer + amount: + type: string + recipient: + type: string + signingKeyID: + type: string + + PaymentOptionRequest: + type: object + required: + - name + - description + - config + properties: + name: + type: string + description: + type: string + config: + $ref: '#/components/schemas/PaymentOptionConfig' + + CreatePaymentRequest: + type: object + required: + - optionID + - schemaID + - description + - userDID + properties: + optionID: + type: string + x-go-type: uuid.UUID + x-go-type-import: + name: uuid + path: github.com/google/uuid + schemaID: + type: string + x-go-type: uuid.UUID + x-go-type-import: + name: uuid + path: github.com/google/uuid + description: + type: string + example: "Payment for AML" + userDID: + type: string + example: "" + + CreatePaymentRequestResponse: + type: object + required: + - id + - issuerDID + - userDID + - paymentOptionID + - payments + - createdAt + properties: + id: + type: string + format: uuid + issuerDID: + type: string + userDID: + type: string + paymentOptionID: + type: string + format: uuid + payments: + type: array + items: + $ref: '#/components/schemas/PaymentRequestInfo' + createdAt: + type: string + format: date-time + + PaymentRequestInfo: + type: object + x-go-type: protocol.PaymentRequestInfo + x-go-type-import: + name: protocol + path: github.com/iden3/iden3comm/v2/protocol + TimeUTC: type: string x-go-type: timeapi.Time diff --git a/api/spec.html b/api/spec.html index 9cfa28b6d..ae3fa7a07 100644 --- a/api/spec.html +++ b/api/spec.html @@ -1,7 +1,7 @@ - Privado ID - Issuer Node + Privado ID - Issuer Node API diff --git a/cmd/platform/main.go b/cmd/platform/main.go index e8a058b4f..b167b285c 100644 --- a/cmd/platform/main.go +++ b/cmd/platform/main.go @@ -30,6 +30,7 @@ import ( "github.com/polygonid/sh-id-platform/internal/log" "github.com/polygonid/sh-id-platform/internal/network" "github.com/polygonid/sh-id-platform/internal/packagemanager" + "github.com/polygonid/sh-id-platform/internal/payments" "github.com/polygonid/sh-id-platform/internal/providers" "github.com/polygonid/sh-id-platform/internal/pubsub" "github.com/polygonid/sh-id-platform/internal/repositories" @@ -113,6 +114,7 @@ func main() { linkRepository := repositories.NewLink(*storage) sessionRepository := repositories.NewSessionCached(cachex) keyRepository := repositories.NewKey(*storage) + paymentsRepo := repositories.NewPayment(*storage) // services initialization mtService := services.NewIdentityMerkleTrees(mtRepository) @@ -146,12 +148,19 @@ func main() { return } + paymentSettings, err := payments.SettingsFromConfig(ctx, &cfg.Payments) + if err != nil { + log.Error(ctx, "failed to load payment settings", "err", err) + return + } + revocationStatusResolver := revocationstatus.NewRevocationStatusResolver(*networkResolver) identityService := services.NewIdentity(keyStore, identityRepository, mtRepository, identityStateRepository, mtService, qrService, claimsRepository, revocationRepository, connectionsRepository, storage, verifier, sessionRepository, ps, *networkResolver, rhsFactory, revocationStatusResolver, keyRepository) claimsService := services.NewClaim(claimsRepository, identityService, qrService, mtService, identityStateRepository, schemaLoader, storage, cfg.ServerUrl, ps, cfg.IPFS.GatewayURL, revocationStatusResolver, mediaTypeManager, cfg.UniversalLinks) proofService := services.NewProver(circuitsLoaderService) schemaService := services.NewSchema(schemaRepository, schemaLoader) linkService := services.NewLinkService(storage, claimsService, qrService, claimsRepository, linkRepository, schemaRepository, schemaLoader, sessionRepository, ps, identityService, *networkResolver, cfg.UniversalLinks) + paymentService := services.NewPaymentService(paymentsRepo, *networkResolver, schemaService, paymentSettings, keyStore) displayMethodService := services.NewDisplayMethod(repositories.NewDisplayMethod(*storage)) keyService := services.NewKey(keyStore, claimsService, keyRepository) transactionService, err := gateways.NewTransaction(*networkResolver) @@ -196,7 +205,7 @@ func main() { api.HandlerWithOptions( api.NewStrictHandlerWithOptions( - api.NewServer(cfg, identityService, accountService, connectionsService, claimsService, qrService, publisher, packageManager, *networkResolver, serverHealth, schemaService, linkService, displayMethodService, keyService), + api.NewServer(cfg, identityService, accountService, connectionsService, claimsService, qrService, publisher, packageManager, *networkResolver, serverHealth, schemaService, linkService, displayMethodService, keyService, paymentService), middlewares(ctx, cfg.HTTPBasicAuth), api.StrictHTTPServerOptions{ RequestErrorHandlerFunc: errors.RequestErrorHandlerFunc, diff --git a/go.mod b/go.mod index 7f03497d4..34bc08d72 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/polygonid/sh-id-platform -go 1.22.1 +go 1.22.6 require ( github.com/alicebob/miniredis/v2 v2.33.0 @@ -10,21 +10,22 @@ require ( github.com/aws/aws-sdk-go-v2/service/kms v1.35.5 github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.2 github.com/caarlos0/env/v11 v11.2.2 - github.com/ethereum/go-ethereum v1.14.8 - github.com/getkin/kin-openapi v0.127.0 + github.com/ethereum/go-ethereum v1.14.12 + github.com/getkin/kin-openapi v0.128.0 github.com/go-chi/chi/v5 v5.1.0 github.com/go-chi/cors v1.2.1 github.com/go-redis/cache/v8 v8.4.4 github.com/go-redis/redis/v8 v8.11.5 - github.com/golangci/golangci-lint v1.60.3 + github.com/golangci/golangci-lint v1.62.2 github.com/google/uuid v1.6.0 github.com/hashicorp/go-retryablehttp v0.7.7 github.com/hashicorp/vault/api v1.14.0 github.com/hashicorp/vault/api/auth/userpass v0.7.0 github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0 github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20230911112726-4533c5701af1 + github.com/iden3/driver-did-iden3 v0.0.7 github.com/iden3/go-circuits/v2 v2.4.0 - github.com/iden3/go-iden3-auth/v2 v2.5.0 + github.com/iden3/go-iden3-auth/v2 v2.6.0 github.com/iden3/go-iden3-core/v2 v2.3.1 github.com/iden3/go-iden3-crypto v0.0.17 github.com/iden3/go-jwz/v2 v2.2.0 @@ -36,51 +37,49 @@ require ( github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20240914111027-9588ce2d7e1b github.com/iden3/go-schema-processor v1.3.1 github.com/iden3/go-schema-processor/v2 v2.6.1 - github.com/iden3/iden3comm/v2 v2.6.0 + github.com/iden3/iden3comm/v2 v2.9.0 github.com/iden3/merkletree-proof v0.3.0 github.com/ipfs/go-ipfs-api v0.7.0 github.com/jackc/pgconn v1.14.3 - github.com/jackc/pgtype v1.14.3 - github.com/jackc/pgx/v4 v4.18.2 - github.com/jmoiron/sqlx v1.3.5 + github.com/jackc/pgtype v1.14.4 + github.com/jackc/pgx/v4 v4.18.3 + github.com/jmoiron/sqlx v1.4.0 github.com/joho/godotenv v1.5.1 github.com/labstack/gommon v0.4.2 github.com/lib/pq v1.10.9 github.com/mitchellh/mapstructure v1.5.0 github.com/mr-tron/base58 v1.2.0 - github.com/oapi-codegen/oapi-codegen/v2 v2.3.0 + github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 github.com/oapi-codegen/runtime v1.1.1 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/piprate/json-gold v0.5.1-0.20241210232033-19254b3ec65b github.com/pkg/errors v0.9.1 - github.com/pressly/goose/v3 v3.22.0 - github.com/stretchr/testify v1.9.0 - github.com/valkey-io/valkey-go v1.0.45 - golang.org/x/crypto v0.26.0 + github.com/pressly/goose/v3 v3.23.0 + github.com/stretchr/testify v1.10.0 + github.com/valkey-io/valkey-go v1.0.51 + golang.org/x/crypto v0.30.0 gopkg.in/yaml.v3 v3.0.1 ) -require github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect github.com/4meepo/tagalign v1.3.4 // indirect - github.com/Abirdcfly/dupword v0.1.1 // indirect - github.com/Antonboom/errname v0.1.13 // indirect - github.com/Antonboom/nilnil v0.1.9 // indirect - github.com/Antonboom/testifylint v1.4.3 // indirect + github.com/Abirdcfly/dupword v0.1.3 // indirect + github.com/Antonboom/errname v1.0.0 // indirect + github.com/Antonboom/nilnil v1.0.0 // indirect + github.com/Antonboom/testifylint v1.5.2 // indirect github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect - github.com/Crocmagnon/fatcontext v0.4.0 // indirect + github.com/Crocmagnon/fatcontext v0.5.3 // 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.3.0 // indirect - github.com/Masterminds/semver/v3 v3.2.1 // indirect + github.com/Masterminds/semver/v3 v3.3.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect github.com/VictoriaMetrics/fastcache v1.12.2 // indirect - github.com/alecthomas/go-check-sumtype v0.1.4 // indirect - github.com/alexkohler/nakedret/v2 v2.0.4 // indirect + github.com/alecthomas/go-check-sumtype v0.2.0 // indirect + github.com/alexkohler/nakedret/v2 v2.0.5 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect github.com/alingse/asasalint v0.0.11 // indirect @@ -100,13 +99,12 @@ require ( github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect - github.com/bkielbasa/cyclop v1.2.1 // indirect + github.com/bkielbasa/cyclop v1.2.3 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect github.com/bombsimon/wsl/v4 v4.4.1 // indirect - github.com/breml/bidichk v0.2.7 // indirect - github.com/breml/errchkjson v0.3.6 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect + github.com/breml/bidichk v0.3.2 // indirect + github.com/breml/errchkjson v0.4.0 // indirect github.com/butuzov/ireturn v0.3.0 // indirect github.com/butuzov/mirror v1.2.0 // indirect github.com/catenacyber/perfsprint v0.7.1 // indirect @@ -115,37 +113,32 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.1.0 // indirect - github.com/ckaznocha/intrange v0.1.2 // indirect - github.com/cockroachdb/errors v1.11.3 // indirect - github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect - github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.1 // indirect - github.com/cockroachdb/redact v1.1.5 // indirect + github.com/ckaznocha/intrange v0.2.1 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/crackcomm/go-gitignore v0.0.0-20231225121904-e25f5bc08668 // indirect github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect - github.com/daixiang0/gci v0.13.4 // indirect + github.com/daixiang0/gci v0.13.5 // 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.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/denis-tingaikin/go-header v0.5.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564 // indirect github.com/ethereum/c-kzg-4844 v1.0.1 // indirect - github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect + github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect github.com/ettle/strcase v0.2.0 // indirect - github.com/fatih/color v1.17.0 // indirect + github.com/fatih/color v1.18.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/firefart/nonamedreturns v1.0.5 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/getsentry/sentry-go v0.27.0 // indirect - github.com/ghostiam/protogetter v0.3.6 // indirect - github.com/go-critic/go-critic v0.11.4 // indirect + github.com/ghostiam/protogetter v0.3.8 // indirect + github.com/go-critic/go-critic v0.11.5 // indirect github.com/go-jose/go-jose/v4 v4.0.1 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect @@ -157,14 +150,14 @@ require ( github.com/go-toolsmith/astp v1.1.0 // indirect github.com/go-toolsmith/strparse v1.1.0 // indirect github.com/go-toolsmith/typep v1.1.0 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/gofrs/flock v0.12.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect + github.com/golangci/go-printf-func-name v0.1.0 // indirect github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 // indirect github.com/golangci/misspell v0.6.0 // indirect github.com/golangci/modinfo v0.3.4 // indirect @@ -201,25 +194,22 @@ require ( github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgproto3/v2 v2.3.3 // indirect - github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle v1.3.0 // indirect github.com/jgautheron/goconst v1.7.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect - github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/jjti/go-spancheck v0.6.2 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/julz/importas v0.1.0 // indirect github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect - github.com/kisielk/errcheck v1.7.0 // indirect + github.com/kisielk/errcheck v1.8.0 // indirect github.com/kkHAIKE/contextcheck v1.1.5 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/kr/text v0.2.0 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.10 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect - github.com/lasiar/canonicalheader v1.1.1 // indirect + github.com/lasiar/canonicalheader v1.1.2 // indirect github.com/ldez/gomoddirectives v0.2.4 // indirect github.com/ldez/tagliatelle v0.5.0 // indirect github.com/leonklingele/grouper v1.1.2 // indirect @@ -232,7 +222,6 @@ require ( 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.33.2 // indirect - github.com/lufeee/execinquery v1.2.1 // indirect github.com/macabu/inamedparam v0.1.3 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -241,9 +230,9 @@ require ( github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mfridman/interpolate v0.0.2 // indirect - github.com/mgechev/revive v1.3.9 // indirect + github.com/mgechev/revive v1.5.1 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect @@ -260,25 +249,26 @@ require ( github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.16.2 // indirect + github.com/nunnatsa/ginkgolinter v0.18.3 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/polyfloyd/go-errorlint v1.6.0 // indirect + github.com/polyfloyd/go-errorlint v1.7.0 // indirect github.com/pquerna/cachecontrol v0.2.0 // indirect github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.47.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - github.com/quasilyte/go-ruleguard v0.4.2 // indirect + github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 // indirect github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect - github.com/rivo/uniseg v0.4.4 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/ryancurrah/gomodguard v1.3.3 // indirect + github.com/raeperd/recvcheck v0.1.2 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/rogpeppe/go-internal v1.13.1 // indirect + github.com/ryancurrah/gomodguard v1.3.5 // indirect github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect @@ -287,18 +277,19 @@ require ( github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect - github.com/securego/gosec/v2 v2.20.1-0.20240822074752-ab3f6c1c83a0 // indirect + github.com/securego/gosec/v2 v2.21.4 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/sethvargo/go-retry v0.3.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sivchari/containedctx v1.0.3 // indirect - github.com/sivchari/tenv v1.10.0 // indirect - github.com/sonatard/noctx v0.0.2 // indirect + github.com/sivchari/tenv v1.12.1 // indirect + github.com/sonatard/noctx v0.1.0 // 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/speakeasy-api/openapi-overlay v0.9.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/spf13/cobra v1.8.1 // indirect @@ -308,13 +299,12 @@ require ( github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/supranational/blst v0.3.11 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect + github.com/supranational/blst v0.3.13 // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect - github.com/tetafro/godot v1.4.16 // indirect + github.com/tetafro/godot v1.4.18 // indirect github.com/tetratelabs/wazero v1.8.0 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect - github.com/timonwong/loggercheck v0.9.4 // indirect + github.com/timonwong/loggercheck v0.10.1 // indirect github.com/tklauser/go-sysconf v0.3.13 // indirect github.com/tklauser/numcpus v0.7.0 // indirect github.com/tomarrell/wrapcheck/v2 v2.9.0 // indirect @@ -323,11 +313,13 @@ require ( github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.1.1 // indirect github.com/uudashr/gocognit v1.1.3 // indirect + github.com/uudashr/iface v1.2.1 // indirect 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.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.3.0 // indirect @@ -335,20 +327,20 @@ require ( github.com/yuin/gopher-lua v1.1.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect gitlab.com/bosi/decorder v0.4.2 // indirect - go-simpler.org/musttag v0.12.2 // indirect + go-simpler.org/musttag v0.13.0 // indirect go-simpler.org/sloglint v0.7.2 // indirect - go.uber.org/automaxprocs v1.5.3 // indirect + go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect - golang.org/x/mod v0.20.0 // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/net v0.31.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.24.0 // indirect + golang.org/x/tools v0.27.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index c52b94436..a1f484dd6 100644 --- a/go.sum +++ b/go.sum @@ -6,19 +6,19 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/4meepo/tagalign v1.3.4 h1:P51VcvBnf04YkHzjfclN6BbsopfJR5rxs1n+5zHt+w8= github.com/4meepo/tagalign v1.3.4/go.mod h1:M+pnkHH2vG8+qhE5bVc/zeP7HS/j910Fwa9TUSyZVI0= -github.com/Abirdcfly/dupword v0.1.1 h1:Bsxe0fIw6OwBtXMIncaTxCLHYO5BB+3mcsR5E8VXloY= -github.com/Abirdcfly/dupword v0.1.1/go.mod h1:B49AcJdTYYkpd4HjgAcutNGG9HZ2JWwKunH9Y2BA6sM= -github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHOVvM= -github.com/Antonboom/errname v0.1.13/go.mod h1:uWyefRYRN54lBg6HseYCFhs6Qjcy41Y3Jl/dVhA87Ns= -github.com/Antonboom/nilnil v0.1.9 h1:eKFMejSxPSA9eLSensFmjW2XTgTwJMjZ8hUHtV4s/SQ= -github.com/Antonboom/nilnil v0.1.9/go.mod h1:iGe2rYwCq5/Me1khrysB4nwI7swQvjclR8/YRPl5ihQ= -github.com/Antonboom/testifylint v1.4.3 h1:ohMt6AHuHgttaQ1xb6SSnxCeK4/rnK7KKzbvs7DmEck= -github.com/Antonboom/testifylint v1.4.3/go.mod h1:+8Q9+AOLsz5ZiQiiYujJKs9mNz398+M6UgslP4qgJLA= +github.com/Abirdcfly/dupword v0.1.3 h1:9Pa1NuAsZvpFPi9Pqkd93I7LIYRURj+A//dFd5tgBeE= +github.com/Abirdcfly/dupword v0.1.3/go.mod h1:8VbB2t7e10KRNdwTVoxdBaxla6avbhGzb8sCTygUMhw= +github.com/Antonboom/errname v1.0.0 h1:oJOOWR07vS1kRusl6YRSlat7HFnb3mSfMl6sDMRoTBA= +github.com/Antonboom/errname v1.0.0/go.mod h1:gMOBFzK/vrTiXN9Oh+HFs+e6Ndl0eTFbtsRTSRdXyGI= +github.com/Antonboom/nilnil v1.0.0 h1:n+v+B12dsE5tbAqRODXmEKfZv9j2KcTBrp+LkoM4HZk= +github.com/Antonboom/nilnil v1.0.0/go.mod h1:fDJ1FSFoLN6yoG65ANb1WihItf6qt9PJVTn/s2IrcII= +github.com/Antonboom/testifylint v1.5.2 h1:4s3Xhuv5AvdIgbd8wOOEeo0uZG7PbDKQyKY5lGoQazk= +github.com/Antonboom/testifylint v1.5.2/go.mod h1:vxy8VJ0bc6NavlYqjZfmp6EfqXMtBgQ4+mhCojwC1P8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Crocmagnon/fatcontext v0.4.0 h1:4ykozu23YHA0JB6+thiuEv7iT6xq995qS1vcuWZq0tg= -github.com/Crocmagnon/fatcontext v0.4.0/go.mod h1:ZtWrXkgyfsYPzS6K3O88va6t2GEglG93vnII/F94WC0= +github.com/Crocmagnon/fatcontext v0.5.3 h1:zCh/wjc9oyeF+Gmp+V60wetm8ph2tlsxocgg/J0hOps= +github.com/Crocmagnon/fatcontext v0.5.3/go.mod h1:XoCQYY1J+XTfyv74qLXvNw4xFunr3L1wkopIIKG7wGM= 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= @@ -26,8 +26,8 @@ github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5H github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0/go.mod h1:ONJg5sxcbsdQQ4pOW8TGdTidT2TMAUy/2Xhr8mrYaao= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= +github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA= @@ -37,12 +37,12 @@ github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjC github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -github.com/alecthomas/go-check-sumtype v0.1.4 h1:WCvlB3l5Vq5dZQTFmodqL2g68uHiSwwlWcT5a2FGK0c= -github.com/alecthomas/go-check-sumtype v0.1.4/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= +github.com/alecthomas/go-check-sumtype v0.2.0 h1:Bo+e4DFf3rs7ME9w/0SU/g6nmzJaphduP8Cjiz0gbwY= +github.com/alecthomas/go-check-sumtype v0.2.0/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= -github.com/alexkohler/nakedret/v2 v2.0.4 h1:yZuKmjqGi0pSmjGpOC016LtPJysIL0WEUiaXW5SUnNg= -github.com/alexkohler/nakedret/v2 v2.0.4/go.mod h1:bF5i0zF2Wo2o4X4USt9ntUWve6JbFv02Ff4vlkmS/VU= +github.com/alexkohler/nakedret/v2 v2.0.5 h1:fP5qLgtwbx9EJE8dGEERT02YwS8En4r9nnZ71RK+EVU= +github.com/alexkohler/nakedret/v2 v2.0.5/go.mod h1:bF5i0zF2Wo2o4X4USt9ntUWve6JbFv02Ff4vlkmS/VU= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= @@ -95,8 +95,8 @@ 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/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= github.com/bits-and-blooms/bitset v1.13.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/bkielbasa/cyclop v1.2.3 h1:faIVMIGDIANuGPWH031CZJTi2ymOQBULs9H21HSMa5w= +github.com/bkielbasa/cyclop v1.2.3/go.mod h1:kHTwA9Q0uZqOADdupvcFJQtp/ksSnytRMe8ztxG8Fuo= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= @@ -104,18 +104,18 @@ github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkAp github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/bombsimon/wsl/v4 v4.4.1 h1:jfUaCkN+aUpobrMO24zwyAMwMAV5eSziCkOKEauOLdw= github.com/bombsimon/wsl/v4 v4.4.1/go.mod h1:Xu/kDxGZTofQcDGCtQe9KCzhHphIe0fDuyWTxER9Feo= -github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= -github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= -github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= -github.com/breml/errchkjson v0.3.6/go.mod h1:jhSDoFheAF2RSDOlCfhHO9KqhZgAYLyvHe7bRCX8f/U= -github.com/btcsuite/btcd v0.23.3 h1:4KH/JKy9WiCd+iUS9Mu0Zp7Dnj17TGdKrg9xc/FGj24= -github.com/btcsuite/btcd v0.23.3/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/breml/bidichk v0.3.2 h1:xV4flJ9V5xWTqxL+/PMFF6dtJPvZLPsyixAoPe8BGJs= +github.com/breml/bidichk v0.3.2/go.mod h1:VzFLBxuYtT23z5+iVkamXO386OB+/sVwZOpIj6zXGos= +github.com/breml/errchkjson v0.4.0 h1:gftf6uWZMtIa/Is3XJgibewBm2ksAQSY/kABDNFTAdk= +github.com/breml/errchkjson v0.4.0/go.mod h1:AuBOSTHyLSaaAFlWsRSuRBIroCh3eh7ZHh5YeelDIk8= +github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY= +github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ= +github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/butuzov/ireturn v0.3.0 h1:hTjMqWw3y5JC3kpnC5vXmFJAWI/m31jaCYQqzkS6PL0= github.com/butuzov/ireturn v0.3.0/go.mod h1:A09nIiwiqzN/IoVo9ogpa0Hzi9fex1kd9PSD6edP5ZA= github.com/butuzov/mirror v1.2.0 h1:9YVK1qIjNspaqWutSv8gsge2e/Xpq1eqEkslEUHy5cs= @@ -128,8 +128,8 @@ github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= github.com/cenkalti/backoff/v3 v3.2.2/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= -github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= +github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU= +github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= 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/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -141,20 +141,21 @@ github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+UIPD+Gww= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= -github.com/ckaznocha/intrange v0.1.2 h1:3Y4JAxcMntgb/wABQ6e8Q8leMd26JbX2790lIss9MTI= -github.com/ckaznocha/intrange v0.1.2/go.mod h1:RWffCw/vKBwHeOEwWdCikAtY0q4gGt8VhJZEEA5n+RE= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/ckaznocha/intrange v0.2.1 h1:M07spnNEQoALOJhwrImSrJLaxwuiQK+hA2DeajBlwYk= +github.com/ckaznocha/intrange v0.2.1/go.mod h1:7NEhVyf8fzZO5Ds7CRaqPEm52Ut83hsTiL5zbER/HYk= 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.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= -github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= 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 v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= -github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= 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/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= @@ -177,8 +178,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= -github.com/daixiang0/gci v0.13.4 h1:61UGkmpoAcxHM2hhNkZEf5SzwQtWJXTSws7jaPyqwlw= -github.com/daixiang0/gci v0.13.4/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= +github.com/daixiang0/gci v0.13.5 h1:kThgmH1yBmZSBCh1EJVxQ7JsHpm5Oms0AMed/0LaH4c= +github.com/daixiang0/gci v0.13.5/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -195,20 +196,23 @@ github.com/denis-tingaikin/go-header v0.5.0 h1:SRdnP5ZKvcO9KKRP1KJrhFR3RrlGuD+42 github.com/denis-tingaikin/go-header v0.5.0/go.mod h1:mMenU5bWrok6Wl2UsZjy+1okegmwQ3UgWl4V1D8gjlY= 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/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= 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= github.com/ethereum/c-kzg-4844 v1.0.1 h1:pGixCbGizcVKSwoV70ge48+PrbB+iSKs2rjgfE4yJmQ= github.com/ethereum/c-kzg-4844 v1.0.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.14.8 h1:NgOWvXS+lauK+zFukEvi85UmmsS/OkV0N23UZ1VTIig= -github.com/ethereum/go-ethereum v1.14.8/go.mod h1:TJhyuDq0JDppAkFXgqjwpdlQApywnu/m10kFPxh8vvs= -github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4= -github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w= +github.com/ethereum/go-ethereum v1.14.12 h1:8hl57x77HSUo+cXExrURjU/w1VhL+ShCTJrTwcCQSe4= +github.com/ethereum/go-ethereum v1.14.12/go.mod h1:RAC2gVMWJ6FkxSPESfbshrcKpIokgQKsVKmAuqdekDY= +github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 h1:8NfxH2iXvJ60YRB8ChToFTUzl8awsc3cJ8CbLjGIl/A= +github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q= github.com/ettle/strcase v0.2.0/go.mod h1:DajmHElDSaX76ITe3/VHVyMin4LWSJN5Z909Wp+ED1A= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/firefart/nonamedreturns v1.0.5 h1:tM+Me2ZaXs8tfdDw3X6DOX++wMCOqzYUho6tUTYIdRA= @@ -221,22 +225,18 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/getkin/kin-openapi v0.127.0 h1:Mghqi3Dhryf3F8vR370nN67pAERW+3a95vomb3MAREY= -github.com/getkin/kin-openapi v0.127.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM= +github.com/getkin/kin-openapi v0.128.0 h1:jqq3D9vC9pPq1dGcOCv7yOp1DaEe7c/T1vzcLbITSp4= +github.com/getkin/kin-openapi v0.128.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/ghostiam/protogetter v0.3.6 h1:R7qEWaSgFCsy20yYHNIJsU9ZOb8TziSRRxuAOTVKeOk= -github.com/ghostiam/protogetter v0.3.6/go.mod h1:7lpeDnEJ1ZjL/YtyoN99ljO4z0pd3H0d18/t2dPBxHw= +github.com/ghostiam/protogetter v0.3.8 h1:LYcXbYvybUyTIxN2Mj9h6rHrDZBDwZloPoKctWrFyJY= +github.com/ghostiam/protogetter v0.3.8/go.mod h1:WZ0nw9pfzsgxuRsPOFQomgDVSWtDLJRfQJEhsGbmQMA= github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= github.com/go-chi/chi/v5 v5.1.0/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.11.4 h1:O7kGOCx0NDIni4czrkRIXTnit0mkyKOCePh3My6OyEU= -github.com/go-critic/go-critic v0.11.4/go.mod h1:2QAdo4iuLik5S9YG0rT4wcZ8QxwHYkrr6/2MWAiv/vc= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-critic/go-critic v0.11.5 h1:TkDTOn5v7EEngMxu8KbuFqFR43USaaH8XRJLz1jhVYA= +github.com/go-critic/go-critic v0.11.5/go.mod h1:wu6U7ny9PiaHaZHcvMDmdysMqvDem162Rh3zWTrqk8M= github.com/go-jose/go-jose/v4 v4.0.1 h1:QVEPDE3OluqXBQZDcnNvQrInro2h0e4eqNbnZSWqS6U= github.com/go-jose/go-jose/v4 v4.0.1/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -257,7 +257,6 @@ github.com/go-redis/cache/v8 v8.4.4/go.mod h1:JM6CkupsPvAu/LYEVGQy6UB4WDAzQSXkR0 github.com/go-redis/redis/v8 v8.11.3/go.mod h1:xNJ9xDG09FsIPwh3bWdk+0oDWHbtF9rPN0F/oD9XeKc= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= -github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -286,8 +285,8 @@ github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQi github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= -github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= -github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= @@ -300,8 +299,8 @@ github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPh github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= +github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -318,10 +317,12 @@ github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXi github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= +github.com/golangci/go-printf-func-name v0.1.0 h1:dVokQP+NMTO7jwO4bwsRwLWeudOVUPPyAKJuzv8pEJU= +github.com/golangci/go-printf-func-name v0.1.0/go.mod h1:wqhWFH5mUdJQhweRnldEywnR5021wTdZSNgwYceV14s= github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 h1:/1322Qns6BtQxUZDTAT4SdcoxknUki7IAoK4SAXr8ME= github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9/go.mod h1:Oesb/0uFAyWoaw1U1qS5zyjCg5NP9C9iwjnI4tIsXEE= -github.com/golangci/golangci-lint v1.60.3 h1:l38A5de24ZeDlcFF+EB7m3W5joPD99/hS5SIHJPyZa0= -github.com/golangci/golangci-lint v1.60.3/go.mod h1:J4vOpcjzRI+lDL2DKNGBZVB3EQSBfCBCMpaydWLtJNo= +github.com/golangci/golangci-lint v1.62.2 h1:b8K5K9PN+rZN1+mKLtsZHz2XXS9aYKzQ9i25x3Qnxxw= +github.com/golangci/golangci-lint v1.62.2/go.mod h1:ILWWyeFUrctpHVGMa1dg2xZPKoMUTc5OIMgW7HZr34g= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= @@ -345,8 +346,9 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= 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.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -411,16 +413,19 @@ github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXei github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0 h1:Fu1/tAINi9FzZ0nKoEVOGXWzL1l15tR1loJx5sQEQ8k= github.com/iden3/contracts-abi/onchain-credential-status-resolver/go/abi v0.0.0-20230911113809-c58b7e7a69b0/go.mod h1:8fkd2xyUG/V7ovpvZRyD2LyK2zZ4ALbgf5vJGyhzKdg= github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e3c48 h1:/g4rru+OM5WAhVNXEpowKH+vWZLGjgpk5+O8Stu4QBo= github.com/iden3/contracts-abi/rhs-storage/go/abi v0.0.0-20231006141557-7d13ef7e3c48/go.mod h1:kJmVPMk4HfWyl2kcta34aad/K4TAfCwB29xX9PsR7LQ= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20230911112726-4533c5701af1 h1:67302Oni3SpT2sbz7HXXEOR3zK3/usEC69W9ULILR1o= github.com/iden3/contracts-abi/state/go/abi v1.0.2-0.20230911112726-4533c5701af1/go.mod h1:TxgIrXCvxms3sbOdsy8kTvffUCIpEEifNy0fSXdkU4w= +github.com/iden3/driver-did-iden3 v0.0.7 h1:qDbVpEwbk25TCpb1Fw/9+vFiEWRdKTwSYNgWBd9AECI= +github.com/iden3/driver-did-iden3 v0.0.7/go.mod h1:V0zeeDNxrU/yKRFPgVfntMhBfmDL+GxcvHhW+Fdcz9I= github.com/iden3/go-circuits/v2 v2.4.0 h1:m+7uYtrvJKuc+gVhbXDXl1BJQyK7sWdW7OWttM3R/8I= github.com/iden3/go-circuits/v2 v2.4.0/go.mod h1:k0uYx/ZdZPiDEIy7kI3MAixnREKcc7NdCKDRw8Q+iFA= -github.com/iden3/go-iden3-auth/v2 v2.5.0 h1:vvleEbb9WvZ5dH9FSLnE9pYCsdKh+jgIBLfr1tgP+7o= -github.com/iden3/go-iden3-auth/v2 v2.5.0/go.mod h1:z+7+loGUSX2loVVyyipwySvxAizrecz8sbDqdGwqKiI= +github.com/iden3/go-iden3-auth/v2 v2.6.0 h1:R+QD/H1zhtO9+uvZ73Z9CVU7Omx8xf8ckgv4Syv4IsI= +github.com/iden3/go-iden3-auth/v2 v2.6.0/go.mod h1:s6t4ierMRafmJPxHSfwDW3Mh5+ceNbUrtbdP1EVoqfI= github.com/iden3/go-iden3-core v1.0.2 h1:HwNDFeqcUv4ybZj5tH+58JKWKarn/qqBpNCqTLxGP0Y= github.com/iden3/go-iden3-core v1.0.2/go.mod h1:X4PjlJG8OsEQEsSbzzYqqAk2olYGZ2nuGqiUPyEYjOo= github.com/iden3/go-iden3-core/v2 v2.3.1 h1:ytQqiclnVAIWyRKR2LF31hfz4DGRBD6nMjiPILXGSKk= @@ -447,8 +452,8 @@ github.com/iden3/go-schema-processor v1.3.1 h1:LJfFInfYGMOp0bTKKC17R8q4XI+VtqhFL github.com/iden3/go-schema-processor v1.3.1/go.mod h1:NwJ1nuGdRlCFaN1/V6mS0AOAdvpLcGf4KKq0mluLG7U= github.com/iden3/go-schema-processor/v2 v2.6.1 h1:KD33sTAu2xAyG94SmrUAMxI+MREFTmSsavYy70gkTW4= github.com/iden3/go-schema-processor/v2 v2.6.1/go.mod h1:MYrkk55aEx3ZBKz0d/0rfxa7lBH4x9TfKGI1T/WBlpw= -github.com/iden3/iden3comm/v2 v2.6.0 h1:6cu0N2b9oluJGDMvM2C0r2IH1GtrMUmmHOcJTn3O0mQ= -github.com/iden3/iden3comm/v2 v2.6.0/go.mod h1:ZRnfFg4geX336Bp9+29ZQdSqchbsBoVcd7ARn6JXH5Y= +github.com/iden3/iden3comm/v2 v2.9.0 h1:LoD9/1A6L/HO1roWjjzTooka1m1y2SGSgRvcq+UMJS0= +github.com/iden3/iden3comm/v2 v2.9.0/go.mod h1:l8t+BkbHU3ri7kiExZYc4CTY6erkzkcBbYXw416nwhA= github.com/iden3/merkletree-proof v0.3.0 h1:NVlvtUBEgn4Etxxn+RsOmXP/qlI+85BdN8oUDTf3mxI= github.com/iden3/merkletree-proof v0.3.0/go.mod h1:+E2sBxMqhcn/fcu0LDGjmk3us+Vr+fxQUiZMxdpbgUE= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -492,21 +497,22 @@ github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUO github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA= -github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= -github.com/jackc/pgtype v1.14.3 h1:h6W9cPuHsRWQFTWUZMAKMgG5jSwQI0Zurzdvlx3Plus= -github.com/jackc/pgtype v1.14.3/go.mod h1:aKeozOde08iifGosdJpz9MBZonJOUJxqNpPBcMJTlVA= +github.com/jackc/pgtype v1.14.4 h1:fKuNiCumbKTAIxQwXfB/nsrnkEI6bPJrrSiMKgbJ2j8= +github.com/jackc/pgtype v1.14.4/go.mod h1:aKeozOde08iifGosdJpz9MBZonJOUJxqNpPBcMJTlVA= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.18.2 h1:xVpYkNR5pk5bMCZGfClbO962UIqVABcAGt7ha1s/FeU= github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= +github.com/jackc/pgx/v4 v4.18.3 h1:dE2/TrEsGX3RBprb3qryqSV9Y60iZN1C6i8IrmW9/BA= +github.com/jackc/pgx/v4 v4.18.3/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= @@ -518,12 +524,10 @@ github.com/jgautheron/goconst v1.7.1 h1:VpdAG7Ca7yvvJk5n8dMwQhfEZJh95kl/Hl9S1OI5 github.com/jgautheron/goconst v1.7.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= -github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= -github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= github.com/jjti/go-spancheck v0.6.2 h1:iYtoxqPMzHUPp7St+5yA8+cONdyXD3ug6KK15n7Pklk= github.com/jjti/go-spancheck v0.6.2/go.mod h1:+X7lvIrR5ZdUTkxFYqzJ0abr8Sb5LOo80uOhWNqIrYA= -github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= -github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= +github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o= +github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -533,9 +537,8 @@ 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/karamaru-alpha/copyloopvar v1.1.0 h1:x7gNyKcC2vRBO1H2Mks5u1VxQtYvFiym7fCjIP8RPos= github.com/karamaru-alpha/copyloopvar v1.1.0/go.mod h1:u7CIfztblY0jZLOQZgH3oYsJzpC2A7S6u/lfgSXHy0k= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/errcheck v1.7.0 h1:+SbscKmWJ5mOK/bO1zS60F5I9WwZDWOfRsC4RwfwRV0= -github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= +github.com/kisielk/errcheck v1.8.0 h1:ZX/URYa7ilESY19ik/vBmCn6zdGQLxACwjAcWbHlYlg= +github.com/kisielk/errcheck v1.8.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.5 h1:CdnJh63tcDe53vG+RebdpdXJTc9atMgGqdx8LXxiilg= github.com/kkHAIKE/contextcheck v1.1.5/go.mod h1:O930cpht4xb1YQpK+1+AgoM3mFsvxr7uyFptcnWTYUA= @@ -565,8 +568,8 @@ github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= -github.com/lasiar/canonicalheader v1.1.1 h1:wC+dY9ZfiqiPwAexUApFush/csSPXeIi4QqyxXmng8I= -github.com/lasiar/canonicalheader v1.1.1/go.mod h1:cXkb3Dlk6XXy+8MVQnF23CYKWlyA7kfQhSw2CcZtZb0= +github.com/lasiar/canonicalheader v1.1.2 h1:vZ5uqwvDbyJCnMhmFYimgMZnJMjwljN5VGY0VKbMXb4= +github.com/lasiar/canonicalheader v1.1.2/go.mod h1:qJCeLFS0G/QlLQ506T+Fk/fWMa2VmBUiEI2cuMK4djI= github.com/ldez/gomoddirectives v0.2.4 h1:j3YjBIjEBbqZ0NKtBNzr8rtMHTOrLPeiwTkfUJZ3alg= github.com/ldez/gomoddirectives v0.2.4/go.mod h1:oWu9i62VcQDYp9EQ0ONTfqLNh+mDLWWDO+SO0qSQw5g= github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSioo= @@ -599,8 +602,6 @@ github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFG github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= github.com/libp2p/go-libp2p v0.33.2 h1:vCdwnFxoGOXMKmaGHlDSnL4bM3fQeW8pgIa9DECnb40= github.com/libp2p/go-libp2p v0.33.2/go.mod h1:zTeppLuCvUIkT118pFVzA8xzP/p2dJYOMApCkFh0Yww= -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/macabu/inamedparam v0.1.3 h1:2tk/phHkMlEL/1GNe/Yf6kkR/hkcUdAEY3L0hjYV1Mk= github.com/macabu/inamedparam v0.1.3/go.mod h1:93FLICAIk/quk7eaPPQvbzihUdn/QkGDwIZEoLtpH6I= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -626,14 +627,14 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= -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/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= +github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg= -github.com/mgechev/revive v1.3.9 h1:18Y3R4a2USSBF+QZKFQwVkBROUda7uoBlkEuBD+YD1A= -github.com/mgechev/revive v1.3.9/go.mod h1:+uxEIr5UH0TjXWHTno3xh4u7eg6jDpXKzQccA9UGhHU= +github.com/mgechev/revive v1.5.1 h1:hE+QPeq0/wIzJwOphdVyUJ82njdd8Khp4fUIHGZHW3M= +github.com/mgechev/revive v1.5.1/go.mod h1:lC9AhkJIBs5zwx8wkudyHrU+IJkrEKmpCmGMnIJPk4o= 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/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -675,13 +676,13 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.16.2 h1:8iLqHIZvN4fTLDC0Ke9tbSZVcyVHoBs0HIbnVSxfHJk= -github.com/nunnatsa/ginkgolinter v0.16.2/go.mod h1:4tWRinDN1FeJgU+iJANW/kz7xKN5nYRAOfJDQUS9dOQ= +github.com/nunnatsa/ginkgolinter v0.18.3 h1:WgS7X3zzmni3vwHSBhvSgqrRgUecN6PQUcfB0j1noDw= +github.com/nunnatsa/ginkgolinter v0.18.3/go.mod h1:BE1xyB/PNtXXG1azrvrqJW5eFH0hSRylNzFy8QHPwzs= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oapi-codegen/oapi-codegen/v2 v2.3.0 h1:rICjNsHbPP1LttefanBPnwsSwl09SqhCO7Ee623qR84= -github.com/oapi-codegen/oapi-codegen/v2 v2.3.0/go.mod h1:4k+cJeSq5ntkwlcpQSxLxICCxQzCL772o30PxdibRt4= +github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 h1:ykgG34472DWey7TSjd8vIfNykXgjOgYJZoQbKfEeY/Q= +github.com/oapi-codegen/oapi-codegen/v2 v2.4.1/go.mod h1:N5+lY1tiTDV3V1BeHtOxeWXHoPVeApvsvjJqegfoaz8= github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= @@ -689,18 +690,22 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6 github.com/olomix/go-test-pg v1.0.2 h1:4ey3mFBhPx93PdgyshOJI1WrQzqzkWEnb0wL/7UbFMI= github.com/olomix/go-test-pg v1.0.2/go.mod h1:rHMame/S99rnU5YhVYFa3rr0riKqBYe8xsMDP4YzeHA= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.2/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= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw= -github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= +github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= -github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= -github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= +github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= @@ -710,29 +715,26 @@ 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/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/piprate/json-gold v0.5.1-0.20241210232033-19254b3ec65b h1:xyh6boGzDR4EpdEDe9ix1KhHNgOSiBjBocahA6FalEQ= github.com/piprate/json-gold v0.5.1-0.20241210232033-19254b3ec65b/go.mod h1:RVhE35veDX19r5gfUAR+IYHkAUuPwJO8Ie/qVeFaIzw= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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.6.0 h1:tftWV9DE7txiFzPpztTAwyoRLKNj9gpVm2cg8/OwcYY= -github.com/polyfloyd/go-errorlint v1.6.0/go.mod h1:HR7u8wuP1kb1NeN1zqTd1ZMlqUKPPHF+Id4vIPvDqVw= +github.com/polyfloyd/go-errorlint v1.7.0 h1:Zp6lzCK4hpBDj8y8a237YK4EPrMXQWvOe3nGoH4pFrU= +github.com/polyfloyd/go-errorlint v1.7.0/go.mod h1:dGWKu85mGHnegQ2SWpEybFityCg3j7ZbwsVUxAOk9gY= github.com/pquerna/cachecontrol v0.2.0 h1:vBXSNuE5MYP9IJ5kjsdo8uq+w41jSPgvba2DEnkRx9k= github.com/pquerna/cachecontrol v0.2.0/go.mod h1:NrUG3Z7Rdu85UNR3vm7SOsl1nFIeSiQnrHV5K9mBcUI= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= -github.com/pressly/goose/v3 v3.22.0 h1:wd/7kNiPTuNAztWun7iaB98DrhulbWPrzMAaw2DEZNw= -github.com/pressly/goose/v3 v3.22.0/go.mod h1:yJM3qwSj2pp7aAaCvso096sguezamNb2OBgxCnh/EYg= +github.com/pressly/goose/v3 v3.23.0 h1:57hqKos8izGek4v6D5+OXBa+Y4Rq8MU//+MmnevdpVA= +github.com/pressly/goose/v3 v3.23.0/go.mod h1:rpx+D9GX/+stXmzKa+uh1DkjPnNVMdiOCV9iLdle4N8= github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= @@ -741,8 +743,8 @@ github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpj github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= 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.2 h1:htXcXDK6/rO12kiTHKfHuqR4kr3Y4M0J0rOL6CH/BYs= -github.com/quasilyte/go-ruleguard v0.4.2/go.mod h1:GJLgqsLeo4qgavUoL8JeGFNS7qcisx3awV/w9eWTmNI= +github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1 h1:+Wl/0aFp0hpuHM3H//KMft64WQ1yX9LdJY64Qm/gFCo= +github.com/quasilyte/go-ruleguard v0.4.3-0.20240823090925-0fe6f58b47b1/go.mod h1:GJLgqsLeo4qgavUoL8JeGFNS7qcisx3awV/w9eWTmNI= github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE= github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= @@ -751,16 +753,17 @@ github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= +github.com/raeperd/recvcheck v0.1.2 h1:SjdquRsRXJc26eSonWIo8b7IMtKD3OAT2Lb5G3ZX1+4= +github.com/raeperd/recvcheck v0.1.2/go.mod h1:n04eYkwIR0JbgD73wT8wL4JjPC3wm0nFtzBnWNocnYU= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/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.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -768,8 +771,8 @@ github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OK github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= 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.3 h1:eiSQdJVNr9KTNxY2Niij8UReSwR8Xrte3exBrAZfqpg= -github.com/ryancurrah/gomodguard v1.3.3/go.mod h1:rsKQjj4l3LXe8N344Ow7agAy5p9yjsWOtRzUMYmA0QY= +github.com/ryancurrah/gomodguard v1.3.5 h1:cShyguSwUEeC0jS7ylOiG/idnd1TpJ1LfHGpV3oJmPU= +github.com/ryancurrah/gomodguard v1.3.5/go.mod h1:MXlEPQRxgfPQa62O8wzK3Ozbkv9Rkqr+wKjSxTdsNJE= github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= @@ -787,10 +790,12 @@ github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84d github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32ZrusyurIGT9E5wAvXQnI= github.com/sashamelentyev/usestdlibvars v1.27.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/securego/gosec/v2 v2.20.1-0.20240822074752-ab3f6c1c83a0 h1:VqD4JMoqwuuCz8GZlBDsIDyE6K4YUsWJpbNtuOWHoFk= -github.com/securego/gosec/v2 v2.20.1-0.20240822074752-ab3f6c1c83a0/go.mod h1:iyeMMRw8QEmueUSZ2VqmkQMiDyDcobfPnG00CV/NWdE= +github.com/securego/gosec/v2 v2.21.4 h1:Le8MSj0PDmOnHJgUATjD96PaXRvCpKC+DGJvwyy0Mlk= +github.com/securego/gosec/v2 v2.21.4/go.mod h1:Jtb/MwRQfRxCXyCm1rfM1BEiiiTfUOdyzzAhlr6lUTA= 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.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE= github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= @@ -809,16 +814,18 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= -github.com/sivchari/tenv v1.10.0 h1:g/hzMA+dBCKqGXgW8AV/1xIWhAvDrx0zFKNR48NFMg0= -github.com/sivchari/tenv v1.10.0/go.mod h1:tdY24masnVoZFxYrHv/nD6Tc8FbkEtAQEEziXpyMgqY= -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/sivchari/tenv v1.12.1 h1:+E0QzjktdnExv/wwsnnyk4oqZBUfuh89YMQT1cyuvSY= +github.com/sivchari/tenv v1.12.1/go.mod h1:1LjSOUCc25snIr5n3DtGGrENhX3LuWefcplwVGC24mw= +github.com/sonatard/noctx v0.1.0 h1:JjqOc2WN16ISWAjAk8M5ej0RfExEXtkEyExl2hLW+OM= +github.com/sonatard/noctx v0.1.0/go.mod h1:0RvBxqY8D4j9cTTTWE8ylt2vqj2EPI8fHmrxHdsaZ2c= 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/speakeasy-api/openapi-overlay v0.9.0 h1:Wrz6NO02cNlLzx1fB093lBlYxSI54VRhy1aSutx0PQg= +github.com/speakeasy-api/openapi-overlay v0.9.0/go.mod h1:f5FloQrHA7MsxYg9djzMD5h6dxrHjVVByWKh7an8TRc= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= @@ -832,8 +839,6 @@ github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMV 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= -github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= -github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -853,12 +858,12 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ 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.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= -github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= +github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= @@ -867,14 +872,14 @@ github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= -github.com/tetafro/godot v1.4.16 h1:4ChfhveiNLk4NveAZ9Pu2AN8QZ2nkUGFuadM9lrr5D0= -github.com/tetafro/godot v1.4.16/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= +github.com/tetafro/godot v1.4.18 h1:ouX3XGiziKDypbpXqShBfnNLTSjR8r3/HVzrtJ+bHlI= +github.com/tetafro/godot v1.4.18/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= github.com/tetratelabs/wazero v1.8.0 h1:iEKu0d4c2Pd+QSRieYbnQC9yiFlMS9D+Jr0LsRmcF4g= github.com/tetratelabs/wazero v1.8.0/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= -github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= -github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= +github.com/timonwong/loggercheck v0.10.1 h1:uVZYClxQFpw55eh+PIoqM7uAOHMrhVcDoWDery9R8Lg= +github.com/timonwong/loggercheck v0.10.1/go.mod h1:HEAWU8djynujaAVX7QI65Myb8qgfcZ1uKbdpg3ZzKl8= github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= @@ -883,8 +888,6 @@ github.com/tomarrell/wrapcheck/v2 v2.9.0 h1:801U2YCAjLhdN8zhZ/7tdjB3EnAoRlJHt/s+ github.com/tomarrell/wrapcheck/v2 v2.9.0/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo= 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/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= @@ -895,8 +898,10 @@ github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/uudashr/gocognit v1.1.3 h1:l+a111VcDbKfynh+airAy/DJQKaXh2m9vkoysMPSZyM= github.com/uudashr/gocognit v1.1.3/go.mod h1:aKH8/e8xbTRBwjbCkwZ8qt4l2EpKXl31KMHgSS+lZ2U= -github.com/valkey-io/valkey-go v1.0.45 h1:d2ksu+FvKEy9pU9CCMZ94ABTLm2kNHU0jxEJZRqpFA4= -github.com/valkey-io/valkey-go v1.0.45/go.mod h1:BXlVAPIL9rFQinSFM+N32JfWzfCaUAqBpZkc4vPY6fM= +github.com/uudashr/iface v1.2.1 h1:vHHyzAUmWZ64Olq6NZT3vg/z1Ws56kyPdBOd5kTXDF8= +github.com/uudashr/iface v1.2.1/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= +github.com/valkey-io/valkey-go v1.0.51 h1:qioDrTBplnkWLK5TrUq0rkuIv7HUL/RPJU/79wB93Lg= +github.com/valkey-io/valkey-go v1.0.51/go.mod h1:BXlVAPIL9rFQinSFM+N32JfWzfCaUAqBpZkc4vPY6fM= 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/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= @@ -908,6 +913,8 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU github.com/vmihailenco/msgpack/v5 v5.4.1/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/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= +github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= @@ -919,7 +926,6 @@ github.com/yeya24/promlinter v0.3.0/go.mod h1:cDfJQQYv9uYciW60QT0eeHlFodotkYZlL+ github.com/ykadowak/zerologlint v0.1.5 h1:Gy/fMz1dFQN9JZTPjv1hxEk+sRWm05row04Yoolgdiw= github.com/ykadowak/zerologlint v0.1.5/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= 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= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -934,16 +940,16 @@ gitlab.com/bosi/decorder v0.4.2 h1:qbQaV3zgwnBZ4zPMhGLW4KZe7A7NwxEhJx39R3shffo= gitlab.com/bosi/decorder v0.4.2/go.mod h1:muuhHoaJkA9QLcYHq4Mj8FJUwDZ+EirSHRiaTcTf6T8= go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ= go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= -go-simpler.org/musttag v0.12.2 h1:J7lRc2ysXOq7eM8rwaTYnNrHd5JwjppzB6mScysB2Cs= -go-simpler.org/musttag v0.12.2/go.mod h1:uN1DVIasMTQKk6XSik7yrJoEysGtR2GRqvWnI9S7TYM= +go-simpler.org/musttag v0.13.0 h1:Q/YAW0AHvaoaIbsPj3bvEI5/QFP7w696IMUpnKXQfCE= +go-simpler.org/musttag v0.13.0/go.mod h1:FTzIGeK6OkKlUDVpj0iQUXZLUO1Js9+mvykDQy9C5yM= go-simpler.org/sloglint v0.7.2 h1:Wc9Em/Zeuu7JYpl+oKoYOsQSy2X560aVueCW/m6IijY= go-simpler.org/sloglint v0.7.2/go.mod h1:US+9C80ppl7VsThQclkM7BkCHQAzuz8kHLsW3ppuluo= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= -go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= +go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -970,14 +976,14 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= +golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= 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-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8= -golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f h1:WTyX8eCCyfdqiPYkRGm0MqElSfYFH3yR1+rl/mct9sA= +golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= @@ -991,8 +997,8 @@ 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.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/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-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -1001,12 +1007,12 @@ golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 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-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= @@ -1014,8 +1020,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.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1024,8 +1030,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/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.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 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-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1039,11 +1045,10 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1055,6 +1060,7 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/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-20211019181941-9d821ace8654/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-20211216021012-1d35b9e2eb4e/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-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1067,8 +1073,8 @@ 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.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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= @@ -1089,8 +1095,8 @@ 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.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1102,17 +1108,14 @@ golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 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= @@ -1125,8 +1128,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.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o= +golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q= 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= @@ -1159,11 +1162,13 @@ gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= 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= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/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-20191026110619-0b21df46bc1d/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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -1180,8 +1185,8 @@ modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU= -modernc.org/sqlite v1.32.0 h1:6BM4uGza7bWypsw4fdLRsLxut6bHe4c58VeqjRgST8s= -modernc.org/sqlite v1.32.0/go.mod h1:UqoylwmTb9F+IqXERT8bW9zzOWN8qwAIcLdzeBZs4hA= +modernc.org/sqlite v1.34.1 h1:u3Yi6M0N8t9yKRDwhXcyp1eS5/ErhPTBggxWFuR6Hfk= +modernc.org/sqlite v1.34.1/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k= modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= diff --git a/infrastructure/local/docker-compose-full.yml b/infrastructure/local/docker-compose-full.yml index 26ac40b5d..43da41a58 100644 --- a/infrastructure/local/docker-compose-full.yml +++ b/infrastructure/local/docker-compose-full.yml @@ -81,6 +81,7 @@ services: volumes: - ../../localstoragekeys:/localstoragekeys:rw - ../../resolvers_settings.yaml:/resolvers_settings.yaml + - ../../payment_settings.yaml:/payment_settings.yaml healthcheck: test: ["CMD", "curl", "-f", "api:3001/status"] interval: 10s diff --git a/infrastructure/local/docker-compose.yml b/infrastructure/local/docker-compose.yml index bf5d2dc07..75e92f7ec 100644 --- a/infrastructure/local/docker-compose.yml +++ b/infrastructure/local/docker-compose.yml @@ -21,6 +21,7 @@ services: volumes: - ../../localstoragekeys:/localstoragekeys:rw - ../../resolvers_settings.yaml:/resolvers_settings.yaml + - ../../payment_settings.yaml:/payment_settings.yaml healthcheck: test: ["CMD", "curl", "-f", "localhost:3001/status"] interval: 10s diff --git a/internal/api/api.gen.go b/internal/api/api.gen.go index 86044082d..41785cb7e 100644 --- a/internal/api/api.gen.go +++ b/internal/api/api.gen.go @@ -17,6 +17,8 @@ import ( protocol "github.com/iden3/iden3comm/v2/protocol" "github.com/oapi-codegen/runtime" strictnethttp "github.com/oapi-codegen/runtime/strictmiddleware/nethttp" + openapi_types "github.com/oapi-codegen/runtime/types" + payments "github.com/polygonid/sh-id-platform/internal/payments" timeapi "github.com/polygonid/sh-id-platform/internal/timeapi" ) @@ -102,6 +104,14 @@ const ( LinkStatusInactive LinkStatus = "inactive" ) +// Defines values for PaymentStatusStatus. +const ( + PaymentStatusStatusCanceled PaymentStatusStatus = "canceled" + PaymentStatusStatusFailed PaymentStatusStatus = "failed" + PaymentStatusStatusPending PaymentStatusStatus = "pending" + PaymentStatusStatusSuccess PaymentStatusStatus = "success" +) + // Defines values for RefreshServiceType. const ( Iden3RefreshService2023 RefreshServiceType = "Iden3RefreshService2023" @@ -109,10 +119,10 @@ const ( // Defines values for StateTransactionStatus. const ( - Created StateTransactionStatus = "created" - Failed StateTransactionStatus = "failed" - Pending StateTransactionStatus = "pending" - Published StateTransactionStatus = "published" + StateTransactionStatusCreated StateTransactionStatus = "created" + StateTransactionStatusFailed StateTransactionStatus = "failed" + StateTransactionStatusPending StateTransactionStatus = "pending" + StateTransactionStatusPublished StateTransactionStatus = "published" ) // Defines values for GetConnectionsParamsSort. @@ -194,15 +204,7 @@ const ( ) // AgentResponse defines model for AgentResponse. -type AgentResponse struct { - Body interface{} `json:"body"` - From string `json:"from"` - Id string `json:"id"` - ThreadID string `json:"threadID"` - To string `json:"to"` - Typ string `json:"typ"` - Type string `json:"type"` -} +type AgentResponse = BasicMessage // AuthenticationConnection defines model for AuthenticationConnection. type AuthenticationConnection struct { @@ -219,6 +221,17 @@ type AuthenticationResponse struct { SessionID UUIDString `json:"sessionID"` } +// BasicMessage defines model for BasicMessage. +type BasicMessage struct { + Body interface{} `json:"body"` + From string `json:"from"` + Id string `json:"id"` + ThreadID string `json:"threadID"` + To string `json:"to"` + Typ string `json:"typ"` + Type string `json:"type"` +} + // ConnectionsPaginated defines model for ConnectionsPaginated. type ConnectionsPaginated struct { Items GetConnectionsResponse `json:"items"` @@ -341,6 +354,24 @@ type CreateLinkRequest struct { SignatureProof bool `json:"signatureProof"` } +// CreatePaymentRequest defines model for CreatePaymentRequest. +type CreatePaymentRequest struct { + Description string `json:"description"` + OptionID uuid.UUID `json:"optionID"` + SchemaID uuid.UUID `json:"schemaID"` + UserDID string `json:"userDID"` +} + +// CreatePaymentRequestResponse defines model for CreatePaymentRequestResponse. +type CreatePaymentRequestResponse struct { + CreatedAt time.Time `json:"createdAt"` + Id openapi_types.UUID `json:"id"` + IssuerDID string `json:"issuerDID"` + PaymentOptionID openapi_types.UUID `json:"paymentOptionID"` + Payments []PaymentRequestInfo `json:"payments"` + UserDID string `json:"userDID"` +} + // Credential defines model for Credential. type Credential struct { Id string `json:"id"` @@ -555,6 +586,63 @@ type PaginatedMetadata struct { Total uint `json:"total"` } +// PaymentOption defines model for PaymentOption. +type PaymentOption struct { + Config PaymentOptionConfig `json:"config"` + CreatedAt TimeUTC `json:"createdAt"` + Description string `json:"description"` + Id uuid.UUID `json:"id"` + IssuerDID string `json:"issuerDID"` + ModifiedAt TimeUTC `json:"modifiedAt"` + Name string `json:"name"` +} + +// PaymentOptionConfig defines model for PaymentOptionConfig. +type PaymentOptionConfig = []PaymentOptionConfigItem + +// PaymentOptionConfigItem defines model for PaymentOptionConfigItem. +type PaymentOptionConfigItem struct { + Amount string `json:"amount"` + PaymentOptionID int `json:"paymentOptionID"` + Recipient string `json:"recipient"` + SigningKeyID string `json:"signingKeyID"` +} + +// PaymentOptionRequest defines model for PaymentOptionRequest. +type PaymentOptionRequest struct { + Config PaymentOptionConfig `json:"config"` + Description string `json:"description"` + Name string `json:"name"` +} + +// PaymentOptions defines model for PaymentOptions. +type PaymentOptions = []PaymentOption + +// PaymentOptionsPaginated defines model for PaymentOptionsPaginated. +type PaymentOptionsPaginated struct { + Items PaymentOptions `json:"items"` + Meta PaginatedMetadata `json:"meta"` +} + +// PaymentRequestInfo defines model for PaymentRequestInfo. +type PaymentRequestInfo = protocol.PaymentRequestInfo + +// PaymentStatus defines model for PaymentStatus. +type PaymentStatus struct { + Status PaymentStatusStatus `json:"status"` +} + +// PaymentStatusStatus defines model for PaymentStatus.Status. +type PaymentStatusStatus string + +// PaymentVerifyRequest defines model for PaymentVerifyRequest. +type PaymentVerifyRequest struct { + TxHash string `json:"txHash"` +} + +// PaymentsConfiguration defines model for PaymentsConfiguration. +type PaymentsConfiguration = payments.Config + // PublishIdentityStateResponse defines model for PublishIdentityStateResponse. type PublishIdentityStateResponse struct { ClaimsTreeRoot *string `json:"claimsTreeRoot,omitempty"` @@ -599,6 +687,7 @@ type RevokeClaimResponse struct { // Schema defines model for Schema. type Schema struct { BigInt string `json:"bigInt"` + ContextURL string `json:"contextURL"` CreatedAt TimeUTC `json:"createdAt"` Description *string `json:"description"` Hash string `json:"hash"` @@ -948,6 +1037,15 @@ type CreateKeyJSONRequestBody = CreateKeyRequest // UpdateKeyJSONRequestBody defines body for UpdateKey for application/json ContentType. type UpdateKeyJSONRequestBody UpdateKeyJSONBody +// CreatePaymentRequestJSONRequestBody defines body for CreatePaymentRequest for application/json ContentType. +type CreatePaymentRequestJSONRequestBody = CreatePaymentRequest + +// CreatePaymentOptionJSONRequestBody defines body for CreatePaymentOption for application/json ContentType. +type CreatePaymentOptionJSONRequestBody = PaymentOptionRequest + +// VerifyPaymentJSONRequestBody defines body for VerifyPayment for application/json ContentType. +type VerifyPaymentJSONRequestBody = PaymentVerifyRequest + // ImportSchemaJSONRequestBody defines body for ImportSchema for application/json ContentType. type ImportSchemaJSONRequestBody = ImportSchemaRequest @@ -1076,6 +1174,24 @@ type ServerInterface interface { // Update a Key // (PATCH /v2/identities/{identifier}/keys/{id}) UpdateKey(w http.ResponseWriter, r *http.Request, identifier PathIdentifier2, id PathKeyID) + // Create Payment Request + // (POST /v2/identities/{identifier}/payment-request) + CreatePaymentRequest(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) + // Get Payment Options + // (GET /v2/identities/{identifier}/payment/options) + GetPaymentOptions(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) + // Create Payment Option + // (POST /v2/identities/{identifier}/payment/options) + CreatePaymentOption(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) + // Delete Payment Option + // (DELETE /v2/identities/{identifier}/payment/options/{id}) + DeletePaymentOption(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, id Id) + // Get Payment Option + // (GET /v2/identities/{identifier}/payment/options/{id}) + GetPaymentOption(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, id Id) + // Verify Payment + // (POST /v2/identities/{identifier}/payment/verify/{nonce}) + VerifyPayment(w http.ResponseWriter, r *http.Request, identifier string, nonce string) // Get Schemas // (GET /v2/identities/{identifier}/schemas) GetSchemas(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, params GetSchemasParams) @@ -1097,6 +1213,9 @@ type ServerInterface interface { // Get Identity State Transactions // (GET /v2/identities/{identifier}/state/transactions) GetStateTransactions(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, params GetStateTransactionsParams) + // Payments Configuration + // (GET /v2/payment/settings) + GetPaymentSettings(w http.ResponseWriter, r *http.Request) // Get QrCode from store // (GET /v2/qr-store) GetQrFromStore(w http.ResponseWriter, r *http.Request, params GetQrFromStoreParams) @@ -1358,6 +1477,42 @@ func (_ Unimplemented) UpdateKey(w http.ResponseWriter, r *http.Request, identif w.WriteHeader(http.StatusNotImplemented) } +// Create Payment Request +// (POST /v2/identities/{identifier}/payment-request) +func (_ Unimplemented) CreatePaymentRequest(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Get Payment Options +// (GET /v2/identities/{identifier}/payment/options) +func (_ Unimplemented) GetPaymentOptions(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Create Payment Option +// (POST /v2/identities/{identifier}/payment/options) +func (_ Unimplemented) CreatePaymentOption(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Delete Payment Option +// (DELETE /v2/identities/{identifier}/payment/options/{id}) +func (_ Unimplemented) DeletePaymentOption(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, id Id) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Get Payment Option +// (GET /v2/identities/{identifier}/payment/options/{id}) +func (_ Unimplemented) GetPaymentOption(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, id Id) { + w.WriteHeader(http.StatusNotImplemented) +} + +// Verify Payment +// (POST /v2/identities/{identifier}/payment/verify/{nonce}) +func (_ Unimplemented) VerifyPayment(w http.ResponseWriter, r *http.Request, identifier string, nonce string) { + w.WriteHeader(http.StatusNotImplemented) +} + // Get Schemas // (GET /v2/identities/{identifier}/schemas) func (_ Unimplemented) GetSchemas(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, params GetSchemasParams) { @@ -1400,6 +1555,12 @@ func (_ Unimplemented) GetStateTransactions(w http.ResponseWriter, r *http.Reque w.WriteHeader(http.StatusNotImplemented) } +// Payments Configuration +// (GET /v2/payment/settings) +func (_ Unimplemented) GetPaymentSettings(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotImplemented) +} + // Get QrCode from store // (GET /v2/qr-store) func (_ Unimplemented) GetQrFromStore(w http.ResponseWriter, r *http.Request, params GetQrFromStoreParams) { @@ -2999,8 +3160,8 @@ func (siw *ServerInterfaceWrapper) UpdateKey(w http.ResponseWriter, r *http.Requ handler.ServeHTTP(w, r) } -// GetSchemas operation middleware -func (siw *ServerInterfaceWrapper) GetSchemas(w http.ResponseWriter, r *http.Request) { +// CreatePaymentRequest operation middleware +func (siw *ServerInterfaceWrapper) CreatePaymentRequest(w http.ResponseWriter, r *http.Request) { var err error @@ -3019,19 +3180,39 @@ func (siw *ServerInterfaceWrapper) GetSchemas(w http.ResponseWriter, r *http.Req r = r.WithContext(ctx) - // Parameter object where we will unmarshal all parameters from the context - var params GetSchemasParams + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.CreatePaymentRequest(w, r, identifier) + })) - // ------------- Optional query parameter "query" ------------- + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } - err = runtime.BindQueryParameter("form", true, false, "query", r.URL.Query(), ¶ms.Query) + handler.ServeHTTP(w, r) +} + +// GetPaymentOptions operation middleware +func (siw *ServerInterfaceWrapper) GetPaymentOptions(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "identifier" ------------- + var identifier PathIdentifier + + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "query", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return } + ctx := r.Context() + + ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) + + r = r.WithContext(ctx) + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.GetSchemas(w, r, identifier, params) + siw.Handler.GetPaymentOptions(w, r, identifier) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3041,8 +3222,8 @@ func (siw *ServerInterfaceWrapper) GetSchemas(w http.ResponseWriter, r *http.Req handler.ServeHTTP(w, r) } -// ImportSchema operation middleware -func (siw *ServerInterfaceWrapper) ImportSchema(w http.ResponseWriter, r *http.Request) { +// CreatePaymentOption operation middleware +func (siw *ServerInterfaceWrapper) CreatePaymentOption(w http.ResponseWriter, r *http.Request) { var err error @@ -3062,7 +3243,7 @@ func (siw *ServerInterfaceWrapper) ImportSchema(w http.ResponseWriter, r *http.R r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.ImportSchema(w, r, identifier) + siw.Handler.CreatePaymentOption(w, r, identifier) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3072,8 +3253,8 @@ func (siw *ServerInterfaceWrapper) ImportSchema(w http.ResponseWriter, r *http.R handler.ServeHTTP(w, r) } -// GetSchema operation middleware -func (siw *ServerInterfaceWrapper) GetSchema(w http.ResponseWriter, r *http.Request) { +// DeletePaymentOption operation middleware +func (siw *ServerInterfaceWrapper) DeletePaymentOption(w http.ResponseWriter, r *http.Request) { var err error @@ -3102,7 +3283,7 @@ func (siw *ServerInterfaceWrapper) GetSchema(w http.ResponseWriter, r *http.Requ r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.GetSchema(w, r, identifier, id) + siw.Handler.DeletePaymentOption(w, r, identifier, id) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3112,8 +3293,8 @@ func (siw *ServerInterfaceWrapper) GetSchema(w http.ResponseWriter, r *http.Requ handler.ServeHTTP(w, r) } -// PublishIdentityState operation middleware -func (siw *ServerInterfaceWrapper) PublishIdentityState(w http.ResponseWriter, r *http.Request) { +// GetPaymentOption operation middleware +func (siw *ServerInterfaceWrapper) GetPaymentOption(w http.ResponseWriter, r *http.Request) { var err error @@ -3126,6 +3307,15 @@ func (siw *ServerInterfaceWrapper) PublishIdentityState(w http.ResponseWriter, r return } + // ------------- Path parameter "id" ------------- + var id Id + + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + ctx := r.Context() ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) @@ -3133,7 +3323,7 @@ func (siw *ServerInterfaceWrapper) PublishIdentityState(w http.ResponseWriter, r r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.PublishIdentityState(w, r, identifier) + siw.Handler.GetPaymentOption(w, r, identifier, id) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3143,13 +3333,13 @@ func (siw *ServerInterfaceWrapper) PublishIdentityState(w http.ResponseWriter, r handler.ServeHTTP(w, r) } -// RetryPublishState operation middleware -func (siw *ServerInterfaceWrapper) RetryPublishState(w http.ResponseWriter, r *http.Request) { +// VerifyPayment operation middleware +func (siw *ServerInterfaceWrapper) VerifyPayment(w http.ResponseWriter, r *http.Request) { var err error // ------------- Path parameter "identifier" ------------- - var identifier PathIdentifier + var identifier string err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { @@ -3157,6 +3347,15 @@ func (siw *ServerInterfaceWrapper) RetryPublishState(w http.ResponseWriter, r *h return } + // ------------- Path parameter "nonce" ------------- + var nonce string + + err = runtime.BindStyledParameterWithOptions("simple", "nonce", chi.URLParam(r, "nonce"), &nonce, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "nonce", Err: err}) + return + } + ctx := r.Context() ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) @@ -3164,7 +3363,7 @@ func (siw *ServerInterfaceWrapper) RetryPublishState(w http.ResponseWriter, r *h r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.RetryPublishState(w, r, identifier) + siw.Handler.VerifyPayment(w, r, identifier, nonce) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3174,8 +3373,8 @@ func (siw *ServerInterfaceWrapper) RetryPublishState(w http.ResponseWriter, r *h handler.ServeHTTP(w, r) } -// GetStateStatus operation middleware -func (siw *ServerInterfaceWrapper) GetStateStatus(w http.ResponseWriter, r *http.Request) { +// GetSchemas operation middleware +func (siw *ServerInterfaceWrapper) GetSchemas(w http.ResponseWriter, r *http.Request) { var err error @@ -3194,8 +3393,19 @@ func (siw *ServerInterfaceWrapper) GetStateStatus(w http.ResponseWriter, r *http r = r.WithContext(ctx) + // Parameter object where we will unmarshal all parameters from the context + var params GetSchemasParams + + // ------------- Optional query parameter "query" ------------- + + err = runtime.BindQueryParameter("form", true, false, "query", r.URL.Query(), ¶ms.Query) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "query", Err: err}) + return + } + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.GetStateStatus(w, r, identifier) + siw.Handler.GetSchemas(w, r, identifier, params) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3205,8 +3415,8 @@ func (siw *ServerInterfaceWrapper) GetStateStatus(w http.ResponseWriter, r *http handler.ServeHTTP(w, r) } -// GetStateTransactions operation middleware -func (siw *ServerInterfaceWrapper) GetStateTransactions(w http.ResponseWriter, r *http.Request) { +// ImportSchema operation middleware +func (siw *ServerInterfaceWrapper) ImportSchema(w http.ResponseWriter, r *http.Request) { var err error @@ -3225,43 +3435,48 @@ func (siw *ServerInterfaceWrapper) GetStateTransactions(w http.ResponseWriter, r r = r.WithContext(ctx) - // Parameter object where we will unmarshal all parameters from the context - var params GetStateTransactionsParams - - // ------------- Optional query parameter "filter" ------------- + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.ImportSchema(w, r, identifier) + })) - err = runtime.BindQueryParameter("form", true, false, "filter", r.URL.Query(), ¶ms.Filter) - if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter", Err: err}) - return + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) } - // ------------- Optional query parameter "page" ------------- + handler.ServeHTTP(w, r) +} - err = runtime.BindQueryParameter("form", true, false, "page", r.URL.Query(), ¶ms.Page) - if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "page", Err: err}) - return - } +// GetSchema operation middleware +func (siw *ServerInterfaceWrapper) GetSchema(w http.ResponseWriter, r *http.Request) { - // ------------- Optional query parameter "max_results" ------------- + var err error - err = runtime.BindQueryParameter("form", true, false, "max_results", r.URL.Query(), ¶ms.MaxResults) + // ------------- Path parameter "identifier" ------------- + var identifier PathIdentifier + + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "max_results", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return } - // ------------- Optional query parameter "sort" ------------- + // ------------- Path parameter "id" ------------- + var id Id - err = runtime.BindQueryParameter("form", false, false, "sort", r.URL.Query(), ¶ms.Sort) + err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "sort", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) return } + ctx := r.Context() + + ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) + + r = r.WithContext(ctx) + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.GetStateTransactions(w, r, identifier, params) + siw.Handler.GetSchema(w, r, identifier, id) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3271,32 +3486,28 @@ func (siw *ServerInterfaceWrapper) GetStateTransactions(w http.ResponseWriter, r handler.ServeHTTP(w, r) } -// GetQrFromStore operation middleware -func (siw *ServerInterfaceWrapper) GetQrFromStore(w http.ResponseWriter, r *http.Request) { +// PublishIdentityState operation middleware +func (siw *ServerInterfaceWrapper) PublishIdentityState(w http.ResponseWriter, r *http.Request) { var err error - // Parameter object where we will unmarshal all parameters from the context - var params GetQrFromStoreParams - - // ------------- Optional query parameter "id" ------------- + // ------------- Path parameter "identifier" ------------- + var identifier PathIdentifier - err = runtime.BindQueryParameter("form", true, false, "id", r.URL.Query(), ¶ms.Id) + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) return } - // ------------- Optional query parameter "issuer" ------------- + ctx := r.Context() - err = runtime.BindQueryParameter("form", true, false, "issuer", r.URL.Query(), ¶ms.Issuer) - if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "issuer", Err: err}) - return - } + ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) + + r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.GetQrFromStore(w, r, params) + siw.Handler.PublishIdentityState(w, r, identifier) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3306,8 +3517,19 @@ func (siw *ServerInterfaceWrapper) GetQrFromStore(w http.ResponseWriter, r *http handler.ServeHTTP(w, r) } -// GetSupportedNetworks operation middleware -func (siw *ServerInterfaceWrapper) GetSupportedNetworks(w http.ResponseWriter, r *http.Request) { +// RetryPublishState operation middleware +func (siw *ServerInterfaceWrapper) RetryPublishState(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "identifier" ------------- + var identifier PathIdentifier + + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) + return + } ctx := r.Context() @@ -3316,7 +3538,7 @@ func (siw *ServerInterfaceWrapper) GetSupportedNetworks(w http.ResponseWriter, r r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.GetSupportedNetworks(w, r) + siw.Handler.RetryPublishState(w, r, identifier) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3326,8 +3548,8 @@ func (siw *ServerInterfaceWrapper) GetSupportedNetworks(w http.ResponseWriter, r handler.ServeHTTP(w, r) } -// Authentication operation middleware -func (siw *ServerInterfaceWrapper) Authentication(w http.ResponseWriter, r *http.Request) { +// GetStateStatus operation middleware +func (siw *ServerInterfaceWrapper) GetStateStatus(w http.ResponseWriter, r *http.Request) { var err error @@ -3340,19 +3562,14 @@ func (siw *ServerInterfaceWrapper) Authentication(w http.ResponseWriter, r *http return } - // Parameter object where we will unmarshal all parameters from the context - var params AuthenticationParams + ctx := r.Context() - // ------------- Optional query parameter "type" ------------- + ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) - err = runtime.BindQueryParameter("form", true, false, "type", r.URL.Query(), ¶ms.Type) - if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "type", Err: err}) - return - } + r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.Authentication(w, r, identifier, params) + siw.Handler.GetStateStatus(w, r, identifier) })) for _, middleware := range siw.HandlerMiddlewares { @@ -3362,8 +3579,185 @@ func (siw *ServerInterfaceWrapper) Authentication(w http.ResponseWriter, r *http handler.ServeHTTP(w, r) } -type UnescapedCookieParamError struct { - ParamName string +// GetStateTransactions operation middleware +func (siw *ServerInterfaceWrapper) GetStateTransactions(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "identifier" ------------- + var identifier PathIdentifier + + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) + return + } + + ctx := r.Context() + + ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) + + r = r.WithContext(ctx) + + // Parameter object where we will unmarshal all parameters from the context + var params GetStateTransactionsParams + + // ------------- Optional query parameter "filter" ------------- + + err = runtime.BindQueryParameter("form", true, false, "filter", r.URL.Query(), ¶ms.Filter) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter", Err: err}) + return + } + + // ------------- Optional query parameter "page" ------------- + + err = runtime.BindQueryParameter("form", true, false, "page", r.URL.Query(), ¶ms.Page) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "page", Err: err}) + return + } + + // ------------- Optional query parameter "max_results" ------------- + + err = runtime.BindQueryParameter("form", true, false, "max_results", r.URL.Query(), ¶ms.MaxResults) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "max_results", Err: err}) + return + } + + // ------------- Optional query parameter "sort" ------------- + + err = runtime.BindQueryParameter("form", false, false, "sort", r.URL.Query(), ¶ms.Sort) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "sort", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetStateTransactions(w, r, identifier, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetPaymentSettings operation middleware +func (siw *ServerInterfaceWrapper) GetPaymentSettings(w http.ResponseWriter, r *http.Request) { + + ctx := r.Context() + + ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetPaymentSettings(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetQrFromStore operation middleware +func (siw *ServerInterfaceWrapper) GetQrFromStore(w http.ResponseWriter, r *http.Request) { + + var err error + + // Parameter object where we will unmarshal all parameters from the context + var params GetQrFromStoreParams + + // ------------- Optional query parameter "id" ------------- + + err = runtime.BindQueryParameter("form", true, false, "id", r.URL.Query(), ¶ms.Id) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err}) + return + } + + // ------------- Optional query parameter "issuer" ------------- + + err = runtime.BindQueryParameter("form", true, false, "issuer", r.URL.Query(), ¶ms.Issuer) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "issuer", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetQrFromStore(w, r, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// GetSupportedNetworks operation middleware +func (siw *ServerInterfaceWrapper) GetSupportedNetworks(w http.ResponseWriter, r *http.Request) { + + ctx := r.Context() + + ctx = context.WithValue(ctx, BasicAuthScopes, []string{}) + + r = r.WithContext(ctx) + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.GetSupportedNetworks(w, r) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +// Authentication operation middleware +func (siw *ServerInterfaceWrapper) Authentication(w http.ResponseWriter, r *http.Request) { + + var err error + + // ------------- Path parameter "identifier" ------------- + var identifier PathIdentifier + + err = runtime.BindStyledParameterWithOptions("simple", "identifier", chi.URLParam(r, "identifier"), &identifier, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "identifier", Err: err}) + return + } + + // Parameter object where we will unmarshal all parameters from the context + var params AuthenticationParams + + // ------------- Optional query parameter "type" ------------- + + err = runtime.BindQueryParameter("form", true, false, "type", r.URL.Query(), ¶ms.Type) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "type", Err: err}) + return + } + + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + siw.Handler.Authentication(w, r, identifier, params) + })) + + for _, middleware := range siw.HandlerMiddlewares { + handler = middleware(handler) + } + + handler.ServeHTTP(w, r) +} + +type UnescapedCookieParamError struct { + ParamName string Err error } @@ -3598,6 +3992,24 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl r.Group(func(r chi.Router) { r.Patch(options.BaseURL+"/v2/identities/{identifier}/keys/{id}", wrapper.UpdateKey) }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/v2/identities/{identifier}/payment-request", wrapper.CreatePaymentRequest) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/v2/identities/{identifier}/payment/options", wrapper.GetPaymentOptions) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/v2/identities/{identifier}/payment/options", wrapper.CreatePaymentOption) + }) + r.Group(func(r chi.Router) { + r.Delete(options.BaseURL+"/v2/identities/{identifier}/payment/options/{id}", wrapper.DeletePaymentOption) + }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/v2/identities/{identifier}/payment/options/{id}", wrapper.GetPaymentOption) + }) + r.Group(func(r chi.Router) { + r.Post(options.BaseURL+"/v2/identities/{identifier}/payment/verify/{nonce}", wrapper.VerifyPayment) + }) r.Group(func(r chi.Router) { r.Get(options.BaseURL+"/v2/identities/{identifier}/schemas", wrapper.GetSchemas) }) @@ -3619,6 +4031,9 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl r.Group(func(r chi.Router) { r.Get(options.BaseURL+"/v2/identities/{identifier}/state/transactions", wrapper.GetStateTransactions) }) + r.Group(func(r chi.Router) { + r.Get(options.BaseURL+"/v2/payment/settings", wrapper.GetPaymentSettings) + }) r.Group(func(r chi.Router) { r.Get(options.BaseURL+"/v2/qr-store", wrapper.GetQrFromStore) }) @@ -5417,152 +5832,413 @@ func (response UpdateKey500JSONResponse) VisitUpdateKeyResponse(w http.ResponseW return json.NewEncoder(w).Encode(response) } -type GetSchemasRequestObject struct { +type CreatePaymentRequestRequestObject struct { Identifier PathIdentifier `json:"identifier"` - Params GetSchemasParams + Body *CreatePaymentRequestJSONRequestBody } -type GetSchemasResponseObject interface { - VisitGetSchemasResponse(w http.ResponseWriter) error +type CreatePaymentRequestResponseObject interface { + VisitCreatePaymentRequestResponse(w http.ResponseWriter) error } -type GetSchemas200JSONResponse []Schema +type CreatePaymentRequest201JSONResponse CreatePaymentRequestResponse -func (response GetSchemas200JSONResponse) VisitGetSchemasResponse(w http.ResponseWriter) error { +func (response CreatePaymentRequest201JSONResponse) VisitCreatePaymentRequestResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") - w.WriteHeader(200) + w.WriteHeader(201) return json.NewEncoder(w).Encode(response) } -type GetSchemas400JSONResponse struct{ N400JSONResponse } +type CreatePaymentRequest400JSONResponse struct{ N400JSONResponse } -func (response GetSchemas400JSONResponse) VisitGetSchemasResponse(w http.ResponseWriter) error { +func (response CreatePaymentRequest400JSONResponse) VisitCreatePaymentRequestResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(400) return json.NewEncoder(w).Encode(response) } -type GetSchemas500JSONResponse struct{ N500JSONResponse } +type CreatePaymentRequest401JSONResponse struct{ N401JSONResponse } -func (response GetSchemas500JSONResponse) VisitGetSchemasResponse(w http.ResponseWriter) error { +func (response CreatePaymentRequest401JSONResponse) VisitCreatePaymentRequestResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + + return json.NewEncoder(w).Encode(response) +} + +type CreatePaymentRequest500JSONResponse struct{ N500JSONResponse } + +func (response CreatePaymentRequest500JSONResponse) VisitCreatePaymentRequestResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) return json.NewEncoder(w).Encode(response) } -type ImportSchemaRequestObject struct { +type GetPaymentOptionsRequestObject struct { Identifier PathIdentifier `json:"identifier"` - Body *ImportSchemaJSONRequestBody } -type ImportSchemaResponseObject interface { - VisitImportSchemaResponse(w http.ResponseWriter) error +type GetPaymentOptionsResponseObject interface { + VisitGetPaymentOptionsResponse(w http.ResponseWriter) error } -type ImportSchema201JSONResponse UUIDResponse +type GetPaymentOptions200JSONResponse PaymentOptionsPaginated -func (response ImportSchema201JSONResponse) VisitImportSchemaResponse(w http.ResponseWriter) error { +func (response GetPaymentOptions200JSONResponse) VisitGetPaymentOptionsResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") - w.WriteHeader(201) + w.WriteHeader(200) return json.NewEncoder(w).Encode(response) } -type ImportSchema400JSONResponse struct{ N400JSONResponse } +type GetPaymentOptions400JSONResponse struct{ N400JSONResponse } -func (response ImportSchema400JSONResponse) VisitImportSchemaResponse(w http.ResponseWriter) error { +func (response GetPaymentOptions400JSONResponse) VisitGetPaymentOptionsResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(400) return json.NewEncoder(w).Encode(response) } -type ImportSchema500JSONResponse struct{ N500JSONResponse } +type GetPaymentOptions401JSONResponse struct{ N401JSONResponse } -func (response ImportSchema500JSONResponse) VisitImportSchemaResponse(w http.ResponseWriter) error { +func (response GetPaymentOptions401JSONResponse) VisitGetPaymentOptionsResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + + return json.NewEncoder(w).Encode(response) +} + +type GetPaymentOptions500JSONResponse struct{ N500JSONResponse } + +func (response GetPaymentOptions500JSONResponse) VisitGetPaymentOptionsResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) return json.NewEncoder(w).Encode(response) } -type GetSchemaRequestObject struct { +type CreatePaymentOptionRequestObject struct { Identifier PathIdentifier `json:"identifier"` - Id Id `json:"id"` + Body *CreatePaymentOptionJSONRequestBody } -type GetSchemaResponseObject interface { - VisitGetSchemaResponse(w http.ResponseWriter) error +type CreatePaymentOptionResponseObject interface { + VisitCreatePaymentOptionResponse(w http.ResponseWriter) error } -type GetSchema200JSONResponse Schema +type CreatePaymentOption201JSONResponse UUIDResponse -func (response GetSchema200JSONResponse) VisitGetSchemaResponse(w http.ResponseWriter) error { +func (response CreatePaymentOption201JSONResponse) VisitCreatePaymentOptionResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") - w.WriteHeader(200) + w.WriteHeader(201) return json.NewEncoder(w).Encode(response) } -type GetSchema400JSONResponse struct{ N400JSONResponse } +type CreatePaymentOption400JSONResponse struct{ N400JSONResponse } -func (response GetSchema400JSONResponse) VisitGetSchemaResponse(w http.ResponseWriter) error { +func (response CreatePaymentOption400JSONResponse) VisitCreatePaymentOptionResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(400) return json.NewEncoder(w).Encode(response) } -type GetSchema404JSONResponse struct{ N404JSONResponse } +type CreatePaymentOption401JSONResponse struct{ N401JSONResponse } -func (response GetSchema404JSONResponse) VisitGetSchemaResponse(w http.ResponseWriter) error { +func (response CreatePaymentOption401JSONResponse) VisitCreatePaymentOptionResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") - w.WriteHeader(404) + w.WriteHeader(401) return json.NewEncoder(w).Encode(response) } -type GetSchema500JSONResponse struct{ N500JSONResponse } +type CreatePaymentOption500JSONResponse struct{ N500JSONResponse } -func (response GetSchema500JSONResponse) VisitGetSchemaResponse(w http.ResponseWriter) error { +func (response CreatePaymentOption500JSONResponse) VisitCreatePaymentOptionResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(500) return json.NewEncoder(w).Encode(response) } -type PublishIdentityStateRequestObject struct { +type DeletePaymentOptionRequestObject struct { Identifier PathIdentifier `json:"identifier"` + Id Id `json:"id"` } -type PublishIdentityStateResponseObject interface { - VisitPublishIdentityStateResponse(w http.ResponseWriter) error +type DeletePaymentOptionResponseObject interface { + VisitDeletePaymentOptionResponse(w http.ResponseWriter) error } -type PublishIdentityState200JSONResponse GenericMessage +type DeletePaymentOption200JSONResponse GenericMessage -func (response PublishIdentityState200JSONResponse) VisitPublishIdentityStateResponse(w http.ResponseWriter) error { +func (response DeletePaymentOption200JSONResponse) VisitDeletePaymentOptionResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(200) return json.NewEncoder(w).Encode(response) } -type PublishIdentityState202JSONResponse PublishIdentityStateResponse +type DeletePaymentOption400JSONResponse struct{ N400JSONResponse } -func (response PublishIdentityState202JSONResponse) VisitPublishIdentityStateResponse(w http.ResponseWriter) error { +func (response DeletePaymentOption400JSONResponse) VisitDeletePaymentOptionResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") - w.WriteHeader(202) + w.WriteHeader(400) return json.NewEncoder(w).Encode(response) } -type PublishIdentityState400JSONResponse struct{ N400JSONResponse } +type DeletePaymentOption500JSONResponse struct{ N500JSONResponse } -func (response PublishIdentityState400JSONResponse) VisitPublishIdentityStateResponse(w http.ResponseWriter) error { +func (response DeletePaymentOption500JSONResponse) VisitDeletePaymentOptionResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + + return json.NewEncoder(w).Encode(response) +} + +type GetPaymentOptionRequestObject struct { + Identifier PathIdentifier `json:"identifier"` + Id Id `json:"id"` +} + +type GetPaymentOptionResponseObject interface { + VisitGetPaymentOptionResponse(w http.ResponseWriter) error +} + +type GetPaymentOption200JSONResponse PaymentOption + +func (response GetPaymentOption200JSONResponse) VisitGetPaymentOptionResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + +type GetPaymentOption400JSONResponse struct{ N400JSONResponse } + +func (response GetPaymentOption400JSONResponse) VisitGetPaymentOptionResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type GetPaymentOption404JSONResponse struct{ N404JSONResponse } + +func (response GetPaymentOption404JSONResponse) VisitGetPaymentOptionResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + + return json.NewEncoder(w).Encode(response) +} + +type GetPaymentOption500JSONResponse struct{ N500JSONResponse } + +func (response GetPaymentOption500JSONResponse) VisitGetPaymentOptionResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + + return json.NewEncoder(w).Encode(response) +} + +type VerifyPaymentRequestObject struct { + Identifier string `json:"identifier"` + Nonce string `json:"nonce"` + Body *VerifyPaymentJSONRequestBody +} + +type VerifyPaymentResponseObject interface { + VisitVerifyPaymentResponse(w http.ResponseWriter) error +} + +type VerifyPayment200JSONResponse PaymentStatus + +func (response VerifyPayment200JSONResponse) VisitVerifyPaymentResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + +type VerifyPayment400JSONResponse struct{ N400JSONResponse } + +func (response VerifyPayment400JSONResponse) VisitVerifyPaymentResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type VerifyPayment401JSONResponse struct{ N401JSONResponse } + +func (response VerifyPayment401JSONResponse) VisitVerifyPaymentResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(401) + + return json.NewEncoder(w).Encode(response) +} + +type VerifyPayment500JSONResponse struct{ N500JSONResponse } + +func (response VerifyPayment500JSONResponse) VisitVerifyPaymentResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + + return json.NewEncoder(w).Encode(response) +} + +type GetSchemasRequestObject struct { + Identifier PathIdentifier `json:"identifier"` + Params GetSchemasParams +} + +type GetSchemasResponseObject interface { + VisitGetSchemasResponse(w http.ResponseWriter) error +} + +type GetSchemas200JSONResponse []Schema + +func (response GetSchemas200JSONResponse) VisitGetSchemasResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + +type GetSchemas400JSONResponse struct{ N400JSONResponse } + +func (response GetSchemas400JSONResponse) VisitGetSchemasResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type GetSchemas500JSONResponse struct{ N500JSONResponse } + +func (response GetSchemas500JSONResponse) VisitGetSchemasResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + + return json.NewEncoder(w).Encode(response) +} + +type ImportSchemaRequestObject struct { + Identifier PathIdentifier `json:"identifier"` + Body *ImportSchemaJSONRequestBody +} + +type ImportSchemaResponseObject interface { + VisitImportSchemaResponse(w http.ResponseWriter) error +} + +type ImportSchema201JSONResponse UUIDResponse + +func (response ImportSchema201JSONResponse) VisitImportSchemaResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(201) + + return json.NewEncoder(w).Encode(response) +} + +type ImportSchema400JSONResponse struct{ N400JSONResponse } + +func (response ImportSchema400JSONResponse) VisitImportSchemaResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type ImportSchema500JSONResponse struct{ N500JSONResponse } + +func (response ImportSchema500JSONResponse) VisitImportSchemaResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + + return json.NewEncoder(w).Encode(response) +} + +type GetSchemaRequestObject struct { + Identifier PathIdentifier `json:"identifier"` + Id Id `json:"id"` +} + +type GetSchemaResponseObject interface { + VisitGetSchemaResponse(w http.ResponseWriter) error +} + +type GetSchema200JSONResponse Schema + +func (response GetSchema200JSONResponse) VisitGetSchemaResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + +type GetSchema400JSONResponse struct{ N400JSONResponse } + +func (response GetSchema400JSONResponse) VisitGetSchemaResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type GetSchema404JSONResponse struct{ N404JSONResponse } + +func (response GetSchema404JSONResponse) VisitGetSchemaResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + + return json.NewEncoder(w).Encode(response) +} + +type GetSchema500JSONResponse struct{ N500JSONResponse } + +func (response GetSchema500JSONResponse) VisitGetSchemaResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(500) + + return json.NewEncoder(w).Encode(response) +} + +type PublishIdentityStateRequestObject struct { + Identifier PathIdentifier `json:"identifier"` +} + +type PublishIdentityStateResponseObject interface { + VisitPublishIdentityStateResponse(w http.ResponseWriter) error +} + +type PublishIdentityState200JSONResponse GenericMessage + +func (response PublishIdentityState200JSONResponse) VisitPublishIdentityStateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + +type PublishIdentityState202JSONResponse PublishIdentityStateResponse + +func (response PublishIdentityState202JSONResponse) VisitPublishIdentityStateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(202) + + return json.NewEncoder(w).Encode(response) +} + +type PublishIdentityState400JSONResponse struct{ N400JSONResponse } + +func (response PublishIdentityState400JSONResponse) VisitPublishIdentityStateResponse(w http.ResponseWriter) error { w.Header().Set("Content-Type", "application/json") w.WriteHeader(400) @@ -5693,6 +6369,22 @@ func (response GetStateTransactions500JSONResponse) VisitGetStateTransactionsRes return json.NewEncoder(w).Encode(response) } +type GetPaymentSettingsRequestObject struct { +} + +type GetPaymentSettingsResponseObject interface { + VisitGetPaymentSettingsResponse(w http.ResponseWriter) error +} + +type GetPaymentSettings200JSONResponse PaymentsConfiguration + +func (response GetPaymentSettings200JSONResponse) VisitGetPaymentSettingsResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + type GetQrFromStoreRequestObject struct { Params GetQrFromStoreParams } @@ -5959,6 +6651,24 @@ type StrictServerInterface interface { // Update a Key // (PATCH /v2/identities/{identifier}/keys/{id}) UpdateKey(ctx context.Context, request UpdateKeyRequestObject) (UpdateKeyResponseObject, error) + // Create Payment Request + // (POST /v2/identities/{identifier}/payment-request) + CreatePaymentRequest(ctx context.Context, request CreatePaymentRequestRequestObject) (CreatePaymentRequestResponseObject, error) + // Get Payment Options + // (GET /v2/identities/{identifier}/payment/options) + GetPaymentOptions(ctx context.Context, request GetPaymentOptionsRequestObject) (GetPaymentOptionsResponseObject, error) + // Create Payment Option + // (POST /v2/identities/{identifier}/payment/options) + CreatePaymentOption(ctx context.Context, request CreatePaymentOptionRequestObject) (CreatePaymentOptionResponseObject, error) + // Delete Payment Option + // (DELETE /v2/identities/{identifier}/payment/options/{id}) + DeletePaymentOption(ctx context.Context, request DeletePaymentOptionRequestObject) (DeletePaymentOptionResponseObject, error) + // Get Payment Option + // (GET /v2/identities/{identifier}/payment/options/{id}) + GetPaymentOption(ctx context.Context, request GetPaymentOptionRequestObject) (GetPaymentOptionResponseObject, error) + // Verify Payment + // (POST /v2/identities/{identifier}/payment/verify/{nonce}) + VerifyPayment(ctx context.Context, request VerifyPaymentRequestObject) (VerifyPaymentResponseObject, error) // Get Schemas // (GET /v2/identities/{identifier}/schemas) GetSchemas(ctx context.Context, request GetSchemasRequestObject) (GetSchemasResponseObject, error) @@ -5980,6 +6690,9 @@ type StrictServerInterface interface { // Get Identity State Transactions // (GET /v2/identities/{identifier}/state/transactions) GetStateTransactions(ctx context.Context, request GetStateTransactionsRequestObject) (GetStateTransactionsResponseObject, error) + // Payments Configuration + // (GET /v2/payment/settings) + GetPaymentSettings(ctx context.Context, request GetPaymentSettingsRequestObject) (GetPaymentSettingsResponseObject, error) // Get QrCode from store // (GET /v2/qr-store) GetQrFromStore(ctx context.Context, request GetQrFromStoreRequestObject) (GetQrFromStoreResponseObject, error) @@ -7213,6 +7926,186 @@ func (sh *strictHandler) UpdateKey(w http.ResponseWriter, r *http.Request, ident } } +// CreatePaymentRequest operation middleware +func (sh *strictHandler) CreatePaymentRequest(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) { + var request CreatePaymentRequestRequestObject + + request.Identifier = identifier + + var body CreatePaymentRequestJSONRequestBody + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode JSON body: %w", err)) + return + } + request.Body = &body + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.CreatePaymentRequest(ctx, request.(CreatePaymentRequestRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "CreatePaymentRequest") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(CreatePaymentRequestResponseObject); ok { + if err := validResponse.VisitCreatePaymentRequestResponse(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)) + } +} + +// GetPaymentOptions operation middleware +func (sh *strictHandler) GetPaymentOptions(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) { + var request GetPaymentOptionsRequestObject + + request.Identifier = identifier + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.GetPaymentOptions(ctx, request.(GetPaymentOptionsRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "GetPaymentOptions") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(GetPaymentOptionsResponseObject); ok { + if err := validResponse.VisitGetPaymentOptionsResponse(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)) + } +} + +// CreatePaymentOption operation middleware +func (sh *strictHandler) CreatePaymentOption(w http.ResponseWriter, r *http.Request, identifier PathIdentifier) { + var request CreatePaymentOptionRequestObject + + request.Identifier = identifier + + var body CreatePaymentOptionJSONRequestBody + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode JSON body: %w", err)) + return + } + request.Body = &body + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.CreatePaymentOption(ctx, request.(CreatePaymentOptionRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "CreatePaymentOption") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(CreatePaymentOptionResponseObject); ok { + if err := validResponse.VisitCreatePaymentOptionResponse(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)) + } +} + +// DeletePaymentOption operation middleware +func (sh *strictHandler) DeletePaymentOption(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, id Id) { + var request DeletePaymentOptionRequestObject + + request.Identifier = identifier + request.Id = id + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.DeletePaymentOption(ctx, request.(DeletePaymentOptionRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "DeletePaymentOption") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(DeletePaymentOptionResponseObject); ok { + if err := validResponse.VisitDeletePaymentOptionResponse(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)) + } +} + +// GetPaymentOption operation middleware +func (sh *strictHandler) GetPaymentOption(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, id Id) { + var request GetPaymentOptionRequestObject + + request.Identifier = identifier + request.Id = id + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.GetPaymentOption(ctx, request.(GetPaymentOptionRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "GetPaymentOption") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(GetPaymentOptionResponseObject); ok { + if err := validResponse.VisitGetPaymentOptionResponse(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)) + } +} + +// VerifyPayment operation middleware +func (sh *strictHandler) VerifyPayment(w http.ResponseWriter, r *http.Request, identifier string, nonce string) { + var request VerifyPaymentRequestObject + + request.Identifier = identifier + request.Nonce = nonce + + var body VerifyPaymentJSONRequestBody + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + sh.options.RequestErrorHandlerFunc(w, r, fmt.Errorf("can't decode JSON body: %w", err)) + return + } + request.Body = &body + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.VerifyPayment(ctx, request.(VerifyPaymentRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "VerifyPayment") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(VerifyPaymentResponseObject); ok { + if err := validResponse.VisitVerifyPaymentResponse(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)) + } +} + // GetSchemas operation middleware func (sh *strictHandler) GetSchemas(w http.ResponseWriter, r *http.Request, identifier PathIdentifier, params GetSchemasParams) { var request GetSchemasRequestObject @@ -7405,6 +8298,30 @@ func (sh *strictHandler) GetStateTransactions(w http.ResponseWriter, r *http.Req } } +// GetPaymentSettings operation middleware +func (sh *strictHandler) GetPaymentSettings(w http.ResponseWriter, r *http.Request) { + var request GetPaymentSettingsRequestObject + + handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) { + return sh.ssi.GetPaymentSettings(ctx, request.(GetPaymentSettingsRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "GetPaymentSettings") + } + + response, err := handler(r.Context(), w, r, request) + + if err != nil { + sh.options.ResponseErrorHandlerFunc(w, r, err) + } else if validResponse, ok := response.(GetPaymentSettingsResponseObject); ok { + if err := validResponse.VisitGetPaymentSettingsResponse(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/connections_test.go b/internal/api/connections_test.go index 70fc891ab..be1566848 100644 --- a/internal/api/connections_test.go +++ b/internal/api/connections_test.go @@ -182,8 +182,8 @@ func TestServer_CreateConnection(t *testing.T) { reqBytes, err := json.Marshal(tc.body) require.NoError(t, err) req, err := http.NewRequest(http.MethodPost, parsedURL.String(), bytes.NewBuffer(reqBytes)) - req.SetBasicAuth(tc.auth()) require.NoError(t, err) + req.SetBasicAuth(tc.auth()) handler.ServeHTTP(rr, req) diff --git a/internal/api/identity_test.go b/internal/api/identity_test.go index 6d50c6303..27891dc27 100644 --- a/internal/api/identity_test.go +++ b/internal/api/identity_test.go @@ -312,8 +312,8 @@ func TestServer_GetIdentities(t *testing.T) { t.Run(tc.name, func(t *testing.T) { rr := httptest.NewRecorder() req, err := http.NewRequest("GET", "/v2/identities", nil) - req.SetBasicAuth(tc.auth()) require.NoError(t, err) + req.SetBasicAuth(tc.auth()) handler.ServeHTTP(rr, req) require.Equal(t, tc.expected.httpCode, rr.Code) diff --git a/internal/api/main_test.go b/internal/api/main_test.go index 04917db4d..cd247e899 100644 --- a/internal/api/main_test.go +++ b/internal/api/main_test.go @@ -27,6 +27,7 @@ import ( "github.com/polygonid/sh-id-platform/internal/loader" "github.com/polygonid/sh-id-platform/internal/log" "github.com/polygonid/sh-id-platform/internal/network" + "github.com/polygonid/sh-id-platform/internal/payments" "github.com/polygonid/sh-id-platform/internal/providers" "github.com/polygonid/sh-id-platform/internal/pubsub" "github.com/polygonid/sh-id-platform/internal/repositories" @@ -232,6 +233,7 @@ type repos struct { idenMerkleTree ports.IdentityMerkleTreeRepository identityState ports.IdentityStateRepository links ports.LinkRepository + payments ports.PaymentRepository schemas ports.SchemaRepository sessions ports.SessionRepository revocation ports.RevocationRepository @@ -244,6 +246,7 @@ type servicex struct { identity ports.IdentityService schema ports.SchemaService links ports.LinkService + payments ports.PaymentService qrs ports.QrStoreService displayMethod ports.DisplayMethodService keyService ports.KeyService @@ -273,6 +276,7 @@ func newTestServer(t *testing.T, st *db.Storage) *testServer { idenMerkleTree: repositories.NewIdentityMerkleTreeRepository(), identityState: repositories.NewIdentityState(), links: repositories.NewLink(*st), + payments: repositories.NewPayment(*st), sessions: repositories.NewSessionCached(cachex), schemas: repositories.NewSchema(*st), revocation: repositories.NewRevocation(), @@ -286,12 +290,69 @@ func newTestServer(t *testing.T, st *db.Storage) *testServer { require.NoError(t, err) revocationStatusResolver := revocationstatus.NewRevocationStatusResolver(*networkResolver) + paymentSettings, err := payments.SettingsFromReader(common.NewMyYAMLReader([]byte(` +80002: + PaymentRails: 0xF8E49b922D5Fb00d3EdD12bd14064f275726D339 + PaymentOptions: + - ID: 1 + Name: AmoyNative + Type: Iden3PaymentRailsRequestV1 + - ID: 2 + Name: Amoy USDT + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x2FE40749812FAC39a0F380649eF59E01bccf3a1A + Features: [] + - ID: 3 + Name: Amoy USDC + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x2FE40749812FAC39a0F380649eF59E01bccf3a1A + Features: + - EIP-2612 +59141: + PaymentRails: 0x40E3EF221AA93F6Fe997c9b0393322823Bb207d3 + PaymentOptions: + - ID: 4 + Name: LineaSepoliaNative + Type: Iden3PaymentRailsRequestV1 + - ID: 5 + Name: Linea Sepolia USDT + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0xb0101c1Ffdd1213B886FebeF6F07442e48990c9C + Features: [] + - ID: 6 + Name: Linea Sepolia USDC + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0xb0101c1Ffdd1213B886FebeF6F07442e48990c9C + Features: + - EIP-2612 +2442: + PaymentRails: 0x09c269e74d8B47c98537Acd6CbEe8056806F4c70 + PaymentOptions: + - ID: 7 + Name: ZkEvmNative + Type: Iden3PaymentRailsRequestV1 + - ID: 8 + Name: ZkEvm USDT + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x986caE6ADcF5da2a1514afc7317FBdeE0B4048Db + Features: [] + - ID: 9 + Name: ZkEvm USDC + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x986caE6ADcF5da2a1514afc7317FBdeE0B4048Db + Features: + - EIP-2612 +`, + ))) + require.NoError(t, err) + mtService := services.NewIdentityMerkleTrees(repos.idenMerkleTree) qrService := services.NewQrStoreService(cachex) rhsFactory := reversehash.NewFactory(*networkResolver, reversehash.DefaultRHSTimeOut) identityService := services.NewIdentity(keyStore, repos.identity, repos.idenMerkleTree, repos.identityState, mtService, qrService, repos.claims, repos.revocation, repos.connection, st, nil, repos.sessions, pubSub, *networkResolver, rhsFactory, revocationStatusResolver, repos.keyRepository) connectionService := services.NewConnection(repos.connection, repos.claims, st) schemaService := services.NewSchema(repos.schemas, schemaLoader) + paymentService := services.NewPaymentService(repos.payments, *networkResolver, schemaService, paymentSettings, keyStore) mediaTypeManager := services.NewMediaTypeManager( map[iden3comm.ProtocolMessage][]string{ @@ -306,7 +367,7 @@ func newTestServer(t *testing.T, st *db.Storage) *testServer { linkService := services.NewLinkService(storage, claimsService, qrService, repos.claims, repos.links, repos.schemas, schemaLoader, repos.sessions, pubSub, identityService, *networkResolver, cfg.UniversalLinks) displayMethodService := services.NewDisplayMethod(repos.displayMethod) keyService := services.NewKey(keyStore, claimsService, repos.keyRepository) - server := NewServer(&cfg, identityService, accountService, connectionService, claimsService, qrService, NewPublisherMock(), NewPackageManagerMock(), *networkResolver, nil, schemaService, linkService, displayMethodService, keyService) + server := NewServer(&cfg, identityService, accountService, connectionService, claimsService, qrService, NewPublisherMock(), NewPackageManagerMock(), *networkResolver, nil, schemaService, linkService, displayMethodService, keyService, paymentService) return &testServer{ Server: server, @@ -315,6 +376,7 @@ func newTestServer(t *testing.T, st *db.Storage) *testServer { credentials: claimsService, identity: identityService, links: linkService, + payments: paymentService, qrs: qrService, schema: schemaService, displayMethod: displayMethodService, diff --git a/internal/api/payment.go b/internal/api/payment.go new file mode 100644 index 000000000..848d89c1e --- /dev/null +++ b/internal/api/payment.go @@ -0,0 +1,190 @@ +package api + +import ( + "context" + "errors" + "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/iden3/go-iden3-core/v2/w3c" + + "github.com/polygonid/sh-id-platform/internal/core/domain" + "github.com/polygonid/sh-id-platform/internal/core/ports" + "github.com/polygonid/sh-id-platform/internal/log" + "github.com/polygonid/sh-id-platform/internal/payments" + "github.com/polygonid/sh-id-platform/internal/repositories" +) + +// GetPaymentOptions is the controller to get payment options +func (s *Server) GetPaymentOptions(ctx context.Context, request GetPaymentOptionsRequestObject) (GetPaymentOptionsResponseObject, error) { + issuerDID, err := w3c.ParseDID(request.Identifier) + if err != nil { + log.Error(ctx, "parsing issuer did", "err", err, "did", request.Identifier) + return GetPaymentOptions400JSONResponse{N400JSONResponse{Message: "invalid issuer did"}}, nil + } + paymentOptions, err := s.paymentService.GetPaymentOptions(ctx, issuerDID) + if err != nil { + log.Error(ctx, "getting payment options", "err", err, "issuer", issuerDID) + return GetPaymentOptions500JSONResponse{N500JSONResponse{Message: fmt.Sprintf("can't get payment-options: <%s>", err.Error())}}, nil + } + items, err := toGetPaymentOptionsResponse(paymentOptions) + if err != nil { + log.Error(ctx, "creating payment options response", "err", err) + return GetPaymentOptions500JSONResponse{N500JSONResponse{Message: fmt.Sprintf("can't convert payment-options: <%s>", err.Error())}}, nil + } + return GetPaymentOptions200JSONResponse( + PaymentOptionsPaginated{ + Items: items, + Meta: PaginatedMetadata{ // No pagination by now, just return all + MaxResults: uint(len(paymentOptions)), + Page: 1, + Total: uint(len(paymentOptions)), + }, + }), nil +} + +// CreatePaymentOption is the controller to create a payment option +func (s *Server) CreatePaymentOption(ctx context.Context, request CreatePaymentOptionRequestObject) (CreatePaymentOptionResponseObject, error) { + issuerDID, err := w3c.ParseDID(request.Identifier) + if err != nil { + log.Error(ctx, "parsing issuer did", "err", err, "did", request.Identifier) + return CreatePaymentOption400JSONResponse{N400JSONResponse{Message: "invalid issuer did"}}, nil + } + payOptConf, err := newPaymentOptionConfig(request.Body.Config) + if err != nil { + log.Error(ctx, "creating payment option config", "err", err) + return CreatePaymentOption400JSONResponse{N400JSONResponse{Message: fmt.Sprintf("invalid config: %s", err)}}, nil + } + id, err := s.paymentService.CreatePaymentOption(ctx, issuerDID, request.Body.Name, request.Body.Description, payOptConf) + if err != nil { + log.Error(ctx, "creating payment option", "err", err, "issuer", issuerDID, "request", request.Body) + if errors.Is(err, repositories.ErrIdentityNotFound) { + return CreatePaymentOption400JSONResponse{N400JSONResponse{Message: "invalid issuer did"}}, nil + } + return CreatePaymentOption500JSONResponse{N500JSONResponse{Message: fmt.Sprintf("can't create payment-option: <%s>", err.Error())}}, nil + } + return CreatePaymentOption201JSONResponse{Id: id.String()}, nil +} + +// DeletePaymentOption is the controller to delete a payment option +func (s *Server) DeletePaymentOption(ctx context.Context, request DeletePaymentOptionRequestObject) (DeletePaymentOptionResponseObject, error) { + issuerID, err := w3c.ParseDID(request.Identifier) + if err != nil { + log.Error(ctx, "parsing issuer did", "err", err, "did", request.Identifier) + return DeletePaymentOption400JSONResponse{N400JSONResponse{Message: "invalid issuer did"}}, nil + } + if err := s.paymentService.DeletePaymentOption(ctx, issuerID, request.Id); err != nil { + log.Error(ctx, "deleting payment option", "err", err, "issuer", issuerID, "id", request.Id) + if errors.Is(err, repositories.ErrPaymentOptionDoesNotExists) { + return DeletePaymentOption400JSONResponse{N400JSONResponse{Message: "payment option not found"}}, nil + } + return DeletePaymentOption500JSONResponse{N500JSONResponse{Message: fmt.Sprintf("can't delete payment-option: <%s>", err.Error())}}, nil + } + return DeletePaymentOption200JSONResponse{Message: "deleted"}, nil +} + +// GetPaymentOption is the controller to get a payment option +func (s *Server) GetPaymentOption(ctx context.Context, request GetPaymentOptionRequestObject) (GetPaymentOptionResponseObject, error) { + issuerID, err := w3c.ParseDID(request.Identifier) + if err != nil { + log.Error(ctx, "parsing issuer did", "err", err, "did", request.Identifier) + return GetPaymentOption400JSONResponse{N400JSONResponse{Message: "invalid issuer did"}}, nil + } + paymentOption, err := s.paymentService.GetPaymentOptionByID(ctx, issuerID, request.Id) + if err != nil { + if errors.Is(err, repositories.ErrPaymentOptionDoesNotExists) { + return GetPaymentOption404JSONResponse{N404JSONResponse{Message: "payment option not found"}}, nil + } + log.Error(ctx, "getting payment option", "err", err, "issuer", issuerID, "id", request.Id) + return GetPaymentOption500JSONResponse{N500JSONResponse{Message: fmt.Sprintf("can't get payment-option: <%s>", err.Error())}}, nil + } + + option, err := toPaymentOption(paymentOption) + if err != nil { + log.Error(ctx, "creating payment option response", "err", err) + return GetPaymentOption500JSONResponse{N500JSONResponse{Message: fmt.Sprintf("can't convert payment-option: <%s>", err.Error())}}, nil + } + return GetPaymentOption200JSONResponse(option), nil +} + +// CreatePaymentRequest is the controller to get qr bodies +func (s *Server) CreatePaymentRequest(ctx context.Context, request CreatePaymentRequestRequestObject) (CreatePaymentRequestResponseObject, error) { + var err error + issuerDID, err := w3c.ParseDID(request.Identifier) + if err != nil { + log.Error(ctx, "parsing issuer did", "err", err, "did", request.Identifier) + return CreatePaymentRequest400JSONResponse{N400JSONResponse{Message: "invalid issuer did"}}, nil + } + + userDID, err := w3c.ParseDID(request.Body.UserDID) + if err != nil { + log.Error(ctx, "parsing user did", "err", err, "did", request.Body.UserDID) + return CreatePaymentRequest400JSONResponse{N400JSONResponse{Message: "invalid userDID"}}, nil + } + + req := &ports.CreatePaymentRequestReq{ + IssuerDID: *issuerDID, + UserDID: *userDID, + SchemaID: request.Body.SchemaID, + OptionID: request.Body.OptionID, + Description: request.Body.Description, + } + + payReq, err := s.paymentService.CreatePaymentRequest(ctx, req) + if err != nil { + log.Error(ctx, "creating payment request", "err", err) + return CreatePaymentRequest400JSONResponse{N400JSONResponse{Message: fmt.Sprintf("can't create payment-request: %s", err)}}, nil + } + return CreatePaymentRequest201JSONResponse(toCreatePaymentRequestResponse(payReq)), nil +} + +// GetPaymentSettings is the controller to get payment settings +func (s *Server) GetPaymentSettings(_ context.Context, _ GetPaymentSettingsRequestObject) (GetPaymentSettingsResponseObject, error) { + return GetPaymentSettings200JSONResponse(s.paymentService.GetSettings()), nil +} + +// VerifyPayment is the controller to verify payment +func (s *Server) VerifyPayment(ctx context.Context, request VerifyPaymentRequestObject) (VerifyPaymentResponseObject, error) { + const base10 = 10 + issuerDID, err := w3c.ParseDID(request.Identifier) + if err != nil { + log.Error(ctx, "parsing issuer did", "err", err, "did", request.Identifier) + return VerifyPayment400JSONResponse{N400JSONResponse{Message: "invalid issuer did"}}, nil + } + nonce, ok := new(big.Int).SetString(request.Nonce, base10) + if !ok { + log.Error(ctx, "parsing nonce on verify payment", "err", err, "nonce", request.Nonce) + return VerifyPayment400JSONResponse{N400JSONResponse{Message: fmt.Sprintf("invalid nonce: <%s>", request.Nonce)}}, nil + } + status, err := s.paymentService.VerifyPayment(ctx, *issuerDID, nonce, request.Body.TxHash) + if err != nil { + log.Error(ctx, "can't verify payment", "err", err, "nonce", request.Nonce, "txID", request.Body.TxHash) + return VerifyPayment400JSONResponse{N400JSONResponse{Message: fmt.Sprintf("can't verify payment: <%s>", err.Error())}}, nil + } + return toVerifyPaymentResponse(status) +} + +func newPaymentOptionConfig(config PaymentOptionConfig) (*domain.PaymentOptionConfig, error) { + const base10 = 10 + cfg := &domain.PaymentOptionConfig{ + Config: make([]domain.PaymentOptionConfigItem, len(config)), + } + for i, item := range config { + if !common.IsHexAddress(item.Recipient) { + return nil, fmt.Errorf("invalid recipient address: %s", item.Recipient) + } + amount, ok := new(big.Int).SetString(item.Amount, base10) + if !ok { + return nil, fmt.Errorf("could not parse amount: %s", item.Amount) + } + + cfg.Config[i] = domain.PaymentOptionConfigItem{ + PaymentOptionID: payments.OptionConfigIDType(item.PaymentOptionID), + Amount: *amount, + Recipient: common.HexToAddress(item.Recipient), + SigningKeyID: item.SigningKeyID, + } + } + return cfg, nil +} diff --git a/internal/api/payment_test.go b/internal/api/payment_test.go new file mode 100644 index 000000000..d5315a5fc --- /dev/null +++ b/internal/api/payment_test.go @@ -0,0 +1,684 @@ +package api + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "math/big" + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/google/uuid" + "github.com/iden3/go-iden3-core/v2/w3c" + "github.com/iden3/iden3comm/v2/protocol" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/polygonid/sh-id-platform/internal/core/domain" + "github.com/polygonid/sh-id-platform/internal/core/ports" + "github.com/polygonid/sh-id-platform/internal/kms" + "github.com/polygonid/sh-id-platform/internal/payments" +) + +const paymentOptionConfigurationTesting = ` + [ + { + "paymentOptionId": 1, + "amount": "500000000000000000", + "Recipient": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + "SigningKeyId": "pubId" + }, + { + "paymentOptionId": 2, + "amount": "1500000000000000000", + "Recipient": "0x53d284357ec70cE289D6D64134DfAc8E511c8a3D", + "SigningKeyId": "pubId" + } +] +` + +func TestServer_GetPaymentSettings(t *testing.T) { + ctx := context.Background() + + server := newTestServer(t, nil) + handler := getHandler(ctx, server) + + rr := httptest.NewRecorder() + req, err := http.NewRequest(http.MethodGet, "/v2/payment/settings", nil) + assert.NoError(t, err) + req.SetBasicAuth(authOk()) + + handler.ServeHTTP(rr, req) + require.Equal(t, http.StatusOK, rr.Code) + var response GetPaymentSettings200JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) +} + +func TestServer_CreatePaymentOption(t *testing.T) { + const ( + method = "polygonid" + blockchain = "polygon" + network = "amoy" + BJJ = "BJJ" + ) + + var config PaymentOptionConfig + ctx := context.Background() + + server := newTestServer(t, nil) + handler := getHandler(ctx, server) + + iden, err := server.Services.identity.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + require.NoError(t, err) + issuerDID, err := w3c.ParseDID(iden.Identifier) + require.NoError(t, err) + + otherDID, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qRYvPBNBTkPaHk1mKBkcLTequfAdsHzXv549ktnL5") + require.NoError(t, err) + + require.NoError(t, json.Unmarshal([]byte(paymentOptionConfigurationTesting), &config)) + + type expected struct { + httpCode int + msg string + } + + for _, tc := range []struct { + name string + issuerDID w3c.DID + auth func() (string, string) + body CreatePaymentOptionJSONRequestBody + expected expected + }{ + { + name: "no auth header", + auth: authWrong, + issuerDID: *issuerDID, + body: CreatePaymentOptionJSONRequestBody{ + Config: config, + Description: "Payment Option explanation", + Name: "1 POL Payment", + }, + expected: expected{ + httpCode: http.StatusUnauthorized, + msg: "Unauthorized", + }, + }, + { + name: "Happy Path", + auth: authOk, + issuerDID: *issuerDID, + body: CreatePaymentOptionJSONRequestBody{ + Config: config, + Description: "Payment Option explanation", + Name: "1 POL Payment", + }, + expected: expected{ + httpCode: http.StatusCreated, + }, + }, + { + name: "Not existing issuerDID", + auth: authOk, + issuerDID: *otherDID, + body: CreatePaymentOptionJSONRequestBody{ + Config: config, + Description: "Payment Option explanation", + Name: "1 POL Payment", + }, + expected: expected{ + httpCode: http.StatusBadRequest, + msg: "invalid issuer did", + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + rr := httptest.NewRecorder() + payload, err := json.Marshal(tc.body) + require.NoError(t, err) + url := fmt.Sprintf("/v2/identities/%s/payment/options", tc.issuerDID.String()) + req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(payload)) + assert.NoError(t, err) + req.SetBasicAuth(tc.auth()) + + handler.ServeHTTP(rr, req) + require.Equal(t, tc.expected.httpCode, rr.Code) + switch tc.expected.httpCode { + case http.StatusCreated: + var response CreatePaymentOption201JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + case http.StatusBadRequest: + var response CreatePaymentOption400JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.expected.msg, response.Message) + + } + }) + } +} + +func TestServer_GetPaymentOption(t *testing.T) { + const ( + method = "polygonid" + blockchain = "polygon" + network = "amoy" + BJJ = "BJJ" + ) + + ctx := context.Background() + + server := newTestServer(t, nil) + handler := getHandler(ctx, server) + + iden, err := server.Services.identity.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + require.NoError(t, err) + issuerDID, err := w3c.ParseDID(iden.Identifier) + require.NoError(t, err) + + otherDID, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qRYvPBNBTkPaHk1mKBkcLTequfAdsHzXv549ktnL5") + require.NoError(t, err) + + var config PaymentOptionConfig + require.NoError(t, json.Unmarshal([]byte(paymentOptionConfigurationTesting), &config)) + domainConfig := domain.PaymentOptionConfig{} + for _, item := range config { + amount, ok := new(big.Int).SetString(item.Amount, 10) + require.True(t, ok) + domainConfig.Config = append(domainConfig.Config, domain.PaymentOptionConfigItem{ + PaymentOptionID: payments.OptionConfigIDType(item.PaymentOptionID), + Amount: *amount, + Recipient: common.HexToAddress(item.Recipient), + SigningKeyID: item.SigningKeyID, + }) + } + optionID, err := server.Services.payments.CreatePaymentOption( + ctx, + issuerDID, + "1 POL Payment", + "Payment Option explanation", + &domainConfig) + require.NoError(t, err) + + type expected struct { + httpCode int + msg string + option PaymentOption + } + + for _, tc := range []struct { + name string + issuerDID w3c.DID + optionID uuid.UUID + auth func() (string, string) + expected expected + }{ + { + name: "no auth header", + auth: authWrong, + issuerDID: *issuerDID, + optionID: optionID, + expected: expected{ + httpCode: http.StatusUnauthorized, + }, + }, + { + name: "Happy Path", + auth: authOk, + issuerDID: *issuerDID, + optionID: optionID, + expected: expected{ + httpCode: http.StatusOK, + option: PaymentOption{ + Id: optionID, + IssuerDID: issuerDID.String(), + Name: "1 POL Payment", + Description: "Payment Option explanation", + Config: config, + }, + }, + }, + { + name: "Not existing issuerDID", + auth: authOk, + issuerDID: *otherDID, + optionID: optionID, + expected: expected{ + httpCode: http.StatusNotFound, + msg: "payment option not found", + }, + }, + { + name: "Not existing Payment option", + auth: authOk, + issuerDID: *issuerDID, + optionID: uuid.New(), + expected: expected{ + httpCode: http.StatusNotFound, + msg: "payment option not found", + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + rr := httptest.NewRecorder() + url := fmt.Sprintf("/v2/identities/%s/payment/options/%s", tc.issuerDID.String(), tc.optionID.String()) + req, err := http.NewRequest(http.MethodGet, url, nil) + assert.NoError(t, err) + req.SetBasicAuth(tc.auth()) + + handler.ServeHTTP(rr, req) + require.Equal(t, tc.expected.httpCode, rr.Code) + + switch tc.expected.httpCode { + case http.StatusOK: + var response GetPaymentOption200JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.optionID, response.Id) + assert.Equal(t, tc.expected.option.Name, response.Name) + assert.Equal(t, tc.expected.option.Description, response.Description) + assert.Equal(t, tc.expected.option.IssuerDID, response.IssuerDID) + assert.Equal(t, tc.expected.option.Config, response.Config) + + case http.StatusNotFound: + var response GetPaymentOption404JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.expected.msg, response.Message) + } + }) + } +} + +func TestServer_GetPaymentOptions(t *testing.T) { + const ( + method = "polygonid" + blockchain = "polygon" + network = "amoy" + BJJ = "BJJ" + ) + + ctx := context.Background() + + server := newTestServer(t, nil) + handler := getHandler(ctx, server) + + iden, err := server.Services.identity.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + require.NoError(t, err) + issuerDID, err := w3c.ParseDID(iden.Identifier) + require.NoError(t, err) + + otherDID, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qRYvPBNBTkPaHk1mKBkcLTequfAdsHzXv549ktnL5") + require.NoError(t, err) + + config := domain.PaymentOptionConfig{ + Config: []domain.PaymentOptionConfigItem{ + { + PaymentOptionID: 1, + Amount: *big.NewInt(500000000000000000), + Recipient: common.HexToAddress("0x742d35Cc6634C0532925a3b844Bc454e4438f44e"), + SigningKeyID: "pubId", + }, + { + PaymentOptionID: 2, + Amount: *big.NewInt(1500000000000000000), + Recipient: common.HexToAddress("0x53d284357ec70cE289D6D64134DfAc8E511c8a3D"), + SigningKeyID: "pubId", + }, + }, + } + + for i := 0; i < 10; i++ { + _, err = server.Services.payments.CreatePaymentOption(ctx, issuerDID, fmt.Sprintf("Payment Option %d", i+1), "Payment Option explanation", &config) + require.NoError(t, err) + } + type expected struct { + httpCode int + msg string + count int + } + for _, tc := range []struct { + name string + issuerDID w3c.DID + auth func() (string, string) + expected expected + }{ + { + name: "no auth header", + auth: authWrong, + issuerDID: *issuerDID, + expected: expected{ + httpCode: http.StatusUnauthorized, + }, + }, + { + name: "Happy Path", + auth: authOk, + issuerDID: *issuerDID, + expected: expected{ + httpCode: http.StatusOK, + count: 10, + }, + }, + { + name: "Other issuer DID with no payment options. Should return empty string", + auth: authOk, + issuerDID: *otherDID, + expected: expected{ + httpCode: http.StatusOK, + count: 0, + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + rr := httptest.NewRecorder() + url := fmt.Sprintf("/v2/identities/%s/payment/options", tc.issuerDID.String()) + req, err := http.NewRequest(http.MethodGet, url, nil) + assert.NoError(t, err) + req.SetBasicAuth(tc.auth()) + + handler.ServeHTTP(rr, req) + require.Equal(t, tc.expected.httpCode, rr.Code) + + switch tc.expected.httpCode { + case http.StatusOK: + var response GetPaymentOptions200JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.expected.count, len(response.Items)) // Check that 10 items are returned + assert.Equal(t, 1, int(response.Meta.Page)) + assert.Equal(t, tc.expected.count, int(response.Meta.Total)) + case http.StatusBadRequest: + var response GetPaymentOptions400JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.expected.msg, response.Message) + } + }) + } +} + +func TestServer_DeletePaymentOption(t *testing.T) { + const ( + method = "polygonid" + blockchain = "polygon" + network = "amoy" + BJJ = "BJJ" + ) + + var config domain.PaymentOptionConfig + ctx := context.Background() + + server := newTestServer(t, nil) + handler := getHandler(ctx, server) + + iden, err := server.Services.identity.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + require.NoError(t, err) + issuerDID, err := w3c.ParseDID(iden.Identifier) + require.NoError(t, err) + + otherDID, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qRYvPBNBTkPaHk1mKBkcLTequfAdsHzXv549ktnL5") + require.NoError(t, err) + + optionID, err := server.Services.payments.CreatePaymentOption(ctx, issuerDID, "1 POL Payment", "Payment Option explanation", &config) + require.NoError(t, err) + type expected struct { + httpCode int + msg string + } + for _, tc := range []struct { + name string + issuerDID w3c.DID + optionID uuid.UUID + auth func() (string, string) + expected expected + }{ + { + name: "no auth header", + auth: authWrong, + issuerDID: *issuerDID, + optionID: optionID, + expected: expected{ + httpCode: http.StatusUnauthorized, + }, + }, + { + name: "Happy Path", + auth: authOk, + issuerDID: *issuerDID, + optionID: optionID, + expected: expected{ + httpCode: http.StatusOK, + msg: "deleted", + }, + }, + { + name: "Not existing issuerDID", + auth: authOk, + issuerDID: *otherDID, + optionID: optionID, + expected: expected{ + httpCode: http.StatusBadRequest, + msg: "payment option not found", + }, + }, + { + name: "Not existing Payment option", + auth: authOk, + issuerDID: *issuerDID, + optionID: uuid.New(), + expected: expected{ + httpCode: http.StatusBadRequest, + msg: "payment option not found", + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + rr := httptest.NewRecorder() + url := fmt.Sprintf("/v2/identities/%s/payment/options/%s", tc.issuerDID.String(), tc.optionID.String()) + req, err := http.NewRequest(http.MethodDelete, url, nil) + assert.NoError(t, err) + req.SetBasicAuth(tc.auth()) + + handler.ServeHTTP(rr, req) + require.Equal(t, tc.expected.httpCode, rr.Code) + + switch tc.expected.httpCode { + case http.StatusOK: + var response DeletePaymentOption200JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.expected.msg, response.Message) + case http.StatusBadRequest: + var response DeletePaymentOption400JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.expected.msg, response.Message) + case http.StatusInternalServerError: + var response DeletePaymentOption500JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.expected.msg, response.Message) + } + }) + } +} + +func TestServer_CreatePaymentRequest(t *testing.T) { + const ( + method = "polygonid" + blockchain = "polygon" + network = "amoy" + BJJ = "BJJ" + url = "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json" + schemaType = "KYCCountryOfResidenceCredential" + ) + ctx := context.Background() + server := newTestServer(t, nil) + handler := getHandler(ctx, server) + + iden, err := server.Services.identity.Create(ctx, "polygon-test", &ports.DIDCreationOptions{Method: method, Blockchain: blockchain, Network: network, KeyType: BJJ}) + require.NoError(t, err) + issuerDID, err := w3c.ParseDID(iden.Identifier) + require.NoError(t, err) + + receiverDID, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qRYvPBNBTkPaHk1mKBkcLTequfAdsHzXv549ktnL5") + require.NoError(t, err) + + iReq := ports.NewImportSchemaRequest(url, schemaType, nil, "1.0", nil) + schema, err := server.schemaService.ImportSchema(ctx, *issuerDID, iReq) + require.NoError(t, err) + + // Creating an ethereum key + signingKeyID, err := keyStore.CreateKey(kms.KeyTypeEthereum, issuerDID) + require.NoError(t, err) + + amount := new(big.Int).SetUint64(500000000000000000) + config := domain.PaymentOptionConfig{ + Config: []domain.PaymentOptionConfigItem{ + { + PaymentOptionID: 1, + Amount: *amount, + Recipient: common.Address{}, + SigningKeyID: signingKeyID.ID, + }, + { + PaymentOptionID: 2, + Amount: *amount, + Recipient: common.Address{}, + SigningKeyID: signingKeyID.ID, + }, + }, + } + + paymentOptionID, err := server.Services.payments.CreatePaymentOption(ctx, issuerDID, "Cinema ticket single", "Payment Option explanation", &config) + require.NoError(t, err) + type expected struct { + httpCode int + msg string + resp CreatePaymentRequestResponse + } + for _, tc := range []struct { + name string + issuerDID w3c.DID + auth func() (string, string) + body CreatePaymentRequestJSONRequestBody + expected expected + }{ + { + name: "no auth header", + auth: authWrong, + issuerDID: *issuerDID, + expected: expected{ + httpCode: http.StatusUnauthorized, + }, + }, + { + name: "Empty body", + auth: authOk, + issuerDID: *issuerDID, + body: CreatePaymentRequestJSONRequestBody{}, + expected: expected{ + httpCode: http.StatusBadRequest, + msg: "invalid userDID", + }, + }, + { + name: "Not existing payment option", + auth: authOk, + issuerDID: *issuerDID, + body: CreatePaymentRequestJSONRequestBody{ + UserDID: receiverDID.String(), + OptionID: uuid.New(), + SchemaID: schema.ID, + }, + expected: expected{ + httpCode: http.StatusBadRequest, + msg: "can't create payment-request: failed to get payment option: payment option not found", + }, + }, + { + name: "Not existing schema", + auth: authOk, + issuerDID: *issuerDID, + body: CreatePaymentRequestJSONRequestBody{ + UserDID: receiverDID.String(), + OptionID: paymentOptionID, + SchemaID: uuid.New(), + }, + expected: expected{ + httpCode: http.StatusBadRequest, + msg: "can't create payment-request: failed to get schema: schema not found", + }, + }, + { + name: "Happy Path", + auth: authOk, + issuerDID: *issuerDID, + body: CreatePaymentRequestJSONRequestBody{ + UserDID: receiverDID.String(), + OptionID: paymentOptionID, + SchemaID: schema.ID, + Description: "Payment Request", + }, + expected: expected{ + httpCode: http.StatusCreated, + resp: CreatePaymentRequestResponse{ + CreatedAt: time.Now(), + IssuerDID: issuerDID.String(), + PaymentOptionID: paymentOptionID, + Payments: []PaymentRequestInfo{ + { + Credentials: []protocol.PaymentRequestInfoCredentials{ + { + Type: "KYCCountryOfResidenceCredential", + Context: "https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json", + }, + }, + Description: "lala", + Data: protocol.PaymentRequestInfoData{}, + }, + }, + UserDID: receiverDID.String(), + }, + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + rr := httptest.NewRecorder() + payload, err := json.Marshal(tc.body) + require.NoError(t, err) + url := fmt.Sprintf("/v2/identities/%s/payment-request", tc.issuerDID.String()) + req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(payload)) + assert.NoError(t, err) + req.SetBasicAuth(tc.auth()) + + handler.ServeHTTP(rr, req) + require.Equal(t, tc.expected.httpCode, rr.Code) + + switch tc.expected.httpCode { + case http.StatusCreated: + var response CreatePaymentRequest201JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.NotEqual(t, uuid.Nil, response.Id) + assert.Equal(t, tc.expected.resp.IssuerDID, response.IssuerDID) + assert.Equal(t, tc.expected.resp.UserDID, response.UserDID) + assert.InDelta(t, time.Now().UnixMilli(), response.CreatedAt.UnixMilli(), 100) + /* + assert.Equal(t, len(tc.expected.resp.Payments), len(response.Payments)) + for i := range tc.expected.resp.Payments { + assert.NotEqual(t, big.Int{}, response.Payments[i].Nonce) + assert.NotEqual(t, uuid.Nil, response.Payments[i].PaymentRequestID) + assert.NotEqual(t, uuid.Nil, response.Payments[i].Id) + // TODO: Fix it assert.Equal(t, tc.expected.resp.Payments[i].Payment, response.Payments[i].Payment) + } + + */ + case http.StatusBadRequest: + var response CreatePaymentRequest400JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.expected.msg, response.Message) + case http.StatusInternalServerError: + var response CreatePaymentRequest500JSONResponse + require.NoError(t, json.Unmarshal(rr.Body.Bytes(), &response)) + assert.Equal(t, tc.expected.msg, response.Message) + } + }) + } +} diff --git a/internal/api/responses.go b/internal/api/responses.go index 4be127ff3..c5dcb63de 100644 --- a/internal/api/responses.go +++ b/internal/api/responses.go @@ -1,13 +1,17 @@ package api import ( + "encoding/json" + "fmt" "net/http" "github.com/iden3/go-schema-processor/v2/verifiable" + "github.com/iden3/iden3comm/v2/protocol" "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/pagination" + "github.com/polygonid/sh-id-platform/internal/core/ports" "github.com/polygonid/sh-id-platform/internal/schema" "github.com/polygonid/sh-id-platform/internal/timeapi" ) @@ -135,6 +139,7 @@ func schemaResponse(s *domain.Schema) Schema { return Schema{ Id: s.ID.String(), Type: s.Type, + ContextURL: s.ContextURL, Url: s.URL, BigInt: s.Hash.BigInt().String(), Hash: string(hash), @@ -280,3 +285,96 @@ func getTransactionStatus(status domain.IdentityStatus) StateTransactionStatus { return "failed" } } + +func toGetPaymentOptionsResponse(opts []domain.PaymentOption) (PaymentOptions, error) { + var err error + res := make([]PaymentOption, len(opts)) + for i, opt := range opts { + res[i], err = toPaymentOption(&opt) + if err != nil { + return PaymentOptions{}, err + } + } + return res, nil +} + +func toPaymentOption(opt *domain.PaymentOption) (PaymentOption, error) { + var config map[string]interface{} + raw, err := json.Marshal(opt.Config) + if err != nil { + return PaymentOption{}, err + } + if err := json.Unmarshal(raw, &config); err != nil { + return PaymentOption{}, err + } + return PaymentOption{ + Id: opt.ID, + IssuerDID: opt.IssuerDID.String(), + Name: opt.Name, + Description: opt.Description, + Config: toPaymentOptionConfig(opt.Config), + CreatedAt: TimeUTC(opt.CreatedAt), + ModifiedAt: TimeUTC(opt.UpdatedAt), + }, nil +} + +func toPaymentOptionConfig(config domain.PaymentOptionConfig) PaymentOptionConfig { + cfg := make([]PaymentOptionConfigItem, len(config.Config)) + for i, item := range config.Config { + cfg[i] = PaymentOptionConfigItem{ + PaymentOptionID: int(item.PaymentOptionID), + Amount: item.Amount.String(), + Recipient: item.Recipient.String(), + SigningKeyID: item.SigningKeyID, + } + } + return cfg +} + +func toCreatePaymentRequestResponse(payReq *domain.PaymentRequest) CreatePaymentRequestResponse { + creds := make([]struct { + Context string `json:"context"` + Type string `json:"type"` + }, len(payReq.Credentials)) + for i, cred := range payReq.Credentials { + creds[i] = struct { + Context string `json:"context"` + Type string `json:"type"` + }{ + Context: cred.Context, + Type: cred.Type, + } + } + payment := PaymentRequestInfo{ + Credentials: payReq.Credentials, + Description: payReq.Description, + } + payment.Data = make([]protocol.PaymentRequestInfoDataItem, len(payReq.Payments)) + for i, pay := range payReq.Payments { + payment.Data[i] = pay.Payment + } + resp := CreatePaymentRequestResponse{ + CreatedAt: payReq.CreatedAt, + Id: payReq.ID, + IssuerDID: payReq.IssuerDID.String(), + UserDID: payReq.RecipientDID.String(), + PaymentOptionID: payReq.PaymentOptionID, + Payments: []PaymentRequestInfo{payment}, + } + return resp +} + +func toVerifyPaymentResponse(status ports.BlockchainPaymentStatus) (VerifyPaymentResponseObject, error) { + switch status { + case ports.BlockchainPaymentStatusPending: + return VerifyPayment200JSONResponse{Status: PaymentStatusStatusPending}, nil + case ports.BlockchainPaymentStatusSuccess: + return VerifyPayment200JSONResponse{Status: PaymentStatusStatusSuccess}, nil + case ports.BlockchainPaymentStatusCancelled: + return VerifyPayment200JSONResponse{Status: PaymentStatusStatusCanceled}, nil + case ports.BlockchainPaymentStatusFailed: + return VerifyPayment200JSONResponse{Status: PaymentStatusStatusFailed}, nil + default: + return VerifyPayment400JSONResponse{N400JSONResponse{Message: fmt.Sprintf("unknown blockchain payment status <%d>", status)}}, nil + } +} diff --git a/internal/api/schemas.go b/internal/api/schemas.go index 45dc71964..80a925673 100644 --- a/internal/api/schemas.go +++ b/internal/api/schemas.go @@ -43,13 +43,15 @@ func (s *Server) GetSchema(ctx context.Context, request GetSchemaRequestObject) return GetSchema400JSONResponse{N400JSONResponse{Message: "invalid issuer did"}}, nil } schema, err := s.schemaService.GetByID(ctx, *issuerDID, request.Id) - if errors.Is(err, services.ErrSchemaNotFound) { - log.Error(ctx, "schema not found", "id", request.Id) - return GetSchema404JSONResponse{N404JSONResponse{Message: "schema not found"}}, nil - } if err != nil { + if errors.Is(err, services.ErrSchemaNotFound) { + log.Error(ctx, "schema not found", "id", request.Id) + return GetSchema404JSONResponse{N404JSONResponse{Message: "schema not found"}}, nil + } log.Error(ctx, "loading schema", "err", err, "id", request.Id) + return GetSchema500JSONResponse{N500JSONResponse{Message: err.Error()}}, nil } + return GetSchema200JSONResponse(schemaResponse(schema)), nil } diff --git a/internal/api/schemas_test.go b/internal/api/schemas_test.go index 0261384ca..89726cc75 100644 --- a/internal/api/schemas_test.go +++ b/internal/api/schemas_test.go @@ -33,7 +33,7 @@ func TestServer_GetSchema(t *testing.T) { s := &domain.Schema{ ID: uuid.New(), IssuerDID: *issuerDID, - URL: "https://domain.org/this/is/an/url", + URL: "http://localhost:8080/json/exampleMultidepth.json", Type: "schemaType", Words: domain.SchemaWordsFromString("attr1, attr2, attr3"), CreatedAt: time.Now(), @@ -88,12 +88,13 @@ func TestServer_GetSchema(t *testing.T) { expected: expected{ httpCode: http.StatusOK, schema: &Schema{ - BigInt: s.Hash.BigInt().String(), - CreatedAt: TimeUTC(s.CreatedAt), - Hash: string(sHash), - Id: s.ID.String(), - Type: s.Type, - Url: s.URL, + BigInt: s.Hash.BigInt().String(), + CreatedAt: TimeUTC(s.CreatedAt), + ContextURL: "http://localhost:8080/json-ld/exampleMultidepth.jsonld", + Hash: string(sHash), + Id: s.ID.String(), + Type: s.Type, + Url: s.URL, }, }, }, @@ -114,6 +115,7 @@ func TestServer_GetSchema(t *testing.T) { assert.Equal(t, tc.expected.schema.Id, response.Id) assert.Equal(t, tc.expected.schema.BigInt, response.BigInt) assert.Equal(t, tc.expected.schema.Type, response.Type) + assert.Equal(t, tc.expected.schema.ContextURL, response.ContextURL) assert.Equal(t, tc.expected.schema.Url, response.Url) assert.Equal(t, tc.expected.schema.Hash, response.Hash) assert.InDelta(t, time.Time(tc.expected.schema.CreatedAt).UnixMilli(), time.Time(response.CreatedAt).UnixMilli(), 1000) diff --git a/internal/api/server.go b/internal/api/server.go index bd4617399..ebc41877c 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -29,12 +29,13 @@ type Server struct { publisherGateway ports.Publisher qrService ports.QrStoreService schemaService ports.SchemaService + paymentService ports.PaymentService displayMethodService ports.DisplayMethodService keyService ports.KeyService } // NewServer is a Server constructor -func NewServer(cfg *config.Configuration, identityService ports.IdentityService, accountService ports.AccountService, connectionsService ports.ConnectionService, claimsService ports.ClaimService, qrService ports.QrStoreService, publisherGateway ports.Publisher, packageManager *iden3comm.PackageManager, networkResolver network.Resolver, health *health.Status, schemaService ports.SchemaService, linkService ports.LinkService, displayMethodService ports.DisplayMethodService, keyService ports.KeyService) *Server { +func NewServer(cfg *config.Configuration, identityService ports.IdentityService, accountService ports.AccountService, connectionsService ports.ConnectionService, claimsService ports.ClaimService, qrService ports.QrStoreService, publisherGateway ports.Publisher, packageManager *iden3comm.PackageManager, networkResolver network.Resolver, health *health.Status, schemaService ports.SchemaService, linkService ports.LinkService, displayMethodService ports.DisplayMethodService, keyService ports.KeyService, paymentService ports.PaymentService) *Server { return &Server{ cfg: cfg, accountService: accountService, @@ -50,6 +51,7 @@ func NewServer(cfg *config.Configuration, identityService ports.IdentityService, schemaService: schemaService, displayMethodService: displayMethodService, keyService: keyService, + paymentService: paymentService, } } diff --git a/internal/config/config.go b/internal/config/config.go index 86174c16e..a12bea0e7 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -64,6 +64,13 @@ type Configuration struct { MediaTypeManager MediaTypeManager UniversalLinks UniversalLinks UniversalDIDResolver UniversalDIDResolver + Payments Payments +} + +// Payments configurations +type Payments struct { + SettingsPath string `env:"ISSUER_PAYMENTS_SETTINGS_PATH"` + SettingsFile *string `env:"ISSUER_PAYMENTS_SETTINGS_FILE"` } // Database has the database configuration @@ -258,6 +265,8 @@ func lookupVaultTokenFromFile(pathVaultConfig string) (string, error) { // nolint:gocyclo,gocognit func checkEnvVars(ctx context.Context, cfg *Configuration) error { + const defResolverPath = "./resolvers_settings.yaml" + const defPaymentPath = "./payment_settings.yaml" if cfg.IPFS.GatewayURL == "" { log.Warn(ctx, "ISSUER_IPFS_GATEWAY_URL value is missing, using default value: "+ipfsGateway) cfg.IPFS.GatewayURL = ipfsGateway @@ -321,15 +330,19 @@ func checkEnvVars(ctx context.Context, cfg *Configuration) error { if cfg.NetworkResolverPath == "" { log.Info(ctx, "ISSUER_RESOLVER_PATH value is missing. Trying to use ISSUER_RESOLVER_FILE") if cfg.NetworkResolverFile == nil || *cfg.NetworkResolverFile == "" { - log.Info(ctx, "ISSUER_RESOLVER_FILE value is missing") - } else { - log.Info(ctx, "ISSUER_RESOLVER_FILE value is present") + log.Info(ctx, "ISSUER_RESOLVER_PATH and ISSUER_RESOLVER_FILE value is missing. Using default value", "path", "/resolvers_settings.yaml") + cfg.NetworkResolverPath = defResolverPath } + log.Info(ctx, "ISSUER_RESOLVER_FILE value is present") } - if cfg.NetworkResolverPath == "" && (cfg.NetworkResolverFile == nil || *cfg.NetworkResolverFile == "") { - log.Info(ctx, "ISSUER_RESOLVER_PATH and ISSUER_RESOLVER_FILE value is missing. Using default value: ./resolvers_settings.yaml") - cfg.NetworkResolverPath = "./resolvers_settings.yaml" + if cfg.Payments.SettingsPath == "" { + log.Info(ctx, "ISSUER_PAYMENTS_SETTINGS_PATH value is missing. Trying to use ISSUER_PAYMENTS_SETTINGS_FILE") + if cfg.Payments.SettingsFile == nil || *cfg.Payments.SettingsFile == "" { + log.Info(ctx, "ISSUER_PAYMENTS_SETTINGS_FILE value is missing. Using default value:", "path", defPaymentPath) + cfg.Payments.SettingsPath = defPaymentPath + } + log.Info(ctx, "ISSUER_PAYMENTS_SETTINGS_FILE value is present") } if cfg.KeyStore.BJJProvider == "" { diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 09e9b3825..6737563a8 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -141,6 +141,7 @@ func TestLoad(t *testing.T) { assert.Equal(t, "123HHUBUuO5", cfg.KeyStore.AWSSecretKey) assert.Equal(t, "eu-west-1", cfg.KeyStore.AWSRegion) assert.Equal(t, "./resolvers_settings.yaml", cfg.NetworkResolverPath) + assert.Equal(t, "./payment_settings.yaml", cfg.Payments.SettingsPath) assert.Equal(t, "hvs.NK8jrOU4XNY", cfg.KeyStore.Token) assert.Equal(t, "123", *cfg.NetworkResolverFile) assert.Equal(t, "./pkg/credentials/circuits", cfg.Circuit.Path) diff --git a/internal/core/domain/payment.go b/internal/core/domain/payment.go new file mode 100644 index 000000000..8021fccb1 --- /dev/null +++ b/internal/core/domain/payment.go @@ -0,0 +1,82 @@ +package domain + +import ( + "math/big" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/google/uuid" + "github.com/iden3/go-iden3-core/v2/w3c" + "github.com/iden3/iden3comm/v2/protocol" + + "github.com/polygonid/sh-id-platform/internal/payments" +) + +// PaymentRequest represents a payment request +type PaymentRequest struct { + ID uuid.UUID + Credentials []protocol.PaymentRequestInfoCredentials + Description string + IssuerDID w3c.DID + RecipientDID w3c.DID + PaymentOptionID uuid.UUID + Payments []PaymentRequestItem + CreatedAt time.Time +} + +// PaymentRequestItem represents a payment request item +type PaymentRequestItem struct { + ID uuid.UUID + Nonce big.Int + PaymentRequestID uuid.UUID + PaymentOptionID payments.OptionConfigIDType // The numeric id that identify a payment option in payments config file. + SigningKeyID string + Payment protocol.PaymentRequestInfoDataItem +} + +// PaymentOption represents a payment option +type PaymentOption struct { + ID uuid.UUID + IssuerDID w3c.DID + Name string + Description string + Config PaymentOptionConfig + CreatedAt time.Time + UpdatedAt time.Time +} + +// NewPaymentOption creates a new PaymentOption +func NewPaymentOption(issuerDID w3c.DID, name string, description string, config *PaymentOptionConfig) *PaymentOption { + return &PaymentOption{ + ID: uuid.New(), + IssuerDID: issuerDID, + Name: name, + Description: description, + Config: *config, + CreatedAt: time.Now(), + UpdatedAt: time.Now(), + } +} + +// PaymentOptionConfig represents the configuration of a payment option +type PaymentOptionConfig struct { + Config []PaymentOptionConfigItem `json:"Config"` +} + +// GetByID runs over all items in configuration and returns one with matching ID +func (c *PaymentOptionConfig) GetByID(paymentOptionID payments.OptionConfigIDType) *PaymentOptionConfigItem { + for _, item := range c.Config { + if item.PaymentOptionID == paymentOptionID { + return &item + } + } + return nil +} + +// PaymentOptionConfigItem is an item in Payment option config +type PaymentOptionConfigItem struct { + PaymentOptionID payments.OptionConfigIDType `json:"paymentOptionId"` + Amount big.Int `json:"amount"` + Recipient common.Address `json:"Recipient"` + SigningKeyID string `json:"SigningKeyID"` +} diff --git a/internal/core/domain/schema.go b/internal/core/domain/schema.go index 43978042a..024cc8dff 100644 --- a/internal/core/domain/schema.go +++ b/internal/core/domain/schema.go @@ -23,14 +23,6 @@ const ( // SchemaFormat type type SchemaFormat string -const ( - // JSONLD JSON-LD schema format - JSONLD SchemaFormat = "json-ld" - - // JSON JSON schema format - JSON SchemaFormat = "json" -) - // SchemaWords is a collection of schema attributes type SchemaWords []string @@ -61,6 +53,7 @@ type Schema struct { IssuerDID w3c.DID URL string Type string + ContextURL string Title *string Description *string Version string diff --git a/internal/core/ports/payment_service.go b/internal/core/ports/payment_service.go new file mode 100644 index 000000000..013995f58 --- /dev/null +++ b/internal/core/ports/payment_service.go @@ -0,0 +1,51 @@ +package ports + +import ( + "context" + "math/big" + + "github.com/google/uuid" + "github.com/iden3/go-iden3-core/v2/w3c" + comm "github.com/iden3/iden3comm/v2" + "github.com/iden3/iden3comm/v2/protocol" + + "github.com/polygonid/sh-id-platform/internal/core/domain" + "github.com/polygonid/sh-id-platform/internal/payments" +) + +// BlockchainPaymentStatus represents the status of a payment +type BlockchainPaymentStatus int + +const ( + // BlockchainPaymentStatusPending - Payment is still pending + BlockchainPaymentStatusPending BlockchainPaymentStatus = iota + // BlockchainPaymentStatusCancelled - Payment was cancelled + BlockchainPaymentStatusCancelled + // BlockchainPaymentStatusSuccess - Payment was successful + BlockchainPaymentStatusSuccess + // BlockchainPaymentStatusFailed - Payment has failed + BlockchainPaymentStatusFailed + // BlockchainPaymentStatusUnknown - Payment status is unknown. Something went wrong + BlockchainPaymentStatusUnknown +) + +// CreatePaymentRequestReq is the request for PaymentService.CreatePaymentRequest +type CreatePaymentRequestReq struct { + IssuerDID w3c.DID + UserDID w3c.DID + OptionID uuid.UUID + SchemaID uuid.UUID + Description string +} + +// PaymentService is the interface implemented by the payment service +type PaymentService interface { + CreatePaymentRequest(ctx context.Context, req *CreatePaymentRequestReq) (*domain.PaymentRequest, error) + CreatePaymentRequestForProposalRequest(ctx context.Context, proposalRequest *protocol.CredentialsProposalRequestMessage) (*comm.BasicMessage, error) + GetSettings() payments.Config + VerifyPayment(ctx context.Context, issuerDID w3c.DID, nonce *big.Int, txHash string) (BlockchainPaymentStatus, error) + CreatePaymentOption(ctx context.Context, issuerDID *w3c.DID, name, description string, config *domain.PaymentOptionConfig) (uuid.UUID, error) + GetPaymentOptions(ctx context.Context, issuerDID *w3c.DID) ([]domain.PaymentOption, error) + GetPaymentOptionByID(ctx context.Context, issuerDID *w3c.DID, id uuid.UUID) (*domain.PaymentOption, error) + DeletePaymentOption(ctx context.Context, issuerDID *w3c.DID, id uuid.UUID) error +} diff --git a/internal/core/ports/payments_repository.go b/internal/core/ports/payments_repository.go new file mode 100644 index 000000000..1986de6a7 --- /dev/null +++ b/internal/core/ports/payments_repository.go @@ -0,0 +1,24 @@ +package ports + +import ( + "context" + "math/big" + + "github.com/google/uuid" + "github.com/iden3/go-iden3-core/v2/w3c" + + "github.com/polygonid/sh-id-platform/internal/core/domain" +) + +// PaymentRepository is the interface that defines the available methods for the Payment repository +type PaymentRepository interface { + SavePaymentOption(ctx context.Context, opt *domain.PaymentOption) (uuid.UUID, error) + GetAllPaymentOptions(ctx context.Context, issuerDID w3c.DID) ([]domain.PaymentOption, error) + GetPaymentOptionByID(ctx context.Context, issuerDID *w3c.DID, id uuid.UUID) (*domain.PaymentOption, error) + DeletePaymentOption(ctx context.Context, issuerDID w3c.DID, id uuid.UUID) error + + SavePaymentRequest(ctx context.Context, req *domain.PaymentRequest) (uuid.UUID, error) + GetPaymentRequestByID(ctx context.Context, issuerDID w3c.DID, id uuid.UUID) (*domain.PaymentRequest, error) + GetAllPaymentRequests(ctx context.Context, issuerDID w3c.DID) ([]domain.PaymentRequest, error) + GetPaymentRequestItem(ctx context.Context, issuerDID w3c.DID, nonce *big.Int) (*domain.PaymentRequestItem, error) +} diff --git a/internal/core/ports/schema_repository.go b/internal/core/ports/schema_repository.go index b1cbdcb48..3e74e0ddf 100644 --- a/internal/core/ports/schema_repository.go +++ b/internal/core/ports/schema_repository.go @@ -14,4 +14,5 @@ type SchemaRepository interface { Save(ctx context.Context, schema *domain.Schema) error GetByID(ctx context.Context, issuerDID w3c.DID, id uuid.UUID) (*domain.Schema, error) GetAll(ctx context.Context, issuerDID w3c.DID, query *string) ([]domain.Schema, error) + Update(ctx context.Context, s *domain.Schema) error } diff --git a/internal/core/services/identity.go b/internal/core/services/identity.go index 231daec0e..ba880aeee 100644 --- a/internal/core/services/identity.go +++ b/internal/core/services/identity.go @@ -1356,7 +1356,7 @@ func sanitizeIssuerDoc(issDoc []byte) []byte { return []byte(str) } -// ethPubKey returns the public key from the key manager service. +// EthPubKey returns the ethereum public key from the key manager service. // the public key is either uncompressed or compressed, so we need to handle both cases. func ethPubKey(ctx context.Context, keyMS kms.KMSType, keyID kms.KeyID) (*ecdsa.PublicKey, error) { const ( @@ -1365,6 +1365,10 @@ func ethPubKey(ctx context.Context, keyMS kms.KMSType, keyID kms.KeyID) (*ecdsa. defaultKeyLength = 33 ) + if keyID.Type != kms.KeyTypeEthereum { + return nil, errors.New("key type is not ethereum") + } + keyBytes, err := keyMS.PublicKey(keyID) if err != nil { log.Error(ctx, "can't get bytes from public key", "err", err) diff --git a/internal/core/services/payment.go b/internal/core/services/payment.go new file mode 100644 index 000000000..5c1c85e86 --- /dev/null +++ b/internal/core/services/payment.go @@ -0,0 +1,485 @@ +package services + +import ( + "context" + "crypto/ecdsa" + "crypto/rand" + "encoding/hex" + "fmt" + "math/big" + "strconv" + "time" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/math" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/signer/core/apitypes" + "github.com/google/uuid" + core "github.com/iden3/go-iden3-core/v2" + "github.com/iden3/go-iden3-core/v2/w3c" + comm "github.com/iden3/iden3comm/v2" + "github.com/iden3/iden3comm/v2/protocol" + + "github.com/polygonid/sh-id-platform/internal/core/domain" + "github.com/polygonid/sh-id-platform/internal/core/ports" + "github.com/polygonid/sh-id-platform/internal/eth" + "github.com/polygonid/sh-id-platform/internal/kms" + "github.com/polygonid/sh-id-platform/internal/log" + "github.com/polygonid/sh-id-platform/internal/network" + "github.com/polygonid/sh-id-platform/internal/payments" +) + +type payment struct { + networkResolver network.Resolver + settings payments.Config + schemaService ports.SchemaService + paymentsStore ports.PaymentRepository + kms kms.KMSType +} + +// NewPaymentService creates a new payment service +func NewPaymentService(payOptsRepo ports.PaymentRepository, resolver network.Resolver, schemaSrv ports.SchemaService, settings *payments.Config, kms kms.KMSType) ports.PaymentService { + return &payment{ + networkResolver: resolver, + settings: *settings, + schemaService: schemaSrv, + paymentsStore: payOptsRepo, + kms: kms, + } +} + +// CreatePaymentOption creates a payment option for a specific issuer +func (p *payment) CreatePaymentOption(ctx context.Context, issuerDID *w3c.DID, name, description string, config *domain.PaymentOptionConfig) (uuid.UUID, error) { + paymentOption := domain.NewPaymentOption(*issuerDID, name, description, config) + id, err := p.paymentsStore.SavePaymentOption(ctx, paymentOption) + if err != nil { + log.Error(ctx, "failed to save payment option", "err", err, "issuerDID", issuerDID, "name", name, "description", description, "config", config) + return uuid.Nil, err + } + return id, nil +} + +// GetPaymentOptions returns all payment options of a issuer +func (p *payment) GetPaymentOptions(ctx context.Context, issuerDID *w3c.DID) ([]domain.PaymentOption, error) { + opts, err := p.paymentsStore.GetAllPaymentOptions(ctx, *issuerDID) + if err != nil { + log.Error(ctx, "failed to get payment options", "err", err, "issuerDID", issuerDID) + return nil, err + } + return opts, nil +} + +// GetPaymentOptionByID returns a payment option by its ID +func (p *payment) GetPaymentOptionByID(ctx context.Context, issuerDID *w3c.DID, id uuid.UUID) (*domain.PaymentOption, error) { + opt, err := p.paymentsStore.GetPaymentOptionByID(ctx, issuerDID, id) + if err != nil { + log.Error(ctx, "failed to get payment option", "err", err, "issuerDID", issuerDID, "id", id) + return nil, err + } + return opt, nil +} + +// DeletePaymentOption deletes a payment option +func (p *payment) DeletePaymentOption(ctx context.Context, issuerDID *w3c.DID, id uuid.UUID) error { + err := p.paymentsStore.DeletePaymentOption(ctx, *issuerDID, id) + if err != nil { + log.Error(ctx, "failed to delete payment option", "err", err, "issuerDID", issuerDID, "id", id) + return err + } + return nil +} + +// CreatePaymentRequest creates a payment request +func (p *payment) CreatePaymentRequest(ctx context.Context, req *ports.CreatePaymentRequestReq) (*domain.PaymentRequest, error) { + option, err := p.paymentsStore.GetPaymentOptionByID(ctx, &req.IssuerDID, req.OptionID) + if err != nil { + log.Error(ctx, "failed to get payment option", "err", err, "issuerDID", req.IssuerDID, "optionID", req.OptionID) + return nil, fmt.Errorf("failed to get payment option: %w", err) + } + schema, err := p.schemaService.GetByID(ctx, req.IssuerDID, req.SchemaID) + if err != nil { + log.Error(ctx, "failed to get schema", "err", err, "issuerDID", req.IssuerDID, "schemaID", req.SchemaID) + return nil, fmt.Errorf("failed to get schema: %w", err) + } + + paymentRequest := &domain.PaymentRequest{ + ID: uuid.New(), + IssuerDID: req.IssuerDID, + RecipientDID: req.UserDID, + Credentials: []protocol.PaymentRequestInfoCredentials{ + { + Context: schema.ContextURL, + Type: schema.Type, + }, + }, + Description: req.Description, + PaymentOptionID: req.OptionID, + CreatedAt: time.Now(), + } + for _, chainConfig := range option.Config.Config { + setting, found := p.settings[chainConfig.PaymentOptionID] + if !found { + log.Error(ctx, "chain not found in configuration", "paymentOptionID", chainConfig.PaymentOptionID) + return nil, fmt.Errorf("payment Option <%d> not found in payment configuration", chainConfig.PaymentOptionID) + } + + nonce, err := rand.Int(rand.Reader, big.NewInt(0).Exp(big.NewInt(2), big.NewInt(130), nil)) //nolint: mnd + if err != nil { + log.Error(ctx, "failed to generate nonce", "err", err) + return nil, err + } + + data, err := p.paymentInfo(ctx, setting, &chainConfig, nonce) + if err != nil { + log.Error(ctx, "failed to create payment info", "err", err) + return nil, err + } + item := domain.PaymentRequestItem{ + ID: uuid.New(), + Nonce: *nonce, + PaymentRequestID: paymentRequest.ID, + PaymentOptionID: chainConfig.PaymentOptionID, + SigningKeyID: chainConfig.SigningKeyID, + Payment: data, + } + paymentRequest.Payments = append(paymentRequest.Payments, item) + } + + _, err = p.paymentsStore.SavePaymentRequest(ctx, paymentRequest) + if err != nil { + log.Error(ctx, "failed to save payment request", "err", err, "paymentRequest", paymentRequest) + return nil, fmt.Errorf("failed to save payment request: %w", err) + } + + return paymentRequest, nil +} + +// CreatePaymentRequestForProposalRequest creates a payment request for a proposal request +func (p *payment) CreatePaymentRequestForProposalRequest(_ context.Context, proposalRequest *protocol.CredentialsProposalRequestMessage) (*comm.BasicMessage, error) { + basicMessage := comm.BasicMessage{ + From: proposalRequest.To, + To: proposalRequest.From, + ThreadID: proposalRequest.ThreadID, + ID: proposalRequest.ID, + Typ: proposalRequest.Typ, + } + return &basicMessage, nil +} + +// GetSettings returns the current payment settings +func (p *payment) GetSettings() payments.Config { + return p.settings +} + +// VerifyPayment verifies a payment +func (p *payment) VerifyPayment(ctx context.Context, issuerDID w3c.DID, nonce *big.Int, txHash string) (ports.BlockchainPaymentStatus, error) { + paymentReqItem, err := p.paymentsStore.GetPaymentRequestItem(ctx, issuerDID, nonce) + if err != nil { + return ports.BlockchainPaymentStatusPending, fmt.Errorf("failed to get payment request: %w", err) + } + + setting, found := p.settings[paymentReqItem.PaymentOptionID] + if !found { + log.Error(ctx, "chain not found in configuration", "paymentOptionID", paymentReqItem.PaymentOptionID) + return ports.BlockchainPaymentStatusPending, fmt.Errorf("payment Option <%d> not found in payment configuration", paymentReqItem.PaymentOptionID) + } + + payOptConfItem, err := p.paymentOptionConfigItem(ctx, issuerDID, paymentReqItem) + if err != nil { + log.Error(ctx, "failed to get payment option config", "err", err) + return ports.BlockchainPaymentStatusPending, fmt.Errorf("failed to get payment option config: %w", err) + } + + client, err := p.networkResolver.GetEthClientByChainID(core.ChainID(setting.ChainID)) + if err != nil { + log.Error(ctx, "failed to get ethereum client from resolvers", "err", err, "key", paymentReqItem.SigningKeyID) + return ports.BlockchainPaymentStatusPending, fmt.Errorf("failed to get ethereum client from resolvers settings for key <%s>", paymentReqItem.SigningKeyID) + } + + instance, err := eth.NewPaymentContract(setting.PaymentRails, client.GetEthereumClient()) + if err != nil { + return ports.BlockchainPaymentStatusPending, err + } + + status, err := p.verifyPaymentOnBlockchain(ctx, client, instance, payOptConfItem.Recipient, nonce, txHash) + if err != nil { + log.Error(ctx, "failed to verify payment on blockchain", "err", err, "txHash", txHash, "nonce", nonce) + return ports.BlockchainPaymentStatusPending, err + } + return status, nil +} + +func (p *payment) verifyPaymentOnBlockchain( + ctx context.Context, + client *eth.Client, + contract *eth.PaymentContract, + recipient common.Address, + nonce *big.Int, + txID string, +) (ports.BlockchainPaymentStatus, error) { + _, isPending, err := client.GetTransactionByID(ctx, txID) + if err != nil { + if err.Error() == "not found" { + return ports.BlockchainPaymentStatusCancelled, nil + } + return ports.BlockchainPaymentStatusUnknown, err + } + if isPending { + return ports.BlockchainPaymentStatusPending, nil + } + receipt, err := client.GetTransactionReceiptByID(ctx, txID) + if err != nil { + return ports.BlockchainPaymentStatusUnknown, err + } + if receipt.Status == 1 { + isPaid, err := contract.IsPaymentDone(&bind.CallOpts{Context: ctx}, recipient, nonce) + if err != nil { + return ports.BlockchainPaymentStatusPending, nil + } + if isPaid { + return ports.BlockchainPaymentStatusSuccess, nil + } + return ports.BlockchainPaymentStatusPending, nil + } + return ports.BlockchainPaymentStatusFailed, nil +} + +// paymentOptionConfigItem finds the payment option config item used to pay using the payment id stored in PaymentRequest database +func (p *payment) paymentOptionConfigItem(ctx context.Context, issuerDID w3c.DID, item *domain.PaymentRequestItem) (*domain.PaymentOptionConfigItem, error) { + paymentReq, err := p.paymentsStore.GetPaymentRequestByID(ctx, issuerDID, item.PaymentRequestID) + if err != nil { + return nil, fmt.Errorf("failed to get payment request: %w", err) + } + + option, err := p.paymentsStore.GetPaymentOptionByID(ctx, &issuerDID, paymentReq.PaymentOptionID) + if err != nil { + return nil, fmt.Errorf("failed to get payment option: %w", err) + } + + configItem := option.Config.GetByID(item.PaymentOptionID) + if configItem == nil { + return nil, fmt.Errorf("payment option config item for id <%d> not found", item.PaymentOptionID) + } + return configItem, nil +} + +func (p *payment) paymentInfo(ctx context.Context, setting payments.ChainConfig, chainConfig *domain.PaymentOptionConfigItem, nonce *big.Int) (protocol.PaymentRequestInfoDataItem, error) { + const defaultExpirationDate = 1 * time.Hour + expirationTime := time.Now().Add(defaultExpirationDate) + + metadata := "0x" + signature, err := p.paymentRequestSignature(ctx, setting, chainConfig, expirationTime, nonce, metadata) + if err != nil { + log.Error(ctx, "failed to create payment request signature", "err", err) + return nil, err + } + + signerAddress, err := p.getSignerAddress(ctx, chainConfig.SigningKeyID) + if err != nil { + log.Error(ctx, "failed to retrieve signer address", "err", err) + return nil, err + } + switch setting.PaymentOption.Type { + case protocol.Iden3PaymentRailsRequestV1Type: + return &protocol.Iden3PaymentRailsRequestV1{ + Nonce: nonce.String(), + Type: protocol.Iden3PaymentRailsRequestV1Type, + Context: protocol.NewPaymentContextString( + "https://schema.iden3.io/core/jsonld/payment.jsonld#Iden3PaymentRailsRequestV1", + "https://w3id.org/security/suites/eip712sig-2021/v1", + ), + Amount: chainConfig.Amount.String(), + ExpirationDate: fmt.Sprint(expirationTime.Format(time.RFC3339)), + Metadata: metadata, + Recipient: chainConfig.Recipient.String(), + Proof: paymentProof(&setting, signature, signerAddress), + }, nil + + case protocol.Iden3PaymentRailsERC20RequestV1Type: + return &protocol.Iden3PaymentRailsERC20RequestV1{ + Nonce: nonce.String(), + Type: protocol.Iden3PaymentRailsERC20RequestV1Type, + Context: protocol.NewPaymentContextString( + "https://schema.iden3.io/core/jsonld/payment.jsonld#Iden3PaymentRailsERC20RequestV1", + "https://w3id.org/security/suites/eip712sig-2021/v1", + ), + Amount: chainConfig.Amount.String(), + ExpirationDate: fmt.Sprint(expirationTime.Format(time.RFC3339)), + Metadata: metadata, + Recipient: chainConfig.Recipient.String(), + Features: setting.PaymentOption.Features, + TokenAddress: setting.PaymentOption.ContractAddress.String(), + Proof: paymentProof(&setting, signature, signerAddress), + }, nil + default: + return nil, fmt.Errorf("unsupported payment option type: %s", setting.PaymentOption.Type) + } +} + +func paymentProof(setting *payments.ChainConfig, signature []byte, signerAddress common.Address) protocol.PaymentProof { + var eip712DataTypes string + if setting.PaymentOption.Type == protocol.Iden3PaymentRailsRequestV1Type { + eip712DataTypes = "https://schema.iden3.io/core/json/Iden3PaymentRailsRequestV1.json" + } + if setting.PaymentOption.Type == protocol.Iden3PaymentRailsERC20RequestV1Type { + eip712DataTypes = "https://schema.iden3.io/core/json/Iden3PaymentRailsERC20RequestV1.json" + } + return protocol.PaymentProof{ + protocol.EthereumEip712Signature2021{ + Type: "EthereumEip712Signature2021", + ProofPurpose: "assertionMethod", + ProofValue: fmt.Sprintf("0x%s", hex.EncodeToString(signature)), + VerificationMethod: fmt.Sprintf("did:pkh:eip155:%d:%s", setting.ChainID, signerAddress), + Created: time.Now().Format(time.RFC3339), + Eip712: protocol.Eip712Data{ + Types: eip712DataTypes, + PrimaryType: string(setting.PaymentOption.Type), + Domain: protocol.Eip712Domain{ + Name: "MCPayment", + Version: "1.0.0", + ChainID: strconv.Itoa(setting.ChainID), + VerifyingContract: setting.PaymentRails.String(), + }, + }, + }, + } +} + +func (p *payment) paymentRequestSignature( + ctx context.Context, + setting payments.ChainConfig, + chainConfig *domain.PaymentOptionConfigItem, + expTime time.Time, + nonce *big.Int, + metadata string, +) ([]byte, error) { + paymentType := string(setting.PaymentOption.Type) + + keyID := kms.KeyID{ + Type: kms.KeyTypeEthereum, + ID: chainConfig.SigningKeyID, + } + + typedData := apitypes.TypedData{ + Types: apitypes.Types{ + "EIP712Domain": []apitypes.Type{ + {Name: "name", Type: "string"}, + {Name: "version", Type: "string"}, + {Name: "chainId", Type: "uint256"}, + {Name: "verifyingContract", Type: "address"}, + }, + paymentType: []apitypes.Type{ + { + Name: "recipient", + Type: "address", + }, + { + Name: "amount", + Type: "uint256", + }, + { + Name: "expirationDate", + Type: "uint256", + }, + { + Name: "nonce", + Type: "uint256", + }, + { + Name: "metadata", + Type: "bytes", + }, + }, + }, + PrimaryType: paymentType, + Domain: apitypes.TypedDataDomain{ + Name: "MCPayment", + Version: "1.0.0", + ChainId: math.NewHexOrDecimal256(int64(setting.ChainID)), + VerifyingContract: setting.PaymentRails.String(), + }, + Message: apitypes.TypedDataMessage{ + "recipient": chainConfig.Recipient.String(), + "amount": chainConfig.Amount.String(), + "expirationDate": big.NewInt(expTime.Unix()), + "nonce": nonce, + "metadata": metadata, + }, + } + if paymentType == string(protocol.Iden3PaymentRailsERC20RequestV1Type) { + typedData.Types[paymentType] = []apitypes.Type{ + { + Name: "tokenAddress", + Type: "address", + }, + { + Name: "recipient", + Type: "address", + }, + { + Name: "amount", + Type: "uint256", + }, + { + Name: "expirationDate", + Type: "uint256", + }, + { + Name: "nonce", + Type: "uint256", + }, + { + Name: "metadata", + Type: "bytes", + }, + } + typedData.Message["tokenAddress"] = setting.PaymentOption.ContractAddress.String() + } + typedDataBytes, _, err := apitypes.TypedDataAndHash(typedData) + if err != nil { + return nil, err + } + + signature, err := p.kms.Sign(ctx, keyID, typedDataBytes) + if err != nil { + log.Error(ctx, "failed to sign typed data hash", "err", err, "keyId", keyID) + return nil, err + } + + const recoveryIdOffset = 64 + if len(signature) > recoveryIdOffset { + if signature[recoveryIdOffset] <= 1 { + signature[recoveryIdOffset] += 27 + } + } + + return signature, nil +} + +func (p *payment) getSignerAddress(ctx context.Context, signingKeyID string) (common.Address, error) { + bytesPubKey, err := p.kms.PublicKey(kms.KeyID{ + Type: kms.KeyTypeEthereum, + ID: signingKeyID, + }) + if err != nil { + return common.Address{}, err + } + var pubKey *ecdsa.PublicKey + switch len(bytesPubKey) { + case eth.CompressedPublicKeyLength: + pubKey, err = crypto.DecompressPubkey(bytesPubKey) + case eth.AwsKmsPublicKeyLength: + pubKey, err = kms.DecodeAWSETHPubKey(ctx, bytesPubKey) + if err != nil { + return common.Address{}, err + } + default: + pubKey, err = crypto.UnmarshalPubkey(bytesPubKey) + } + if err != nil { + return common.Address{}, err + } + fromAddress := crypto.PubkeyToAddress(*pubKey) + return fromAddress, nil +} diff --git a/internal/core/services/schema.go b/internal/core/services/schema.go index c8bfef9ee..490c6ba7d 100644 --- a/internal/core/services/schema.go +++ b/internal/core/services/schema.go @@ -3,6 +3,7 @@ package services import ( "context" "errors" + "fmt" "time" "github.com/google/uuid" @@ -35,6 +36,35 @@ func (s *schema) GetByID(ctx context.Context, issuerDID w3c.DID, id uuid.UUID) ( if err != nil { return nil, err } + schemaID := schema.ID + schema, err = s.fixSchemaContext(ctx, schema) + if err != nil { + log.Error(ctx, "fixing schema context", "err", err, "schema", schemaID) + return nil, fmt.Errorf("fixing schema context: %w", err) + } + return schema, nil +} + +// fixSchemaContext updates the schema context url if it is empty. This will happen in old installations +// that did not have the context url stored in the database +// There is no action in DB if the context url is already stored +func (s *schema) fixSchemaContext(ctx context.Context, schema *domain.Schema) (*domain.Schema, error) { + if schema.ContextURL == "" { + remoteSchema, err := jsonschema.Load(ctx, schema.URL, s.loader) + if err != nil { + log.Error(ctx, "loading jsonschema", "err", err, "jsonschema", schema.URL) + return nil, ErrLoadingSchema + } + contextUrl, err := remoteSchema.JSONLdContext() + if err != nil { + log.Error(ctx, "getting jsonld context", "err", err, "jsonschema", schema.URL) + return nil, ErrProcessSchema + } + schema.ContextURL = contextUrl + if err := s.repo.Update(ctx, schema); err != nil { + return nil, fmt.Errorf("updating schema: %w", err) + } + } return schema, nil } @@ -61,12 +91,18 @@ func (s *schema) ImportSchema(ctx context.Context, did w3c.DID, req *ports.Impor log.Error(ctx, "hashing schema", "err", err, "jsonschema", req.URL) return nil, ErrProcessSchema } + contextUrl, err := remoteSchema.JSONLdContext() + if err != nil { + log.Error(ctx, "getting jsonld context", "err", err, "jsonschema", req.URL) + return nil, ErrProcessSchema + } schema := &domain.Schema{ ID: uuid.New(), IssuerDID: did, URL: req.URL, Type: req.SType, + ContextURL: contextUrl, Version: req.Version, Title: req.Title, Description: req.Description, diff --git a/internal/db/schema/migrations/202412171212000_add_context_field_to_schemas_table.sql b/internal/db/schema/migrations/202412171212000_add_context_field_to_schemas_table.sql new file mode 100644 index 000000000..1230841ae --- /dev/null +++ b/internal/db/schema/migrations/202412171212000_add_context_field_to_schemas_table.sql @@ -0,0 +1,9 @@ +-- +goose Up +-- +goose StatementBegin +ALTER TABLE schemas ADD COLUMN context_url text NOT NULL DEFAULT ''; +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +ALTER TABLE schemas DROP COLUMN context_url; +-- +goose StatementEnd \ No newline at end of file diff --git a/internal/db/schema/migrations/202412231508172_payment_options.sql b/internal/db/schema/migrations/202412231508172_payment_options.sql new file mode 100644 index 000000000..dce61453e --- /dev/null +++ b/internal/db/schema/migrations/202412231508172_payment_options.sql @@ -0,0 +1,50 @@ +-- +goose Up +-- +goose StatementBegin +CREATE TABLE payment_options +( + id UUID PRIMARY KEY NOT NULL, + issuer_did text NOT NULL REFERENCES identities (identifier), + name text NOT NULL, + description text NOT NULL, + configuration jsonb NOT NULL, + created_at timestamptz NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamptz NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE INDEX payment_options_id_issuer_did_index ON payment_options (id, issuer_did); +CREATE INDEX payment_options_issuer_did_created_at_index ON payment_options (issuer_did, created_at); +CREATE INDEX payment_options_issuer_did ON payment_options (issuer_did); + +CREATE TABLE payment_requests +( + id UUID PRIMARY KEY NOT NULL, + credentials jsonb NOT NULL, /* []protocol.PaymentRequestCredentials */ + description text NOT NULL, + issuer_did text NOT NULL REFERENCES identities (identifier), + recipient_did text NOT NULL, + payment_option_id UUID REFERENCES payment_options (id), + created_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP +); +CREATE INDEX payment_requests_from_nonce_created_at_idx ON payment_requests (issuer_did, created_at); + +CREATE TABLE payment_request_items +( + id UUID PRIMARY KEY NOT NULL, + nonce numeric NOT NULL, + payment_request_id UUID NOT NULL REFERENCES payment_requests (id), + payment_option_id int NOT NULL, + signing_key text NOT NULL, + payment_request_info jsonb NOT NULL /* protocol.PaymentRequestInfo */ +); + +CREATE UNIQUE INDEX payment_request_items_nonce_idx ON payment_request_items (nonce); + + +-- +goose StatementEnd + +-- +goose Down +-- +goose StatementBegin +DROP TABLE IF EXISTS payment_requests_items; +DROP TABLE IF EXISTS payment_requests; +DROP TABLE IF EXISTS payment_options; +-- +goose StatementEnd \ No newline at end of file diff --git a/internal/eth/PaymentContract.go b/internal/eth/PaymentContract.go new file mode 100644 index 000000000..8a7f925c4 --- /dev/null +++ b/internal/eth/PaymentContract.go @@ -0,0 +1,1543 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package eth + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// MCPaymentIden3PaymentRailsERC20RequestV1 is an auto generated low-level Go binding around an user-defined struct. +type MCPaymentIden3PaymentRailsERC20RequestV1 struct { + TokenAddress common.Address + Recipient common.Address + Amount *big.Int + ExpirationDate *big.Int + Nonce *big.Int + Metadata []byte +} + +// MCPaymentIden3PaymentRailsRequestV1 is an auto generated low-level Go binding around an user-defined struct. +type MCPaymentIden3PaymentRailsRequestV1 struct { + Recipient common.Address + Amount *big.Int + ExpirationDate *big.Int + Nonce *big.Int + Metadata []byte +} + +// PaymentContractMetaData contains all meta data concerning the PaymentContract contract. +var PaymentContractMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"InvalidOwnerPercentage\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"PaymentError\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"message\",\"type\":\"string\"}],\"name\":\"WithdrawError\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"Payment\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ERC_20_PAYMENT_DATA_TYPE_HASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PAYMENT_DATA_TYPE_HASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VERSION\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"getBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOwnerBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOwnerPercentage\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"ownerPercentage\",\"type\":\"uint8\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"name\":\"isPaymentDone\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"issuerWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ownerWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expirationDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"metadata\",\"type\":\"bytes\"}],\"internalType\":\"structMCPayment.Iden3PaymentRailsRequestV1\",\"name\":\"paymentData\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"pay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expirationDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"metadata\",\"type\":\"bytes\"}],\"internalType\":\"structMCPayment.Iden3PaymentRailsERC20RequestV1\",\"name\":\"paymentData\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"payERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"permitSignature\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expirationDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"metadata\",\"type\":\"bytes\"}],\"internalType\":\"structMCPayment.Iden3PaymentRailsERC20RequestV1\",\"name\":\"paymentData\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"payERC20Permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"ownerPercentage\",\"type\":\"uint8\"}],\"name\":\"updateOwnerPercentage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expirationDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"metadata\",\"type\":\"bytes\"}],\"internalType\":\"structMCPayment.Iden3PaymentRailsERC20RequestV1\",\"name\":\"paymentData\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"verifyIden3PaymentRailsERC20RequestV1Signature\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expirationDate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"metadata\",\"type\":\"bytes\"}],\"internalType\":\"structMCPayment.Iden3PaymentRailsRequestV1\",\"name\":\"paymentData\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"verifyIden3PaymentRailsRequestV1Signature\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"}]", +} + +// PaymentContractABI is the input ABI used to generate the binding from. +// Deprecated: Use PaymentContractMetaData.ABI instead. +var PaymentContractABI = PaymentContractMetaData.ABI + +// PaymentContract is an auto generated Go binding around an Ethereum contract. +type PaymentContract struct { + PaymentContractCaller // Read-only binding to the contract + PaymentContractTransactor // Write-only binding to the contract + PaymentContractFilterer // Log filterer for contract events +} + +// PaymentContractCaller is an auto generated read-only Go binding around an Ethereum contract. +type PaymentContractCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PaymentContractTransactor is an auto generated write-only Go binding around an Ethereum contract. +type PaymentContractTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PaymentContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type PaymentContractFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PaymentContractSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type PaymentContractSession struct { + Contract *PaymentContract // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// PaymentContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type PaymentContractCallerSession struct { + Contract *PaymentContractCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// PaymentContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type PaymentContractTransactorSession struct { + Contract *PaymentContractTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// PaymentContractRaw is an auto generated low-level Go binding around an Ethereum contract. +type PaymentContractRaw struct { + Contract *PaymentContract // Generic contract binding to access the raw methods on +} + +// PaymentContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type PaymentContractCallerRaw struct { + Contract *PaymentContractCaller // Generic read-only contract binding to access the raw methods on +} + +// PaymentContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type PaymentContractTransactorRaw struct { + Contract *PaymentContractTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewPaymentContract creates a new instance of PaymentContract, bound to a specific deployed contract. +func NewPaymentContract(address common.Address, backend bind.ContractBackend) (*PaymentContract, error) { + contract, err := bindPaymentContract(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &PaymentContract{PaymentContractCaller: PaymentContractCaller{contract: contract}, PaymentContractTransactor: PaymentContractTransactor{contract: contract}, PaymentContractFilterer: PaymentContractFilterer{contract: contract}}, nil +} + +// NewPaymentContractCaller creates a new read-only instance of PaymentContract, bound to a specific deployed contract. +func NewPaymentContractCaller(address common.Address, caller bind.ContractCaller) (*PaymentContractCaller, error) { + contract, err := bindPaymentContract(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &PaymentContractCaller{contract: contract}, nil +} + +// NewPaymentContractTransactor creates a new write-only instance of PaymentContract, bound to a specific deployed contract. +func NewPaymentContractTransactor(address common.Address, transactor bind.ContractTransactor) (*PaymentContractTransactor, error) { + contract, err := bindPaymentContract(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &PaymentContractTransactor{contract: contract}, nil +} + +// NewPaymentContractFilterer creates a new log filterer instance of PaymentContract, bound to a specific deployed contract. +func NewPaymentContractFilterer(address common.Address, filterer bind.ContractFilterer) (*PaymentContractFilterer, error) { + contract, err := bindPaymentContract(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &PaymentContractFilterer{contract: contract}, nil +} + +// bindPaymentContract binds a generic wrapper to an already deployed contract. +func bindPaymentContract(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := PaymentContractMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_PaymentContract *PaymentContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _PaymentContract.Contract.PaymentContractCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_PaymentContract *PaymentContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PaymentContract.Contract.PaymentContractTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_PaymentContract *PaymentContractRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _PaymentContract.Contract.PaymentContractTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_PaymentContract *PaymentContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _PaymentContract.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_PaymentContract *PaymentContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PaymentContract.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_PaymentContract *PaymentContractTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _PaymentContract.Contract.contract.Transact(opts, method, params...) +} + +// ERC20PAYMENTDATATYPEHASH is a free data retrieval call binding the contract method 0xc6bfaa3f. +// +// Solidity: function ERC_20_PAYMENT_DATA_TYPE_HASH() view returns(bytes32) +func (_PaymentContract *PaymentContractCaller) ERC20PAYMENTDATATYPEHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "ERC_20_PAYMENT_DATA_TYPE_HASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ERC20PAYMENTDATATYPEHASH is a free data retrieval call binding the contract method 0xc6bfaa3f. +// +// Solidity: function ERC_20_PAYMENT_DATA_TYPE_HASH() view returns(bytes32) +func (_PaymentContract *PaymentContractSession) ERC20PAYMENTDATATYPEHASH() ([32]byte, error) { + return _PaymentContract.Contract.ERC20PAYMENTDATATYPEHASH(&_PaymentContract.CallOpts) +} + +// ERC20PAYMENTDATATYPEHASH is a free data retrieval call binding the contract method 0xc6bfaa3f. +// +// Solidity: function ERC_20_PAYMENT_DATA_TYPE_HASH() view returns(bytes32) +func (_PaymentContract *PaymentContractCallerSession) ERC20PAYMENTDATATYPEHASH() ([32]byte, error) { + return _PaymentContract.Contract.ERC20PAYMENTDATATYPEHASH(&_PaymentContract.CallOpts) +} + +// PAYMENTDATATYPEHASH is a free data retrieval call binding the contract method 0xf0dd6899. +// +// Solidity: function PAYMENT_DATA_TYPE_HASH() view returns(bytes32) +func (_PaymentContract *PaymentContractCaller) PAYMENTDATATYPEHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "PAYMENT_DATA_TYPE_HASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// PAYMENTDATATYPEHASH is a free data retrieval call binding the contract method 0xf0dd6899. +// +// Solidity: function PAYMENT_DATA_TYPE_HASH() view returns(bytes32) +func (_PaymentContract *PaymentContractSession) PAYMENTDATATYPEHASH() ([32]byte, error) { + return _PaymentContract.Contract.PAYMENTDATATYPEHASH(&_PaymentContract.CallOpts) +} + +// PAYMENTDATATYPEHASH is a free data retrieval call binding the contract method 0xf0dd6899. +// +// Solidity: function PAYMENT_DATA_TYPE_HASH() view returns(bytes32) +func (_PaymentContract *PaymentContractCallerSession) PAYMENTDATATYPEHASH() ([32]byte, error) { + return _PaymentContract.Contract.PAYMENTDATATYPEHASH(&_PaymentContract.CallOpts) +} + +// VERSION is a free data retrieval call binding the contract method 0xffa1ad74. +// +// Solidity: function VERSION() view returns(string) +func (_PaymentContract *PaymentContractCaller) VERSION(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "VERSION") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// VERSION is a free data retrieval call binding the contract method 0xffa1ad74. +// +// Solidity: function VERSION() view returns(string) +func (_PaymentContract *PaymentContractSession) VERSION() (string, error) { + return _PaymentContract.Contract.VERSION(&_PaymentContract.CallOpts) +} + +// VERSION is a free data retrieval call binding the contract method 0xffa1ad74. +// +// Solidity: function VERSION() view returns(string) +func (_PaymentContract *PaymentContractCallerSession) VERSION() (string, error) { + return _PaymentContract.Contract.VERSION(&_PaymentContract.CallOpts) +} + +// Eip712Domain is a free data retrieval call binding the contract method 0x84b0196e. +// +// Solidity: function eip712Domain() view returns(bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) +func (_PaymentContract *PaymentContractCaller) Eip712Domain(opts *bind.CallOpts) (struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int +}, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "eip712Domain") + + outstruct := new(struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Fields = *abi.ConvertType(out[0], new([1]byte)).(*[1]byte) + outstruct.Name = *abi.ConvertType(out[1], new(string)).(*string) + outstruct.Version = *abi.ConvertType(out[2], new(string)).(*string) + outstruct.ChainId = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.VerifyingContract = *abi.ConvertType(out[4], new(common.Address)).(*common.Address) + outstruct.Salt = *abi.ConvertType(out[5], new([32]byte)).(*[32]byte) + outstruct.Extensions = *abi.ConvertType(out[6], new([]*big.Int)).(*[]*big.Int) + + return *outstruct, err + +} + +// Eip712Domain is a free data retrieval call binding the contract method 0x84b0196e. +// +// Solidity: function eip712Domain() view returns(bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) +func (_PaymentContract *PaymentContractSession) Eip712Domain() (struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int +}, error) { + return _PaymentContract.Contract.Eip712Domain(&_PaymentContract.CallOpts) +} + +// Eip712Domain is a free data retrieval call binding the contract method 0x84b0196e. +// +// Solidity: function eip712Domain() view returns(bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) +func (_PaymentContract *PaymentContractCallerSession) Eip712Domain() (struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int +}, error) { + return _PaymentContract.Contract.Eip712Domain(&_PaymentContract.CallOpts) +} + +// GetBalance is a free data retrieval call binding the contract method 0xf8b2cb4f. +// +// Solidity: function getBalance(address recipient) view returns(uint256) +func (_PaymentContract *PaymentContractCaller) GetBalance(opts *bind.CallOpts, recipient common.Address) (*big.Int, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "getBalance", recipient) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetBalance is a free data retrieval call binding the contract method 0xf8b2cb4f. +// +// Solidity: function getBalance(address recipient) view returns(uint256) +func (_PaymentContract *PaymentContractSession) GetBalance(recipient common.Address) (*big.Int, error) { + return _PaymentContract.Contract.GetBalance(&_PaymentContract.CallOpts, recipient) +} + +// GetBalance is a free data retrieval call binding the contract method 0xf8b2cb4f. +// +// Solidity: function getBalance(address recipient) view returns(uint256) +func (_PaymentContract *PaymentContractCallerSession) GetBalance(recipient common.Address) (*big.Int, error) { + return _PaymentContract.Contract.GetBalance(&_PaymentContract.CallOpts, recipient) +} + +// GetOwnerBalance is a free data retrieval call binding the contract method 0x590791f2. +// +// Solidity: function getOwnerBalance() view returns(uint256) +func (_PaymentContract *PaymentContractCaller) GetOwnerBalance(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "getOwnerBalance") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetOwnerBalance is a free data retrieval call binding the contract method 0x590791f2. +// +// Solidity: function getOwnerBalance() view returns(uint256) +func (_PaymentContract *PaymentContractSession) GetOwnerBalance() (*big.Int, error) { + return _PaymentContract.Contract.GetOwnerBalance(&_PaymentContract.CallOpts) +} + +// GetOwnerBalance is a free data retrieval call binding the contract method 0x590791f2. +// +// Solidity: function getOwnerBalance() view returns(uint256) +func (_PaymentContract *PaymentContractCallerSession) GetOwnerBalance() (*big.Int, error) { + return _PaymentContract.Contract.GetOwnerBalance(&_PaymentContract.CallOpts) +} + +// GetOwnerPercentage is a free data retrieval call binding the contract method 0x309a042c. +// +// Solidity: function getOwnerPercentage() view returns(uint8) +func (_PaymentContract *PaymentContractCaller) GetOwnerPercentage(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "getOwnerPercentage") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// GetOwnerPercentage is a free data retrieval call binding the contract method 0x309a042c. +// +// Solidity: function getOwnerPercentage() view returns(uint8) +func (_PaymentContract *PaymentContractSession) GetOwnerPercentage() (uint8, error) { + return _PaymentContract.Contract.GetOwnerPercentage(&_PaymentContract.CallOpts) +} + +// GetOwnerPercentage is a free data retrieval call binding the contract method 0x309a042c. +// +// Solidity: function getOwnerPercentage() view returns(uint8) +func (_PaymentContract *PaymentContractCallerSession) GetOwnerPercentage() (uint8, error) { + return _PaymentContract.Contract.GetOwnerPercentage(&_PaymentContract.CallOpts) +} + +// IsPaymentDone is a free data retrieval call binding the contract method 0x9d9c12b7. +// +// Solidity: function isPaymentDone(address recipient, uint256 nonce) view returns(bool) +func (_PaymentContract *PaymentContractCaller) IsPaymentDone(opts *bind.CallOpts, recipient common.Address, nonce *big.Int) (bool, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "isPaymentDone", recipient, nonce) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsPaymentDone is a free data retrieval call binding the contract method 0x9d9c12b7. +// +// Solidity: function isPaymentDone(address recipient, uint256 nonce) view returns(bool) +func (_PaymentContract *PaymentContractSession) IsPaymentDone(recipient common.Address, nonce *big.Int) (bool, error) { + return _PaymentContract.Contract.IsPaymentDone(&_PaymentContract.CallOpts, recipient, nonce) +} + +// IsPaymentDone is a free data retrieval call binding the contract method 0x9d9c12b7. +// +// Solidity: function isPaymentDone(address recipient, uint256 nonce) view returns(bool) +func (_PaymentContract *PaymentContractCallerSession) IsPaymentDone(recipient common.Address, nonce *big.Int) (bool, error) { + return _PaymentContract.Contract.IsPaymentDone(&_PaymentContract.CallOpts, recipient, nonce) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_PaymentContract *PaymentContractCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_PaymentContract *PaymentContractSession) Owner() (common.Address, error) { + return _PaymentContract.Contract.Owner(&_PaymentContract.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_PaymentContract *PaymentContractCallerSession) Owner() (common.Address, error) { + return _PaymentContract.Contract.Owner(&_PaymentContract.CallOpts) +} + +// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. +// +// Solidity: function pendingOwner() view returns(address) +func (_PaymentContract *PaymentContractCaller) PendingOwner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "pendingOwner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. +// +// Solidity: function pendingOwner() view returns(address) +func (_PaymentContract *PaymentContractSession) PendingOwner() (common.Address, error) { + return _PaymentContract.Contract.PendingOwner(&_PaymentContract.CallOpts) +} + +// PendingOwner is a free data retrieval call binding the contract method 0xe30c3978. +// +// Solidity: function pendingOwner() view returns(address) +func (_PaymentContract *PaymentContractCallerSession) PendingOwner() (common.Address, error) { + return _PaymentContract.Contract.PendingOwner(&_PaymentContract.CallOpts) +} + +// VerifyIden3PaymentRailsERC20RequestV1Signature is a free data retrieval call binding the contract method 0x3039009d. +// +// Solidity: function verifyIden3PaymentRailsERC20RequestV1Signature((address,address,uint256,uint256,uint256,bytes) paymentData, bytes signature) view returns() +func (_PaymentContract *PaymentContractCaller) VerifyIden3PaymentRailsERC20RequestV1Signature(opts *bind.CallOpts, paymentData MCPaymentIden3PaymentRailsERC20RequestV1, signature []byte) error { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "verifyIden3PaymentRailsERC20RequestV1Signature", paymentData, signature) + + if err != nil { + return err + } + + return err + +} + +// VerifyIden3PaymentRailsERC20RequestV1Signature is a free data retrieval call binding the contract method 0x3039009d. +// +// Solidity: function verifyIden3PaymentRailsERC20RequestV1Signature((address,address,uint256,uint256,uint256,bytes) paymentData, bytes signature) view returns() +func (_PaymentContract *PaymentContractSession) VerifyIden3PaymentRailsERC20RequestV1Signature(paymentData MCPaymentIden3PaymentRailsERC20RequestV1, signature []byte) error { + return _PaymentContract.Contract.VerifyIden3PaymentRailsERC20RequestV1Signature(&_PaymentContract.CallOpts, paymentData, signature) +} + +// VerifyIden3PaymentRailsERC20RequestV1Signature is a free data retrieval call binding the contract method 0x3039009d. +// +// Solidity: function verifyIden3PaymentRailsERC20RequestV1Signature((address,address,uint256,uint256,uint256,bytes) paymentData, bytes signature) view returns() +func (_PaymentContract *PaymentContractCallerSession) VerifyIden3PaymentRailsERC20RequestV1Signature(paymentData MCPaymentIden3PaymentRailsERC20RequestV1, signature []byte) error { + return _PaymentContract.Contract.VerifyIden3PaymentRailsERC20RequestV1Signature(&_PaymentContract.CallOpts, paymentData, signature) +} + +// VerifyIden3PaymentRailsRequestV1Signature is a free data retrieval call binding the contract method 0x955317f6. +// +// Solidity: function verifyIden3PaymentRailsRequestV1Signature((address,uint256,uint256,uint256,bytes) paymentData, bytes signature) view returns() +func (_PaymentContract *PaymentContractCaller) VerifyIden3PaymentRailsRequestV1Signature(opts *bind.CallOpts, paymentData MCPaymentIden3PaymentRailsRequestV1, signature []byte) error { + var out []interface{} + err := _PaymentContract.contract.Call(opts, &out, "verifyIden3PaymentRailsRequestV1Signature", paymentData, signature) + + if err != nil { + return err + } + + return err + +} + +// VerifyIden3PaymentRailsRequestV1Signature is a free data retrieval call binding the contract method 0x955317f6. +// +// Solidity: function verifyIden3PaymentRailsRequestV1Signature((address,uint256,uint256,uint256,bytes) paymentData, bytes signature) view returns() +func (_PaymentContract *PaymentContractSession) VerifyIden3PaymentRailsRequestV1Signature(paymentData MCPaymentIden3PaymentRailsRequestV1, signature []byte) error { + return _PaymentContract.Contract.VerifyIden3PaymentRailsRequestV1Signature(&_PaymentContract.CallOpts, paymentData, signature) +} + +// VerifyIden3PaymentRailsRequestV1Signature is a free data retrieval call binding the contract method 0x955317f6. +// +// Solidity: function verifyIden3PaymentRailsRequestV1Signature((address,uint256,uint256,uint256,bytes) paymentData, bytes signature) view returns() +func (_PaymentContract *PaymentContractCallerSession) VerifyIden3PaymentRailsRequestV1Signature(paymentData MCPaymentIden3PaymentRailsRequestV1, signature []byte) error { + return _PaymentContract.Contract.VerifyIden3PaymentRailsRequestV1Signature(&_PaymentContract.CallOpts, paymentData, signature) +} + +// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. +// +// Solidity: function acceptOwnership() returns() +func (_PaymentContract *PaymentContractTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "acceptOwnership") +} + +// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. +// +// Solidity: function acceptOwnership() returns() +func (_PaymentContract *PaymentContractSession) AcceptOwnership() (*types.Transaction, error) { + return _PaymentContract.Contract.AcceptOwnership(&_PaymentContract.TransactOpts) +} + +// AcceptOwnership is a paid mutator transaction binding the contract method 0x79ba5097. +// +// Solidity: function acceptOwnership() returns() +func (_PaymentContract *PaymentContractTransactorSession) AcceptOwnership() (*types.Transaction, error) { + return _PaymentContract.Contract.AcceptOwnership(&_PaymentContract.TransactOpts) +} + +// Initialize is a paid mutator transaction binding the contract method 0x943b24b2. +// +// Solidity: function initialize(address owner, uint8 ownerPercentage) returns() +func (_PaymentContract *PaymentContractTransactor) Initialize(opts *bind.TransactOpts, owner common.Address, ownerPercentage uint8) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "initialize", owner, ownerPercentage) +} + +// Initialize is a paid mutator transaction binding the contract method 0x943b24b2. +// +// Solidity: function initialize(address owner, uint8 ownerPercentage) returns() +func (_PaymentContract *PaymentContractSession) Initialize(owner common.Address, ownerPercentage uint8) (*types.Transaction, error) { + return _PaymentContract.Contract.Initialize(&_PaymentContract.TransactOpts, owner, ownerPercentage) +} + +// Initialize is a paid mutator transaction binding the contract method 0x943b24b2. +// +// Solidity: function initialize(address owner, uint8 ownerPercentage) returns() +func (_PaymentContract *PaymentContractTransactorSession) Initialize(owner common.Address, ownerPercentage uint8) (*types.Transaction, error) { + return _PaymentContract.Contract.Initialize(&_PaymentContract.TransactOpts, owner, ownerPercentage) +} + +// IssuerWithdraw is a paid mutator transaction binding the contract method 0xcc9cd961. +// +// Solidity: function issuerWithdraw() returns() +func (_PaymentContract *PaymentContractTransactor) IssuerWithdraw(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "issuerWithdraw") +} + +// IssuerWithdraw is a paid mutator transaction binding the contract method 0xcc9cd961. +// +// Solidity: function issuerWithdraw() returns() +func (_PaymentContract *PaymentContractSession) IssuerWithdraw() (*types.Transaction, error) { + return _PaymentContract.Contract.IssuerWithdraw(&_PaymentContract.TransactOpts) +} + +// IssuerWithdraw is a paid mutator transaction binding the contract method 0xcc9cd961. +// +// Solidity: function issuerWithdraw() returns() +func (_PaymentContract *PaymentContractTransactorSession) IssuerWithdraw() (*types.Transaction, error) { + return _PaymentContract.Contract.IssuerWithdraw(&_PaymentContract.TransactOpts) +} + +// OwnerWithdraw is a paid mutator transaction binding the contract method 0x4311de8f. +// +// Solidity: function ownerWithdraw() returns() +func (_PaymentContract *PaymentContractTransactor) OwnerWithdraw(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "ownerWithdraw") +} + +// OwnerWithdraw is a paid mutator transaction binding the contract method 0x4311de8f. +// +// Solidity: function ownerWithdraw() returns() +func (_PaymentContract *PaymentContractSession) OwnerWithdraw() (*types.Transaction, error) { + return _PaymentContract.Contract.OwnerWithdraw(&_PaymentContract.TransactOpts) +} + +// OwnerWithdraw is a paid mutator transaction binding the contract method 0x4311de8f. +// +// Solidity: function ownerWithdraw() returns() +func (_PaymentContract *PaymentContractTransactorSession) OwnerWithdraw() (*types.Transaction, error) { + return _PaymentContract.Contract.OwnerWithdraw(&_PaymentContract.TransactOpts) +} + +// Pay is a paid mutator transaction binding the contract method 0xaa021669. +// +// Solidity: function pay((address,uint256,uint256,uint256,bytes) paymentData, bytes signature) payable returns() +func (_PaymentContract *PaymentContractTransactor) Pay(opts *bind.TransactOpts, paymentData MCPaymentIden3PaymentRailsRequestV1, signature []byte) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "pay", paymentData, signature) +} + +// Pay is a paid mutator transaction binding the contract method 0xaa021669. +// +// Solidity: function pay((address,uint256,uint256,uint256,bytes) paymentData, bytes signature) payable returns() +func (_PaymentContract *PaymentContractSession) Pay(paymentData MCPaymentIden3PaymentRailsRequestV1, signature []byte) (*types.Transaction, error) { + return _PaymentContract.Contract.Pay(&_PaymentContract.TransactOpts, paymentData, signature) +} + +// Pay is a paid mutator transaction binding the contract method 0xaa021669. +// +// Solidity: function pay((address,uint256,uint256,uint256,bytes) paymentData, bytes signature) payable returns() +func (_PaymentContract *PaymentContractTransactorSession) Pay(paymentData MCPaymentIden3PaymentRailsRequestV1, signature []byte) (*types.Transaction, error) { + return _PaymentContract.Contract.Pay(&_PaymentContract.TransactOpts, paymentData, signature) +} + +// PayERC20 is a paid mutator transaction binding the contract method 0x57615a3a. +// +// Solidity: function payERC20((address,address,uint256,uint256,uint256,bytes) paymentData, bytes signature) returns() +func (_PaymentContract *PaymentContractTransactor) PayERC20(opts *bind.TransactOpts, paymentData MCPaymentIden3PaymentRailsERC20RequestV1, signature []byte) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "payERC20", paymentData, signature) +} + +// PayERC20 is a paid mutator transaction binding the contract method 0x57615a3a. +// +// Solidity: function payERC20((address,address,uint256,uint256,uint256,bytes) paymentData, bytes signature) returns() +func (_PaymentContract *PaymentContractSession) PayERC20(paymentData MCPaymentIden3PaymentRailsERC20RequestV1, signature []byte) (*types.Transaction, error) { + return _PaymentContract.Contract.PayERC20(&_PaymentContract.TransactOpts, paymentData, signature) +} + +// PayERC20 is a paid mutator transaction binding the contract method 0x57615a3a. +// +// Solidity: function payERC20((address,address,uint256,uint256,uint256,bytes) paymentData, bytes signature) returns() +func (_PaymentContract *PaymentContractTransactorSession) PayERC20(paymentData MCPaymentIden3PaymentRailsERC20RequestV1, signature []byte) (*types.Transaction, error) { + return _PaymentContract.Contract.PayERC20(&_PaymentContract.TransactOpts, paymentData, signature) +} + +// PayERC20Permit is a paid mutator transaction binding the contract method 0x3dbbdbe5. +// +// Solidity: function payERC20Permit(bytes permitSignature, (address,address,uint256,uint256,uint256,bytes) paymentData, bytes signature) returns() +func (_PaymentContract *PaymentContractTransactor) PayERC20Permit(opts *bind.TransactOpts, permitSignature []byte, paymentData MCPaymentIden3PaymentRailsERC20RequestV1, signature []byte) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "payERC20Permit", permitSignature, paymentData, signature) +} + +// PayERC20Permit is a paid mutator transaction binding the contract method 0x3dbbdbe5. +// +// Solidity: function payERC20Permit(bytes permitSignature, (address,address,uint256,uint256,uint256,bytes) paymentData, bytes signature) returns() +func (_PaymentContract *PaymentContractSession) PayERC20Permit(permitSignature []byte, paymentData MCPaymentIden3PaymentRailsERC20RequestV1, signature []byte) (*types.Transaction, error) { + return _PaymentContract.Contract.PayERC20Permit(&_PaymentContract.TransactOpts, permitSignature, paymentData, signature) +} + +// PayERC20Permit is a paid mutator transaction binding the contract method 0x3dbbdbe5. +// +// Solidity: function payERC20Permit(bytes permitSignature, (address,address,uint256,uint256,uint256,bytes) paymentData, bytes signature) returns() +func (_PaymentContract *PaymentContractTransactorSession) PayERC20Permit(permitSignature []byte, paymentData MCPaymentIden3PaymentRailsERC20RequestV1, signature []byte) (*types.Transaction, error) { + return _PaymentContract.Contract.PayERC20Permit(&_PaymentContract.TransactOpts, permitSignature, paymentData, signature) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_PaymentContract *PaymentContractTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_PaymentContract *PaymentContractSession) RenounceOwnership() (*types.Transaction, error) { + return _PaymentContract.Contract.RenounceOwnership(&_PaymentContract.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_PaymentContract *PaymentContractTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _PaymentContract.Contract.RenounceOwnership(&_PaymentContract.TransactOpts) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_PaymentContract *PaymentContractTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_PaymentContract *PaymentContractSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _PaymentContract.Contract.TransferOwnership(&_PaymentContract.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_PaymentContract *PaymentContractTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _PaymentContract.Contract.TransferOwnership(&_PaymentContract.TransactOpts, newOwner) +} + +// UpdateOwnerPercentage is a paid mutator transaction binding the contract method 0x0cea58aa. +// +// Solidity: function updateOwnerPercentage(uint8 ownerPercentage) returns() +func (_PaymentContract *PaymentContractTransactor) UpdateOwnerPercentage(opts *bind.TransactOpts, ownerPercentage uint8) (*types.Transaction, error) { + return _PaymentContract.contract.Transact(opts, "updateOwnerPercentage", ownerPercentage) +} + +// UpdateOwnerPercentage is a paid mutator transaction binding the contract method 0x0cea58aa. +// +// Solidity: function updateOwnerPercentage(uint8 ownerPercentage) returns() +func (_PaymentContract *PaymentContractSession) UpdateOwnerPercentage(ownerPercentage uint8) (*types.Transaction, error) { + return _PaymentContract.Contract.UpdateOwnerPercentage(&_PaymentContract.TransactOpts, ownerPercentage) +} + +// UpdateOwnerPercentage is a paid mutator transaction binding the contract method 0x0cea58aa. +// +// Solidity: function updateOwnerPercentage(uint8 ownerPercentage) returns() +func (_PaymentContract *PaymentContractTransactorSession) UpdateOwnerPercentage(ownerPercentage uint8) (*types.Transaction, error) { + return _PaymentContract.Contract.UpdateOwnerPercentage(&_PaymentContract.TransactOpts, ownerPercentage) +} + +// PaymentContractEIP712DomainChangedIterator is returned from FilterEIP712DomainChanged and is used to iterate over the raw logs and unpacked data for EIP712DomainChanged events raised by the PaymentContract contract. +type PaymentContractEIP712DomainChangedIterator struct { + Event *PaymentContractEIP712DomainChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PaymentContractEIP712DomainChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PaymentContractEIP712DomainChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PaymentContractEIP712DomainChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PaymentContractEIP712DomainChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PaymentContractEIP712DomainChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PaymentContractEIP712DomainChanged represents a EIP712DomainChanged event raised by the PaymentContract contract. +type PaymentContractEIP712DomainChanged struct { + Raw types.Log // Blockchain specific contextual infos +} + +// FilterEIP712DomainChanged is a free log retrieval operation binding the contract event 0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31. +// +// Solidity: event EIP712DomainChanged() +func (_PaymentContract *PaymentContractFilterer) FilterEIP712DomainChanged(opts *bind.FilterOpts) (*PaymentContractEIP712DomainChangedIterator, error) { + + logs, sub, err := _PaymentContract.contract.FilterLogs(opts, "EIP712DomainChanged") + if err != nil { + return nil, err + } + return &PaymentContractEIP712DomainChangedIterator{contract: _PaymentContract.contract, event: "EIP712DomainChanged", logs: logs, sub: sub}, nil +} + +// WatchEIP712DomainChanged is a free log subscription operation binding the contract event 0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31. +// +// Solidity: event EIP712DomainChanged() +func (_PaymentContract *PaymentContractFilterer) WatchEIP712DomainChanged(opts *bind.WatchOpts, sink chan<- *PaymentContractEIP712DomainChanged) (event.Subscription, error) { + + logs, sub, err := _PaymentContract.contract.WatchLogs(opts, "EIP712DomainChanged") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PaymentContractEIP712DomainChanged) + if err := _PaymentContract.contract.UnpackLog(event, "EIP712DomainChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseEIP712DomainChanged is a log parse operation binding the contract event 0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31. +// +// Solidity: event EIP712DomainChanged() +func (_PaymentContract *PaymentContractFilterer) ParseEIP712DomainChanged(log types.Log) (*PaymentContractEIP712DomainChanged, error) { + event := new(PaymentContractEIP712DomainChanged) + if err := _PaymentContract.contract.UnpackLog(event, "EIP712DomainChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PaymentContractInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the PaymentContract contract. +type PaymentContractInitializedIterator struct { + Event *PaymentContractInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PaymentContractInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PaymentContractInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PaymentContractInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PaymentContractInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PaymentContractInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PaymentContractInitialized represents a Initialized event raised by the PaymentContract contract. +type PaymentContractInitialized struct { + Version uint64 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. +// +// Solidity: event Initialized(uint64 version) +func (_PaymentContract *PaymentContractFilterer) FilterInitialized(opts *bind.FilterOpts) (*PaymentContractInitializedIterator, error) { + + logs, sub, err := _PaymentContract.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &PaymentContractInitializedIterator{contract: _PaymentContract.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. +// +// Solidity: event Initialized(uint64 version) +func (_PaymentContract *PaymentContractFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *PaymentContractInitialized) (event.Subscription, error) { + + logs, sub, err := _PaymentContract.contract.WatchLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PaymentContractInitialized) + if err := _PaymentContract.contract.UnpackLog(event, "Initialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialized is a log parse operation binding the contract event 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2. +// +// Solidity: event Initialized(uint64 version) +func (_PaymentContract *PaymentContractFilterer) ParseInitialized(log types.Log) (*PaymentContractInitialized, error) { + event := new(PaymentContractInitialized) + if err := _PaymentContract.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PaymentContractOwnershipTransferStartedIterator is returned from FilterOwnershipTransferStarted and is used to iterate over the raw logs and unpacked data for OwnershipTransferStarted events raised by the PaymentContract contract. +type PaymentContractOwnershipTransferStartedIterator struct { + Event *PaymentContractOwnershipTransferStarted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PaymentContractOwnershipTransferStartedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PaymentContractOwnershipTransferStarted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PaymentContractOwnershipTransferStarted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PaymentContractOwnershipTransferStartedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PaymentContractOwnershipTransferStartedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PaymentContractOwnershipTransferStarted represents a OwnershipTransferStarted event raised by the PaymentContract contract. +type PaymentContractOwnershipTransferStarted struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferStarted is a free log retrieval operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. +// +// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) +func (_PaymentContract *PaymentContractFilterer) FilterOwnershipTransferStarted(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*PaymentContractOwnershipTransferStartedIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _PaymentContract.contract.FilterLogs(opts, "OwnershipTransferStarted", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &PaymentContractOwnershipTransferStartedIterator{contract: _PaymentContract.contract, event: "OwnershipTransferStarted", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferStarted is a free log subscription operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. +// +// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) +func (_PaymentContract *PaymentContractFilterer) WatchOwnershipTransferStarted(opts *bind.WatchOpts, sink chan<- *PaymentContractOwnershipTransferStarted, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _PaymentContract.contract.WatchLogs(opts, "OwnershipTransferStarted", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PaymentContractOwnershipTransferStarted) + if err := _PaymentContract.contract.UnpackLog(event, "OwnershipTransferStarted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferStarted is a log parse operation binding the contract event 0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700. +// +// Solidity: event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) +func (_PaymentContract *PaymentContractFilterer) ParseOwnershipTransferStarted(log types.Log) (*PaymentContractOwnershipTransferStarted, error) { + event := new(PaymentContractOwnershipTransferStarted) + if err := _PaymentContract.contract.UnpackLog(event, "OwnershipTransferStarted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PaymentContractOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the PaymentContract contract. +type PaymentContractOwnershipTransferredIterator struct { + Event *PaymentContractOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PaymentContractOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PaymentContractOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PaymentContractOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PaymentContractOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PaymentContractOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PaymentContractOwnershipTransferred represents a OwnershipTransferred event raised by the PaymentContract contract. +type PaymentContractOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_PaymentContract *PaymentContractFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*PaymentContractOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _PaymentContract.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &PaymentContractOwnershipTransferredIterator{contract: _PaymentContract.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_PaymentContract *PaymentContractFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *PaymentContractOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _PaymentContract.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PaymentContractOwnershipTransferred) + if err := _PaymentContract.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_PaymentContract *PaymentContractFilterer) ParseOwnershipTransferred(log types.Log) (*PaymentContractOwnershipTransferred, error) { + event := new(PaymentContractOwnershipTransferred) + if err := _PaymentContract.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PaymentContractPaymentIterator is returned from FilterPayment and is used to iterate over the raw logs and unpacked data for Payment events raised by the PaymentContract contract. +type PaymentContractPaymentIterator struct { + Event *PaymentContractPayment // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PaymentContractPaymentIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PaymentContractPayment) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PaymentContractPayment) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PaymentContractPaymentIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PaymentContractPaymentIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PaymentContractPayment represents a Payment event raised by the PaymentContract contract. +type PaymentContractPayment struct { + Recipient common.Address + Nonce *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterPayment is a free log retrieval operation binding the contract event 0xd4f43975feb89f48dd30cabbb32011045be187d1e11c8ea9faa43efc35282519. +// +// Solidity: event Payment(address indexed recipient, uint256 indexed nonce) +func (_PaymentContract *PaymentContractFilterer) FilterPayment(opts *bind.FilterOpts, recipient []common.Address, nonce []*big.Int) (*PaymentContractPaymentIterator, error) { + + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) + } + var nonceRule []interface{} + for _, nonceItem := range nonce { + nonceRule = append(nonceRule, nonceItem) + } + + logs, sub, err := _PaymentContract.contract.FilterLogs(opts, "Payment", recipientRule, nonceRule) + if err != nil { + return nil, err + } + return &PaymentContractPaymentIterator{contract: _PaymentContract.contract, event: "Payment", logs: logs, sub: sub}, nil +} + +// WatchPayment is a free log subscription operation binding the contract event 0xd4f43975feb89f48dd30cabbb32011045be187d1e11c8ea9faa43efc35282519. +// +// Solidity: event Payment(address indexed recipient, uint256 indexed nonce) +func (_PaymentContract *PaymentContractFilterer) WatchPayment(opts *bind.WatchOpts, sink chan<- *PaymentContractPayment, recipient []common.Address, nonce []*big.Int) (event.Subscription, error) { + + var recipientRule []interface{} + for _, recipientItem := range recipient { + recipientRule = append(recipientRule, recipientItem) + } + var nonceRule []interface{} + for _, nonceItem := range nonce { + nonceRule = append(nonceRule, nonceItem) + } + + logs, sub, err := _PaymentContract.contract.WatchLogs(opts, "Payment", recipientRule, nonceRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PaymentContractPayment) + if err := _PaymentContract.contract.UnpackLog(event, "Payment", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParsePayment is a log parse operation binding the contract event 0xd4f43975feb89f48dd30cabbb32011045be187d1e11c8ea9faa43efc35282519. +// +// Solidity: event Payment(address indexed recipient, uint256 indexed nonce) +func (_PaymentContract *PaymentContractFilterer) ParsePayment(log types.Log) (*PaymentContractPayment, error) { + event := new(PaymentContractPayment) + if err := _PaymentContract.contract.UnpackLog(event, "Payment", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/internal/eth/payment.abi b/internal/eth/payment.abi new file mode 100644 index 000000000..56a528ff2 --- /dev/null +++ b/internal/eth/payment.abi @@ -0,0 +1,669 @@ +[ + { + "inputs": [ + { + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "InvalidOwnerPercentage", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "PaymentError", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "WithdrawError", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "Payment", + "type": "event" + }, + { + "inputs": [], + "name": "ERC_20_PAYMENT_DATA_TYPE_HASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAYMENT_DATA_TYPE_HASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "getBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOwnerBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOwnerPercentage", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint8", + "name": "ownerPercentage", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } + ], + "name": "isPaymentDone", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "issuerWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ownerWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expirationDate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "metadata", + "type": "bytes" + } + ], + "internalType": "struct MCPayment.Iden3PaymentRailsRequestV1", + "name": "paymentData", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "pay", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expirationDate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "metadata", + "type": "bytes" + } + ], + "internalType": "struct MCPayment.Iden3PaymentRailsERC20RequestV1", + "name": "paymentData", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "payERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "permitSignature", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expirationDate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "metadata", + "type": "bytes" + } + ], + "internalType": "struct MCPayment.Iden3PaymentRailsERC20RequestV1", + "name": "paymentData", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "payERC20Permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "ownerPercentage", + "type": "uint8" + } + ], + "name": "updateOwnerPercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expirationDate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "metadata", + "type": "bytes" + } + ], + "internalType": "struct MCPayment.Iden3PaymentRailsERC20RequestV1", + "name": "paymentData", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "verifyIden3PaymentRailsERC20RequestV1Signature", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expirationDate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "metadata", + "type": "bytes" + } + ], + "internalType": "struct MCPayment.Iden3PaymentRailsRequestV1", + "name": "paymentData", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "verifyIden3PaymentRailsRequestV1Signature", + "outputs": [], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/internal/kms/aws_secret_storage_provider_test.go b/internal/kms/aws_secret_storage_provider_test.go index afc656c2f..80941f0a0 100644 --- a/internal/kms/aws_secret_storage_provider_test.go +++ b/internal/kms/aws_secret_storage_provider_test.go @@ -2,8 +2,10 @@ package kms import ( "context" + "encoding/hex" "testing" + "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -143,9 +145,14 @@ func Test_searchPrivateKey(t *testing.T) { t.Run("should get private key for BJJ", func(t *testing.T) { did := randomDID(t) - privateKey := "9d7abdd5a43573ab9b623c50b9fc8f4357329d3009fe0fc22c8931161d98a03d" + + privKey, err := crypto.GenerateKey() + require.NoError(t, err) + privKeyBytes := crypto.FromECDSA(privKey) + privateKey := hex.EncodeToString(privKeyBytes) + id := getKeyID(&did, KeyTypeBabyJubJub, "BJJ:2290140c920a31a596937095f18a9ae15c1fe7091091be485f353968a4310380") - err := awsStorageProvider.SaveKeyMaterial(ctx, map[string]string{ + err = awsStorageProvider.SaveKeyMaterial(ctx, map[string]string{ jsonKeyType: string(KeyTypeBabyJubJub), jsonKeyData: privateKey, }, id) @@ -164,9 +171,14 @@ func Test_searchPrivateKey(t *testing.T) { t.Run("should get private key for ETH", func(t *testing.T) { did := randomDID(t) - privateKey := "9d7abdd5a43573ab9b623c50b9fc8f4357329d3009fe0fc22c8931161d98a03d" + + privKey, err := crypto.GenerateKey() + require.NoError(t, err) + privKeyBytes := crypto.FromECDSA(privKey) + privateKey := hex.EncodeToString(privKeyBytes) + id := getKeyID(&did, KeyTypeEthereum, "ETH:2290140c920a31a596937095f18a9ae15c1fe7091091be485f353968a4310380") - err := awsStorageProvider.SaveKeyMaterial(ctx, map[string]string{ + err = awsStorageProvider.SaveKeyMaterial(ctx, map[string]string{ jsonKeyType: string(KeyTypeEthereum), jsonKeyData: privateKey, }, id) @@ -185,9 +197,14 @@ func Test_searchPrivateKey(t *testing.T) { t.Run("should get private key for BJJ | from eth identity", func(t *testing.T) { did := randomDID(t) - privateKey := "9d7abdd5a43573ab9b623c50b9fc8f4357329d3009fe0fc22c8931161d98a03d" + + privKey, err := crypto.GenerateKey() + require.NoError(t, err) + privKeyBytes := crypto.FromECDSA(privKey) + privateKey := hex.EncodeToString(privKeyBytes) + id := did.String() + "/BJJ:f6eb5b16318de6054ccc30047d9ba395c954e78b6f1ba0a8f52a6e46b7f2500f" - err := awsStorageProvider.SaveKeyMaterial(ctx, map[string]string{ + err = awsStorageProvider.SaveKeyMaterial(ctx, map[string]string{ jsonKeyType: string(KeyTypeBabyJubJub), jsonKeyData: privateKey, }, id) diff --git a/internal/kms/local_eth_key_provider.go b/internal/kms/local_eth_key_provider.go index 28115af1b..b6bea84cc 100644 --- a/internal/kms/local_eth_key_provider.go +++ b/internal/kms/local_eth_key_provider.go @@ -97,7 +97,10 @@ func (ls *localEthKeyProvider) Sign(ctx context.Context, keyID KeyID, data []byt } sig, err := crypto.Sign(data, privKey) - return sig, err + if err != nil { + return nil, err + } + return sig, nil } func (ls *localEthKeyProvider) LinkToIdentity(ctx context.Context, keyID KeyID, identity w3c.DID) (KeyID, error) { diff --git a/internal/kms/vault_eth_key_provider.go b/internal/kms/vault_eth_key_provider.go index 4fee096bd..535a67ec5 100644 --- a/internal/kms/vault_eth_key_provider.go +++ b/internal/kms/vault_eth_key_provider.go @@ -101,7 +101,10 @@ func (v *vaultETHKeyProvider) Sign(_ context.Context, keyID KeyID, data []byte) } sig, err := crypto.Sign(data, privKey) - return sig, errors.WithStack(err) + if err != nil { + return nil, errors.WithStack(err) + } + return sig, nil } func (v *vaultETHKeyProvider) ListByIdentity(_ context.Context, identity w3c.DID) ([]KeyID, error) { diff --git a/internal/network/resolver.go b/internal/network/resolver.go index f2c84f018..6764021a3 100644 --- a/internal/network/resolver.go +++ b/internal/network/resolver.go @@ -49,11 +49,12 @@ type ResolverClientConfig struct { // Resolver holds the resolver type Resolver struct { - ethereumClients map[resolverPrefix]ResolverClientConfig - rhsSettings map[resolverPrefix]RhsSettings - supportedContracts map[string]*abi.State - stateResolvers map[string]pubsignals.StateResolver - supportedNetworks []SupportedNetworks + ethereumClientsByChainID map[core.ChainID]ResolverClientConfig + ethereumClients map[resolverPrefix]ResolverClientConfig + rhsSettings map[resolverPrefix]RhsSettings + supportedContracts map[string]*abi.State + stateResolvers map[string]pubsignals.StateResolver + supportedNetworks []SupportedNetworks } // SupportedNetworks holds the chain and networks supoprted @@ -103,6 +104,7 @@ func NewResolver(ctx context.Context, cfg config.Configuration, kms *kms.KMS, re } ethereumClients := make(map[resolverPrefix]ResolverClientConfig) + ethereumClientsByChainID := make(map[core.ChainID]ResolverClientConfig) rhsSettings := make(map[resolverPrefix]RhsSettings) supportedContracts := make(map[string]*abi.State) stateResolvers := make(map[string]pubsignals.StateResolver) @@ -148,6 +150,12 @@ func NewResolver(ctx context.Context, cfg config.Configuration, kms *kms.KMS, re } ethereumClients[resolverPrefix(resolverPrefixKey)] = *resolverClientConfig + chainID, err := core.GetChainID(core.Blockchain(chainName), core.NetworkID(networkName)) + if err != nil { + log.Error(ctx, "cannot get chain ID from blockchain and network", "err", err, "blockchain", chainName, "networl", networkName) + return nil, err + } + ethereumClientsByChainID[chainID] = *resolverClientConfig settings := networkSettings.RhsSettings settings.Iden3CommAgentStatus = strings.TrimSuffix(cfg.ServerUrl, "/") @@ -182,11 +190,12 @@ func NewResolver(ctx context.Context, cfg config.Configuration, kms *kms.KMS, re log.Info(ctx, "resolver settings", "settings:", printer.String()) return &Resolver{ - ethereumClients: ethereumClients, - rhsSettings: rhsSettings, - supportedContracts: supportedContracts, - stateResolvers: stateResolvers, - supportedNetworks: supportedNetworks, + ethereumClients: ethereumClients, + ethereumClientsByChainID: ethereumClientsByChainID, + rhsSettings: rhsSettings, + supportedContracts: supportedContracts, + stateResolvers: stateResolvers, + supportedNetworks: supportedNetworks, }, nil } @@ -199,6 +208,15 @@ func (r *Resolver) GetEthClient(resolverPrefixKey string) (*eth.Client, error) { return resolverClientConfig.client, nil } +// GetEthClientByChainID returns the eth client by chain id. +func (r *Resolver) GetEthClientByChainID(chainID core.ChainID) (*eth.Client, error) { + resolverClientConfig, ok := r.ethereumClientsByChainID[chainID] + if !ok { + return nil, fmt.Errorf("ethClient not found for chainID: %d", chainID) + } + return resolverClientConfig.client, nil +} + // GetContractAddress returns the contract address func (r *Resolver) GetContractAddress(resolverPrefixKey string) (*common.Address, error) { resolverClientConfig, ok := r.ethereumClients[resolverPrefix(resolverPrefixKey)] diff --git a/internal/payments/settings.go b/internal/payments/settings.go new file mode 100644 index 000000000..ab7dfd037 --- /dev/null +++ b/internal/payments/settings.go @@ -0,0 +1,179 @@ +package payments + +import ( + "context" + "encoding/base64" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "strings" + + "github.com/ethereum/go-ethereum/common" + "github.com/iden3/iden3comm/v2/protocol" + "gopkg.in/yaml.v3" + + "github.com/polygonid/sh-id-platform/internal/config" + "github.com/polygonid/sh-id-platform/internal/log" +) + +// OptionConfigIDType is a custom type to represent the payment option id +type OptionConfigIDType int + +// Config is a map of payment option id and chain config +type Config map[OptionConfigIDType]ChainConfig + +// ChainConfig is the configuration for a chain +type ChainConfig struct { + ChainID int + PaymentRails common.Address + PaymentOption PaymentOptionConfig +} + +// PaymentOptionConfig is the configuration for a payment option +type PaymentOptionConfig struct { + Name string + Type protocol.PaymentRequestType + ContractAddress common.Address + Features []protocol.PaymentFeatures `json:"features,omitempty"` +} + +// configDTO is the data transfer object for the configuration. It maps to payment configuration file +type configDTO map[int]chainConfigDTO + +type chainConfigDTO struct { + PaymentRails string `yaml:"PaymentRails" json:"paymentRails"` + PaymentOptions []paymentOptionConfigDTO `yaml:"PaymentOptions" json:"paymentOptions"` +} + +type paymentOptionConfigDTO struct { + ID int `yaml:"ID" json:"id"` + Name string `yaml:"Name" json:"name"` + Type protocol.PaymentRequestType `yaml:"Type" json:"type"` + ContractAddress string `yaml:"ContractAddress,omitempty" json:"contractAddress,omitempty"` + Features []string `yaml:"Features,omitempty" json:"features,omitempty"` +} + +// CustomDecoder wraps yaml.Decoder to add custom functionality +type configDecoder struct { + decoder *yaml.Decoder +} + +// NewCustomDecoder creates a new CustomDecoder +func newConfigDecoder(r io.Reader) *configDecoder { + return &configDecoder{ + decoder: yaml.NewDecoder(r), + } +} + +// Decode parse the payment settings yaml file, do some checks and returns +// a Config object with curated data +// Config object is created from the yaml using the configDTO struct. +// Information is the same but formatted in a more usable way +func (d *configDecoder) Decode() (*Config, error) { + var dto configDTO + var cfg Config + + err := d.decoder.Decode(&dto) + if err != nil { + return nil, fmt.Errorf("cannot decode payment settings file: %w", err) + } + cfg = make(Config) + // Converting the dto to a Config object + for id, chainConfig := range dto { + if !common.IsHexAddress(chainConfig.PaymentRails) { + return nil, fmt.Errorf("invalid payment rails address: %s", chainConfig.PaymentRails) + } + for _, option := range chainConfig.PaymentOptions { + if _, found := cfg[OptionConfigIDType(id)]; found { + return nil, fmt.Errorf("duplicate payment option id: %d", id) + } + if !common.IsHexAddress(option.ContractAddress) && strings.TrimSpace(option.ContractAddress) != "" { + return nil, fmt.Errorf("invalid PaymentRails address: %s", chainConfig.PaymentRails) + } + var features []protocol.PaymentFeatures + if len(option.Features) > 0 { + features = make([]protocol.PaymentFeatures, len(option.Features)) + for i, feature := range option.Features { + features[i] = protocol.PaymentFeatures(feature) + } + } + cfg[OptionConfigIDType(option.ID)] = ChainConfig{ + ChainID: id, + PaymentRails: common.HexToAddress(chainConfig.PaymentRails), + PaymentOption: PaymentOptionConfig{ + Name: option.Name, + Type: option.Type, + ContractAddress: common.HexToAddress(option.ContractAddress), + Features: features, + }, + } + } + } + return &cfg, nil +} + +// SettingsFromConfig returns the settings from the configuration +// It reads the settings from the file if the path is provided or from the base64 encoded file injected +// into the configuration via an environment variable +func SettingsFromConfig(ctx context.Context, cfg *config.Payments) (*Config, error) { + var reader io.Reader + var err error + if cfg.SettingsPath != "" { + reader, err = readFileFromPath(ctx, cfg.SettingsPath) + if err != nil { + log.Error(ctx, "cannot read settings file", "err", err) + return nil, err + } + return SettingsFromReader(reader) + } + if settingsFileHasContent(cfg) { + reader, err = readBase64FileContent(ctx, *cfg.SettingsFile) + if err != nil { + log.Error(ctx, "cannot read settings file", "err", err) + return nil, err + } + return SettingsFromReader(reader) + } + return nil, errors.New("no payment settings file or payment file path provided") +} + +func settingsFileHasContent(cfg *config.Payments) bool { + return cfg.SettingsFile != nil && *cfg.SettingsFile != "" +} + +// SettingsFromReader reads the settings from a reader +func SettingsFromReader(reader io.Reader) (*Config, error) { + return newConfigDecoder(reader).Decode() +} + +// ReadFileFromPath is a function that returns a reader for the resolver settings file +func readFileFromPath(ctx context.Context, path string) (io.Reader, error) { + if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) { + log.Info(ctx, "payment settings file not found", "path", path) + return nil, fmt.Errorf("payment settings file not found: %w", err) + } + + if info, _ := os.Stat(path); info.Size() == 0 { + log.Info(ctx, "payment settings file is empty") + return nil, fmt.Errorf("payment settings file is empty: %s", path) + } + + f, err := os.Open(filepath.Clean(path)) + if err != nil { + return nil, err + } + + return f, nil +} + +// readBase64FileContent is a function that returns a reader for the encoded (base64) file +func readBase64FileContent(ctx context.Context, payload string) (io.Reader, error) { + decodedBytes, err := base64.StdEncoding.DecodeString(payload) + if err != nil { + log.Error(ctx, "cannot decode base64 encoded file", "err", err) + return nil, err + } + return strings.NewReader(string(decodedBytes)), nil +} diff --git a/internal/payments/settings_test.go b/internal/payments/settings_test.go new file mode 100644 index 000000000..fc3093518 --- /dev/null +++ b/internal/payments/settings_test.go @@ -0,0 +1,197 @@ +package payments + +import ( + "context" + "encoding/base64" + "errors" + "os" + "testing" + + ethCommon "github.com/ethereum/go-ethereum/common" + "github.com/iden3/iden3comm/v2/protocol" + "github.com/stretchr/testify/require" + + "github.com/polygonid/sh-id-platform/internal/common" + "github.com/polygonid/sh-id-platform/internal/config" +) + +func TestSettingsFromConfig(t *testing.T) { + ctx := context.Background() + filePath := "testdata/payment_settings.test.yaml" + fileContent, err := os.ReadFile(filePath) + require.NoError(t, err) + fileContentUrlBase64 := base64.StdEncoding.EncodeToString(fileContent) + + expectedSettings := Config{ + 1: ChainConfig{ + ChainID: 80002, + PaymentRails: ethCommon.HexToAddress("0xF8E49b922D5Fb00d3EdD12bd14064f275726D339"), + PaymentOption: PaymentOptionConfig{ + Name: "AmoyNative", + Type: protocol.Iden3PaymentRailsRequestV1Type, + ContractAddress: ethCommon.HexToAddress(""), + Features: nil, + }, + }, + 2: ChainConfig{ + ChainID: 80002, + PaymentRails: ethCommon.HexToAddress("0xF8E49b922D5Fb00d3EdD12bd14064f275726D339"), + PaymentOption: PaymentOptionConfig{ + Name: "Amoy USDT", + Type: protocol.Iden3PaymentRailsERC20RequestV1Type, + ContractAddress: ethCommon.HexToAddress("0x2FE40749812FAC39a0F380649eF59E01bccf3a1A"), + Features: nil, + }, + }, + 3: ChainConfig{ + ChainID: 80002, + PaymentRails: ethCommon.HexToAddress("0xF8E49b922D5Fb00d3EdD12bd14064f275726D339"), + PaymentOption: PaymentOptionConfig{ + Name: "Amoy USDC", + Type: protocol.Iden3PaymentRailsERC20RequestV1Type, + ContractAddress: ethCommon.HexToAddress("0x2FE40749812FAC39a0F380649eF59E01bccf3a1A"), + Features: []protocol.PaymentFeatures{"EIP-2612"}, + }, + }, + 4: ChainConfig{ + ChainID: 59141, + PaymentRails: ethCommon.HexToAddress("0x40E3EF221AA93F6Fe997c9b0393322823Bb207d3"), + PaymentOption: PaymentOptionConfig{ + Name: "LineaSepoliaNative", + Type: protocol.Iden3PaymentRailsRequestV1Type, + ContractAddress: ethCommon.HexToAddress(""), + Features: nil, + }, + }, + 5: ChainConfig{ + ChainID: 59141, + PaymentRails: ethCommon.HexToAddress("0x40E3EF221AA93F6Fe997c9b0393322823Bb207d3"), + PaymentOption: PaymentOptionConfig{ + Name: "Linea Sepolia USDT", + Type: protocol.Iden3PaymentRailsERC20RequestV1Type, + ContractAddress: ethCommon.HexToAddress("0xb0101c1Ffdd1213B886FebeF6F07442e48990c9C"), + Features: nil, + }, + }, + 6: ChainConfig{ + ChainID: 59141, + PaymentRails: ethCommon.HexToAddress("0x40E3EF221AA93F6Fe997c9b0393322823Bb207d3"), + PaymentOption: PaymentOptionConfig{ + Name: "Linea Sepolia USDC", + Type: protocol.Iden3PaymentRailsERC20RequestV1Type, + ContractAddress: ethCommon.HexToAddress("0xb0101c1Ffdd1213B886FebeF6F07442e48990c9C"), + Features: []protocol.PaymentFeatures{"EIP-2612"}, + }, + }, + 7: ChainConfig{ + ChainID: 2442, + PaymentRails: ethCommon.HexToAddress("0x09c269e74d8B47c98537Acd6CbEe8056806F4c70"), + PaymentOption: PaymentOptionConfig{ + Name: "ZkEvmNative", + Type: protocol.Iden3PaymentRailsRequestV1Type, + ContractAddress: ethCommon.HexToAddress(""), + Features: nil, + }, + }, + 8: ChainConfig{ + ChainID: 2442, + PaymentRails: ethCommon.HexToAddress("0x09c269e74d8B47c98537Acd6CbEe8056806F4c70"), + PaymentOption: PaymentOptionConfig{ + Name: "ZkEvm USDT", + Type: protocol.Iden3PaymentRailsERC20RequestV1Type, + ContractAddress: ethCommon.HexToAddress("0x986caE6ADcF5da2a1514afc7317FBdeE0B4048Db"), + Features: nil, + }, + }, + 9: ChainConfig{ + ChainID: 2442, + PaymentRails: ethCommon.HexToAddress("0x09c269e74d8B47c98537Acd6CbEe8056806F4c70"), + PaymentOption: PaymentOptionConfig{ + Name: "ZkEvm USDC", + Type: protocol.Iden3PaymentRailsERC20RequestV1Type, + ContractAddress: ethCommon.HexToAddress("0x986caE6ADcF5da2a1514afc7317FBdeE0B4048Db"), + Features: []protocol.PaymentFeatures{"EIP-2612"}, + }, + }, + } + + type expected struct { + err error + settings Config + } + for _, tc := range []struct { + name string + cfg config.Payments + expected expected + }{ + { + name: "Config from file content base64 encoded", + cfg: config.Payments{ + SettingsPath: "", + SettingsFile: common.ToPointer(fileContentUrlBase64), + }, + expected: expected{ + settings: expectedSettings, + }, + }, + { + name: "Config from file path", + cfg: config.Payments{ + SettingsPath: filePath, + SettingsFile: nil, + }, + expected: expected{ + settings: expectedSettings, + }, + }, + { + name: "Config from file has preference", + cfg: config.Payments{ + SettingsPath: filePath, + SettingsFile: common.ToPointer("irrelevant wrong content"), + }, + expected: expected{ + settings: expectedSettings, + }, + }, + { + name: "No file or path configured", + cfg: config.Payments{ + SettingsPath: "", + SettingsFile: nil, + }, + expected: expected{ + err: errors.New("no payment settings file or payment file path provided"), + }, + }, + { + name: "Wrong file content. Not base64 encoded", + cfg: config.Payments{ + SettingsPath: "", + SettingsFile: common.ToPointer(string(fileContent)), + }, + expected: expected{ + err: errors.New("illegal base64 data at input byte 5"), + }, + }, + { + name: "Wrong file path", + cfg: config.Payments{ + SettingsPath: "/wrong/path", + }, + expected: expected{ + err: errors.New("payment settings file not found: stat /wrong/path: no such file or directory"), + }, + }, + } { + t.Run(tc.name, func(t *testing.T) { + settings, err := SettingsFromConfig(ctx, &tc.cfg) + if tc.expected.err == nil { + require.NoError(t, err) + require.EqualValues(t, tc.expected.settings, *settings) + } else { + require.Equal(t, tc.expected.err.Error(), err.Error()) + } + }) + } +} diff --git a/internal/payments/testdata/payment_settings.test.yaml b/internal/payments/testdata/payment_settings.test.yaml new file mode 100644 index 000000000..537d71f23 --- /dev/null +++ b/internal/payments/testdata/payment_settings.test.yaml @@ -0,0 +1,52 @@ +80002: + PaymentRails: 0xF8E49b922D5Fb00d3EdD12bd14064f275726D339 + PaymentOptions: + - ID: 1 + Name: AmoyNative + Type: Iden3PaymentRailsRequestV1 + - ID: 2 + Name: Amoy USDT + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x2FE40749812FAC39a0F380649eF59E01bccf3a1A + Features: [] + - ID: 3 + Name: Amoy USDC + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x2FE40749812FAC39a0F380649eF59E01bccf3a1A + Features: + - EIP-2612 +59141: + PaymentRails: 0x40E3EF221AA93F6Fe997c9b0393322823Bb207d3 + PaymentOptions: + - ID: 4 + Name: LineaSepoliaNative + Type: Iden3PaymentRailsRequestV1 + - ID: 5 + Name: Linea Sepolia USDT + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0xb0101c1Ffdd1213B886FebeF6F07442e48990c9C + Features: [] + - ID: 6 + Name: Linea Sepolia USDC + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0xb0101c1Ffdd1213B886FebeF6F07442e48990c9C + Features: + - EIP-2612 +2442: + PaymentRails: 0x09c269e74d8B47c98537Acd6CbEe8056806F4c70 + PaymentOptions: + - ID: 7 + Name: ZkEvmNative + Type: Iden3PaymentRailsRequestV1 + - ID: 8 + Name: ZkEvm USDT + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x986caE6ADcF5da2a1514afc7317FBdeE0B4048Db + Features: [] + - ID: 9 + Name: ZkEvm USDC + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x986caE6ADcF5da2a1514afc7317FBdeE0B4048Db + Features: + - EIP-2612 + diff --git a/internal/repositories/fixture.go b/internal/repositories/fixture.go index 7918317e3..0a631d836 100644 --- a/internal/repositories/fixture.go +++ b/internal/repositories/fixture.go @@ -18,6 +18,7 @@ type Fixture struct { connectionsRepository ports.ConnectionRepository schemaRepository ports.SchemaRepository identityStateRepository ports.IdentityStateRepository + paymentRepository ports.PaymentRepository } // NewFixture - constructor @@ -29,10 +30,11 @@ func NewFixture(storage *db.Storage) *Fixture { connectionsRepository: NewConnection(), schemaRepository: NewSchema(*storage), identityStateRepository: NewIdentityState(), + paymentRepository: NewPayment(*storage), } } -// ExecQueryParams - handle the query and the argumens for that query. +// ExecQueryParams - handle the query and the arguments for that query. type ExecQueryParams struct { Query string Arguments []interface{} diff --git a/internal/repositories/link.go b/internal/repositories/link.go index 4c71fe93c..f0011791a 100644 --- a/internal/repositories/link.go +++ b/internal/repositories/link.go @@ -158,6 +158,7 @@ SELECT links.id, schemas.issuer_id as schema_issuer_id, schemas.url, schemas.type, + schemas.context_url, schemas.hash, schemas.words, schemas.created_at @@ -223,6 +224,7 @@ WHERE links.issuer_id = $1 &schema.IssuerID, &schema.URL, &schema.Type, + &schema.ContextURL, &schema.Hash, &schema.Words, &schema.CreatedAt, diff --git a/internal/repositories/payment.go b/internal/repositories/payment.go new file mode 100644 index 000000000..fa56528e0 --- /dev/null +++ b/internal/repositories/payment.go @@ -0,0 +1,289 @@ +package repositories + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "math/big" + "strings" + + "github.com/google/uuid" + "github.com/iden3/go-iden3-core/v2/w3c" + "github.com/iden3/iden3comm/v2/protocol" + + "github.com/polygonid/sh-id-platform/internal/core/domain" + "github.com/polygonid/sh-id-platform/internal/core/ports" + "github.com/polygonid/sh-id-platform/internal/db" +) + +// ErrPaymentOptionDoesNotExists error +var ErrPaymentOptionDoesNotExists = errors.New("payment option not found") + +// payment repository +type payment struct { + conn db.Storage +} + +// NewPayment creates a new payment repository +func NewPayment(conn db.Storage) ports.PaymentRepository { + return &payment{conn} +} + +// SavePaymentRequest saves a payment request +func (p *payment) SavePaymentRequest(ctx context.Context, req *domain.PaymentRequest) (uuid.UUID, error) { + const ( + insertPaymentRequest = ` +INSERT +INTO payment_requests (id, credentials, description, issuer_did, recipient_did, payment_option_id, created_at) +VALUES ($1, $2, $3, $4, $5, $6, $7);` + insertPaymentRequestItem = ` +INSERT +INTO payment_request_items (id, nonce, payment_request_id, payment_option_id, payment_request_info, signing_key) +VALUES ($1, $2, $3, $4, $5, $6);` + ) + + tx, err := p.conn.Pgx.Begin(ctx) + if err != nil { + return uuid.Nil, fmt.Errorf("could not start transaction: %w", err) + } + defer func() { _ = tx.Rollback(ctx) }() + + _, err = tx.Exec(ctx, insertPaymentRequest, + req.ID, + req.Credentials, + req.Description, + req.IssuerDID.String(), + req.RecipientDID.String(), + req.PaymentOptionID, + req.CreatedAt, + ) + if err != nil { + return uuid.Nil, fmt.Errorf("could not insert payment request: %w", err) + } + for _, item := range req.Payments { + _, err = tx.Exec(ctx, insertPaymentRequestItem, + item.ID, + item.Nonce.String(), + item.PaymentRequestID, + item.PaymentOptionID, + item.Payment, + item.SigningKeyID, + ) + if err != nil { + return uuid.Nil, fmt.Errorf("could not insert payment request item: %w", err) + } + } + if err := tx.Commit(ctx); err != nil { + return uuid.Nil, fmt.Errorf("could not commit transaction: %w", err) + } + return req.ID, nil +} + +// GetPaymentRequestByID returns a payment request by ID +func (p *payment) GetPaymentRequestByID(ctx context.Context, issuerDID w3c.DID, id uuid.UUID) (*domain.PaymentRequest, error) { + const query = ` +SELECT pr.id, pr.issuer_did, pr.recipient_did, pr.payment_option_id, pr.created_at, pri.id, pri.nonce, pri.payment_request_id, pri.payment_request_info, pri.payment_option_id, pri.signing_key +FROM payment_requests pr +LEFT JOIN payment_request_items pri ON pr.id = pri.payment_request_id +WHERE pr.issuer_did = $1 AND pr.id = $2;` + rows, err := p.conn.Pgx.Query(ctx, query, issuerDID.String(), id) + if err != nil { + return nil, err + } + defer rows.Close() + var pr domain.PaymentRequest + for rows.Next() { + var item domain.PaymentRequestItem + var strIssuerDID, strRecipientDID string + var sNonce string + var did *w3c.DID + var paymentRequestInfoBytes []byte + if err := rows.Scan( + &pr.ID, + &strIssuerDID, + &strRecipientDID, + &pr.PaymentOptionID, + &pr.CreatedAt, + &item.ID, + &sNonce, + &item.PaymentRequestID, + &paymentRequestInfoBytes, + &item.PaymentOptionID, + &item.SigningKeyID, + ); err != nil { + return nil, fmt.Errorf("could not scan payment request: %w", err) + } + + item.Payment, err = p.paymentRequestItem(paymentRequestInfoBytes) + if err != nil { + return nil, fmt.Errorf("could not unmarshal payment request info: %w", err) + } + + const base10 = 10 + nonce, ok := new(big.Int).SetString(sNonce, base10) + if !ok { + return nil, fmt.Errorf("could not parse nonce: %w", err) + } + item.Nonce = *nonce + if did, err = w3c.ParseDID(strIssuerDID); err != nil { + return nil, fmt.Errorf("could not parse issuer DID: %w", err) + } + pr.IssuerDID = *did + if did, err = w3c.ParseDID(strRecipientDID); err != nil { + return nil, fmt.Errorf("could not parse recipient DID: %w", err) + } + pr.RecipientDID = *did + pr.Payments = append(pr.Payments, item) + } + return &pr, nil +} + +// GetAllPaymentRequests returns all payment requests +// TODO: Pagination? +func (p *payment) GetAllPaymentRequests(ctx context.Context, issuerDID w3c.DID) ([]domain.PaymentRequest, error) { + // TODO implement me + panic("implement me") +} + +// GetPaymentRequestItem returns a payment request item +func (p *payment) GetPaymentRequestItem(ctx context.Context, issuerDID w3c.DID, nonce *big.Int) (*domain.PaymentRequestItem, error) { + const query = ` +SELECT payment_request_items.id, nonce, payment_request_id, payment_request_info, payment_request_items.payment_option_id +FROM payment_request_items +LEFT JOIN payment_requests ON payment_requests.id = payment_request_items.payment_request_id +WHERE payment_requests.issuer_did = $1 AND nonce = $2;` + var item domain.PaymentRequestItem + var sNonce string + var paymentRequestInfoBytes []byte + err := p.conn.Pgx.QueryRow(ctx, query, issuerDID.String(), nonce.String()).Scan( + &item.ID, + &sNonce, + &item.PaymentRequestID, + &paymentRequestInfoBytes, + &item.PaymentOptionID, + ) + if err != nil { + return nil, fmt.Errorf("could not get payment request item: %w", err) + } + item.Payment, err = p.paymentRequestItem(paymentRequestInfoBytes) + if err != nil { + return nil, fmt.Errorf("could not unmarshal payment request info: %w", err) + } + const base10 = 10 + nonceInt, ok := new(big.Int).SetString(sNonce, base10) + if !ok { + return nil, fmt.Errorf("could not parse nonce: %w", err) + } + item.Nonce = *nonceInt + return &item, nil +} + +// SavePaymentOption saves a payment option +func (p *payment) SavePaymentOption(ctx context.Context, opt *domain.PaymentOption) (uuid.UUID, error) { + const query = ` +INSERT INTO payment_options (id, issuer_did, name, description, configuration, created_at, updated_at) +VALUES ($1, $2, $3, $4, $5, $6, $7); +` + + _, err := p.conn.Pgx.Exec(ctx, query, opt.ID, opt.IssuerDID.String(), opt.Name, opt.Description, opt.Config, opt.CreatedAt, opt.UpdatedAt) + if err != nil { + if strings.Contains(err.Error(), "violates foreign key constraint") { + return uuid.Nil, ErrIdentityNotFound + } + } + return opt.ID, nil +} + +// GetAllPaymentOptions returns all payment options +func (p *payment) GetAllPaymentOptions(ctx context.Context, issuerDID w3c.DID) ([]domain.PaymentOption, error) { + const query = ` +SELECT id, issuer_did, name, description, configuration, created_at, updated_at +FROM payment_options +WHERE issuer_did=$1 +ORDER BY created_at DESC;` + + rows, err := p.conn.Pgx.Query(ctx, query, issuerDID.String()) + if err != nil { + return nil, err + } + defer rows.Close() + + var opts []domain.PaymentOption + for rows.Next() { + var opt domain.PaymentOption + var strIssuerDID string + err := rows.Scan(&opt.ID, &strIssuerDID, &opt.Name, &opt.Description, &opt.Config, &opt.CreatedAt, &opt.UpdatedAt) + if err != nil { + return nil, err + } + did, err := w3c.ParseDID(strIssuerDID) + if err != nil { + return nil, fmt.Errorf("could not parse issuer DID: %w", err) + } + opt.IssuerDID = *did + opts = append(opts, opt) + } + return opts, nil +} + +// GetPaymentOptionByID returns a payment option by ID +func (p *payment) GetPaymentOptionByID(ctx context.Context, issuerDID *w3c.DID, id uuid.UUID) (*domain.PaymentOption, error) { + const baseQuery = ` +SELECT id, issuer_did, name, description, configuration, created_at, updated_at +FROM payment_options +WHERE id = $1 +` + var opt domain.PaymentOption + var strIssuerDID string + + query := baseQuery + queryParams := []interface{}{id} + if issuerDID != nil { + query += ` AND issuer_did = $2` + queryParams = append(queryParams, issuerDID.String()) + } + + err := p.conn.Pgx.QueryRow(ctx, query, queryParams...).Scan(&opt.ID, &strIssuerDID, &opt.Name, &opt.Description, &opt.Config, &opt.CreatedAt, &opt.UpdatedAt) + if err != nil { + if strings.Contains(err.Error(), "no rows in result set") { + return nil, ErrPaymentOptionDoesNotExists + } + return nil, err + } + did, err := w3c.ParseDID(strIssuerDID) + if err != nil { + return nil, fmt.Errorf("could not parse issuer DID: %w", err) + } + opt.IssuerDID = *did + return &opt, nil +} + +// DeletePaymentOption deletes a payment option +func (p *payment) DeletePaymentOption(ctx context.Context, issuerDID w3c.DID, id uuid.UUID) error { + const query = `DELETE FROM payment_options WHERE id = $1 and issuer_did = $2;` + + cmd, err := p.conn.Pgx.Exec(ctx, query, id, issuerDID.String()) + if err != nil { + return err + } + if cmd.RowsAffected() == 0 { + return ErrPaymentOptionDoesNotExists + } + return nil +} + +// paymentRequestItem extracts the payment request item from the payload +// It uses an intermediate structure of type protocol.PaymentRequestInfoData +// to unmarshal the payment request info. +// This is necessary because PaymentRequestInfoDataItem is an interface and the unmarshal fails +func (p *payment) paymentRequestItem(payload []byte) (protocol.PaymentRequestInfoDataItem, error) { + var data protocol.PaymentRequestInfoData + if err := json.Unmarshal(payload, &data); err != nil { + return nil, fmt.Errorf("could not unmarshal payment request info: %w", err) + } + if len(data) == 0 { + return nil, errors.New("payment request info is empty") + } + return data[0], nil +} diff --git a/internal/repositories/payment_request_fixture.go b/internal/repositories/payment_request_fixture.go new file mode 100644 index 000000000..8d21e1c08 --- /dev/null +++ b/internal/repositories/payment_request_fixture.go @@ -0,0 +1,78 @@ +package repositories + +import ( + "context" + "math/big" + "math/rand" + "testing" + "time" + + "github.com/google/uuid" + "github.com/iden3/driver-did-iden3/pkg/document" + "github.com/iden3/go-iden3-core/v2/w3c" + "github.com/iden3/iden3comm/v2/protocol" + "github.com/stretchr/testify/require" + + "github.com/polygonid/sh-id-platform/internal/core/domain" + "github.com/polygonid/sh-id-platform/internal/payments" +) + +// CreatePaymentRequest creates a new payment request fixture to be used on tests +func (f *Fixture) CreatePaymentRequest(t *testing.T, issuerDID, recipientDID w3c.DID, paymentOptionID uuid.UUID, nPayments int) *domain.PaymentRequest { + t.Helper() + + var paymentList []domain.PaymentRequestItem + paymentRequestID := uuid.New() + for i := 0; i < nPayments; i++ { + nonce := big.NewInt(rand.Int63()) + paymentList = append(paymentList, domain.PaymentRequestItem{ + ID: uuid.New(), + Nonce: *nonce, + PaymentRequestID: paymentRequestID, + PaymentOptionID: payments.OptionConfigIDType(i + 1), + Payment: protocol.Iden3PaymentRailsRequestV1{ + Nonce: "25", + Type: protocol.Iden3PaymentRailsRequestV1Type, + Context: protocol.NewPaymentContextString( + "https://schema.iden3.io/core/jsonld/payment.jsonld#Iden3PaymentRailsRequestV1", + "https://w3id.org/security/suites/eip712sig-2021/v1", + ), + Recipient: "0xaddress", + Amount: "100", + ExpirationDate: "ISO string", + Proof: protocol.PaymentProof{ + protocol.EthereumEip712Signature2021{ + Type: document.EthereumEip712SignatureProof2021Type, + ProofPurpose: "assertionMethod", + ProofValue: "0xa05292e9874240c5c2bbdf5a8fefff870c9fc801bde823189fc013d8ce39c7e5431bf0585f01c7e191ea7bbb7110a22e018d7f3ea0ed81a5f6a3b7b828f70f2d1c", + VerificationMethod: "did:pkh:eip155:0:0x3e1cFE1b83E7C1CdB0c9558236c1f6C7B203C34e#blockchainAccountId", + Created: "2024-09-26T12:28:19.702580067Z", + Eip712: protocol.Eip712Data{ + Types: "https://schema.iden3.io/core/json/Iden3PaymentRailsRequestV1.json", + PrimaryType: "Iden3PaymentRailsRequestV1", + Domain: protocol.Eip712Domain{ + Name: "MCPayment", + Version: "1.0.0", + ChainID: "0x0", + VerifyingContract: "0x0000000000000000000000000000000000000000", + }, + }, + }, + }, + Metadata: "0x", + }, + }) + } + paymentRequest := &domain.PaymentRequest{ + ID: paymentRequestID, + IssuerDID: issuerDID, + RecipientDID: recipientDID, + PaymentOptionID: paymentOptionID, + Payments: paymentList, + CreatedAt: time.Now(), + } + + _, err := f.paymentRepository.SavePaymentRequest(context.Background(), paymentRequest) + require.NoError(t, err) + return paymentRequest +} diff --git a/internal/repositories/payment_test.go b/internal/repositories/payment_test.go new file mode 100644 index 000000000..73cb5f296 --- /dev/null +++ b/internal/repositories/payment_test.go @@ -0,0 +1,310 @@ +package repositories + +import ( + "context" + "encoding/json" + "fmt" + "math/big" + "math/rand" + "testing" + "time" + + "github.com/google/uuid" + "github.com/iden3/go-iden3-core/v2/w3c" + "github.com/iden3/iden3comm/v2/protocol" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/polygonid/sh-id-platform/internal/core/domain" +) + +const paymentOptionTest = ` +{ + "Chains": [ + { + "ChainId": 137, + "Recipient": "0x..", + "SigningKeyId": "", + "Iden3PaymentRailsRequestV1": { + "Amount": "0.01", + "Currency": "POL" + }, + "Iden3PaymentRailsERC20RequestV1": { + "USDT": { + "Amount": "3" + }, + "USDC": { + "Amount": "3" + } + } + }, + { + "ChainId": 1101, + "Recipient": "0x..", + "SigningKeyId": "", + "Iden3PaymentRailsRequestV1": { + "Amount": "0.5", + "Currency": "ETH" + } + } + ] + } +` + +func TestPayment_SavePaymentOption(t *testing.T) { + var paymentOptionConfig domain.PaymentOptionConfig + ctx := context.Background() + + fixture := NewFixture(storage) + issuerID, err := w3c.ParseDID("did:iden3:privado:main:2Sh93vMXNar5fP5ifutHerL9bdUkocB464n3TG6BWV") + require.NoError(t, err) + issuerDIDOther, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qYQdd1yqFyrM9ZPqYTE4WHAQH2PX5Rjtj7YDYPppj") + require.NoError(t, err) + + fixture.CreateIdentity(t, &domain.Identity{Identifier: issuerID.String()}) + + require.NoError(t, json.Unmarshal([]byte(paymentOptionTest), &paymentOptionConfig)) + + repo := NewPayment(*storage) + t.Run("Save payment option", func(t *testing.T) { + id, err := repo.SavePaymentOption(ctx, domain.NewPaymentOption(*issuerID, "name", "description", &paymentOptionConfig)) + assert.NoError(t, err) + assert.NotEqual(t, uuid.Nil, id) + }) + t.Run("Save payment option linked to non existing issuer", func(t *testing.T) { + id, err := repo.SavePaymentOption(ctx, domain.NewPaymentOption(*issuerDIDOther, "name 2", "description 2", &paymentOptionConfig)) + require.Error(t, err) + assert.Equal(t, uuid.Nil, id) + }) +} + +func TestPayment_GetAllPaymentOptions(t *testing.T) { + var paymentOptionConfig domain.PaymentOptionConfig + ctx := context.Background() + fixture := NewFixture(storage) + issuerID, err := w3c.ParseDID("did:iden3:privado:main:2SbDGSG2TTN1N1UuFaFq7EoFK3RY5wfcotuD8rDCn2") + require.NoError(t, err) + fixture.CreateIdentity(t, &domain.Identity{Identifier: issuerID.String()}) + issuerDIDOther, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qYQdd1yqFyrM9ZPqYTE4WHAQH2PX5Rjtj7YDYPppj") + require.NoError(t, err) + + require.NoError(t, json.Unmarshal([]byte(paymentOptionTest), &paymentOptionConfig)) + + repo := NewPayment(*storage) + ids := make([]uuid.UUID, 0) + now := time.Now() + for i := 0; i < 10; i++ { + id, err := repo.SavePaymentOption(ctx, &domain.PaymentOption{ + ID: uuid.New(), + IssuerDID: *issuerID, + Name: fmt.Sprintf("name %d", i), + Description: fmt.Sprintf("description %d", i), + Config: paymentOptionConfig, + CreatedAt: now, + UpdatedAt: now, + }) + now = now.Add(1 * time.Second) + + require.NoError(t, err) + ids = append([]uuid.UUID{id}, ids...) + } + t.Run("Get all payment options", func(t *testing.T) { + opts, err := repo.GetAllPaymentOptions(ctx, *issuerID) + assert.NoError(t, err) + assert.Len(t, opts, 10) + for i, opt := range opts { + assert.Equal(t, ids[i], opt.ID) + assert.Equal(t, fmt.Sprintf("name %d", len(opts)-i-1), opt.Name) + assert.Equal(t, fmt.Sprintf("description %d", len(opts)-i-1), opt.Description) + assert.Equal(t, paymentOptionConfig, opt.Config) + } + }) + t.Run("Get all payment options linked to non existing issuer", func(t *testing.T) { + opts, err := repo.GetAllPaymentOptions(ctx, *issuerDIDOther) + require.NoError(t, err) + assert.Len(t, opts, 0) + }) +} + +func TestPayment_GetPaymentOptionByID(t *testing.T) { + var paymentOptionConfig domain.PaymentOptionConfig + ctx := context.Background() + fixture := NewFixture(storage) + issuerID, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qWxoum8UEJzbUL1Ej9UWjGYHL8oL31BBLJ4ob8bmM") + require.NoError(t, err) + issuerDIDOther, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qYQdd1yqFyrM9ZPqYTE4WHAQH2PX5Rjtj7YDYPppj") + require.NoError(t, err) + + require.NoError(t, json.Unmarshal([]byte(paymentOptionTest), &paymentOptionConfig)) + + fixture.CreateIdentity(t, &domain.Identity{Identifier: issuerID.String()}) + repo := NewPayment(*storage) + id, err := repo.SavePaymentOption(ctx, domain.NewPaymentOption(*issuerID, "name", "description", &paymentOptionConfig)) + assert.NoError(t, err) + assert.NotEqual(t, uuid.Nil, id) + + t.Run("Get payment option", func(t *testing.T) { + opt, err := repo.GetPaymentOptionByID(ctx, issuerID, id) + assert.NoError(t, err) + assert.Equal(t, id, opt.ID) + assert.Equal(t, "name", opt.Name) + assert.Equal(t, "description", opt.Description) + assert.Equal(t, paymentOptionConfig, opt.Config) + }) + t.Run("Get payment option linked to non existing issuer", func(t *testing.T) { + opt, err := repo.GetPaymentOptionByID(ctx, issuerDIDOther, id) + require.Error(t, err) + assert.Nil(t, opt) + }) +} + +func TestPayment_DeletePaymentOption(t *testing.T) { + ctx := context.Background() + fixture := NewFixture(storage) + issuerID, err := w3c.ParseDID("did:iden3:privado:main:2Se8ZgrJDWycoKfH9JkBsCuEF127n3nk4G4YW7Dxjo") + require.NoError(t, err) + + fixture.CreateIdentity(t, &domain.Identity{Identifier: issuerID.String()}) + repo := NewPayment(*storage) + id, err := repo.SavePaymentOption(ctx, domain.NewPaymentOption(*issuerID, "name", "description", &domain.PaymentOptionConfig{})) + assert.NoError(t, err) + assert.NotEqual(t, uuid.Nil, id) + + opt, err := repo.GetPaymentOptionByID(ctx, issuerID, id) + assert.NoError(t, err) + assert.Equal(t, id, opt.ID) + + require.NoError(t, repo.DeletePaymentOption(ctx, *issuerID, id)) + + opt, err = repo.GetPaymentOptionByID(ctx, issuerID, id) + assert.Error(t, err) + assert.Nil(t, opt) +} + +func TestPayment_SavePaymentRequest(t *testing.T) { + ctx := context.Background() + fixture := NewFixture(storage) + issuerID, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qQHtVzfwjywqosK24XT7um3R1Ym5L1GJTbijjcxMq") + require.NoError(t, err) + + fixture.CreateIdentity(t, &domain.Identity{Identifier: issuerID.String()}) + repo := NewPayment(*storage) + + payymentOptionID, err := repo.SavePaymentOption(ctx, domain.NewPaymentOption(*issuerID, "name", "description", &domain.PaymentOptionConfig{})) + require.NoError(t, err) + + t.Run("Save payment to not existing payment option id", func(t *testing.T) { + id, err := repo.SavePaymentRequest(ctx, &domain.PaymentRequest{ + ID: uuid.New(), + IssuerDID: *issuerID, + RecipientDID: *issuerID, + Description: "this is a payment for cinema", + Credentials: []protocol.PaymentRequestInfoCredentials{{Context: "context", Type: "type"}}, + PaymentOptionID: uuid.New(), + Payments: []domain.PaymentRequestItem{}, + CreatedAt: time.Now(), + }) + assert.Error(t, err) + assert.Equal(t, uuid.Nil, id) + }) + t.Run("Save payment with empty Payments", func(t *testing.T) { + id, err := repo.SavePaymentRequest(ctx, &domain.PaymentRequest{ + ID: uuid.New(), + IssuerDID: *issuerID, + RecipientDID: *issuerID, + Description: "this is a payment for cinema", + Credentials: []protocol.PaymentRequestInfoCredentials{{Context: "context", Type: "type"}}, + PaymentOptionID: payymentOptionID, + Payments: nil, + CreatedAt: time.Now(), + }) + assert.NoError(t, err) + assert.NotEqual(t, uuid.Nil, id) + }) + t.Run("Save payment Happy path", func(t *testing.T) { + var payments []domain.PaymentRequestItem + paymentRequestID := uuid.New() + for i := 0; i < 10; i++ { + nonce := big.NewInt(rand.Int63()) + payments = append(payments, domain.PaymentRequestItem{ + ID: uuid.New(), + Nonce: *nonce, + PaymentRequestID: paymentRequestID, + Payment: protocol.Iden3PaymentRailsERC20RequestV1{ + Nonce: "123", + Type: protocol.Iden3PaymentRailsERC20RequestV1Type, + Context: protocol.NewPaymentContextString("https://schema.iden3.io/core/jsonld/payment.jsonld"), + Recipient: "did1", + Amount: "11", + // etc... + }, + PaymentOptionID: 6, + }, + ) + } + id, err := repo.SavePaymentRequest(ctx, &domain.PaymentRequest{ + ID: paymentRequestID, + IssuerDID: *issuerID, + RecipientDID: *issuerID, + Description: "this is a payment for cinema", + Credentials: []protocol.PaymentRequestInfoCredentials{{Context: "context", Type: "type"}}, + PaymentOptionID: payymentOptionID, + Payments: payments, + CreatedAt: time.Now(), + }) + assert.NoError(t, err) + assert.NotEqual(t, uuid.Nil, id) + }) +} + +// TestPayment_GetPaymentRequestByID tests the GetPaymentRequestByID method +func TestPayment_GetPaymentRequestByID(t *testing.T) { + ctx := context.Background() + fixture := NewFixture(storage) + repo := NewPayment(*storage) + issuerID, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qSrFwSvp8rLicBhUz4D21nZavGsZufBpjazwQHKmS") + require.NoError(t, err) + + fixture.CreateIdentity(t, &domain.Identity{Identifier: issuerID.String()}) + paymentOptionID, err := repo.SavePaymentOption(ctx, domain.NewPaymentOption(*issuerID, "name", "description", &domain.PaymentOptionConfig{})) + require.NoError(t, err) + expected := fixture.CreatePaymentRequest(t, *issuerID, *issuerID, paymentOptionID, 10) + + t.Run("Get payment request", func(t *testing.T) { + paymentRequest, err := repo.GetPaymentRequestByID(ctx, expected.IssuerDID, expected.ID) + require.NoError(t, err) + assert.Equal(t, expected.ID, paymentRequest.ID) + assert.Equal(t, expected.IssuerDID, paymentRequest.IssuerDID) + assert.Equal(t, expected.RecipientDID, paymentRequest.RecipientDID) + assert.Equal(t, expected.PaymentOptionID, paymentRequest.PaymentOptionID) + assert.InDelta(t, expected.CreatedAt.UnixMilli(), paymentRequest.CreatedAt.UnixMilli(), 1) + assert.Len(t, expected.Payments, len(paymentRequest.Payments)) + for i, expectedPayment := range expected.Payments { + assert.Equal(t, expectedPayment.ID, paymentRequest.Payments[i].ID) + assert.Equal(t, expectedPayment.Nonce, paymentRequest.Payments[i].Nonce) + assert.Equal(t, expectedPayment.PaymentRequestID, paymentRequest.Payments[i].PaymentRequestID) + assert.Equal(t, expectedPayment.Payment, paymentRequest.Payments[i].Payment) + assert.NotZero(t, paymentRequest.Payments[i].PaymentOptionID) + } + }) +} + +func TestPayment_GetPaymentRequestItem(t *testing.T) { + ctx := context.Background() + fixture := NewFixture(storage) + issuerID, err := w3c.ParseDID("did:polygonid:polygon:amoy:2qX7mBeonrp5u7GapztqjYZTdLsv9XBhyXgjYQGjgi") + require.NoError(t, err) + + fixture.CreateIdentity(t, &domain.Identity{Identifier: issuerID.String()}) + repo := NewPayment(*storage) + + payymentOptionID, err := repo.SavePaymentOption(ctx, domain.NewPaymentOption(*issuerID, "name", "description", &domain.PaymentOptionConfig{})) + require.NoError(t, err) + expected := fixture.CreatePaymentRequest(t, *issuerID, *issuerID, payymentOptionID, 10) + + t.Run("Get payment request item", func(t *testing.T) { + paymentRequestItem, err := repo.GetPaymentRequestItem(ctx, *issuerID, &expected.Payments[0].Nonce) + require.NoError(t, err) + assert.Equal(t, expected.Payments[0].ID, paymentRequestItem.ID) + }) +} diff --git a/internal/repositories/schema-inmemory.go b/internal/repositories/schema-inmemory.go index f7d896e38..d5c67544d 100644 --- a/internal/repositories/schema-inmemory.go +++ b/internal/repositories/schema-inmemory.go @@ -13,6 +13,10 @@ type schemaInMemory struct { schemas map[uuid.UUID]domain.Schema } +func (s *schemaInMemory) Update(ctx context.Context, schema *domain.Schema) error { + return s.Save(ctx, schema) +} + // NewSchemaInMemory returns schemaRepository implemented in memory convenient for testing func NewSchemaInMemory() *schemaInMemory { return &schemaInMemory{schemas: make(map[uuid.UUID]domain.Schema)} diff --git a/internal/repositories/schema.go b/internal/repositories/schema.go index 264e38807..39915e848 100644 --- a/internal/repositories/schema.go +++ b/internal/repositories/schema.go @@ -27,6 +27,7 @@ type dbSchema struct { IssuerID string URL string Type string + ContextURL string Version string Title *string Description *string @@ -46,7 +47,7 @@ func NewSchema(conn db.Storage) *schema { // Save stores a new entry in schemas table func (r *schema) Save(ctx context.Context, s *domain.Schema) error { - const insertSchema = `INSERT INTO schemas (id, issuer_id, url, type, hash, words, created_at,version,title,description) VALUES($1, $2::text, $3::text, $4::text, $5::text, $6::text, $7, $8::text,$9::text,$10::text);` + const insertSchema = `INSERT INTO schemas (id, issuer_id, url, type, context_url, hash, words, created_at, version, title, description) VALUES($1, $2, $3, $4, $5, $6, $7, $8,$9,$10,$11);` hash, err := s.Hash.MarshalText() if err != nil { return err @@ -58,6 +59,7 @@ func (r *schema) Save(ctx context.Context, s *domain.Schema) error { s.IssuerDID.String(), s.URL, s.Type, + s.ContextURL, string(hash), r.toFullTextSearchDocument(s.Type, s.Words), s.CreatedAt, @@ -72,7 +74,38 @@ func (r *schema) Save(ctx context.Context, s *domain.Schema) error { return err } + return nil +} +func (r *schema) Update(ctx context.Context, s *domain.Schema) error { + const updateSchema = ` +UPDATE schemas +SET issuer_id=$2, url=$3, type=$4, context_url=$5, hash=$6, words=$7, created_at=$8, version=$9, title=$10, description=$11 +WHERE schemas.id = $1;` + hash, err := s.Hash.MarshalText() + if err != nil { + return err + } + cmd, err := r.conn.Pgx.Exec( + ctx, + updateSchema, + s.ID, + s.IssuerDID.String(), + s.URL, + s.Type, + s.ContextURL, + string(hash), + r.toFullTextSearchDocument(s.Type, s.Words), + s.CreatedAt, + s.Version, + s.Title, + s.Description) + if err != nil { + return err + } + if cmd.RowsAffected() == 0 { + return ErrSchemaDoesNotExist + } return nil } @@ -89,7 +122,7 @@ func (r *schema) GetAll(ctx context.Context, issuerDID w3c.DID, query *string) ( var err error var rows pgx.Rows sqlArgs := make([]interface{}, 0) - sqlQuery := `SELECT id, issuer_id, url, type, words, hash, created_at,version,title,description + sqlQuery := `SELECT id, issuer_id, url, type, context_url, words, hash, created_at,version,title,description FROM schemas WHERE issuer_id=$1` sqlArgs = append(sqlArgs, issuerDID.String()) @@ -110,7 +143,7 @@ func (r *schema) GetAll(ctx context.Context, issuerDID w3c.DID, query *string) ( schemaCol := make([]domain.Schema, 0) s := dbSchema{} for rows.Next() { - if err := rows.Scan(&s.ID, &s.IssuerID, &s.URL, &s.Type, &s.Words, &s.Hash, &s.CreatedAt, &s.Version, &s.Title, &s.Description); err != nil { + if err := rows.Scan(&s.ID, &s.IssuerID, &s.URL, &s.Type, &s.ContextURL, &s.Words, &s.Hash, &s.CreatedAt, &s.Version, &s.Title, &s.Description); err != nil { return nil, err } item, err := toSchemaDomain(&s) @@ -124,14 +157,14 @@ func (r *schema) GetAll(ctx context.Context, issuerDID w3c.DID, query *string) ( // GetByID searches and returns an schema by id func (r *schema) GetByID(ctx context.Context, issuerDID w3c.DID, id uuid.UUID) (*domain.Schema, error) { - const byID = `SELECT id, issuer_id, url, type, words, hash, created_at,version,title,description + const byID = `SELECT id, issuer_id, url, type, context_url, words, hash, created_at,version,title,description FROM schemas WHERE issuer_id = $1 AND id=$2` s := dbSchema{} row := r.conn.Pgx.QueryRow(ctx, byID, issuerDID.String(), id) - err := row.Scan(&s.ID, &s.IssuerID, &s.URL, &s.Type, &s.Words, &s.Hash, &s.CreatedAt, &s.Version, &s.Title, &s.Description) - if err == pgx.ErrNoRows { + err := row.Scan(&s.ID, &s.IssuerID, &s.URL, &s.Type, &s.ContextURL, &s.Words, &s.Hash, &s.CreatedAt, &s.Version, &s.Title, &s.Description) + if errors.Is(err, pgx.ErrNoRows) { return nil, ErrSchemaDoesNotExist } if err != nil { @@ -154,6 +187,7 @@ func toSchemaDomain(s *dbSchema) (*domain.Schema, error) { IssuerDID: *issuerDID, URL: s.URL, Type: s.Type, + ContextURL: s.ContextURL, Hash: schemaHash, Words: domain.SchemaWordsFromString(s.Words), CreatedAt: s.CreatedAt, diff --git a/k8s/helm/templates/issuer-node-api-configmap.yaml b/k8s/helm/templates/issuer-node-api-configmap.yaml index 6f94f9372..085a4411a 100644 --- a/k8s/helm/templates/issuer-node-api-configmap.yaml +++ b/k8s/helm/templates/issuer-node-api-configmap.yaml @@ -32,5 +32,4 @@ data: ISSUER_CREDENTIAL_STATUS_PUBLISHING_KEY_PATH : {{ .Values.apiIssuerNode.configMap.issuerCredentialStatusPublishingKeyPath | quote }} ISSUER_RESOLVER_FILE : {{ .Values.issuerResolverFile | quote }} ISSUER_KMS_PROVIDER_LOCAL_STORAGE_FILE_PATH: {{ .Values.apiIssuerNode.configMap.issuerKMSProviderLocalStorageFilePath | quote }} - - \ No newline at end of file + ISSUER_PAYMENTS_SETTINGS_FILE: {{ .Values.apiIssuerNode.configMap.issuerPaymentsSettingsFile | quote }} \ No newline at end of file diff --git a/k8s/helm/values.yaml b/k8s/helm/values.yaml index 2d4032bd0..e74966ded 100644 --- a/k8s/helm/values.yaml +++ b/k8s/helm/values.yaml @@ -68,6 +68,7 @@ apiIssuerNode: issuerCredentialStatusPublishingKeyPath: pbkey issuerIpfsGatewayUrl: https://gateway.pinata.cloud issuerKMSProviderLocalStorageFilePath: /localstoragekeys + issuerPaymentsSettingsFile: "ODAwMDI6CiAgUGF5bWVudFJhaWxzOiAweEY4RTQ5YjkyMkQ1RmIwMGQzRWREMTJiZDE0MDY0ZjI3NTcyNkQzMzkKICBQYXltZW50T3B0aW9uczoKICAgIC0gSUQ6IDEKICAgICAgTmFtZTogQW1veU5hdGl2ZQogICAgICBUeXBlOiBJZGVuM1BheW1lbnRSYWlsc1JlcXVlc3RWMQogICAgLSBJRDogMgogICAgICBOYW1lOiBBbW95IFVTRFQKICAgICAgVHlwZTogSWRlbjNQYXltZW50UmFpbHNFUkMyMFJlcXVlc3RWMQogICAgICBDb250cmFjdEFkZHJlc3M6IDB4NzFkY2M4RGM1RWIxMzgwMDNkMzU3MTI1NTQ1OEJjNTY5MmE2MGVENAogICAgICBGZWF0dXJlczogW10KICAgIC0gSUQ6IDMKICAgICAgTmFtZTogQW1veSBVU0RDCiAgICAgIFR5cGU6IElkZW4zUGF5bWVudFJhaWxzRVJDMjBSZXF1ZXN0VjEKICAgICAgQ29udHJhY3RBZGRyZXNzOiAweDcxZGNjOERjNUViMTM4MDAzZDM1NzEyNTU0NThCYzU2OTJhNjBlRDQKICAgICAgRmVhdHVyZXM6CiAgICAgICAgLSBFSVAtMjYxMgo1OTE0MToKICBQYXltZW50UmFpbHM6IDB4NDBFM0VGMjIxQUE5M0Y2RmU5OTdjOWIwMzkzMzIyODIzQmIyMDdkMwogIFBheW1lbnRPcHRpb25zOgogICAgLSBJRDogNAogICAgICBOYW1lOiBMaW5lYVNlcG9saWFOYXRpdmUKICAgICAgVHlwZTogSWRlbjNQYXltZW50UmFpbHNSZXF1ZXN0VjEKICAgIC0gSUQ6IDUKICAgICAgTmFtZTogTGluZWEgU2Vwb2xpYSBVU0RUCiAgICAgIFR5cGU6IElkZW4zUGF5bWVudFJhaWxzRVJDMjBSZXF1ZXN0VjEKICAgICAgQ29udHJhY3RBZGRyZXNzOiAweGIwMTAxYzFGZmRkMTIxM0I4ODZGZWJlRjZGMDc0NDJlNDg5OTBjOUMKICAgICAgRmVhdHVyZXM6IFtdCiAgICAtIElEOiA2CiAgICAgIE5hbWU6IExpbmVhIFNlcG9saWEgVVNEQwogICAgICBUeXBlOiBJZGVuM1BheW1lbnRSYWlsc0VSQzIwUmVxdWVzdFYxCiAgICAgIENvbnRyYWN0QWRkcmVzczogMHhiMDEwMWMxRmZkZDEyMTNCODg2RmViZUY2RjA3NDQyZTQ4OTkwYzlDCiAgICAgIEZlYXR1cmVzOgogICAgICAgIC0gRUlQLTI2MTIKMjQ0MjoKICBQYXltZW50UmFpbHM6IDB4MDljMjY5ZTc0ZDhCNDdjOTg1MzdBY2Q2Q2JFZTgwNTY4MDZGNGM3MAogIFBheW1lbnRPcHRpb25zOgogICAgLSBJRDogNwogICAgICBOYW1lOiBaa0V2bU5hdGl2ZQogICAgICBUeXBlOiBJZGVuM1BheW1lbnRSYWlsc1JlcXVlc3RWMQogICAgLSBJRDogOAogICAgICBOYW1lOiBaa0V2bSBVU0RUCiAgICAgIFR5cGU6IElkZW4zUGF5bWVudFJhaWxzRVJDMjBSZXF1ZXN0VjEKICAgICAgQ3VycmVuY3k6IFVTRFQKICAgICAgQ29udHJhY3RBZGRyZXNzOiAweDk4NmNhRTZBRGNGNWRhMmExNTE0YWZjNzMxN0ZCZGVFMEI0MDQ4RGIKICAgICAgRmVhdHVyZXM6IFtdCiAgICAtIElEOiA5CiAgICAgIE5hbWU6IFprRXZtIFVTREMKICAgICAgVHlwZTogSWRlbjNQYXltZW50UmFpbHNFUkMyMFJlcXVlc3RWMQogICAgICBDb250cmFjdEFkZHJlc3M6IDB4OTg2Y2FFNkFEY0Y1ZGEyYTE1MTRhZmM3MzE3RkJkZUUwQjQwNDhEYgogICAgICBGZWF0dXJlczoKICAgICAgICAtIEVJUC0yNjEy" notificationsIssuerNode: deployment: diff --git a/k8s/testing/branches.txt b/k8s/testing/branches.txt index 5f8221642..9975325ae 100644 --- a/k8s/testing/branches.txt +++ b/k8s/testing/branches.txt @@ -1 +1 @@ -add_key_endpoint=add-key-endpoint \ No newline at end of file +feat/multichain-payment=multichain-payment \ No newline at end of file diff --git a/k8s/testing/values.yaml b/k8s/testing/values.yaml index e4f3207d6..6bc541ff3 100644 --- a/k8s/testing/values.yaml +++ b/k8s/testing/values.yaml @@ -68,6 +68,7 @@ apiIssuerNode: issuerVaultUserpassAuthEnabled: "true" issuerCredentialStatusPublishingKeyPath: pbkey issuerIpfsGatewayUrl: https://gateway.pinata.cloud + issuerPaymentsSettingsFile: "ODAwMDI6CiAgUGF5bWVudFJhaWxzOiAweEY4RTQ5YjkyMkQ1RmIwMGQzRWREMTJiZDE0MDY0ZjI3NTcyNkQzMzkKICBQYXltZW50T3B0aW9uczoKICAgIC0gSUQ6IDEKICAgICAgTmFtZTogQW1veU5hdGl2ZQogICAgICBUeXBlOiBJZGVuM1BheW1lbnRSYWlsc1JlcXVlc3RWMQogICAgLSBJRDogMgogICAgICBOYW1lOiBBbW95IFVTRFQKICAgICAgVHlwZTogSWRlbjNQYXltZW50UmFpbHNFUkMyMFJlcXVlc3RWMQogICAgICBDb250cmFjdEFkZHJlc3M6IDB4NzFkY2M4RGM1RWIxMzgwMDNkMzU3MTI1NTQ1OEJjNTY5MmE2MGVENAogICAgICBGZWF0dXJlczogW10KICAgIC0gSUQ6IDMKICAgICAgTmFtZTogQW1veSBVU0RDCiAgICAgIFR5cGU6IElkZW4zUGF5bWVudFJhaWxzRVJDMjBSZXF1ZXN0VjEKICAgICAgQ29udHJhY3RBZGRyZXNzOiAweDcxZGNjOERjNUViMTM4MDAzZDM1NzEyNTU0NThCYzU2OTJhNjBlRDQKICAgICAgRmVhdHVyZXM6CiAgICAgICAgLSBFSVAtMjYxMgo1OTE0MToKICBQYXltZW50UmFpbHM6IDB4NDBFM0VGMjIxQUE5M0Y2RmU5OTdjOWIwMzkzMzIyODIzQmIyMDdkMwogIFBheW1lbnRPcHRpb25zOgogICAgLSBJRDogNAogICAgICBOYW1lOiBMaW5lYVNlcG9saWFOYXRpdmUKICAgICAgVHlwZTogSWRlbjNQYXltZW50UmFpbHNSZXF1ZXN0VjEKICAgIC0gSUQ6IDUKICAgICAgTmFtZTogTGluZWEgU2Vwb2xpYSBVU0RUCiAgICAgIFR5cGU6IElkZW4zUGF5bWVudFJhaWxzRVJDMjBSZXF1ZXN0VjEKICAgICAgQ29udHJhY3RBZGRyZXNzOiAweGIwMTAxYzFGZmRkMTIxM0I4ODZGZWJlRjZGMDc0NDJlNDg5OTBjOUMKICAgICAgRmVhdHVyZXM6IFtdCiAgICAtIElEOiA2CiAgICAgIE5hbWU6IExpbmVhIFNlcG9saWEgVVNEQwogICAgICBUeXBlOiBJZGVuM1BheW1lbnRSYWlsc0VSQzIwUmVxdWVzdFYxCiAgICAgIENvbnRyYWN0QWRkcmVzczogMHhiMDEwMWMxRmZkZDEyMTNCODg2RmViZUY2RjA3NDQyZTQ4OTkwYzlDCiAgICAgIEZlYXR1cmVzOgogICAgICAgIC0gRUlQLTI2MTIKMjQ0MjoKICBQYXltZW50UmFpbHM6IDB4MDljMjY5ZTc0ZDhCNDdjOTg1MzdBY2Q2Q2JFZTgwNTY4MDZGNGM3MAogIFBheW1lbnRPcHRpb25zOgogICAgLSBJRDogNwogICAgICBOYW1lOiBaa0V2bU5hdGl2ZQogICAgICBUeXBlOiBJZGVuM1BheW1lbnRSYWlsc1JlcXVlc3RWMQogICAgLSBJRDogOAogICAgICBOYW1lOiBaa0V2bSBVU0RUCiAgICAgIFR5cGU6IElkZW4zUGF5bWVudFJhaWxzRVJDMjBSZXF1ZXN0VjEKICAgICAgQ3VycmVuY3k6IFVTRFQKICAgICAgQ29udHJhY3RBZGRyZXNzOiAweDk4NmNhRTZBRGNGNWRhMmExNTE0YWZjNzMxN0ZCZGVFMEI0MDQ4RGIKICAgICAgRmVhdHVyZXM6IFtdCiAgICAtIElEOiA5CiAgICAgIE5hbWU6IFprRXZtIFVTREMKICAgICAgVHlwZTogSWRlbjNQYXltZW50UmFpbHNFUkMyMFJlcXVlc3RWMQogICAgICBDb250cmFjdEFkZHJlc3M6IDB4OTg2Y2FFNkFEY0Y1ZGEyYTE1MTRhZmM3MzE3RkJkZUUwQjQwNDhEYgogICAgICBGZWF0dXJlczoKICAgICAgICAtIEVJUC0yNjEy" notificationsIssuerNode: deployment: diff --git a/payment_settings.sample.yaml b/payment_settings.sample.yaml new file mode 100644 index 000000000..7c73c6b24 --- /dev/null +++ b/payment_settings.sample.yaml @@ -0,0 +1,53 @@ +80002: + PaymentRails: 0xF8E49b922D5Fb00d3EdD12bd14064f275726D339 + PaymentOptions: + - ID: 1 + Name: AmoyNative + Type: Iden3PaymentRailsRequestV1 + - ID: 2 + Name: Amoy USDT + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x2FE40749812FAC39a0F380649eF59E01bccf3a1A + Features: [] + - ID: 3 + Name: Amoy USDC + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x2FE40749812FAC39a0F380649eF59E01bccf3a1A + Features: + - EIP-2612 +59141: + PaymentRails: 0x40E3EF221AA93F6Fe997c9b0393322823Bb207d3 + PaymentOptions: + - ID: 4 + Name: LineaSepoliaNative + Type: Iden3PaymentRailsRequestV1 + - ID: 5 + Name: Linea Sepolia USDT + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0xb0101c1Ffdd1213B886FebeF6F07442e48990c9C + Features: [] + - ID: 6 + Name: Linea Sepolia USDC + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0xb0101c1Ffdd1213B886FebeF6F07442e48990c9C + Features: + - EIP-2612 +2442: + PaymentRails: 0x09c269e74d8B47c98537Acd6CbEe8056806F4c70 + PaymentOptions: + - ID: 7 + Name: ZkEvmNative + Type: Iden3PaymentRailsRequestV1 + - ID: 8 + Name: ZkEvm USDT + Type: Iden3PaymentRailsERC20RequestV1 + Currency: USDT + ContractAddress: 0x986caE6ADcF5da2a1514afc7317FBdeE0B4048Db + Features: [] + - ID: 9 + Name: ZkEvm USDC + Type: Iden3PaymentRailsERC20RequestV1 + ContractAddress: 0x986caE6ADcF5da2a1514afc7317FBdeE0B4048Db + Features: + - EIP-2612 +