@prifilabs/auth-oracle-ethereum-js
v1.1.2
Published
Multi-factor authentication for Ethereum applications
Downloads
0
Readme
The Authentication Oracle
The privacy-preserving multi-factor authentication for blockchain applications.
Installation
npm install @prifilabs/auth-oracle-ethereum-js
The Authenticatable Contract
pragma solidity ^0.8.9;
import "@prifilabs/auth-oracle-ethereum-js/contracts/token/ERC20/IERC20.sol";
import "@prifilabs/auth-oracle-ethereum-js/contracts/Authenticatable.sol";
contract TwoFactorExample is Authenticatable{
address public owner;
bytes32 public token;
uint public freshness;
constructor(AuthOracle _auth, Credentials memory credentials, uint _freshness) payable Authenticatable(_auth) checkCredentialsWithFactorAndFreshness(credentials, msg.sender, "email",
_freshness){
owner = msg.sender;
token = credentials.token;
freshness = _freshness;
}
function withdraw(Credentials memory credentials, uint256 amount) public checkCredentialsWithFactorAndFreshness(credentials, msg.sender, "email", freshness) {
require(owner == msg.sender);
require(token == credentials.token);
payable(msg.sender).transfer(amount);
}
}