Coder Social home page Coder Social logo

solidity-dkim's Introduction

Solidity DKIM

A Solidity library to verify DKIM signatures:

  • Support rsa-sha1 and rsa-sha256 signature algorithms
  • Implement both canonicalization algorithms (simple, relaxed)
  • Support the signature schemes by Gmail, Yahoo, ProtonMail, Outlook
  • Gas cost under 3 million gas

The contract receive raw email as input and return number of success verifications along with the last success domain or the last fail status (if there's no success).

Getting Started

Clone and install dependencies

$ git clone https://github.com/bakaoh/solidity-dkim
$ cd solidity-dkim
$ npm install

Start ganache

Download email from your inbox

download

Test with raw email

$ RAW_EMAIL=<path to your email file> npm run test
# example
$ RAW_EMAIL=test/data/gmail-raw.txt npm run test

3rd party Smart Contracts

Troubleshoot

no header boundary found: The raw email must be in "network normal" format (text is ASCII encoded, lines are separated with CRLF characters, etc.). The downloaded files should work just fine, but if you copy the email content to your text editor, you may need to replace \n with \r\n, e.g. input = input.replace(new RegExp("\n", 'g'), "\r\n")

dns query error: The library is using hardcode _domainkey records and your email domain is not in the current list. In the future, we'll need a proper oracle that can read the _domainkey record for any arbitrary domain.

solidity-dkim's People

Contributors

bakaoh avatar bakatsar avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.