Add authenticated WiFi transport with BLE fallback

This commit is contained in:
2026-10-01 14:32:18 +08:00
parent 071f06d365
commit f011d8357d
55 changed files with 6327 additions and 29 deletions
@@ -0,0 +1,20 @@
"""Public deterministic interop fixture, never live session material."""
import json
from pathlib import Path
from app.mobile.wifi import wifi_cipher
def generate():
secret = bytes(range(32))
channel = '0123456789abcdef0123456789abcdef'
request = b'{"device_id":"public-test-device"}'
response = b'{"device_id":"public-test-device","ready":true}'
c, s = wifi_cipher(secret, channel, server=False), wifi_cipher(secret, channel, server=True)
return dict(secret=secret.hex(), channel_id=channel, request=request.hex(), response=response.hex(),
client_record=c.encrypt(request).hex(), server_record=s.encrypt(response).hex())
if __name__ == '__main__':
root = Path(__file__).resolve().parents[2]
raw = json.dumps(generate(), indent=2) + '\n'
for path in [root / '核桃派软件源代码/tests/fixtures/protocol-wifi-v1.json',
root / '移动端相关内容/安卓app/安卓程序源代码/sharedCore/src/jvmTest/resources/protocol-wifi-v1.json']:
path.write_text(raw, encoding='utf-8')