Skip to content

Commit

Permalink
Merge branch 'master' into idpay-data-refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mastro993 authored Nov 10, 2023
2 parents d818a9a + 284edc2 commit 5122768
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
6 changes: 5 additions & 1 deletion assets/wallet/wallet_onboarding.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<script type="text/javascript">
const outcomeList = [
["0", "SUCCESS"],
["1", "ERROR"]
["1", "GENERIC_ERROR"],
["2", "AUTH_ERROR"],
["4", "TIMEOUT"],
["8", "CANCELED_BY_USER"],
["14", "INVALID_SESSION"]
];

const simulateOutcome = () => {
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"description": "A mock server to help io-app development https://io.italia.it/",
"version": "1.0.0",
"main": "app.js",
"api_backend_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v13.10.1-RELEASE/api_backend.yaml",
"api_public_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v13.10.1-RELEASE/api_public.yaml",
"api_bonus_vacanze": "https://raw.githubusercontent.com/pagopa/io-backend/v13.10.1-RELEASE/api_bonus.yaml",
"api_cgn": "https://raw.githubusercontent.com/pagopa/io-backend/v13.10.1-RELEASE/api_cgn.yaml",
"api_cgn_merchants": "https://raw.githubusercontent.com/pagopa/io-backend/v13.10.1-RELEASE/api_cgn_operator_search.yaml",
"api_backend_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v13.20.0-RELEASE/api_backend.yaml",
"api_public_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v13.20.0-RELEASE/api_public.yaml",
"api_bonus_vacanze": "https://raw.githubusercontent.com/pagopa/io-backend/v13.20.0-RELEASE/api_bonus.yaml",
"api_cgn": "https://raw.githubusercontent.com/pagopa/io-backend/v13.20.0-RELEASE/api_cgn.yaml",
"api_cgn_merchants": "https://raw.githubusercontent.com/pagopa/io-backend/v13.20.0-RELEASE/api_cgn_operator_search.yaml",
"api_cgn_geo": "https://raw.githubusercontent.com/pagopa/io-backend/here_geoapi_integration/api_geo.yaml",
"content_specs": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.28/definitions.yml",
"api_pagopa_walletv2": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.28/bonus/specs/bpd/pm/walletv2.json",
Expand All @@ -21,13 +21,13 @@
"api_bpd_award": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.28/bonus/specs/bpd/award.json",
"api_bpd_winning_transactions": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.28/bonus/specs/bpd/winning_transactions.json",
"api_bpd_winning_transactions_v2": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.28/bonus/specs/bpd/winning_transactions_v2.json",
"api_eu_covid_cert": "https://raw.githubusercontent.com/pagopa/io-backend/v13.10.1-RELEASE/api_eucovidcert.yaml",
"api_eu_covid_cert": "https://raw.githubusercontent.com/pagopa/io-backend/v13.20.0-RELEASE/api_eucovidcert.yaml",
"api_sicilia_vola": "assets/SiciliaVola.yml",
"api_cdc": "https://raw.githubusercontent.com/pagopa/io-app/master/assets/CdcSwagger.yml",
"api_fci": "https://raw.githubusercontent.com/pagopa/io-backend/v13.10.1-RELEASE/api_io_sign.yaml",
"api_pn": "https://raw.githubusercontent.com/pagopa/io-backend/v13.10.1-RELEASE/api_pn.yaml",
"api_fci": "https://raw.githubusercontent.com/pagopa/io-backend/v13.20.0-RELEASE/api_io_sign.yaml",
"api_pn": "https://raw.githubusercontent.com/pagopa/io-backend/v13.20.0-RELEASE/api_pn.yaml",
"api_idpay": "https://raw.githubusercontent.com/pagopa/cstar-infrastructure/v5.8.0/src/domains/idpay-app/api/idpay_appio_full/openapi.appio.full.yml",
"api_fast_login": "https://raw.githubusercontent.com/pagopa/io-backend/v13.10.1-RELEASE/openapi/generated/api_fast_login.yaml",
"api_fast_login": "https://raw.githubusercontent.com/pagopa/io-backend/v13.20.0-RELEASE/openapi/generated/api_fast_login.yaml",
"api_pagopa_walletv3": "https://raw.githubusercontent.com/pagopa/pagopa-infra/fde8d344d1eae9d16ca338d4f71095c805b99f75/src/domains/wallet-app/api/payment-wallet/v1/_openapi.json.tpl",
"author": "Matteo Boschi",
"license": "MIT",
Expand Down
10 changes: 4 additions & 6 deletions src/features/fastLogin/nonceHandler.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { randomBytes } from "crypto";
import { randomUUID } from "crypto";
import { pipe } from "fp-ts/lib/function";
import { Request } from "express";
import * as O from "fp-ts/lib/Option";
import { getDateMsDifference } from "../../utils/date";

export const NONCE_EXPYRING_MS = 30000;
export const NONCE_EXPYRING_MS = 60000;

export type NonceInfo = {
nonce: string;
Expand All @@ -24,10 +24,8 @@ const setNonceInfo = (nonce: string, instantiationDate: Date) => {
};

export const generateNewNonce = () =>
pipe(
randomBytes(16),
str => str.toString("hex"),
base64 => setNonceInfo(base64, new Date())
pipe(randomUUID({ disableEntropyCache: true }), uuid =>
setNonceInfo(uuid, new Date())
);

const extractNonceFromRequest = (request: Request): O.Option<string> =>
Expand Down
2 changes: 1 addition & 1 deletion src/routers/features/fastLogin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const fastLoginRouter = Router();
addHandler(
fastLoginRouter,
"post",
addApiV1Prefix("/fast-login/generate-nonce"),
addApiV1Prefix("/fast-login/nonce/generate"),
(_, res) => {
generateNewNonce();
const nonce = getNonceInfo().nonce;
Expand Down

0 comments on commit 5122768

Please sign in to comment.