mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2025-01-09 17:33:47 +00:00
yay kinda works, very hacked
This commit is contained in:
parent
af71383f5d
commit
32d5b56567
3 changed files with 44 additions and 8 deletions
12
demo.py
12
demo.py
|
@ -46,7 +46,8 @@ except FileNotFoundError:
|
||||||
CONFIG = {}
|
CONFIG = {}
|
||||||
|
|
||||||
# Re-register if the commit hash has changed
|
# Re-register if the commit hash has changed
|
||||||
if CONFIG.get("commit_hash") != commit_hash or True:
|
FORCE_REREGISTER = True
|
||||||
|
if CONFIG.get("commit_hash") != commit_hash or FORCE_REREGISTER:
|
||||||
logging.warning("pypush commit is different, forcing re-registration...")
|
logging.warning("pypush commit is different, forcing re-registration...")
|
||||||
CONFIG["commit_hash"] = commit_hash
|
CONFIG["commit_hash"] = commit_hash
|
||||||
if "id" in CONFIG:
|
if "id" in CONFIG:
|
||||||
|
@ -97,7 +98,7 @@ async def main():
|
||||||
"number": phone_number,
|
"number": phone_number,
|
||||||
"sig": b64encode(phone_sig).decode(),
|
"sig": b64encode(phone_sig).decode(),
|
||||||
}
|
}
|
||||||
if CONFIG.get("phone", {}).get("auth_key") is not None:
|
if CONFIG.get("phone", {}).get("auth_key") is not None and CONFIG.get("phone", {}).get("auth_cert") is not None:
|
||||||
phone_auth_keypair = ids._helpers.KeyPair(CONFIG["phone"]["auth_key"], CONFIG["phone"]["auth_cert"])
|
phone_auth_keypair = ids._helpers.KeyPair(CONFIG["phone"]["auth_key"], CONFIG["phone"]["auth_cert"])
|
||||||
else:
|
else:
|
||||||
phone_auth_keypair = ids.profile.get_phone_cert(phone_number, user.push_connection.credentials.token, [phone_sig])
|
phone_auth_keypair = ids.profile.get_phone_cert(phone_number, user.push_connection.credentials.token, [phone_sig])
|
||||||
|
@ -111,7 +112,8 @@ async def main():
|
||||||
)
|
)
|
||||||
|
|
||||||
#user._auth_keypair = phone_auth_keypair
|
#user._auth_keypair = phone_auth_keypair
|
||||||
#user.handles = [f"tel:{phone_number}"]
|
user.handles = [f"tel:{phone_number}"]
|
||||||
|
print(user.user_id)
|
||||||
# user.user_id = f"P:{phone_number}"
|
# user.user_id = f"P:{phone_number}"
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,7 +130,7 @@ async def main():
|
||||||
vd = emulated.nac.generate_validation_data()
|
vd = emulated.nac.generate_validation_data()
|
||||||
vd = b64encode(vd).decode()
|
vd = b64encode(vd).decode()
|
||||||
|
|
||||||
user.register(vd, [("P:" + phone_number, phone_auth_keypair)], ["tel:" + phone_number, "tel:1"])
|
user.register(vd, [("P:" + phone_number, phone_auth_keypair)])
|
||||||
#user.register(vd)
|
#user.register(vd)
|
||||||
|
|
||||||
print("Handles: ", user.handles)
|
print("Handles: ", user.handles)
|
||||||
|
@ -168,7 +170,7 @@ async def input_task(im: imessage.iMessageUser):
|
||||||
while True:
|
while True:
|
||||||
cmd = await trio.to_thread.run_sync(input, "> ", cancellable=True)
|
cmd = await trio.to_thread.run_sync(input, "> ", cancellable=True)
|
||||||
if cmd != "":
|
if cmd != "":
|
||||||
await im.send(imessage.iMessage.create(im, cmd, [im.user.current_handle]))
|
await im.send(imessage.iMessage.create(im, cmd, ["tel:+16106632676"]))
|
||||||
|
|
||||||
async def output_task(im: imessage.iMessageUser):
|
async def output_task(im: imessage.iMessageUser):
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -66,8 +66,9 @@ class IDSUser:
|
||||||
if self.encryption_identity is None:
|
if self.encryption_identity is None:
|
||||||
self.encryption_identity = identity.IDSIdentity()
|
self.encryption_identity = identity.IDSIdentity()
|
||||||
|
|
||||||
auth_keys = [(self.user_id, self._auth_keypair)]
|
auth_keys = additional_keys
|
||||||
auth_keys.extend(additional_keys)
|
auth_keys.extend([(self.user_id, self._auth_keypair)])
|
||||||
|
#auth_keys.extend(additional_keys)
|
||||||
|
|
||||||
handles_request = self.handles
|
handles_request = self.handles
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,40 @@ def register(
|
||||||
'supports-st-v1': True,
|
'supports-st-v1': True,
|
||||||
'supports-update-attachments-v1': True,
|
'supports-update-attachments-v1': True,
|
||||||
},
|
},
|
||||||
|
"tag": "SIM",
|
||||||
"uris": uris,
|
"uris": uris,
|
||||||
|
"user-id": auth_keys[0][0],
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client-data": {
|
||||||
|
'is-c2k-equipment': True,
|
||||||
|
'optionally-receive-typing-indicators': True,
|
||||||
|
'public-message-identity-key': identity.encode(),
|
||||||
|
'public-message-identity-version':2,
|
||||||
|
'show-peer-errors': True,
|
||||||
|
'supports-ack-v1': True,
|
||||||
|
'supports-activity-sharing-v1': True,
|
||||||
|
'supports-audio-messaging-v2': True,
|
||||||
|
"supports-autoloopvideo-v1": True,
|
||||||
|
'supports-be-v1': True,
|
||||||
|
'supports-ca-v1': True,
|
||||||
|
'supports-fsm-v1': True,
|
||||||
|
'supports-fsm-v2': True,
|
||||||
|
'supports-fsm-v3': True,
|
||||||
|
'supports-ii-v1': True,
|
||||||
|
'supports-impact-v1': True,
|
||||||
|
'supports-inline-attachments': True,
|
||||||
|
'supports-keep-receipts': True,
|
||||||
|
"supports-location-sharing": True,
|
||||||
|
'supports-media-v2': True,
|
||||||
|
'supports-photos-extension-v1': True,
|
||||||
|
'supports-st-v1': True,
|
||||||
|
'supports-update-attachments-v1': True,
|
||||||
|
},
|
||||||
|
"uris": [{
|
||||||
|
"uri": "tel:+16106632676"
|
||||||
|
}],
|
||||||
"user-id": user_id,
|
"user-id": user_id,
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue