Coder Social home page Coder Social logo

Comments (3)

rmeissner avatar rmeissner commented on July 17, 2024
  • Check how to validate that a transaction was submitted by an owner

from safe-transaction-service.

rmeissner avatar rmeissner commented on July 17, 2024

Currently you can use a hack around it by using a random transaction hash when submitting the transaction.

@rmeissner add more info on that

from safe-transaction-service.

Uxio0 avatar Uxio0 commented on July 17, 2024

API endpoints

POST /safes/{safe_address}/delegates

{
  "delegate": "<checksummed-eth-address>",
  "label": "<short-string-max-50-chars>",
  "signature": "<0x-prefixed-hex-signature>"
}

Generation of <hex-signature>

Multiple signature types are allowed:

  • Contract Signature, EOA or eth_sign: The hash to sign must be keccak(checksummed-eth-address + TOTP)
  • Approved Hash is not supported.

Calculation of TOTP

  • TOTP will be used to prevent a repetition attack. E.g. a user signs a delegate, that delegate is compromised and removed but the signature is always valid, so another user could send that signature again to register the user as a delegate. This will prevent it.
  • We will use a TOTP with T0=0 and Tx=3600 (1 hour)
  • TOTP is calculated by taking the Unix epoch time (no milliseconds) and dividing by 3600 (natural division, no decimals)

Example

  • We want to add the owner 0x132512f995866CcE1b0092384A6118EDaF4508Ff
  • We calculate the TOTP. Current epoch=1586779140, so 1586779140 // 3600 = 440771
  • We sign keccak("0x132512f995866CcE1b0092384A6118EDaF4508Ff440771")

DELETE /safes/{safe_address}/delegates/{delegate-address}

{
  "signature": "<hex-signature>"
}

Signature must be generated the same way that in POST

GET /safes/{safe_address}/delegates

{
  "delegate": "<checksummed-eth-address>",
  "delegator": "<checksummed-eth-address>", // Who added the delegate
  "label": "<short-string>"}

Notes: Endpoint will be paginated

Notes

  • Every tx proposed must have a signature, so backend can check the sender. No signed txs must be discarded
  • Delegates cannot add/remove delegates
  • Multiple POSTs with same delegateAddress, different label and valid signature will update the label

from safe-transaction-service.

Related Issues (20)

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.