diff --git a/docker-compose/README.md b/docker-compose/README.md index f7777037..987d6d78 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -3,14 +3,10 @@ This is the docker-compose setup to run - **mimoto-service** which act as BFF for Inji mobile and backend for Inji web. -- **inji-web** and **inji-web-proxy** for frontend +- **inji-web** for frontend This is not for production use. -## Navigate to inji-web-proxy folder and Build the inji-web-proxy image locally. - -> cd inji-web-proxy && docker build -t inji-web-proxy:local . - ## Navigate to inji-web folder and Build the inji-web image locally. > docker build -t inji-web:local . @@ -29,9 +25,7 @@ This is not for production use. 3. Start esignet services (authorisation server) or use existing esignet service deployed on cloud and update esignet host references in mimoto-default.properties and mimoto-issuers-config.json -4. Start the data share services and update data share host references in mimoto-default.properties. data share service helm is available in the [Inji Web Helm](https://github.com/mosip/inji-web/tree/release-0.10.x/helm/inji-web) - -5. Create certs folder in the same directory and create OIDC client. Add key in oidckeystore.p12 and copy this file under certs folder. +4. Create certs folder in the same directory and create OIDC client. Add key in oidckeystore.p12 and copy this file under certs folder. Replace oidc_p12_password environment variable value by password provided in documentation. Refer [here](https://docs.mosip.io/inji/inji-mobile-wallet/customization-overview/credential_providers) to create client * Update client_id and client_alias as per onboarding in mimoto-issuers-config.json file. diff --git a/docker-compose/config/data-share-inji-default.properties b/docker-compose/config/data-share-inji-default.properties new file mode 100644 index 00000000..ac669265 --- /dev/null +++ b/docker-compose/config/data-share-inji-default.properties @@ -0,0 +1,64 @@ +# Follow properites have their values assigned via 'overrides' environment variables of config server docker. +# DO NOT define these in any of the property files. They must be passed as env variables. Refer to config-server +# helm chart: +# keycloak.external.host +# keycloak.external.url +# keycloak.internal.host +# keycloak.internal.url +# mosip.datsha.client.secret +# s3.accesskey +# s3.region +# s3.secretkey + +mosip.data.share.service.id=mosip.data.share +mosip.data.share.service.version=1.0 + +CRYPTOMANAGER_ENCRYPT=${mosip.kernel.keymanager.url}/v1/keymanager/encrypt +KEYMANAGER_JWTSIGN=${mosip.kernel.keymanager.url}/v1/keymanager/jwtSign +PARTNER_POLICY=${mosip.pms.policymanager.url}/v1/policymanager/policies/{policyId}/partner/{partnerId} +KEYBASEDTOKENAPI=${mosip.kernel.authmanager.url}/v1/authmanager/authenticate/clientidsecretkey + + +data.share.application.id=PARTNER +mosip.data.share.datetime.pattern=yyyy-MM-dd'T'HH:mm:ss.SSS'Z' +!-- if value is true then please set servlet path to / --! +mosip.data.share.urlshortner=false +data.share.token.request.appid=datsha +data.share.token.request.clientId=mosip-datsha-client +data.share.token.request.secretKey=${mosip.datsha.client.secret} +data.share.token.request.password= +data.share.token.request.username= +data.share.token.request.version=1.0 +data.share.token.request.id=io.mosip.datashare +data.share.token.request.issuerUrl=${keycloak.internal.url}/auth/realms/mosip +spring.servlet.multipart.max-file-size=14MB +mosip.data.share.protocol=http +mosip.data.share.includeCertificateHash=false +mosip.data.share.includeCertificate=false +mosip.data.share.includePayload=false +mosip.data.share.digest.algorithm=SHA256 +mosip.data.share.prependThumbprint=false +mosip.role.durian.postcreatepolicyidsubscriberid=CREATE_SHARE +auth.server.admin.allowed.audience=mosip-creser-client,mpartner-default-auth,mosip-regproc-client,mosip-reg-client,mosip-syncdata-client,mpartner-default-print,mosip-resident-client,opencrvs-partner,mosip-pms-client,mpartner-default-digitalcard,mosip-admin-client,mosip-abis-client,mpartner-default-mobile + +mosip.auth.filter_disable=false + +# Object store +object.store.s3.accesskey=minioadmin +object.store.s3.secretkey=minioadmin +object.store.s3.url=http://minio-service:9000 +object.store.s3.region=us-east-1 +object.store.s3.readlimit=10000000 + +#specific to Compliance Toolkit, to ABIS DataShare testcases +auth.handle.ctk.flow=true +mosip.api.internal.toolkit.url=https://${mosip.api.internal.host}/v1/toolkit +mosip.compliance.toolkit.saveDataShareToken.url=${mosip.api.internal.toolkit.url}/saveDataShareToken +mosip.compliance.toolkit.invalidateDataShareToken.url=${mosip.api.internal.toolkit.url}/invalidateDataShareToken +mosip.compliance.toolkit.invalidateDataShareToken.testCaseId=ABIS3031 +logging.level.org.springframework.web: DEBUG +#cache schedular +mosip.data.share.policy-cache.expiry-time-millisec=7200000 + +mosip.auth.adapter.impl.basepackage=io.mosip.kernel.auth.defaultadapter +mosip.pms.policymanager.url=http://pms-policy.pms diff --git a/docker-compose/config/data-share-standalone.properties b/docker-compose/config/data-share-standalone.properties new file mode 100644 index 00000000..52134774 --- /dev/null +++ b/docker-compose/config/data-share-standalone.properties @@ -0,0 +1,15 @@ +# Enables the data-share application in standalone mode. +mosip.data.share.standalone.mode.enabled=true +# Defines the policy json which will be taken into consideration if +# "mosip.data.share.standalone.mode.enabled" is set as true. +# If we are using "encryptionType" as "Partner based" then subscriberId must be a valid subscriberId +# i.e. should exist in system. +mosip.data.share.static-policy.policy-json={"typeOfShare":"","transactionsAllowed":"250","shareDomain":"datashare-service:8097","encryptionType":"NONE","source":"","validForInMinutes":"30"} +# Defines the policyId which will be taken into consideration if " +# mosip.data.share.standalone.mode.enabled" is set as true. +mosip.data.share.static-policy.policy-id=static-policyid +# Defines the subscriberId which will be taken into consideration if +# "mosip.data.share.standalone.mode.enabled" is set as true. +mosip.data.share.static-policy.subscriber-id=static-subscriberid +# Disables JWT signature computation while storing object in object store. +mosip.data.share.signature.disabled=true \ No newline at end of file diff --git a/docker-compose/config/mimoto-default.properties b/docker-compose/config/mimoto-default.properties index d1f0c7a9..86c4704a 100644 --- a/docker-compose/config/mimoto-default.properties +++ b/docker-compose/config/mimoto-default.properties @@ -30,7 +30,7 @@ mosip.inji.warningDomainName=${mosip.api.public.url} #timeout for vc download api via openid4vci flow in milliseconds mosip.inji.openId4VCIDownloadVCTimeout=30000 # inji documentation url -mosip.inji.aboutInjiUrl=https://docs.mosip.io/inji/inji-mobile-wallet/overview +mosip.inji.aboutInjiUrl=https://docs.inji.io/inji-wallet/inji-mobile # minimum storage space required for making audit entry in MB mosip.inji.minStorageRequiredForAuditEntry=2 # minimum storage space required for downloading / receiving vc in MB @@ -260,7 +260,7 @@ mosip.openid.issuers=mimoto-issuers-config.json mosip.openid.htmlTemplate=credential-template.html mosip.oidc.client.assertion.type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer mosip.oidc.p12.filename=oidckeystore.p12 -mosip.oidc.p12.password=mosip123 +mosip.oidc.p12.password=${oidc_p12_password} mosip.oidc.p12.path=certs/ @@ -270,21 +270,20 @@ mosip.oidc.p12.path=certs/ mosip.openid.verifiers=mimoto-trusted-verifiers.json #Inji Web Config -mosip.inji.web.url=https://injiweb.collab.mosip.net -mosip.inji.web.redirect.url=https://injiweb.collab.mosip.net/authorize +mosip.inji.web.url=http://localhost:3004 +mosip.inji.web.redirect.url=${mosip.inji.web.url}/authorize mosip.inji.qr.data.size.limit=10000 mosip.inji.qr.code.height=650 mosip.inji.qr.code.width=650 #OVP Config -mosip.inji.ovp.qrdata.pattern=INJI_OVP://https://injiweb.collab.mosip.net/authorize?response_type=vp_token&resource=%s&presentation_definition=%s +mosip.inji.ovp.qrdata.pattern=INJI_OVP://http://localhost:${server.port}/v1/mimoto/authorize?response_type=vp_token&resource=%s&presentation_definition=%s mosip.inji.ovp.redirect.url.pattern=%s#vp_token=%s&presentation_submission=%s mosip.inji.ovp.error.redirect.url.pattern=%s?error=%s&error_description=%s #DataShare Config -mosip.data.share.url=https://datashare-inji.collab.mosip.net -mosip.data.share.create.url=https://datashare-inji.collab.mosip.net/v1/datashare/create/static-policyid/static-subscriberid +mosip.data.share.url=http://datashare-service:8097 +mosip.data.share.create.url=http://datashare-service:8097/v1/datashare/create/static-policyid/static-subscriberid +mosip.data.share.get.url.pattern=http://datashare-service:8097/v1/datashare/get/static-policyid/static-subscriberid/* mosip.data.share.create.retry.count=3 -mosip.data.share.get.url.pattern=https://datashare-inji.collab.mosip.net/v1/datashare/get/static-policyid/static-subscriberid/* - #OpenId4VP related Configuration END diff --git a/docker-compose/config/mimoto-issuers-config.json b/docker-compose/config/mimoto-issuers-config.json index b0570ebf..8e9defa2 100644 --- a/docker-compose/config/mimoto-issuers-config.json +++ b/docker-compose/config/mimoto-issuers-config.json @@ -1,85 +1,7 @@ { "issuers": [ { - "issuer_id": "Mosip", - "protocol": "OpenId4VCI", - "display": [ - { - "name": "National Identity Department", - "logo": { - "url": "https://api.collab.mosip.net/inji/mosip-logo.png", - "alt_text": "mosip-logo" - }, - "title": "National Identity Department", - "description": "Download MOSIP National / Foundational Identity Credential", - "language": "en" - }, - { - "name": "دائرة الهوية الوطنية", - "logo": { - "url": "https://api.collab.mosip.net/inji/mosip-logo.png", - "alt_text": "شعار موسيب" - }, - "title": "دائرة الهوية الوطنية", - "description": "قم بتنزيل بيانات اعتماد الهوية الوطنية / التأسيسية MOSIP", - "language": "ar" - }, - { - "name": "राष्ट्रीय पहचान विभाग", - "logo": { - "url": "https://api.collab.mosip.net/inji/mosip-logo.png", - "alt_text": "मोसिप लोगो" - }, - "title": "राष्ट्रीय पहचान विभाग", - "description": "MOSIP नेशनल/फाउंडेशनल आइडेंटिटी क्रेडेंशियल डाउनलोड करेंं", - "language": "hi" - }, - { - "name": "ರಾಷ್ಟ್ರೀಯ ಗುರುತಿನ ಇಲಾಖೆ", - "logo": { - "url": "https://api.collab.mosip.net/inji/mosip-logo.png", - "alt_text": "mosip ಲೋಗೋ" - }, - "title": "ರಾಷ್ಟ್ರೀಯ ಗುರುತಿನ ಇಲಾಖೆ", - "description": "MOSIP ರಾಷ್ಟ್ರೀಯ / ಫೌಂಡೇಶನಲ್ ಐಡೆಂಟಿಟಿ ರುಜುವಾತು ಡೌನ್‌ಲೋಡ್ ಮಾಡಿ", - "language": "kn" - }, - { - "name": "தேசிய அடையாளத் துறை", - "logo": { - "url": "https://api.collab.mosip.net/inji/mosip-logo.png", - "alt_text": "mosip லோகோ" - }, - "title": "தேசிய அடையாளத் துறை", - "description": "MOSIP தேசிய / அடிப்படை அடையாளச் சான்றிதழைப் பதிவிறக்கவும்", - "language": "ta" - }, - { - "name": "National Identity Department", - "logo": { - "url": "https://api.collab.mosip.net/inji/mosip-logo.png", - "alt_text": "logo ng mosip" - }, - "title": "National Identity Department", - "description": "I-download ang MOSIP National / Foundational Identity Credential", - "language": "fil" - } - ], - "client_id": "XusU7P1y10lMr9NA1qnrny_fqynODwV4SCvWPP8cfdY", - "redirect_uri": "io.mosip.residentapp.inji://oauthredirect", - "token_endpoint": "https://api.collab.mosip.net/v1/mimoto/get-token/Mosip", - "authorization_audience": "https://esignet-insurance.collab.mosip.net/v1/esignet/oauth/v2/token", - "proxy_token_endpoint": "https://esignet-mosipid.collab.mosip.net/v1/esignet/oauth/v2/token", - "client_alias": "mpartner-default-test-mosipid", - "qr_code_type": "OnlineSharing", - "wellknown_endpoint": "https://injicertify-mosipid.collab.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer", - "credential_issuer": "https://injicertify-mosipid.collab.mosip.net", - "enabled": "true" - - }, - { - "issuer_id": "StayProtected", - "protocol": "OpenId4VCI", + "credential_issuer": "StayProtected", "display": [ { "name": "StayProtected Insurance", @@ -87,47 +9,21 @@ "url": "https://raw.githubusercontent.com/tw-mosip/file-server/master/StayProtectedInsurance.png", "alt_text": "a square logo of a Sunbird" }, + "language": "en", "title": "Download StayProtected Insurance Credentials", - "description": "Download insurance credential", - "language": "en" + "description": "Download insurance credential" } ], - "client_id": "esignet-sunbird-partner", - "redirect_uri": "io.mosip.residentapp.inji://oauthredirect", - "token_endpoint": "https://api.dev1.mosip.net/v1/mimoto/get-token/StayProtected", - "authorization_audience": "https://esignet-insurance.dev1.mosip.net/v1/esignet/oauth/v2/token", - "proxy_token_endpoint": "https://esignet-insurance.dev1.mosip.net/v1/esignet/oauth/v2/token", - "client_alias": "esignet-sunbird-partner", - "qr_code_type": "OnlineSharing", - "wellknown_endpoint": "https://injicertify-insurance.dev1.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer", - "credential_issuer": "https://injicertify-insurance.dev1.mosip.net", - "enabled": "true" - }, - { - "issuer_id": "Mock", "protocol": "OpenId4VCI", - "display": [ - { - "name": "Mock Identity", - "logo": { - "url": "https://api.collab.mosip.net/inji/mosip-logo.png", - "alt_text": "mosip-logo" - }, - "title": "Mock Identity", - "description": "Download Mock Identity Credential", - "language": "en" - } - ], - "client_id": "mpartner-mock-testing", + "client_id": "wallet-demo", + "client_alias": "wallet-demo-client", + "wellknown_endpoint": "https://injicertify-insurance.collab.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer", "redirect_uri": "io.mosip.residentapp.inji://oauthredirect", - "token_endpoint": "https://api.collab.mosip.net/v1/mimoto/get-token/Mock", "authorization_audience": "https://esignet-insurance.collab.mosip.net/v1/esignet/oauth/v2/token", - "proxy_token_endpoint": "https://esignet-mock.collab.mosip.net/v1/esignet/oauth/v2/token", - "client_alias": "mpartner-mock-testing", + "token_endpoint": "https://localhost:8099/v1/mimoto/get-token/StayProtected", + "proxy_token_endpoint": "https://esignet-insurance.collab.mosip.net/v1/esignet/oauth/v2/token", "qr_code_type": "OnlineSharing", - "wellknown_endpoint": "https://injicertify-mock.collab.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer", - "credential_issuer": "https://injicertify-mock.collab.mosip.net", "enabled": "true" } ] -} +} \ No newline at end of file diff --git a/docker-compose/config/mimoto-trusted-verifiers.json b/docker-compose/config/mimoto-trusted-verifiers.json index 0ae0f141..15694ddf 100644 --- a/docker-compose/config/mimoto-trusted-verifiers.json +++ b/docker-compose/config/mimoto-trusted-verifiers.json @@ -2,7 +2,7 @@ "verifiers": [ { "client_id": "https://injiverify.collab.mosip.net", - "redirect_uri": [ + "redirect_uris": [ "https://injiverify.collab.mosip.net/redirect" ] } diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index f83e5fd9..061d34a6 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -2,9 +2,34 @@ version: '3.8' services: + minio: + container_name: 'minio-service' + image: bitnami/minio:2022.2.7-debian-10-r0 + ports: + - "9001:9001" + - "9000:9000" + environment: + MINIO_ROOT_USER: minioadmin # Access Key + MINIO_ROOT_PASSWORD: minioadmin # Secret Key + + datashare: + container_name: 'datashare-service' + image: mosipqa/data-share-service:1.3.x + ports: + - "8097:8097" + environment: + - active_profile_env=inji-default,standalone + - SPRING_CONFIG_NAME=data-share + - SPRING_CONFIG_LOCATION=/home/mosip/ + volumes: + - ./config/data-share-inji-default.properties:/home/mosip/data-share-inji-default.properties + - ./config/data-share-standalone.properties:/home/mosip/data-share-standalone.properties + depends_on: + - minio + mimoto-service: container_name: 'mimoto-service' - image: 'mosipid/mimoto:0.14.0' + image: 'mosipqa/mimoto:0.15.x' user: root ports: - '8099:8099' @@ -13,9 +38,12 @@ services: - active_profile_env=default - SPRING_CONFIG_NAME=mimoto - SPRING_CONFIG_LOCATION=/home/mosip/ + - oidc_p12_password=dummypassword volumes: - ./config/mimoto-default.properties:/home/mosip/mimoto-default.properties - ./certs/oidckeystore.p12:/home/mosip/certs/oidckeystore.p12 + depends_on: + - datashare inji-web: container_name: 'inji-web' @@ -26,8 +54,8 @@ services: - DEFAULT_LANG=en - MIMOTO_HOST=http://localhost:3004/v1/mimoto volumes: - - ./config/mimoto-default.properties:/home/mosip/mimoto-default.properties - ./config/mimoto-issuers-config.json:/home/mosip/mimoto-issuers-config.json - ./config/mimoto-trusted-verifiers.json:/home/mosip/mimoto-trusted-verifiers.json + - ./config/credential-template.html:/home/mosip/credential-template.html depends_on: - - mimoto-service \ No newline at end of file + - mimoto-service diff --git a/helm/inji-web/templates/configmap.yaml b/helm/inji-web/templates/configmap.yaml index 9fc9b509..11ffd6be 100644 --- a/helm/inji-web/templates/configmap.yaml +++ b/helm/inji-web/templates/configmap.yaml @@ -21,6 +21,7 @@ data: http { access_log /var/log/nginx/access1.log; error_log /var/log/nginx/error1.log; + server { listen {{ .Values.inji_web.inji_web_port }}; server_name localhost; diff --git a/inji-web-proxy/.env b/inji-web-proxy/.env deleted file mode 100644 index 4602717b..00000000 --- a/inji-web-proxy/.env +++ /dev/null @@ -1,2 +0,0 @@ -MIMOTO_HOST=https://api.dev1.mosip.net/v1/mimoto -PORT=3010 diff --git a/inji-web-proxy/.gitignore b/inji-web-proxy/.gitignore deleted file mode 100644 index 60f1aa34..00000000 --- a/inji-web-proxy/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.project -.idea -package-*.json -node_modules diff --git a/inji-web-proxy/Dockerfile b/inji-web-proxy/Dockerfile deleted file mode 100644 index eb84af5d..00000000 --- a/inji-web-proxy/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# Dockerfile -# Use the official Node.js image -FROM node:16.9.1 - -# Create and set the working directory inside the container -WORKDIR /usr/src/app - -# Copy package.json and package-lock.json (if available) -COPY package*.json ./ - -# Install dependencies -RUN npm install - -# Copy the rest of the application code -COPY . . - -# Expose the port on which the app runs -EXPOSE 3010 - -# Run the application -CMD ["node", "proxy_server.js"] diff --git a/inji-web-proxy/README.md b/inji-web-proxy/README.md deleted file mode 100644 index 45e06778..00000000 --- a/inji-web-proxy/README.md +++ /dev/null @@ -1,20 +0,0 @@ -### Inji Web Proxy - -Inji Web Proxy is express js application which is build to connect Backend Service From Inji Web to Avoid CORS issue. - - -### Environment Variables : - -> MIMOTO_HOST : Update the host url of the Mimoto with **/v1/mimoto** suffix - -> PORT : port in which proxy will run - -### Installation Steps : - -> npm i && node proxy_server.js - -### Usage : - -- Goto InjiWeb [api.ts](../inji-web/src/utils/api.ts) -- In order to avoid CORS, update the **mimotoHost** of Inji Web from Mimoto service url to Inji Web Proxy server url, so that it proxies and bypasses the CORS - - ref : https://localhost:3010 diff --git a/inji-web-proxy/package.json b/inji-web-proxy/package.json deleted file mode 100644 index 833e8f96..00000000 --- a/inji-web-proxy/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "proxy-server", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "axios": "^1.6.8", - "body-parser": "^1.20.2", - "cors": "^2.8.5", - "dotenv": "^16.4.5", - "express": "^4.19.2", - "fs": "^0.0.1-security", - "path": "^0.12.7" - } -} diff --git a/inji-web-proxy/proxy_server.js b/inji-web-proxy/proxy_server.js deleted file mode 100644 index ab1db6ed..00000000 --- a/inji-web-proxy/proxy_server.js +++ /dev/null @@ -1,53 +0,0 @@ -const express = require('express'); -const cors = require('cors'); -const axios = require('axios'); -const bodyParser = require('body-parser'); -require('dotenv').config() - -const app = express(); -const PORT = process.env.PORT; - -app.use(express.json()); -app.use(cors()); -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ extended: true })); - -app.all('*', async (req, res) => { - delete req.headers.host - delete req.headers.referer - - const API_URL = process.env.MIMOTO_HOST; - const PATH = req.url - try { - - let response = await axios({ - method: req.method, - responseType: PATH.indexOf("/download") === -1 ? "json" : "arraybuffer", - url: `${API_URL + PATH}`, - data: new URLSearchParams(req.body), - headers: req.headers - }); - - if(PATH.indexOf("/download") === -1){ - res.status(response.status).json(response.data); - } else { - res.setHeader('Access-Control-Allow-Origin', '*'); // Change '*' to specific origin if needed - res.setHeader('Access-Control-Allow-Methods', 'GET,OPTIONS,POST'); // Allow GET requests - res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization'); // Allow specific headers - res.set("Content-Type", "application/pdf"); - res.status(response.status).send(response.data); - } - - } catch (error) { - console.error("Error occurred: ", error); - if (error.response) { - res.status(error.response.status).json(error.response.data); - } else { - res.status(500).json({ error: error.message }); - } - } -}); - -app.listen(PORT, () => { - console.log(`Proxy server listening on port ${PORT}`); -}); diff --git a/inji-web-test/src/test/java/stepdefinitions/StepDef.java b/inji-web-test/src/test/java/stepdefinitions/StepDef.java index cb1a2917..0955ddb3 100644 --- a/inji-web-test/src/test/java/stepdefinitions/StepDef.java +++ b/inji-web-test/src/test/java/stepdefinitions/StepDef.java @@ -14,6 +14,7 @@ import utils.GlobelConstants; import java.util.Set; +import java.util.concurrent.TimeUnit; public class StepDef { @@ -81,12 +82,9 @@ public void user_click_on_verify_button() { } @Then("User verify Download Success text displayed") - public void user_verify_download_success_text_displayed() { - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } + public void user_verify_download_success_text_displayed() throws InterruptedException { + Thread.sleep(10000); + baseTest.getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); Assert.assertTrue(homePage.isSuccessMessageDisplayed()); } diff --git a/inji-web/nginx.conf b/inji-web/nginx.conf index c2332953..1a488024 100644 --- a/inji-web/nginx.conf +++ b/inji-web/nginx.conf @@ -13,8 +13,11 @@ server { root /home/mosip; autoindex on; } - - + # Serve credential-template.html from /home/mosip when accessing /credential-template.html + location = /credential-template.html { + root /home/mosip; # Serve from /home/mosip specifically for this file + index credential-template.html; # Serve this file as the index + } # Proxy API requests to mimoto-service location /v1/mimoto/ { proxy_pass http://mimoto-service:8099/v1/mimoto/; diff --git a/inji-web/package-lock.json b/inji-web/package-lock.json index 65016886..e37308a2 100644 --- a/inji-web/package-lock.json +++ b/inji-web/package-lock.json @@ -18,6 +18,7 @@ "@types/react-outside-click-handler": "^1.3.3", "@types/react-redux": "^7.1.33", "autoprefixer": "^9.8.6", + "cross-env": "^7.0.3", "crypto-js": "^4.2.0", "i18next": "^23.11.2", "postcss-cli": "^11.0.0", @@ -5898,6 +5899,23 @@ "node": ">= 6" } }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -21389,6 +21407,14 @@ } } }, + "cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "requires": { + "cross-spawn": "^7.0.1" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", diff --git a/inji-web/package.json b/inji-web/package.json index accddefb..3e5dfdca 100644 --- a/inji-web/package.json +++ b/inji-web/package.json @@ -13,6 +13,7 @@ "@types/react-outside-click-handler": "^1.3.3", "@types/react-redux": "^7.1.33", "autoprefixer": "^9.8.6", + "cross-env": "^7.0.3", "crypto-js": "^4.2.0", "i18next": "^23.11.2", "postcss-cli": "^11.0.0", @@ -33,7 +34,7 @@ "web-vitals": "^2.1.4" }, "scripts": { - "start": "set PORT=3001 && react-scripts start", + "start": "cross-env PORT=3004 react-scripts start", "build": "CI=false react-scripts build", "test": "react-scripts test --silent --testPathPattern=__tests__", "eject": "react-scripts eject", diff --git a/inji-web/public/env.config.js b/inji-web/public/env.config.js index 00ac242b..441fc9a9 100644 --- a/inji-web/public/env.config.js +++ b/inji-web/public/env.config.js @@ -4,5 +4,5 @@ window._env_ = { DEFAULT_FAVICON: "favicon.ico", DEFAULT_TITLE: "Inji Wallet", DEFAULT_FONT_URL: "https://fonts.googleapis.com/css?family=Inter", - MIMOTO_HOST: "http://localhost:3010" + MIMOTO_HOST: "http://localhost:8099/v1/mimoto" }; diff --git a/inji-web/src/__tests__/components/Common/ErrorSheildIcon.test.tsx b/inji-web/src/__tests__/components/Common/ErrorSheildIcon.test.tsx index 6476291e..bedabbce 100644 --- a/inji-web/src/__tests__/components/Common/ErrorSheildIcon.test.tsx +++ b/inji-web/src/__tests__/components/Common/ErrorSheildIcon.test.tsx @@ -1,5 +1,3 @@ -import React from 'react'; -import { screen} from '@testing-library/react'; import { ErrorSheildIcon } from '../../../components/Common/ErrorSheildIcon'; import { renderWithProvider } from '../../../test-utils/mockUtils'; @@ -8,12 +6,4 @@ describe("Testing the Layout of ErrorSheildIcon", () => { const{asFragment} = renderWithProvider(); expect(asFragment()).toMatchSnapshot(); }); -}); - -describe("Testing the Functionality of ErrorSheildIcon", () => { - test('Check for the icon size and color of ErrorShieldIcon Component', () => { - renderWithProvider(); - const iconElement = screen.getByTestId("DownloadResult-Error-ShieldIcon"); - expect(iconElement).toHaveStyle('color: var(--iw-color-shieldErrorIcon)'); - }); -}); +}); \ No newline at end of file diff --git a/inji-web/src/__tests__/components/Common/LanguageSelector.test.tsx b/inji-web/src/__tests__/components/Common/LanguageSelector.test.tsx index 18bab7bf..6046b0f4 100644 --- a/inji-web/src/__tests__/components/Common/LanguageSelector.test.tsx +++ b/inji-web/src/__tests__/components/Common/LanguageSelector.test.tsx @@ -1,7 +1,9 @@ import React from 'react'; import { screen, fireEvent } from '@testing-library/react'; import { LanguageSelector } from '../../../components/Common/LanguageSelector'; -import { renderWithProvider } from '../../../test-utils/mockUtils'; // Import from mockutils +import { mockCrypto, renderWithProvider } from '../../../test-utils/mockUtils'; // Import from mockutils + +global.crypto = mockCrypto; describe("Testing the Layout of Language Selector", () => { test('Check if the layout is matching with the snapshots', () => { diff --git a/inji-web/src/__tests__/components/Common/SuccessSheildIcon.test.tsx b/inji-web/src/__tests__/components/Common/SuccessSheildIcon.test.tsx index de130b19..30fe0135 100644 --- a/inji-web/src/__tests__/components/Common/SuccessSheildIcon.test.tsx +++ b/inji-web/src/__tests__/components/Common/SuccessSheildIcon.test.tsx @@ -1,5 +1,3 @@ -import React from 'react'; -import { screen } from '@testing-library/react'; import { SuccessSheildIcon } from '../../../components/Common/SuccessSheildIcon'; import { renderWithProvider } from '../../../test-utils/mockUtils'; @@ -9,10 +7,3 @@ describe("Testing the Layout of SuccessSheildIcon", () => { expect(asFragment()).toMatchSnapshot(); }); }); -describe("Testing the Functionality of SuccessSheildIcon" ,() =>{ - test('Check the icon color of SuccessSheildIcon component', () => { - renderWithProvider(); - expect(screen.getByTestId("DownloadResult-Success-ShieldIcon")).toHaveAttribute('color', 'var(--iw-color-shieldSuccessIcon)'); - }); - -}); diff --git a/inji-web/src/__tests__/components/Common/__snapshots__/LanguageSelector.test.tsx.snap b/inji-web/src/__tests__/components/Common/__snapshots__/LanguageSelector.test.tsx.snap index 63355d95..83aa4d5a 100644 --- a/inji-web/src/__tests__/components/Common/__snapshots__/LanguageSelector.test.tsx.snap +++ b/inji-web/src/__tests__/components/Common/__snapshots__/LanguageSelector.test.tsx.snap @@ -13,7 +13,7 @@ exports[`Testing the Layout of Language Selector Check if the layout is matching width="0" > { }) }); describe("Testing the Functionality of custom expiry content",()=>{ - test("Check the Time Range Metrics", ()=>{ - const expiryMockFn = jest.fn(); - renderWithProvider(); - const ctDocument = screen.getByTestId("CustomExpiryTimesContent-Times-Metrics"); - expect(ctDocument).toBeInTheDocument(); - expect(ctDocument).toHaveTextContent("Times"); - }) - test("Check the Time Range Increase on Clicking the Increase Button", ()=>{ const expiryTime=1; const expiryMockFn = jest.fn(()=> expiryTime+1); diff --git a/inji-web/src/__tests__/components/DataShare/CustomTimes/CustomExpiryTimesHeader.test.tsx b/inji-web/src/__tests__/components/DataShare/CustomTimes/CustomExpiryTimesHeader.test.tsx index 54e5ce12..7c38adff 100644 --- a/inji-web/src/__tests__/components/DataShare/CustomTimes/CustomExpiryTimesHeader.test.tsx +++ b/inji-web/src/__tests__/components/DataShare/CustomTimes/CustomExpiryTimesHeader.test.tsx @@ -7,13 +7,5 @@ describe("Testing the Layout of the Custom Expiry Header", () => { test("Check if the layout is matching with the snapshots", ()=>{ const{asFragment} = renderWithProvider() expect(asFragment()).toMatchSnapshot(); - }) - -}); -describe("Testing the functionality of custom expiry Header",()=>{ - test("Check to Have the content", ()=>{ - renderWithProvider(); - const document = screen.getByTestId("CustomExpiryTimesHeader-Title-Content"); - expect(document).toHaveTextContent("CTHeader"); - }) + }) }); diff --git a/inji-web/src/__tests__/components/DataShare/DataShareExpiryModal.test.tsx b/inji-web/src/__tests__/components/DataShare/DataShareExpiryModal.test.tsx new file mode 100644 index 00000000..8a1f03bf --- /dev/null +++ b/inji-web/src/__tests__/components/DataShare/DataShareExpiryModal.test.tsx @@ -0,0 +1,49 @@ +import {screen, fireEvent, within} from "@testing-library/react"; +import {DataShareExpiryModal} from "../../../modals/DataShareExpiryModal"; +import { + mockUseTranslation, + renderWithProvider +} from "../../../test-utils/mockUtils"; + +describe("Testing DataShareExpiryModal functionality", () => { + beforeEach(() => { + mockUseTranslation(); + }); + + test("should render updated validity count in DataShareExpiryModal when count is updated with custom validity option", () => { + const mockProps = { + credentialName: "Test Credential", + credentialLogo: "Test Logo", + onSuccess: jest.fn(), + onCancel: jest.fn() + }; + + renderWithProvider(); + expect( + screen.getByTestId("DataShareContent-Selected-Validity-Times") + ).toHaveTextContent("Once"); + fireEvent.click(screen.getByTestId("times-dropdown")); + + const validityTimesDropDownButton = screen.getByTestId( + "DataShareContent-Validity-Times-DropDown-Custom" + ); + fireEvent.click(validityTimesDropDownButton); + + const customTimesValidityOption = screen.getByTestId( + "CustomExpiryTimesContent-Times-Value" + ); + fireEvent.change(customTimesValidityOption, {target: {value: "4"}}); + + const customExpiryModalFooter = screen.getByTestId( + "DataShareFooter-Outer-Container-custom-expiry-modal" + ); + const customExpriyModalFooterSuccessButton = within( + customExpiryModalFooter + ).getByTestId("DataShareFooter-Success-Button"); + fireEvent.click(customExpriyModalFooterSuccessButton); + + expect( + screen.getByTestId("DataShareContent-Selected-Validity-Times") + ).toHaveTextContent("4"); + }); +}); diff --git a/inji-web/src/__tests__/components/DataShare/__snapshots__/DataShareContent.test.tsx.snap b/inji-web/src/__tests__/components/DataShare/__snapshots__/DataShareContent.test.tsx.snap index 165bc23f..cad7d680 100644 --- a/inji-web/src/__tests__/components/DataShare/__snapshots__/DataShareContent.test.tsx.snap +++ b/inji-web/src/__tests__/components/DataShare/__snapshots__/DataShareContent.test.tsx.snap @@ -71,13 +71,20 @@ exports[`Testing the Layout of the Expiry Content Check if the layout is matchi class="w-1/2 flex items-center space-x-2" data-testid="DataShareContent-Validity-Date" > - +
+ +
+
- How can I download a credential in Inji Web? + How can I download a credential in Inji Wallet?
@@ -265,7 +265,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - What happens when I generate a Verifiable Credential (VC) in Inji Web? + What happens when I generate a Verifiable Credential (VC) in Inji Wallet's Web Interface?
@@ -333,7 +333,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How does Inji Web ensure my Verifiable Credential (VC) is stored securely? + How does Inji Wallet’s Web Interface ensure my VC is stored securely?
@@ -401,7 +401,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - What is the benefit of embedding a URL in the QR code instead of the full VC data? + Why embed a URL in the QR code instead of full VC data?
@@ -435,7 +435,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - Can I share my Verifiable Credential (VC) online and offline? + Can I share my VC both online and offline?
@@ -469,7 +469,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How does Inji Web verify and authorize the verifier during online sharing? + How does Inji Wallet verify and authorize the verifier during online sharing?
@@ -503,7 +503,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - What is OpenID4VP, and how is it used in Inji Web? + What is OpenID4VP, and how is it used in Inji Wallet?
@@ -537,7 +537,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How do I know my VC was securely shared using Inji Web? + How do I know my VC was securely shared using Inji Wallet??
@@ -571,7 +571,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - What happens if the QR code is scanned on a different device from where the VC was generated? + What happens if the QR code is scanned on a different device than where the VC was generated?
@@ -605,7 +605,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - Can Inji Web support different formats for the QR code? + Can Inji Wallet support different QR code formats?
@@ -639,7 +639,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How does Inji Web handle credential verification after sharing? + How does Inji Wallet handle credential verification after sharing?
@@ -741,7 +741,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How do I get started with the online sharing feature in Inji Web? + How do I get started with the online sharing feature in Inji Wallet?
@@ -775,7 +775,7 @@ exports[`Testing the layout of Help Accordion Check if the layout is matching wi class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How can I toggle between embedded VC and Online Sharing in Inji Web? + How can I toggle between embedded VC and Online Sharing in Inji Wallet?
diff --git a/inji-web/src/__tests__/components/Issuer/IssuerList.test.tsx b/inji-web/src/__tests__/components/Issuer/IssuerList.test.tsx index 36c3485b..b1964c91 100644 --- a/inji-web/src/__tests__/components/Issuer/IssuerList.test.tsx +++ b/inji-web/src/__tests__/components/Issuer/IssuerList.test.tsx @@ -2,10 +2,12 @@ import React from 'react'; import { IssuersList } from '../../../components/Issuers/IssuersList'; import { RequestStatus } from '../../../hooks/useFetch'; import { mockIssuerObjectList } from '../../../test-utils/mockObjects'; -import { renderWithProvider,mockUseSelector,mockUseTranslation } from '../../../test-utils/mockUtils'; +import { renderWithProvider,mockUseSelector,mockUseTranslation, mockCrypto } from '../../../test-utils/mockUtils'; mockUseTranslation(); mockUseSelector(); +global.crypto = mockCrypto; + describe("Testing the Layout of IssuersList", () => { beforeEach(() => { const useSelectorMock = require('react-redux').useSelector; diff --git a/inji-web/src/__tests__/components/Issuer/__snapshots__/IssuerList.test.tsx.snap b/inji-web/src/__tests__/components/Issuer/__snapshots__/IssuerList.test.tsx.snap index c5e8c9fa..392e5d7a 100644 --- a/inji-web/src/__tests__/components/Issuer/__snapshots__/IssuerList.test.tsx.snap +++ b/inji-web/src/__tests__/components/Issuer/__snapshots__/IssuerList.test.tsx.snap @@ -106,7 +106,7 @@ exports[`Testing the Layout of IssuersList Check whether it renders loading stat width="0" > ({ diff --git a/inji-web/src/__tests__/components/PageTemplate/__snapshots__/Header.test.tsx.snap b/inji-web/src/__tests__/components/PageTemplate/__snapshots__/Header.test.tsx.snap index b07d692f..6bc2afce 100644 --- a/inji-web/src/__tests__/components/PageTemplate/__snapshots__/Header.test.tsx.snap +++ b/inji-web/src/__tests__/components/PageTemplate/__snapshots__/Header.test.tsx.snap @@ -4,7 +4,7 @@ exports[`Header Container Layout Test Check if the layout is matching with the s
{ } content={} - footer={} + footer={} size={"3xl"} zIndex={40} /> ) diff --git a/inji-web/src/__tests__/pages/AuthorizationPage.test.tsx b/inji-web/src/__tests__/pages/AuthorizationPage.test.tsx index db513a5b..718bfdd9 100644 --- a/inji-web/src/__tests__/pages/AuthorizationPage.test.tsx +++ b/inji-web/src/__tests__/pages/AuthorizationPage.test.tsx @@ -1,15 +1,17 @@ -import React from 'react'; -import { AuthorizationPage } from '../../pages/AuthorizationPage'; -import { mockUseTranslation,mockUseapiObject,renderWithRouter,mockWindowLocation} from '../../test-utils/mockUtils'; +import {AuthorizationPage} from "../../pages/AuthorizationPage"; +import {renderWithRouter, mockWindowLocation} from "../../test-utils/mockUtils"; + +jest.mock("../../utils/api", () => ({ + api: { + mimotoHost: "http://mocked-api-host" + } +})); -mockUseTranslation(); -mockUseapiObject() describe('Testing the Layouts of AuthorizationPage', () => { test('Check if it renders properly if there is no error in URL', () => { mockWindowLocation('https://api.collab.mosip.net'); const {asFragment} = renderWithRouter(); expect(asFragment()).toMatchSnapshot(); - }); test('Check if it shows error messages if error in URL', () => { diff --git a/inji-web/src/__tests__/pages/__snapshots__/HelpPage.test.tsx.snap b/inji-web/src/__tests__/pages/__snapshots__/HelpPage.test.tsx.snap index bda17578..ff3caf7c 100644 --- a/inji-web/src/__tests__/pages/__snapshots__/HelpPage.test.tsx.snap +++ b/inji-web/src/__tests__/pages/__snapshots__/HelpPage.test.tsx.snap @@ -144,7 +144,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How can I download a credential in Inji Web? + How can I download a credential in Inji Wallet?
@@ -314,7 +314,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - What happens when I generate a Verifiable Credential (VC) in Inji Web? + What happens when I generate a Verifiable Credential (VC) in Inji Wallet's Web Interface?
@@ -382,7 +382,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How does Inji Web ensure my Verifiable Credential (VC) is stored securely? + How does Inji Wallet’s Web Interface ensure my VC is stored securely?
@@ -450,7 +450,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - What is the benefit of embedding a URL in the QR code instead of the full VC data? + Why embed a URL in the QR code instead of full VC data?
@@ -484,7 +484,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - Can I share my Verifiable Credential (VC) online and offline? + Can I share my VC both online and offline?
@@ -518,7 +518,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How does Inji Web verify and authorize the verifier during online sharing? + How does Inji Wallet verify and authorize the verifier during online sharing?
@@ -552,7 +552,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - What is OpenID4VP, and how is it used in Inji Web? + What is OpenID4VP, and how is it used in Inji Wallet?
@@ -586,7 +586,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How do I know my VC was securely shared using Inji Web? + How do I know my VC was securely shared using Inji Wallet??
@@ -620,7 +620,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - What happens if the QR code is scanned on a different device from where the VC was generated? + What happens if the QR code is scanned on a different device than where the VC was generated?
@@ -654,7 +654,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - Can Inji Web support different formats for the QR code? + Can Inji Wallet support different QR code formats?
@@ -688,7 +688,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How does Inji Web handle credential verification after sharing? + How does Inji Wallet handle credential verification after sharing?
@@ -790,7 +790,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How do I get started with the online sharing feature in Inji Web? + How do I get started with the online sharing feature in Inji Wallet?
@@ -824,7 +824,7 @@ exports[`Testing the Layout of HelpPage Check if the layout is matching with the class="flex flex-row text-iw-title" data-testid="Help-Item-Title-Text" > - How can I toggle between embedded VC and Online Sharing in Inji Web? + How can I toggle between embedded VC and Online Sharing in Inji Wallet?
diff --git a/inji-web/src/__tests__/utils/api.test.tsx b/inji-web/src/__tests__/utils/api.test.tsx index 280d14d4..bb48623d 100644 --- a/inji-web/src/__tests__/utils/api.test.tsx +++ b/inji-web/src/__tests__/utils/api.test.tsx @@ -22,6 +22,13 @@ describe('Testing API Class', () => { writable: true }); + Object.defineProperty(window, "_env_", { + value: { + MIMOTO_HOST: "https://api.collab.mossip.net/v1/mimoto" + }, + writable: true + }); + jest.resetModules(); apiModule = require('../../utils/api') as ApiModule; }); @@ -72,7 +79,7 @@ describe('Testing API Class', () => { expect(fetchTokenAnddownloadVc.url()).toBe('https://api.collab.mossip.net/v1/mimoto/credentials/download'); expect(fetchTokenAnddownloadVc.methodType).toBe(apiModule.MethodType.POST); expect(fetchTokenAnddownloadVc.headers()).toEqual({ - 'accept': 'application/json', + 'accept': 'application/pdf', 'Content-Type': 'application/x-www-form-urlencoded', 'Cache-Control': 'no-cache, no-store, must-revalidate' }); diff --git a/inji-web/src/__tests__/utils/misc.test.tsx b/inji-web/src/__tests__/utils/misc.test.tsx index f0a2289e..c5d97d3a 100644 --- a/inji-web/src/__tests__/utils/misc.test.tsx +++ b/inji-web/src/__tests__/utils/misc.test.tsx @@ -72,11 +72,11 @@ describe('Test misc.ts utility functions', () => { }); test('Check if getErrorObject returns correct error object', () => { - const downloadResponse = { errors: [{ errorCode: 'proof_type_not_supported' }] }; + const downloadResponse = { errors: [{ errorCode: 'err_invalid_issuancedate'}] }; const errorObject = getErrorObject(downloadResponse); expect(errorObject).toEqual({ - code: 'error.verification.proof_type_not_supported.title', - message: 'error.verification.proof_type_not_supported.subTitle' + code: 'error.verification.err_invalid_issuancedate.title', + message: 'error.verification.err_invalid_issuancedate.subTitle' }); }); diff --git a/inji-web/src/components/DataShare/DataShareContent.tsx b/inji-web/src/components/DataShare/DataShareContent.tsx index 9835a9d6..7f645601 100644 --- a/inji-web/src/components/DataShare/DataShareContent.tsx +++ b/inji-web/src/components/DataShare/DataShareContent.tsx @@ -77,25 +77,25 @@ export const DataShareContent:React.FC = (props) => {
-
-
-
setTimesDropDown(times => !times)}> - - -
-
+
setTimesDropDown(times => !times)}> +
+
+ + +
+
- {timesDropDown &&
-
-
- - - - -
-
} + {timesDropDown &&
+
+
+ + + + +
+
}
; } diff --git a/inji-web/src/components/DataShare/DataShareFooter.tsx b/inji-web/src/components/DataShare/DataShareFooter.tsx index ddcd4243..b559d89b 100644 --- a/inji-web/src/components/DataShare/DataShareFooter.tsx +++ b/inji-web/src/components/DataShare/DataShareFooter.tsx @@ -3,11 +3,26 @@ import {DSFooterProps} from "../../types/components"; import {BorderedButton} from "../Common/Buttons/BorderedButton"; import {SolidButton} from "../Common/Buttons/SolidButton"; -export const DataShareFooter:React.FC = (props) => { - return
- - -
; -} - - +export const DataShareFooter: React.FC = (props) => { + return ( +
+ + +
+ ); +}; diff --git a/inji-web/src/modals/CustomExpiryModal.tsx b/inji-web/src/modals/CustomExpiryModal.tsx index d5ba59f8..e0f6b7e8 100644 --- a/inji-web/src/modals/CustomExpiryModal.tsx +++ b/inji-web/src/modals/CustomExpiryModal.tsx @@ -10,27 +10,45 @@ import {useTranslation} from "react-i18next"; import {CustomExpiryModalProps} from "../types/components"; import {toast} from "react-toastify"; - export const CustomExpiryModal: React.FC = (props) => { - - const vcStorageExpiryLimitInTimes = useSelector((state: RootState) => state.common.vcStorageExpiryLimitInTimes); - const [expiryTime, setExpiryTime] = useState(vcStorageExpiryLimitInTimes > 1 ? vcStorageExpiryLimitInTimes : 1 ); + const vcStorageExpiryLimitInTimes = useSelector( + (state: RootState) => state.common.vcStorageExpiryLimitInTimes + ); + const [expiryTime, setExpiryTime] = useState( + vcStorageExpiryLimitInTimes > 1 ? vcStorageExpiryLimitInTimes : 1 + ); const {t} = useTranslation("CustomExpiryModal"); const dispatch = useDispatch(); const onSuccess = () => { - if(expiryTime < 1 || expiryTime > 50){ + if (expiryTime < 1 || expiryTime > 50) { toast.error(t("error")); } else { dispatch(storevcStorageExpiryLimitInTimes(expiryTime)); - props.onSuccess() + props.onSuccess(); } - } - - return } - content={} - footer={} - size={"sm"} - zIndex={50} /> -} + }; + return ( + } + content={ + + } + footer={ + + } + size={"sm"} + zIndex={50} + /> + ); +}; diff --git a/inji-web/src/modals/DataShareExpiryModal.tsx b/inji-web/src/modals/DataShareExpiryModal.tsx index 92643d67..c29e734a 100644 --- a/inji-web/src/modals/DataShareExpiryModal.tsx +++ b/inji-web/src/modals/DataShareExpiryModal.tsx @@ -14,7 +14,7 @@ export const DataShareExpiryModal: React.FC = (props) return } content={} - footer={} + footer={} size={"3xl"} zIndex={40}/> {isCustomExpiryInTimesModalOpen && setIsCustomExpiryInTimesModalOpen(false)} onCancel={() => setIsCustomExpiryInTimesModalOpen(false)}/>} diff --git a/inji-web/src/test-utils/mockUtils.tsx b/inji-web/src/test-utils/mockUtils.tsx index 59194765..234b6a51 100644 --- a/inji-web/src/test-utils/mockUtils.tsx +++ b/inji-web/src/test-utils/mockUtils.tsx @@ -44,7 +44,7 @@ export const mockApi = { export const mockCrypto = { getRandomValues: (array: Uint32Array) => { for (let i = 0; i < array.length; i++) { - array[i] = Math.floor(Math.random() * 4294967296); + array[i] = 4294967296; } return array; }, diff --git a/inji-web/src/types/components.d.ts b/inji-web/src/types/components.d.ts index d78545fe..31a36abf 100644 --- a/inji-web/src/types/components.d.ts +++ b/inji-web/src/types/components.d.ts @@ -78,6 +78,7 @@ export type DSFooterProps = { onSuccess: () => void; cancelText: string; onCancel: () => void; + parent?: string; } export type DSHeaderProps = { title: string;