AmbireTech / solidity-dkim

Verify DomainKeys Identified Mail (DKIM) signatures in solidity

Home Page:https://dkim-oracle-demo-gold-psi.now.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solidity DKIM

A Solidity library to efficiently verify DKIM signatures:

  • Supports rsa-sha1 and rsa-sha256 signature algorithms
  • Implements both canonicalization algorithms (simple, relaxed)
  • Gas costs less than 100 thousand
  • Includes email parser library & demo website
  • Tested on Gmail, iCloud, Outlook, Protonmail and Yahoo

How it works

The goal is to verify DKIM signatures using solidity in a secure, private and economical way.

We achieve that by parsing the raw email off-chain in the user's client, and then running the verification on-chain. This ensures that the email gets securely verified while keeping gas costs low.

The project consists of:

  1. DKIM.sol to verify signatures
  2. parse-email to parse emails (supports node & browser environments)
  3. Service.sol to demonstrate usage with Oracle
  4. solidity-dkim demo demo website

Try it out

  1. download a sample email
  2. (optional) download your own email download
  3. visit demo app
  4. make sure metamask is on the rinkeby network
  5. upload email
  6. verify 🎉

Getting Started

Setup

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

Setup Demo

$ cd client
$ npm install

Run project

$ npm run dev
$ migrate

$ cd client
$ npm run dev

Next steps

  • The goal of this project is to provide the necessary primitives for DKIM verification in an unopinioned way. This is why we only verify what is required and we don't perform any parsing on-chain. The next step is to build a login method within Service.sol.

Contributions to open-sourced projects

3rd party smart contracts

Inspired by

Pitfalls

  • no header boundary found: this is usually due to a raw email format being incorrect. Make sure you "download" the raw email like shown here, since copy / pasting to a text file may replace CRLF characters with LF, learn more

About

Verify DomainKeys Identified Mail (DKIM) signatures in solidity

https://dkim-oracle-demo-gold-psi.now.sh/


Languages

Language:Solidity 43.9%Language:JavaScript 29.6%Language:TypeScript 18.6%Language:HTML 7.9%