Skip to content

Commit 079fa65

Browse files
authored
Format all files with updated prettier. (#2973)
1 parent bda7fde commit 079fa65

File tree

155 files changed

+940
-905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+940
-905
lines changed

demos/test-app/src/auth.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const authWithII = async ({
6767

6868
// Send the request to II
6969
const sessionPublicKey: Uint8Array = new Uint8Array(
70-
sessionIdentity.getPublicKey().toDer()
70+
sessionIdentity.getPublicKey().toDer(),
7171
);
7272

7373
const request = {
@@ -120,12 +120,12 @@ const identityFromResponse = ({
120120

121121
const delegationChain = DelegationChain.fromDelegations(
122122
delegations,
123-
response.userPublicKey.buffer
123+
response.userPublicKey.buffer,
124124
);
125125

126126
const identity = DelegationIdentity.fromDelegation(
127127
sessionIdentity,
128-
delegationChain
128+
delegationChain,
129129
);
130130

131131
return identity;
@@ -137,12 +137,12 @@ type ElementOf<Arr> = Arr extends readonly (infer ElementOf)[]
137137
: "argument is not an array";
138138

139139
export const extractDelegation = (
140-
signedDelegation: ElementOf<AuthResponseSuccess["delegations"]>
140+
signedDelegation: ElementOf<AuthResponseSuccess["delegations"]>,
141141
): SignedDelegation => ({
142142
delegation: new Delegation(
143143
signedDelegation.delegation.pubkey,
144144
signedDelegation.delegation.expiration,
145-
signedDelegation.delegation.targets
145+
signedDelegation.delegation.targets,
146146
),
147147
signature: signedDelegation.signature
148148
.buffer as Signature /* brand type for agent-js */,

demos/test-app/src/index.tsx

+27-27
Original file line numberDiff line numberDiff line change
@@ -21,58 +21,58 @@ import "./main.css";
2121
const signInBtn = document.getElementById("signinBtn") as HTMLButtonElement;
2222
const whoamiBtn = document.getElementById("whoamiBtn") as HTMLButtonElement;
2323
const updateAlternativeOriginsBtn = document.getElementById(
24-
"updateNewAlternativeOrigins"
24+
"updateNewAlternativeOrigins",
2525
) as HTMLButtonElement;
2626
const openIiWindowBtn = document.getElementById(
27-
"openIiWindowBtn"
27+
"openIiWindowBtn",
2828
) as HTMLButtonElement;
2929
const closeIiWindowBtn = document.getElementById(
30-
"closeIIWindowBtn"
30+
"closeIIWindowBtn",
3131
) as HTMLButtonElement;
3232
const invalidDataBtn = document.getElementById(
33-
"invalidDataBtn"
33+
"invalidDataBtn",
3434
) as HTMLButtonElement;
3535
const incompleteMessageBtn = document.getElementById(
36-
"incompleteMessageBtn"
36+
"incompleteMessageBtn",
3737
) as HTMLButtonElement;
3838
const validMessageBtn = document.getElementById(
39-
"validMessageBtn"
39+
"validMessageBtn",
4040
) as HTMLButtonElement;
4141
const customMessageEl = document.getElementById(
42-
"customMessage"
42+
"customMessage",
4343
) as HTMLInputElement;
4444
const customMessageBtn = document.getElementById(
45-
"customMessageBtn"
45+
"customMessageBtn",
4646
) as HTMLButtonElement;
4747
const messagesEl = document.getElementById("messages") as HTMLElement;
4848
const hostUrlEl = document.getElementById("hostUrl") as HTMLInputElement;
4949
const whoAmIResponseEl = document.getElementById(
50-
"whoamiResponse"
50+
"whoamiResponse",
5151
) as HTMLDivElement;
5252
const alternativeOriginsEl = document.getElementById(
53-
"alternativeOrigins"
53+
"alternativeOrigins",
5454
) as HTMLDivElement;
5555
const newAlternativeOriginsEl = document.getElementById(
56-
"newAlternativeOrigins"
56+
"newAlternativeOrigins",
5757
) as HTMLInputElement;
5858
const principalEl = document.getElementById("principal") as HTMLDivElement;
5959
const authnMethodEl = document.querySelector(
60-
'[data-role="authn-method"]'
60+
'[data-role="authn-method"]',
6161
) as HTMLDivElement;
6262
const delegationEl = document.getElementById("delegation") as HTMLPreElement;
6363
const expirationEl = document.getElementById("expiration") as HTMLDivElement;
6464
const iiUrlEl = document.getElementById("iiUrl") as HTMLInputElement;
6565
const maxTimeToLiveEl = document.getElementById(
66-
"maxTimeToLive"
66+
"maxTimeToLive",
6767
) as HTMLInputElement;
6868
const derivationOriginEl = document.getElementById(
69-
"derivationOrigin"
69+
"derivationOrigin",
7070
) as HTMLInputElement;
7171
const autoSelectionPrincipalEl = document.getElementById(
72-
"autoSelectionPrincipal"
72+
"autoSelectionPrincipal",
7373
) as HTMLInputElement;
7474
const allowPinAuthenticationEl = document.getElementById(
75-
"allowPinAuthentication"
75+
"allowPinAuthentication",
7676
) as HTMLInputElement;
7777

7878
let iiProtocolTestWindow: Window | undefined;
@@ -112,7 +112,7 @@ const idlFactory = ({ IDL }: { IDL: any }) => {
112112
update_alternative_origins: IDL.Func(
113113
[IDL.Text, AlternativeOriginsMode],
114114
[],
115-
[]
115+
[],
116116
),
117117
whoami: IDL.Func([], [IDL.Principal], ["query"]),
118118
});
@@ -135,7 +135,7 @@ const updateDelegationView = ({
135135
delegationEl.innerText = JSON.stringify(
136136
identity.getDelegation().toJSON(),
137137
undefined,
138-
2
138+
2,
139139
);
140140

141141
// cannot use Math.min, as we deal with bigint here
@@ -171,7 +171,7 @@ function addMessageElement({
171171
messageTitle.classList.add("postMessage-title");
172172
const messageContent = document.createElement("div");
173173
messageContent.innerText = JSON.stringify(message, (_, v) =>
174-
typeof v === "bigint" ? v.toString() : v
174+
typeof v === "bigint" ? v.toString() : v,
175175
);
176176
if (ty === "received") {
177177
messageTitle.innerText = "Message Received";
@@ -199,12 +199,12 @@ window.addEventListener("message", (event) => {
199199
const delegations = event.data.delegations.map(extractDelegation);
200200
const delegationChain = DelegationChain.fromDelegations(
201201
delegations,
202-
event.data.userPublicKey.buffer
202+
event.data.userPublicKey.buffer,
203203
);
204204
updateDelegationView({
205205
identity: DelegationIdentity.fromDelegation(
206206
getLocalIdentity(),
207-
delegationChain
207+
delegationChain,
208208
),
209209
});
210210
});
@@ -301,7 +301,7 @@ const init = async () => {
301301
const validMessage = {
302302
kind: "authorize-client",
303303
sessionPublicKey: new Uint8Array(
304-
getLocalIdentity().getPublicKey().toDer()
304+
getLocalIdentity().getPublicKey().toDer(),
305305
),
306306
derivationOrigin,
307307
maxTimeToLive,
@@ -330,7 +330,7 @@ const init = async () => {
330330
});
331331
const modeSelection = (
332332
document.querySelector(
333-
'input[name="alternativeOriginsMode"]:checked'
333+
'input[name="alternativeOriginsMode"]:checked',
334334
) as HTMLInputElement
335335
).value;
336336
let mode:
@@ -430,7 +430,7 @@ function handleFlowReady(evnt: MessageEvent) {
430430

431431
if (opts === undefined) {
432432
return showError(
433-
"Unexpected: received OK from IDP but this test app is not ready"
433+
"Unexpected: received OK from IDP but this test app is not ready",
434434
);
435435
}
436436

@@ -491,7 +491,7 @@ function handleFlowFinished(evnt: MessageEvent) {
491491
const ver = decodeJwt(verifiablePresentation) as any;
492492
const creds = ver.vp.verifiableCredential;
493493
const [alias, credential] = creds.map((cred: string) =>
494-
JSON.stringify(decodeJwt(cred), null, 2)
494+
JSON.stringify(decodeJwt(cred), null, 2),
495495
);
496496

497497
setLatestPresentation({ alias, credential });
@@ -504,7 +504,7 @@ function handleFlowFinished(evnt: MessageEvent) {
504504
const App = () => {
505505
// The URL used for connecting to the issuer
506506
const [issuerUrl, setIssuerUrl] = useState<string>(
507-
"http://issuer.localhost:5173"
507+
"http://issuer.localhost:5173",
508508
);
509509

510510
const [issuerCanisterId, setIssuerCanisterId] = useState<string>("");
@@ -607,5 +607,5 @@ const App = () => {
607607
ReactDOM.createRoot(document.getElementById("root-vc-flow")!).render(
608608
<React.StrictMode>
609609
<App />
610-
</React.StrictMode>
610+
</React.StrictMode>,
611611
);

demos/using-dev-build/specs/auth.e2e.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe("authentication", () => {
1818
(await title.getText()) === "You’ve created an Internet Identity!"
1919
);
2020
},
21-
{ timeout: 20_000 }
21+
{ timeout: 20_000 },
2222
);
2323
});
2424
});

demos/using-dev-build/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const readCanisterId = ({
2020
return stdout.toString().trim();
2121
} catch (e) {
2222
throw Error(
23-
`Could not get canister ID for '${canisterName}' with command '${command}', was the canister deployed? ${e}`
23+
`Could not get canister ID for '${canisterName}' with command '${command}', was the canister deployed? ${e}`,
2424
);
2525
}
2626
};

demos/using-dev-build/vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ export default defineConfig(
2929
"/api": "http://127.0.0.1:4943",
3030
},
3131
},
32-
})
32+
}),
3333
);

demos/using-dev-build/vite.plugins.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const readCanisterIds = (): Record<string, string> => {
2020
};
2121

2222
const config: Record<string, Details> = JSON.parse(
23-
readFileSync(canisterIdsJsonFile, "utf-8")
23+
readFileSync(canisterIdsJsonFile, "utf-8"),
2424
);
2525

2626
return Object.entries(config).reduce((acc, current: [string, Details]) => {

demos/using-dev-build/webapp/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<style>

demos/vc_issuer/app/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />

demos/vc_issuer/app/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import "./main.css";
1414
const readCanisterId = (): string => {
1515
// The backend uses a known element ID so that we can pick up the value from here
1616
const setupJs = document.querySelector(
17-
"[data-canister-id]"
17+
"[data-canister-id]",
1818
) as HTMLElement | null;
1919
if (!setupJs || setupJs.dataset.canisterId === undefined) {
2020
throw new Error("canisterId is undefined"); // abort further execution of this script
@@ -42,7 +42,7 @@ const App = () => {
4242

4343
// The derivation origin to use for authentication
4444
const [derivationOrigin, setDerivationOrigin] = useState<string | undefined>(
45-
undefined
45+
undefined,
4646
);
4747

4848
// The principal, set during auth
@@ -185,5 +185,5 @@ const App = () => {
185185
ReactDOM.createRoot(document.getElementById("root")!).render(
186186
<React.StrictMode>
187187
<App />
188-
</React.StrictMode>
188+
</React.StrictMode>,
189189
);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"lint:eslint": "eslint --max-warnings 0 --cache --cache-location node_modules/.cache/eslint 'src/frontend/**/*.ts*' 'src/showcase/**/*.ts'",
3232
"lint:lit": "lit-analyzer -- --rules.no-incompatible-type-binding off --rules.no-invalid-directive-binding off --rules.no-noncallable-event-binding off ./src/showcase ./src/frontend",
3333
"format": "prettier --write src/showcase src/frontend src/vc-api src/sig-verifier-js src/vite-plugins tsconfig.json tsconfig.all.json eslint.config.js vite.config.ts vitest.config.ts demos",
34-
"format-check": "exit 0"
34+
"format-check": "prettier --check src/showcase src/frontend src/vc-api src/sig-verifier-js src/vite-plugins tsconfig.json tsconfig.all.json eslint.config.js vite.config.ts vitest.config.ts demos"
3535
},
3636
"devDependencies": {
3737
"@astrojs/check": "^0.9.4",

src/frontend/callback/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />

src/frontend/faq.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />

src/frontend/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />

src/frontend/screenshots.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async function takeLandingScreenshots(browser: WebdriverIO.Browser) {
4242
window.scrollTo(0, i * screenshotHeight);
4343
},
4444
i,
45-
screenshotHeight
45+
screenshotHeight,
4646
);
4747
await browser.saveScreenshot(`${SCREENSHOTS_DIR}/landing_${i + 1}.png`);
4848
}
@@ -59,7 +59,7 @@ async function takeShowcaseScreenshots(browser: WebdriverIO.Browser) {
5959
await pageLinks.map(async (link) => {
6060
const pageName = await link.getAttribute("data-page-name");
6161
return pageName;
62-
})
62+
}),
6363
);
6464

6565
// Iterate the pages and screenshot them
@@ -83,7 +83,7 @@ async function takeShowcaseScreenshots(browser: WebdriverIO.Browser) {
8383

8484
/** Create a chrome instance and run callback, deleting session afterwards */
8585
async function withChrome<T>(
86-
cb: (browser: WebdriverIO.Browser) => T
86+
cb: (browser: WebdriverIO.Browser) => T,
8787
): Promise<T> {
8888
// Screenshot image dimension, if specified
8989
const { mobileEmulation } = readScreenshotsConfig();
@@ -169,15 +169,15 @@ async function visit(browser: WebdriverIO.Browser, url: string) {
169169
{
170170
timeout: 10 * 1000,
171171
timeoutMsg: "Images did not load after 10 seconds",
172-
}
172+
},
173173
);
174174

175175
await browser.waitUntil(
176176
() => browser.execute(() => document.readyState === "complete"),
177177
{
178178
timeout: 10 * 1000,
179179
timeoutMsg: "Browser did not load after 10 seconds",
180-
}
180+
},
181181
);
182182
}
183183

src/frontend/src/banner.ts

+20-16
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,27 @@ export const showWarningIfNecessary = (config: InternetIdentityInit): void => {
99
const isProduction: boolean = config.is_production[0] ?? false;
1010
const firstUrl: string = config.related_origins[0]?.[0] ?? OFFICIAL_II_URL;
1111
if (anyFeatures()) {
12-
showWarning(html`Test only. Do not use your regular Internet Identity!
13-
<a
14-
class="features-warning-btn"
15-
target="_blank"
16-
rel="noopener noreferrer"
17-
href="https://github.com/dfinity/internet-identity#build-features"
18-
>more</a
19-
>`);
12+
showWarning(
13+
html`Test only. Do not use your regular Internet Identity!
14+
<a
15+
class="features-warning-btn"
16+
target="_blank"
17+
rel="noopener noreferrer"
18+
href="https://github.com/dfinity/internet-identity#build-features"
19+
>more</a
20+
>`,
21+
);
2022
} else if (!isProduction) {
21-
showWarning(html`This is not the official Internet Identity.
22-
<a
23-
class="features-warning-btn"
24-
target="_blank"
25-
rel="noopener noreferrer"
26-
href=${firstUrl}
27-
>go to official</a
28-
>`);
23+
showWarning(
24+
html`This is not the official Internet Identity.
25+
<a
26+
class="features-warning-btn"
27+
target="_blank"
28+
rel="noopener noreferrer"
29+
href=${firstUrl}
30+
>go to official</a
31+
>`,
32+
);
2933
}
3034
};
3135

0 commit comments

Comments
 (0)