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
4 changes: 2 additions & 2 deletions packages/sdk/src/utils/encoding.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Address, encodeAbiParameters, getAbiItem, type Hash, type Hex, parseAbiParameters, toHex } from "viem";
import { type Address, encodeAbiParameters, getAbiItem, type Hash, type Hex, pad, parseAbiParameters, toHex } from "viem";

import { SessionKeyModuleAbi } from "../abi/SessionKeyModule.js";
import { getPeriodIdsForTransaction, type SessionConfig } from "../utils/session.js";
Expand Down Expand Up @@ -52,7 +52,7 @@ export const encodePasskeyModuleParameters = (passkey: { passkeyPublicKey: [Buff
{ type: "string", name: "expectedOrigin" },
],
[
[toHex(passkey.passkeyPublicKey[0]), toHex(passkey.passkeyPublicKey[1])],
[pad(toHex(passkey.passkeyPublicKey[0])), pad(toHex(passkey.passkeyPublicKey[1]))],
passkey.expectedOrigin,
],
);
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/utils/passkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ECDSASigValue } from "@peculiar/asn1-ecc";
import { AsnParser } from "@peculiar/asn1-schema";
import { bigintToBuf, bufToBigint } from "bigint-conversion";
import { Buffer } from "buffer";
import { type Address, encodeAbiParameters, type Hex, toHex } from "viem";
import { type Address, encodeAbiParameters, type Hex, pad, toHex } from "viem";

enum COSEKEYS {
kty = 1, // Key Type
Expand Down Expand Up @@ -324,7 +324,7 @@ export function passkeyHashSignatureResponseFormat(
[
toHex(base64UrlToUint8Array(passkeyResponse.authenticatorData)),
toHex(base64UrlToUint8Array(passkeyResponse.clientDataJSON)),
[toHex(signature.r), toHex(signature.s)],
[pad(toHex(signature.r)), pad(toHex(signature.s))],
],
);
const fullFormattedSig = encodeAbiParameters(
Expand Down
Loading