Files
zkAuth/backend
2023-04-19 00:01:11 +00:00
..
2022-09-26 20:41:26 +02:00
2022-09-24 17:21:00 +02:00
2022-09-23 13:59:23 +05:30
2022-09-22 19:05:19 +05:30
2022-09-18 19:03:16 +02:00
2022-09-26 20:10:21 +02:00
2022-09-26 19:17:06 +02:00
Prettier 💅
2022-09-15 00:47:06 +02:00
2022-09-26 20:41:26 +02:00
2022-09-26 20:10:21 +02:00

This is the smart-contract crib

crib

We disclose the smart-logic, turing the wheels of the zkAuthenticator. One step closer to zero trust and away from web2.

The zkAuth onchain authentication can be invoked by both wallets and contracts. For optimal security and user-experience, incorporate it with 2nd gen Wallets (ERC 4337) or similar contracts supporting paymasters.

The turing wheels

Here an walk-through of our complete contracts:

zkWalletFactory

Upon successfully setting up 2FA, the msg.sender gets assigned a personal ZkSocialRecoveryWallet. The Factory takes on the tasks of creating those wallets, mapping addresses to wallets and connecting to the hash-verifier for social recovery.

HashCheckVerifier

The logic used to recover wa compromised wallet and reassign its owner.

OtpMerkleTreeVerifier

The logic to verify the wallet specific 2 factor authentication.

Delpoy on Optimism Görli

First set your private key on a .env file

yarn hardhat deploy --network optimsm-goerli

Cyborg Run 🏃‍♂️

How to setup the project, compile the contracts, run the test and deploy.

@Rish check if you can scale scope the tests :)

Yarn, remix and hardhat:

yarn hardhat node

yarn remixed -s . --remix-ide https://remix.ethereum.org

yarn hardhat test

Optimism

A blocqchain with free lunch, I mean, free gas! How could we not choose for Optimism?

Contracts on Optimism-Goerli

Last deployment: 26.9.2022

export const address = { 
      zkWalletFactory: "0xcaF6c8C45c4fA0d2F6BFcE0c904FBedE08c773f1",
      HashCheckVerifier: "0xDFD466d2A14cB2895f2C8BCacc67BDEF37C60De0",
      OtpMerkleTreeVerifier: "0x87469041b414E1f2dEC2e79e32f4E911E7f50622",
    }

Deployer wallet:

0x369551E7c1D29756e18BA4Ed7f85f2E6663e1e8d

Testnet Explorer

Faucets

Notes4devs

A collection of more and less relevant technical tips and hacqs for our fellow devs and future selfs.

Onchain sha256 Hashing

How to calculate and submit hash:

convert TOTP (eg. 123456) to bytes/hex with ethers. Padding left!!! Then sha256 it and insert 0x at the start. That's it, now it should match the sha256 on-chain.

123456 as hex: 0x000000000000000000000000000000000000000000000000000000000001e240

123456 to hex to sha256 hash: 0x4a438cf911dc63bd7d53c1be977516e82f4d8f19b950d72d6730d4717709eae1

bytes32 sha256 from hex