1.1.2 • Published 1 year ago

@prifilabs/auth-oracle-ethereum-js v1.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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);
   }
}

The Authenticatable Contract

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago