Skip to content

Commit 8a5fc79

Browse files
committed
Passkey migrate fix
1 parent a85afbb commit 8a5fc79

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

packages/account/src/account.ts

-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ export class Account {
507507

508508
const wallet = this.walletFor(chainId, status.original.context, allOfAll, this.coders)
509509
const signature = await wallet.signDigest(digest)
510-
511510
const decoded = this.coders.signature.decode(signature)
512511
const signatures = this.coders.signature.signaturesOf(decoded)
513512

packages/passkeys/src/index.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export type PasskeySignerContext = {
3838
}
3939

4040
export type PasskeySignMetadata = {
41-
cantValidateBehavior: 'ignore' | 'eip6492' | 'throw',
41+
cantValidateBehavior: 'ignore' | 'eip6492' | 'throw'
4242
}
4343

4444
function bytesToBase64URL(bytes: Uint8Array): string {
@@ -131,7 +131,9 @@ export class SequencePasskeySigner implements signers.SapientSigner {
131131
return this.reader().isDeployed(await this.getAddress())
132132
}
133133

134-
async buildDeployTransaction(metadata?: commons.WalletDeployMetadata): Promise<commons.transaction.TransactionBundle | undefined> {
134+
async buildDeployTransaction(
135+
metadata?: commons.WalletDeployMetadata
136+
): Promise<commons.transaction.TransactionBundle | undefined> {
135137
if (metadata?.ignoreDeployed && (await this.isDeployed())) {
136138
return
137139
}
@@ -204,11 +206,11 @@ export class SequencePasskeySigner implements signers.SapientSigner {
204206
}
205207

206208
// Pack the flags as hex string for encoding
207-
const flags = `0x${
209+
const flags = `0x${(
208210
(this.requireUserValidation ? 0x40 : 0) |
209211
(BigInt(this.chainId) === 0n ? 0x20 : 0) |
210212
(this.requireBackupSanityCheck ? 0x10 : 0)
211-
}`
213+
).toString(16)}`
212214

213215
// Build signature
214216
const signatureBytes = ethers.solidityPacked(
@@ -228,16 +230,16 @@ export class SequencePasskeySigner implements signers.SapientSigner {
228230
]
229231
)
230232

231-
if (!!metadata && metadata.cantValidateBehavior !== "ignore") {
233+
if (!!metadata && metadata.cantValidateBehavior !== 'ignore') {
232234
let isDeployed = false
233235
try {
234236
isDeployed = await this.isDeployed()
235237
} catch (e) {
236238
// Ignore. Handled below
237239
}
238-
if (!isDeployed && metadata.cantValidateBehavior === "eip6492") {
240+
if (!isDeployed && metadata.cantValidateBehavior === 'eip6492') {
239241
return this.buildEIP6492Signature(signatureBytes)
240-
} else if (!isDeployed && metadata.cantValidateBehavior === "throw") {
242+
} else if (!isDeployed && metadata.cantValidateBehavior === 'throw') {
241243
throw new Error('Cannot sign with a non-deployed passkey signer')
242244
}
243245
}

0 commit comments

Comments
 (0)