Skip to content

Commit

Permalink
chore: ignore examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Nov 22, 2024
1 parent 7bb3da8 commit 8414577
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"changelog": ["@changesets/changelog-github", { "repo": "ithacaxyz/porto" }],
"commit": false,
"fixed": [],
"ignore": [],
"ignore": ["wagmi"],
"linked": [],
"updateInternalDependencies": "patch"
}
1 change: 0 additions & 1 deletion examples/wagmi/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "wagmi",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
32 changes: 22 additions & 10 deletions src/internal/accountDelegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,16 +398,25 @@ export async function load<chain extends Chain | undefined>(
) {
const { authorizeKeys = [], rpId } = parameters

// We will sign a random challenge. We need to do this to extract the
// user id (ie. the address) to query for the Account's keys.
const { raw } = await WebAuthnP256.sign({
challenge: '0x',
rpId,
})
let address: Address.Address
let raw: PublicKeyCredential
let credentialId: string
if (parameters.address && parameters.credentialId) {
address = parameters.address
credentialId = parameters.credentialId
} else {
// We will sign a random challenge. We need to do this to extract the
// user id (ie. the address) to query for the Account's keys.
const credential = await WebAuthnP256.sign({
challenge: '0x',
rpId,
})

const response = raw.response as AuthenticatorAssertionResponse
const address = Bytes.toHex(new Uint8Array(response.userHandle!))
const credentialId = raw.id
const response = credential.raw.response as AuthenticatorAssertionResponse
address = Bytes.toHex(new Uint8Array(response.userHandle!))
raw = credential.raw
credentialId = raw.id
}

// If there are extra keys to authorize (ie. session keys), sign over them.
const authorizeKeysResult = await (async () => {
Expand All @@ -418,11 +427,12 @@ export async function load<chain extends Chain | undefined>(
keys: authorizeKeys ?? [],
})

const { signature, metadata } = await WebAuthnP256.sign({
const { signature, metadata, ...rest } = await WebAuthnP256.sign({
challenge: payload,
credentialId,
rpId,
})
raw = rest.raw

const wrappedSignature = wrapSignature({
metadata: getWebAuthnMetadata(metadata),
Expand Down Expand Up @@ -495,6 +505,8 @@ export async function load<chain extends Chain | undefined>(

export declare namespace load {
type Parameters = {
address?: Address.Address | undefined
credentialId?: string | undefined
/** Extra keys to authorize. */
authorizeKeys?: readonly Key[] | undefined
/** Relying Party ID. */
Expand Down

0 comments on commit 8414577

Please sign in to comment.