-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR changes the behaviour of the shared signer to store its configuration as if it were behind a mapping where the key is the shared signer address. This allows multiple shared signer instances to be configured for a single account (in case you ever need to deploy a 2/2 Safe owned by passkeys with 4337). I created an "accessor" contract to prove that the storage location is indeed the equivalent to a `mapping(address self => Signer)`.
- Loading branch information
Showing
4 changed files
with
98 additions
and
26 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
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
19 changes: 19 additions & 0 deletions
19
modules/passkey/contracts/test/TestSharedWebAuthnSignerAccessor.sol
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,19 @@ | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
pragma solidity ^0.8.0; | ||
|
||
import {SafeWebAuthnSharedSigner} from "../4337/experimental/SafeWebAuthnSharedSigner.sol"; | ||
|
||
contract TestSharedWebAuthnSignerAccessor { | ||
function getSignerConfiguration(address sharedSigner) external view returns (SafeWebAuthnSharedSigner.Signer memory signer) { | ||
signer = _getSigners()[sharedSigner]; | ||
} | ||
|
||
function _getSigners() private pure returns (mapping(address => SafeWebAuthnSharedSigner.Signer) storage signers) { | ||
uint256 signersSlot = uint256(keccak256("SafeWebAuthnSharedSigner.signer")) - 1; | ||
|
||
// solhint-disable-next-line no-inline-assembly | ||
assembly ("memory-safe") { | ||
signers.slot := signersSlot | ||
} | ||
} | ||
} |
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