Closed matevz closed 1 month ago
Fixes #327
This PR:
contracts/SiweParser.sol
contracts/auth/A13e.sol
contracts/auth/SiweAuth.sol
TODO:
contract MyContract { address private _owner; modifier onlyOwner() { if (msg.sender != _owner) { revert("not allowed"); } _; } constructor() { _owner = msg.sender; } function getSecretMessage() external view onlyOwner returns (string memory) { return "Very secret message"; } }
import {SiweAuth} from "@oasisprotocol/sapphire-contracts/contracts/auth/SiweAuth.sol" contract MyContract is SiweAuth { address private _owner; modifier onlyOwner(bytes calldata bearer) { if (authMsgSender(bearer) != _owner) { revert("not allowed"); } _; } constructor(string memory domain) SiweAuth(domain) { _owner = msg.sender; } function getSecretMessage(bytes calldata bearer) external view onlyOwner(bearer) returns (string memory) { return "Very secret message"; } }
Fixes #327
This PR:
contracts/SiweParser.sol
, an on-chain parser for SIWE messagescontracts/auth/A13e.sol
, an abstract interface for authenticated queries (an alternative to signed queries which will get deprecated in https://github.com/oasisprotocol/sapphire-paratime/pull/303)contracts/auth/SiweAuth.sol
, an on-chain authenticator for SIWE.TODO:
Before (signed queries)
After (on-chain auth)