ingenrod / mesh

0 stars 0 forks source link

how to phone number #3

Open sloev opened 2 months ago

sloev commented 2 months ago

use phone numbers as mac adresses: [issuer_number][user_number]

and use a three layered signature approach where a root issues pub/private keys to issuers and issuers issue phone numbers

then we can: f

from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
import logging

root_priv_key = Ed25519PrivateKey.generate()

issuer_priv_key = Ed25519PrivateKey.generate()
root_issuer_signature = root_priv_key.sign(issuer_priv_key.public_key(
).public_bytes(Encoding.Raw, PublicFormat.Raw))

user_number = "62217128"
user_priv_key = Ed25519PrivateKey.generate()
issuer_user_signature = issuer_priv_key.sign(user_number.encode()+user_priv_key.public_key(
).public_bytes(Encoding.Raw, PublicFormat.Raw))

numbers = [user_number, "000000"]
for num in numbers:
    try:
        # verify user has rights on number:
        user_has_rights = issuer_priv_key.public_key().verify(
            issuer_user_signature, num.encode()+user_priv_key.public_key(
        ).public_bytes(Encoding.Raw, PublicFormat.Raw))
    except:
        print(f"user does not own number: {num}")
    else:
        print(f"user owns number: {num}")

flow
alice wants to call bob
alice sends her public_key + issuer_user_signature to bob
bob receives and uses the public key of issuer to verify alice 
has indeed the rights of her phone number
bob responds with his issuer_user_signature and his public key
alice verifies bob has the right to his phone number
alice encrypts a payload with bobs public key and sends it to bob
bob decrypts the payload using his private key
bob sends a payload to alice using her public key

print("hello")
sloev commented 2 months ago

https://www.oryx-embedded.com/benchmark/espressif/crypto-esp32-s2.html

sloev commented 2 months ago

https://github.com/LieBtrau/digital-walkie-talkie/blob/master/audio-codec.md

sloev commented 2 months ago

Each device have settings. In settings each realm added have a prefix in range 111-999

The realm that the device is geographically close to is labeled 111 by birth.

The realms are identified by the public key of the realm manager

The realm manager can issue phone numbers and keypairs in its realm

Tunnels bring connections between realms.

To establish connections between realms the device looks up the peers of a realm using a dht

sloev commented 1 month ago

https://github.com/sikorapatryk/sip-call