Skip to content

Commit

Permalink
Merge pull request #1526 from ianco/print_invite_qr
Browse files Browse the repository at this point in the history
Display QR code when generating/displaying invites on startup
  • Loading branch information
ianco authored Dec 1, 2021
2 parents 67539b9 + 5f5419b commit 25be55f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion aries_cloudagent/core/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import hashlib
import json
import logging
from qrcode import QRCode

from ..admin.base_server import BaseAdminServer
from ..admin.server import AdminResponder, AdminServer
Expand Down Expand Up @@ -350,6 +351,9 @@ async def start(self) -> None:
invite_url = invi_rec.invitation.to_url(base_url)
print("Invitation URL:")
print(invite_url, flush=True)
qr = QRCode(border=1)
qr.add_data(invite_url)
qr.print_ascii(invert=True)
del mgr
except Exception:
LOGGER.exception("Error creating invitation")
Expand All @@ -367,8 +371,12 @@ async def start(self) -> None:
),
)
base_url = context.settings.get("invite_base_url")
invite_url = invite.to_url(base_url)
print("Invitation URL (Connections protocol):")
print(invite.to_url(base_url), flush=True)
print(invite_url, flush=True)
qr = QRCode(border=1)
qr.add_data(invite_url)
qr.print_ascii(invert=True)
del mgr
except Exception:
LOGGER.exception("Error creating invitation")
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ jsonpath_ng==1.5.2
pytz~=2021.1
python-dateutil~=2.8.1
rlp==0.5.1
unflatten~=0.1
unflatten~=0.1
qrcode[pil]~=6.1

0 comments on commit 25be55f

Please sign in to comment.