Catalog npm
Back to packageRELEASE DETAILS

0.4.2

npm

@0xsequence/ethauth

ETHAuth -- self-signed authorization proofs

Published11 Feb 2021
Direct dependencies10
Transitive dependenciesNot calculated

README

Current package documentation
 ____ ____ ____ ____ ____ ____ ____
||e |||t |||h |||a |||u |||t |||h ||
||__|||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|/__\|

Usage

pnpm add @0xsequence/ethauth (or yarn add ... or npm install ...)

Format

proof = eth.<address>.<claims>.<signature>.<extra>

Address

The account address in hex encoding, ie. '0x9e63b5BF4b31A7F8d5D8b4f54CD361344Eb744C5'.

Note, you should not take the account address in the ethauth proof at face value -- you must parse the Proof and validate it with the library methods provided. The address is included when used to verify smart wallet based accounts (aka contract-based accounts).

Claims

a base64 encoded JSON object of

interface Claims {
  app: string
  exp: number
  iat?: number
  n?: number
  typ?: string
  ogn?: string
}

Fields:

  • app (required) - App identifier requesting the issuance of the ethauth proof
  • exp (required) - Expired at unix timestamp of when the ethauth proof is valid until
  • iat (optonal) - Issued at unix timestamp of when the ethauth proof has been signed/issued
  • n (optional) - Nonce value which can be used as a challenge number for added security
  • typ (optional) - Type of authorization for this ethauth proof
  • ogn (optional) - Domain origin requesting the issuance of the ethauth proof

Signature

Signature value of the claims message payload. The signature is computed by the EIP712 eth_signTypedData call of the claims object. The signature may be recoverable with ECRecover to determine the EOA address, or you may have a different encoding such as one used with EIP-1271, to validate the contract-based account signature.

Example ETHAuth encoding / decoding

EOA account signature

ethauth-proof = eth.0x89d9f8f31817badb5d718cd6fb483b71dbd2dfed.eyJhcHAiOiJFV1RUZXN0IiwiaWF0IjoxNTk1NTMwODQwLCJleHAiOjE1OTU1MzExNDB9.0x233ab9164a677a41acc8d52c9e1d1a621acebf9bc8d956c8474618b589acebe10cc350deb4b02bf6951cec8bd23507170f204ca326a5a264b8f6f67fa2619c251c

decodes & verifies to:

  • account address: 0x89D9F8f31817BAdb5D718CD6fb483b71DbD2dfeD
  • claims: {"app":"EWTTest","iat":1595530840,"exp":1595531140}
  • signature: 0x233ab9164a677a41acc8d52c9e1d1a621acebf9bc8d956c8474618b589acebe10cc350deb4b02bf6951cec8bd23507170f204ca326a5a264b8f6f67fa2619c251c

Contract-based account signature (verifiable with EIP 1271)

ethauth-proof = eth.0x9e63b5bf4b31a7f8d5d8b4f54cd361344eb744c5.eyJpYXQiOjE1OTQ3NDM4NDgsImV4cCI6MTYyNjI3OTg0OCwibiI6MTMzN30.0x000100012dd090aec5e4a9678f7968533c10fc42b07b9a23fa3b719f79a861adcfc7e1d958e3521bb061c34072f5435681390ccc9be19bf9da32320bd2356d0b4b4d316b1c02

decodes & verifies to:

  • account address: 0x9e63b5bf4b31a7f8d5d8b4f54cd361344eb744c5
  • message: {"iat":1594743848,"exp":1626279848,"n":1337}
  • signature: 0x000100012dd090aec5e4a9678f7968533c10fc42b07b9a23fa3b719f79a861adcfc7e1d958e3521bb061c34072f5435681390ccc9be19bf9da32320bd2356d0b4b4d316b1c02

LICENSE

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 11

