Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"ts-pattern": "^5.8.0",
"turnstile-types": "^1.2.3",
"type-fest": "^5.1.0",
"typescript": "^5.8.3",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.1",
"unist-util-visit": "^5.0.0",
"vite": "^7.1.10",
Expand Down
2 changes: 1 addition & 1 deletion web/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@types/semver": "^7.7.1",
"prettier": "^3.6.2",
"semver": "^7.7.3",
"typescript": "^5.8.3"
"typescript": "^5.9.3"
},
"engines": {
"node": ">=24"
Expand Down
47 changes: 0 additions & 47 deletions web/packages/sfe/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,53 +311,6 @@ class AuthenticatorValidateStage extends Stage<AuthenticatorValidationChallenge>
return false;
}

/**
* Transforms items in the credentialCreateOptions generated on the server
* into byte arrays expected by the navigator.credentials.create() call
*/
transformCredentialCreateOptions(
credentialCreateOptions: PublicKeyCredentialCreationOptions,
userId: string,
): PublicKeyCredentialCreationOptions {
const user = credentialCreateOptions.user;
// Because json can't contain raw bytes, the server base64-encodes the User ID
// So to get the base64 encoded byte array, we first need to convert it to a regular
// string, then a byte array, re-encode it and wrap that in an array.
const stringId = decodeURIComponent(window.atob(userId));
user.id = this.u8arr(this.b64enc(this.u8arr(stringId)));
const challenge = this.u8arr(credentialCreateOptions.challenge.toString());

return Object.assign({}, credentialCreateOptions, {
challenge,
user,
});
}

/**
* Transforms the binary data in the credential into base64 strings
* for posting to the server.
* @param {PublicKeyCredential} newAssertion
*/
transformNewAssertionForServer(newAssertion: PublicKeyCredential): Assertion {
const attObj = new Uint8Array(
(newAssertion.response as AuthenticatorAttestationResponse).attestationObject,
);
const clientDataJSON = new Uint8Array(newAssertion.response.clientDataJSON);
const rawId = new Uint8Array(newAssertion.rawId);

const registrationClientExtensions = newAssertion.getClientExtensionResults();
return {
id: newAssertion.id,
rawId: this.b64enc(rawId),
type: newAssertion.type,
registrationClientExtensions: JSON.stringify(registrationClientExtensions),
response: {
clientDataJSON: this.b64enc(clientDataJSON),
attestationObject: this.b64enc(attObj),
},
};
}

transformCredentialRequestOptions(
credentialRequestOptions: PublicKeyCredentialRequestOptions,
): PublicKeyCredentialRequestOptions {
Expand Down
9 changes: 6 additions & 3 deletions web/scripts/build-locales.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { spawnSync } from "node:child_process";
import { readFileSync, statSync } from "node:fs";
import path from "node:path";
/// <reference types="node" />

/**
* @file Lit Localize build script.
Expand All @@ -16,6 +14,11 @@ import path from "node:path";
* @import { ConfigFile } from "@lit/localize-tools/lib/types/config.js"
* @import { Stats } from "node:fs";
*/

import { spawnSync } from "node:child_process";
import { readFileSync, statSync } from "node:fs";
import path from "node:path";

import { PackageRoot } from "#paths/node";

/**
Expand Down
2 changes: 2 additions & 0 deletions web/scripts/pseudolocalize.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="node" />

/**
* @file Pseudo-localization script.
*
Expand Down
2 changes: 1 addition & 1 deletion web/src/common/helpers/webauthn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function b64RawEnc(buf: Uint8Array): string {
return base64js.fromByteArray(buf).replace(/\+/g, "-").replace(/\//g, "_");
}

export function u8arr(input: string): Uint8Array {
export function u8arr(input: string): Uint8Array<ArrayBuffer> {
return Uint8Array.from(atob(input.replace(/_/g, "/").replace(/-/g, "+")), (c) =>
c.charCodeAt(0),
);
Expand Down
4 changes: 4 additions & 0 deletions web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
"storybook-static",
"src/**/*.test.ts",
"./tests",
// TODO: @lit/localize-tools v0.8.0 has a nullish coalescing typing error.
// Remove when we upgrade past that.
"scripts/pseudolocalize.mjs",
"scripts/build-locales.mjs",

// TODO: Remove after monorepo cleanup.
"src/**/*.comp.ts"
Expand Down
Loading