Comments (4)
Hi there, checking in on the status of this PR (#68), would be very helpful to implement EIP-1271 for Sign-In with Ethereum spruceid/siwe-ruby#15, let me know if there is anything I can do to help!
@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 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. 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.
from eth.rb.
from eth.rb.
from eth.rb.
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;
}
}
from eth.rb.
Related Issues (20)
- Personal signatures differ from metamask signatures HOT 1
- Geth version question HOT 1
- Invalid value for negative int from eth_call HOT 2
- Unpatch Geth
- missing bech32 depedency HOT 4
- client.rb is_a? Address HOT 2
- Abi::Event.decode_log raised an error HOT 1
- I can't pass an array of addresses to the smart contract.
- Signature Mismatch Issue with bytes HOT 9
- How call a method via Contract Proxy? HOT 6
- Upgrade from 0.4.X to 0.5.X Eth.configure issue HOT 3
- Unable to make ERC20 Transfer or any other transfer on self-hosted GETH Blockchain/Node HOT 6
- unable to build with clang: ./warnp.c:39:9: error: call to undeclared function 'strdup' HOT 1
- Signature Mismatch in Ruby vs. JavaScrip HOT 1
- eth call contract function get error IOError: execution reverted HOT 2
- Problem with fetching archive data HOT 2
- Unable to parse tuple response HOT 1
- ci: incompatible solc and geth version
- calling methods with "tuple" type return gives error
- Decode transaction input HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eth.rb.