Native requirements
10 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
base64url
Environment
{
  "local_name": "base64url",
  "alias": false,
  "peer_metadata": null
}
^3.0.1runtime
jest
Environment
{
  "local_name": "jest",
  "alias": false,
  "peer_metadata": null
}
^26.6.3development
ethers
Environment
{
  "local_name": "ethers",
  "alias": false,
  "peer_metadata": null
}
^5.0.30development
rimraf
Environment
{
  "local_name": "rimraf",
  "alias": false,
  "peer_metadata": null
}
^3.0.2development
rollup
Environment
{
  "local_name": "rollup",
  "alias": false,
  "peer_metadata": null
}
^2.38.5development
ts-jest
Environment
{
  "local_name": "ts-jest",
  "alias": false,
  "peer_metadata": null
}
^26.5.1development
ts-node
Environment
{
  "local_name": "ts-node",
  "alias": false,
  "peer_metadata": null
}
^9.1.1development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^4.1.5development
@types/jest
Environment
{
  "local_name": "@types/jest",
  "alias": false,
  "peer_metadata": null
}
^26.0.18development
rollup-plugin-typescript2
Environment
{
  "local_name": "rollup-plugin-typescript2",
  "alias": false,
  "peer_metadata": null
}
^0.29.0development
ethers
Environment
{
  "local_name": "ethers",
  "alias": false,
  "peer_metadata": null
}
^5.0.26peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "07bf0a0e94f348f81f02fc69f60bc99204da0ec6",
  "tarball": "https://registry.npmjs.org/@0xsequence/ethauth/-/ethauth-0.4.2.tgz",
  "fileCount": 12,
  "integrity": "sha512-CzsoQCcXq9yHdkUsldcML9y4h4yIEnIiDG2jcAUsOZBdBBp2mMimOICgw2A3r+Zxt3sLJrlIkPOEElY3YhGZjw==",
  "signatures": [
    {
      "sig": "MEUCICZ85flB7ciTToQCDt0NM18KLXKyW99EfXcUIoqLYAXbAiEA1WtGhw66n5eNdv4uYu7wvbYT2o3puEYlI+sx2dIDAog=",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 49045,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJa5XCRA9TVsSAnZWagAAzZwP/2WW9guuKHq+mxCLEYmr\nV46ZocCdiyP4AEllTE64Yf1xEXeatm7x+WVfWCm3Mow9Ub3L+zcuqnKGED+f\nK5RTgbMTotqSi2GNGkmphGMOlC2m/BQfNmmJ33WduZRXKhWl9yI4Q6uclDCQ\nrsQKL4sEmLpoV9HrDBBuW9Um/bmD/C/4ypBed3d5n97bpPgN9o+fUdeyz2d1\n9Fog3oBuatgRwWCJh7qUjny+b76PAr8XeVgY26jA0DUV+i5s0LsxHip1D/wX\nhep53fu6hQ8jE1gjbJLM1G7LDpZYnM64DqyqQRrQTZ++b+oAmef4OjUUFP7G\napjqiS80fs1pjvnkacdenCAEq5mbY0Zxp+1yOhXMW+MfSvtt0XQ1TWF6aHwr\nr7mQLWmu29zuhbvkAICW3QlZOM1YHRT3NMBH5ylBGtzjKypKmpdKBFBSdN8X\nJSUhvh78nOMcQa4HlYI3qWuTVTHxyiY7CvQe5AnRjV8oNLz5Ju3UqtMsXMJ2\nub827GXlsmGRFOs/OM4MiraMXcFbuy36HlBRkHYfQdj0ESbn0rA1x3tl+7uN\nvd+7LhTv7FTSbqszwu+EkgD11qmxuVGDw6xy4irhxXF9Zso2rmxLizHJkzDX\n8qMhLAU+UKqeIb9i+WazBCQQfE7F49yphJXWumEJyrplzvOXK39HOqO60vsc\n8Xqy\r\n=51A7\r\n-----END PGP SIGNATURE-----\r\n"
}

Repository

PENDING
0xsequence/ethauth.js

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:20 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:f3fb3a280fd3d0b2c84b41bdd9c8f27a47fcb5081fa3c3668d2f9b48164fb9bf

Other collected versions

2.0.02 Oct1.0.03 Jul0.8.116 Nov0.8.016 Nov0.7.023 Feb0.6.018 DecView all collected versions →