Skip to content

SelfKeyDAO/selfkey-authorization

Repository files navigation

Selfkey ID Authorization

Overview

Selfkey ID Authorization Smart Contract. Signature based authorization mechanism for onchain transactions.

Development

All smart contracts are implemented in Solidity ^0.8.19, using Hardhat as the Solidity development framework.

Prerequisites

  • NodeJS, v16.1.0+
  • Hardhat, which is a comprehensive framework for Ethereum development.

Initialization

npm install

Testing

npx hardhat test

or with code coverage

npx hardhat coverage

Contract method interface

The following public functions are provided:

  • getMessageHash(address _from, address _to, string memory _scope, bytes32 _param, uint _timestamp) returns (bytes32) : obtain hash
  • getEthSignedMessageHash(bytes32 _messageHash) returns (bytes32) : obtain signed message hash
  • setMinimumAmount(uint _amount) onlyOwners: allows owners to change the minimum payment amoutn required
  • verify(address _signer, address _from, address _to, string memory _scope, bytes32 _param, uint _timestamp, bytes memory signature) returns (bool): Verify if hash correctly signed
  • authorize(address _from, address _to, string memory _scope, bytes32 _param, uint _timestamp, address signer, bytes memory signature) returns (bool): Returns true if hash is valid
  • recoverSigner(bytes32 _ethSignedMessageHash, bytes memory _signature) returns (address): Recover signer

Contributing

Please see the contributing notes.

Copyright

Copyright SelfKey DAO Foundation 2024. All rights reserved.

About

Selfkey ID Authorization Smart Contract.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors