Skip to content

Instantly share code, notes, and snippets.

@matiu
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matiu/07786e0d875b4093accb to your computer and use it in GitHub Desktop.
Save matiu/07786e0d875b4093accb to your computer and use it in GitHub Desktop.
Copay, joining a wallet overview
Joining a wallet
================
Creator (C) <-> Joining Peer (J)
(J)
<- Hello (secret random, peerPubkey) encrypted with creatorPubkey
(C)
(async._addConnectedPeer, emit 'connect', w.sendWalletId)
-> walletId (wallet options)
(J)
(peer creates the wallet with the wallet Id and sends:
<- walletReady (walletId)
(C)
(w._onData)
-> PublicKeyRing, AddressBook, TxProposals.
@matiu
Copy link
Author

matiu commented Jan 8, 2015

Proposal:

  1. Shared string: URL + Secret. URL is something like: https://copay.io/wallets/<id>

  2. (c)
    POST URL /wallets

    • wallet options (encrypted with secret)
    • pkr (encrypted with secret)
      <- walletId.
  3. (J)
    GET URL.
    <- wallet opts, pkr, status
    POST URL
    pkr

    GET URL/status
    [...]

Then everyone uses the mailboxes.
no more helo, walletId, walletReady, pubkeyring messages.

@matiu
Copy link
Author

matiu commented Jan 8, 2015

Storage

  1. All devices, store WALLET_CRITICAL_DATA (WCD):
  • Extended Private Key
  • WalletID
  • Pub Key Ring (could be incomplete) (i.e. copayers Extended Public Key, and copayer's aliases)
  • if (!isComplete) Wallet Creation URL

Device mobility is possible when moving the WCD on a file or similar between devices. New devices can sync Wallet Extended Data (WED) from the Copa Server.

Communication (WED)

Communications thru Shared mailbox ONLY happen when the ring is complete.

  • copayerId = pub key derivation of the ext pub key of certain path.
  • walletEncKey = f(pkr)
  • mailboxId = f(walletId, pkr)
  • mailboxWriteSecret= f2(walletId, prk) (for the server to limit who can write the shared mbox)

All message have header: mailboxWriteSecret, which is checked by the server.

Shared mailbox

It is created by any of the copayers
/walletMailbox/<mailboxId>/list/<type>
/walletMailbox/<mailboxId>/state/<type>/copayerId
-> Signed with copayerId, encrypted with walletEncKey.

State (overwritten, one item per copayer)

  • Indexes
  • My name
  • My Addressbook
    ...

List (limited list, FIFO).

  • Tx proposals

TODO: TxProposals expiration / deletion policy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment