Skip to content

Commit

Permalink
Removed unnecessary msgPayload parameter from parseRawP256Signature
Browse files Browse the repository at this point in the history
  • Loading branch information
SnickerChar committed Oct 30, 2024
1 parent 7a330e8 commit 9d4b85f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/node-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@snickerdoodlelabs/node-utils",
"version": "2.1.0",
"version": "2.1.1",
"description": "Utilities that rely on Node APIs. They are usable in a browser with polyfills",
"license": "MIT",
"repository": {
Expand Down
3 changes: 0 additions & 3 deletions packages/node-utils/src/implementations/CryptoUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,6 @@ export class CryptoUtils implements ICryptoUtils {
// returns a 64-byte ArrayBuffer containing r and s concatenated together
public parseRawP256Signature(
signature: P256Signature,
msgPayload: string,
): Result<P256SignatureComponents, InvalidParametersError> {
const signatureView = this.hexToUint8Array(signature);

Expand Down Expand Up @@ -793,8 +792,6 @@ export class CryptoUtils implements ICryptoUtils {
"",
);

const sigAndMsgPayload = msgPayload + `r: 0x${rString}, s: 0x${sString}`;

// return the signature formatted for use in crypto.subtle.verify
return ok(
new P256SignatureComponents(
Expand Down
1 change: 0 additions & 1 deletion packages/node-utils/src/interfaces/ICryptoUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ export interface ICryptoUtils {

parseRawP256Signature(
signature: P256Signature,
msgPayload: string,
): Result<P256SignatureComponents, InvalidParametersError>;

parseClientDataJSON(
Expand Down
4 changes: 1 addition & 3 deletions packages/node-utils/test/unit/CryptoUtils4.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ describe("CryptoUtils Tests 4", () => {
// 31, 110, 197, 103, 194, 3, 1, 44, 58, 255, 82, 175, 220, 80, 29, 139, 21,
// 137, 114, 60,
// ]);
const mockMsgPayload = `authenticatorData: 0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000, clientJSONData: "{\"type\":\"webauthn.get\",\"challenge\":\"SkgtbmpSNGs4TUw3T3k3LUxsVUZtQeCNdoJu1unwpgzfenUVeSFuX221IEmGHVYEGrQ0G5A3l1CPrqa6jtHx3a4SdKeJxGRgaH2ChCnqOjcfmd6TiLc\",\"origin\":\"http://localhost:8000\",\"crossOrigin\":false}"`;

const expectedValue = {
r: "2ae4188c4bf694fa309f6d05145408b57744fa7edfadfa120143f82c8887dd45",
s: "a3009ac7d91a9945a454011ec4e5c568a5b20727e3fc8b804142fda1d918f289",
Expand All @@ -86,7 +84,7 @@ describe("CryptoUtils Tests 4", () => {

// Act
const result = utils
.parseRawP256Signature(mockSignature, mockMsgPayload)
.parseRawP256Signature(mockSignature)
.unwrapOr(defaultValue);

// Assert
Expand Down

0 comments on commit 9d4b85f

Please sign in to comment.