Skip to content

ERC-1341: Ethereum Web Tokens #1341

@macalinao

Description

@macalinao
eip: 1341
title: Ethereum Web Tokens
author: Ian Macalinao <ian@abacusprotocol.com>, Pradyuman Vig <pradyuman@abacusprotocol.com>
discussions-to: this issue
status: WIP
type: Standards Track
category: ERC
created: 2018-08-20

Simple Summary

JWTs signed using Ethereum addresses.

Abstract

Ethereum web tokens (EWTs) are a subset of JSON web tokens that are signed using Web3. They provide all of the benefits of JWTs while also using Ethereum's cryptography system.

Motivation

There are many use cases out there for authentication, including:

  • Standardizing authorization to permissioned ERC721 metadata
  • Restricting API access to certain Ethereum addresses
  • Proving ownership of an Ethereum address
  • Basically anything auth related!

By creating an authentication specification that plays well with Ethereum, we can standardize the way people authenticate with off-chain systems using their Ethereum address.

Specification

EWTs are just JWTs with a few additional constraints:

  • The alg is set to ETH.
  • An address field must be included in the payload. This address is cross-referenced with the checksummed address retrieved from ecrecover to verify the authenticity of the message.
  • The signed payload is the base64url encoding of web3.sign(payload) where payload is defined as per the JWT standard.

Authentication to an HTTP server can be done by specifying the header:

Authorization: Bearer <ewt>

Rationale

The EWT standard is intentionally simple to make it easy to migrate from or integrate with existing JWT-based systems and libraries.

The JWT standard is already well adopted, so it makes sense to use it as a starting point. It contains features such as expiry, issuer name, etc. that don't make sense to reinvent for Ethereum.

The traditional JWT algorithms do not use Web3 to sign messages, meaning that there is a back-and-forth needed to actually generate a JWT showing that you own your address. EWTs are different, and its auth is akin to the way the Github API does its auth except it uses Ethereum's system instead.

Implementation

JS implementation is available here: https://github.com/abacusprotocol/eth-web-token

Copyright

Copyright and related rights waived via CC0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions