Skip to content

Commit 4290361

Browse files
author
trung hieu dao
committed
[MISC][DH] fix prettier issues
1 parent 43f7832 commit 4290361

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

src/corppass/corppass-helper-ndi.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { AxiosInstance, AxiosProxyConfig } from "axios";
22
import * as querystringUtil from "querystring";
33
import { createClient } from "../client/axios-client";
44
import { JweUtil } from "../util";
5+
import { DateUtils } from "../util/DateUtils";
56
import { SingpassMyInfoError } from "../util/error/SingpassMyinfoError";
6-
import { logger } from "../util/Logger";
7-
import { AuthInfo, EntityInfo, EserviceAuthResultRow, TokenResponse, TPAccessInfo, UserInfo } from "./shared-constants";
87
import { Key } from "../util/KeyUtil";
8+
import { logger } from "../util/Logger";
99
import { createClientAssertion } from "../util/SigningUtil";
10-
import { DateUtils } from "../util/DateUtils";
10+
import { AuthInfo, EntityInfo, EserviceAuthResultRow, TokenResponse, TPAccessInfo, UserInfo } from "./shared-constants";
1111

1212
interface AccessTokenPayload {
1313
exp: number;
@@ -179,7 +179,7 @@ export class NdiOidcHelper {
179179
if (error) {
180180
throw error;
181181
} else {
182-
throw new SingpassMyInfoError('could not verify with any key');
182+
throw new SingpassMyInfoError("could not verify with any key");
183183
}
184184
} catch (e) {
185185
logger.error("Failed to get access token payload", e);
@@ -219,7 +219,7 @@ export class NdiOidcHelper {
219219
if (error) {
220220
throw error;
221221
} else {
222-
throw new SingpassMyInfoError('could not verify with any key');
222+
throw new SingpassMyInfoError("could not verify with any key");
223223
}
224224
} catch (e) {
225225
logger.error("Failed to get ID token payload", e);

src/singpass/__tests__/singpass-helper-ndi.ext.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import * as jwt from "jsonwebtoken";
2+
import { generators } from "openid-client";
23
import { KeyFormat } from "../../util/KeyUtil";
34
import { logger } from "../../util/Logger";
45
import { NdiOidcHelper, NdiOidcHelperConstructor } from "../singpass-helper-ndi";
56
import { configs } from "./test.configs";
6-
import { generators } from "openid-client";
7+
78
const expectedUinfin = ""; // FIXME: fill in with expected uinfin
89

910
/**
@@ -32,7 +33,7 @@ describe.skip("Singpass NDI OIDC integration", () => {
3233

3334
describe("integration tester for Ndi OIDC", () => {
3435
describe("construct authorization url", () => {
35-
it("should successfully construct authorization url", async () => {
36+
it("should successfully construct authorization url", async () => {
3637
await constructAuthorizationUrlHelper();
3738
});
3839
});
@@ -54,7 +55,7 @@ describe.skip("Singpass NDI OIDC integration", () => {
5455
});
5556

5657
describe("get user identity after successful redirect with auth code", () => {
57-
it("should successfully extract nric and uuid", async () => {
58+
it("should successfully extract nric and uuid", async () => {
5859
const authCode = ""; // FIXME: fill in with authCode
5960
const codeVerifier = ""; // FIXME: fill in with codeVerifier
6061
const nric = await extractNricHelper(authCode, codeVerifier);
@@ -74,16 +75,16 @@ describe.skip("Singpass NDI OIDC integration", () => {
7475
};
7576

7677
const extractNricHelper = async (authCode: string, codeVerifier?: string) => {
77-
const spNdiHelper = new NdiOidcHelper(props);
78+
const spNdiHelper = new NdiOidcHelper(props);
7879

7980
const tokens = await spNdiHelper.getTokens(authCode, codeVerifier);
80-
logger.debug("tokens", tokens);
81+
logger.debug("tokens", tokens);
8182

82-
const tokenPayload = await spNdiHelper.getIdTokenPayload(tokens);
83-
logger.debug("tokenPayload", tokenPayload);
83+
const tokenPayload = await spNdiHelper.getIdTokenPayload(tokens);
84+
logger.debug("tokenPayload", tokenPayload);
8485

85-
const { nric } = await spNdiHelper.extractNricAndUuidFromPayload(tokenPayload);
86-
logger.debug("nric", nric);
86+
const { nric } = await spNdiHelper.extractNricAndUuidFromPayload(tokenPayload);
87+
logger.debug("nric", nric);
8788

8889
return nric;
8990
};

src/singpass/__tests__/test.configs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export const configs = {
1515
redirectUri: getValueFromEnv("SINGPASS_AUTH_REDIRECT_URL"),
1616
jweDecryptKey: {
1717
key: getValueFromEnv("SINGPASS_AUTH_JWE_DECRYPT_KEY"),
18-
format: getValueFromEnv("SINGPASS_AUTH_JWE_DECRYPT_KEY_FORMAT")
18+
format: getValueFromEnv("SINGPASS_AUTH_JWE_DECRYPT_KEY_FORMAT"),
1919
},
2020
clientAssertionSignKey: {
2121
key: getValueFromEnv("SINGPASS_AUTH_CLIENT_ASSERTION_SIGN_KEY"),
2222
alg: getValueFromEnv("SINGPASS_AUTH_CLIENT_ASSERTION_SIGN_KEY_ALG"),
23-
}
24-
}
23+
},
24+
},
2525
};

src/util/__tests__/JweUtil.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable max-len */
22
import * as jose from "node-jose";
33
import { TokenResponse } from "../../singpass/shared-constants";
4-
import { decryptJWE, extractJwtHeader, extractKidFromIdToken } from "../JweUtil";
54
import { SingpassMyInfoError } from "../error/SingpassMyinfoError";
5+
import { decryptJWE, extractJwtHeader, extractKidFromIdToken } from "../JweUtil";
66

77
describe("extractJwtHeader", () => {
88
it("should extract JWT header", () => {
@@ -54,7 +54,7 @@ fdescribe("decryptJWE", () => {
5454
d: "4yo4UhZCl7wrfi1Wi5TzHUMfDNhN_aUn-kNM4zJvsaM",
5555
use: "enc",
5656
kid: "MatchingKey",
57-
alg: "ECDH-ES+A128KW"
57+
alg: "ECDH-ES+A128KW",
5858
};
5959
const jwks = JSON.stringify({
6060
keys: [
@@ -64,9 +64,9 @@ fdescribe("decryptJWE", () => {
6464
},
6565
{
6666
...jwkKey,
67-
kid: "NonMatchingKey"
68-
}
69-
]
67+
kid: "NonMatchingKey",
68+
},
69+
],
7070
});
7171
const jwk = JSON.stringify({ ...jwkKey, kid: "MatchingKey" });
7272
const payload = JSON.stringify({ foo: "bar" });

0 commit comments

Comments
 (0)