{"library":"magic-wormhole","title":"Magic-Wormhole","description":"Magic-Wormhole is a Python library and command-line tool for securely transferring arbitrary data (files, directories, or text) between computers using a short, human-speakable 'wormhole code'. It leverages PAKE (Password-Authenticated Key Exchange) for secure key establishment. It is actively maintained at version 0.23.0 with a focus on security, reliability, and ease of use, releasing updates on a moderate cadence.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install magic-wormhole"],"cli":{"name":"wormhole","version":"magic-wormhole 0.24.0"}},"imports":["from magic_wormhole.api import Wormhole"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import asyncio\nfrom magic_wormhole.api import Wormhole\n\nasync def send_data_example():\n    w = Wormhole()\n    code = await w.get_code()\n    print(f\"Your wormhole code is: {code}\")\n    print(\"Waiting for recipient to connect...\")\n    \n    # In a real scenario, you'd wait for connection confirmation before sending sensitive data.\n    # The 'send_data' or 'send_file' automatically handles the rendezvous.\n\n    data_to_send = b\"Hello, magic wormhole!\"\n    print(f\"Sending: '{data_to_send.decode()}'\")\n    await w.send_data(data_to_send)\n    print(\"Data sent.\")\n    \n    # The wormhole object must be closed to release resources and ensure clean exit.\n    await w.close()\n\nif __name__ == \"__main__\":\n    # This runs the asynchronous example using asyncio\n    asyncio.run(send_data_example())","lang":"python","description":"This quickstart demonstrates how to programmatically send data using the `magic-wormhole` API. Run this script, and it will output a wormhole code. On another machine, a recipient would initiate a transfer by calling `Wormhole.from_code(code)` and then `await w.receive_data()` (or `receive_file()`). The API is asynchronous, requiring `async`/`await` and `asyncio.run()`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}