-
-
Notifications
You must be signed in to change notification settings - Fork 959
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove webauthn-p256 in favor of Ox (#3232)
* feat: remove webauthn-p256 in favor of Ox Co-Authored-By: Micah Zoltu <[email protected]> * chore: up size --------- Co-authored-by: Micah Zoltu <[email protected]>
- Loading branch information
1 parent
884f5ee
commit e1df486
Showing
9 changed files
with
132 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"viem": patch | ||
--- | ||
|
||
Upgraded WebAuthn Accounts to use `ox` instead of `webauthn-p256`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 27 additions & 7 deletions
34
src/account-abstraction/accounts/createWebAuthnCredential.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
// biome-ignore lint/performance/noBarrelFile: | ||
export { | ||
type CreateCredentialParameters as CreateWebAuthnCredentialParameters, | ||
type CreateCredentialReturnType as CreateWebAuthnCredentialReturnType, | ||
type P256Credential, | ||
createCredential as createWebAuthnCredential, | ||
} from 'webauthn-p256' | ||
// TODO(v3): Remove this in favor of `ox/WebAuthnP256` entirely. | ||
import * as PublicKey from 'ox/PublicKey' | ||
import * as WebAuthnP256 from 'ox/WebAuthnP256' | ||
|
||
import type { Hex } from '../../types/misc.js' | ||
|
||
export type P256Credential = { | ||
id: WebAuthnP256.P256Credential['id'] | ||
publicKey: Hex | ||
raw: WebAuthnP256.P256Credential['raw'] | ||
} | ||
|
||
export type CreateWebAuthnCredentialParameters = | ||
WebAuthnP256.createCredential.Options | ||
|
||
export type CreateWebAuthnCredentialReturnType = P256Credential | ||
|
||
export async function createWebAuthnCredential( | ||
parameters: CreateWebAuthnCredentialParameters, | ||
): Promise<CreateWebAuthnCredentialReturnType> { | ||
const credential = await WebAuthnP256.createCredential(parameters) | ||
return { | ||
id: credential.id, | ||
publicKey: PublicKey.toHex(credential.publicKey, { includePrefix: false }), | ||
raw: credential.raw, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters