Generation of DMTP key pairs
First you connect your wallet to DMTP, you have to do initial setting. The initial set up has two flows「Generate DMTP key pair」and 「Sign to DMTP key」
Generate DMTP key pair
You have to generate DMTP key pair that are used to encrypt and decrypt messages. These keys are not directly related to the wallet keys, so you don't have to care the risk of compromising your wallet. DMTP key pair are generated by the algorithm of Elliptic Curve Diffie-Hellman. DHKE generates key pair public key and private key as same as the normal public key encryption. In this model, combined secret generated by (Alice's pubKey & Bob's priKey) and (Alice's priKey & Bob's pubKey) will be same. This model realizes the E2EE model of P2P messaging. DMTP client generates these key pair automatically, so you don't need do any special setting at this section.
From security perspective we shouldn't store DMTP_priKey
low data. Thus users encrypt it with public key of their wallet so only wallet holder can decrypt it and see messages.
Sign to the DMTP_pubKey
In this section you sign to the DMTP_pubKey
to prove that the wallet address of yours andDMTP_pubKey
of yours are actually linked.
DMTP_pubKey
encrypted DMTP_priKey
signature
are stored in DB. We describe you the detailed flow using some diagrams and code.
Flow
Alice connect her wallet to DMTP
Client generates DMTP key-pair that is used for en/de crypt messeges in DMTP. We name them
DMTP_pubKey
andDMTP_priKey.
Alice encrypts her
DMTP_priKey
with her wallet's public key.Alice sign
DMTP_pubKey
with her wallet. This signature provesDMTP_pubKey
is linked to Alice’s wallet.Store
DMTP_pubKey &
encrypted DMTP_priKey & Signature
in DB and IPFS The stored data is like this.Store the CID of keys in the blockchain and DB The CID of keys is stored in
DMTPkeys
like this so anyone can findDMTP_pubkey
from the contract.
Last updated