-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eip 1271 support #44
Comments
@w4ll3 I'm tracking EIP-1271 here, let's briefly discuss this. I'm not very familiar with the mechanics of 1271 but will you require full smart-contract support as in It's quite probable that 1271 does only require a subset of the functionality of that PR #68. Could you describe in a few bullet points what the 1271 authentication workflow looks like, so I can take a look? Maybe we can prioritize this specific feature. |
Sure, 1271 defines a function that should be implemented on smart contract
wallets, isValidSignature(hash, signature), so in order to support it we
would need support to make a call using this ABI, you can see a Typescript
implementation of it here
https://github.com/spruceid/siwe/blob/main/packages/siwe/lib/utils.ts
Att,
Gregório Granado Magalhães.
…On Mon, Apr 25, 2022, 1:24 PM Afr Schoe ***@***.***> wrote:
Hi there, checking in on the status of this PR (#68
<#68>), would be very helpful to
implement EIP-1271 for Sign-In with Ethereum spruceid/siwe-ruby#15
<spruceid/siwe-ruby#15>, let me know if there
is anything I can do to help!
@w4ll3 <https://github.com/w4ll3> I'm tracking EIP-1271 here, let's
briefly discuss this. I'm not very familiar with the mechanics of 1271 but
will you require full smart-contract support as in ethereum.rb gem?
@kurotaky <https://github.com/kurotaky> is working on that but it might
take a couple of weeks to release this.
It's quite probable that 1271 does only require a subset of the
functionality of that PR #68 <#68>.
Could you describe in a few bullet points what the 1271 authentication
workflow looks like, so I can take a look? Maybe we can prioritize this
specific feature.
—
Reply to this email directly, view it on GitHub
<#44 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBSTQCOD5N52HCHWPXXZB3VG3BKJANCNFSM5LYGLIOA>
.
You are receiving this because you were mentioned.Message ID: <q9f/eth.
***@***.***>
|
Gotcha. // SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8;
library LibBytes {
function readBytes32(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes32 result)
{
index += 32;
require(b.length >= index);
assembly {
result := mload(add(b, index))
}
return result;
}
}
contract Signer {
using LibBytes for bytes;
address constant internal OWNER = 0xCaA29806044A08E533963b2e573C1230A2cd9a2d;
bytes4 constant internal MAGIC_VALUE = 0x1626ba7e;
function isValidSignature(
bytes32 _hash,
bytes calldata _signature
)
external
pure
returns (bytes4)
{
if (recoverSigner(_hash, _signature) == OWNER) {
return MAGIC_VALUE;
} else {
return 0xffffffff;
}
}
function recoverSigner(
bytes32 _hash,
bytes memory _signature
)
internal
pure
returns (address signer)
{
require(_signature.length == 65);
uint8 v = uint8(_signature[64]);
bytes32 r = _signature.readBytes32(0);
bytes32 s = _signature.readBytes32(32);
signer = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _hash)), v, r, s);
return signer;
}
} |
https://eips.ethereum.org/EIPS/eip-1271
The text was updated successfully, but these errors were encountered: