Everyone gets a card...

pull/2115/head
Kieran R. Prasch 2020-06-23 15:52:41 -07:00
parent 2439168dc0
commit ccc9d86ff8
No known key found for this signature in database
GPG Key ID: FDC3146ED25617D8
2 changed files with 12 additions and 1 deletions

View File

@ -181,6 +181,11 @@ class Alice(Character, BlockchainPolicyAuthor):
self.active_policies = dict()
self.revocation_kits = dict()
def get_card(self) -> 'Card':
from nucypher.policy.collections import Card
card = Card.from_character(self)
return card
def add_active_policy(self, active_policy):
"""
Adds a Policy object that is active on the NuCypher network to Alice's

View File

@ -450,8 +450,14 @@ class Card:
return cls.from_bytes(base64.urlsafe_b64decode(b64data))
def to_qr_code(self):
import qrcode
from qrcode.main import QRCode
qr = QRCode()
qr = QRCode(
version=1,
box_size=1,
border=4, # min spec is 4
error_correction=qrcode.constants.ERROR_CORRECT_L,
)
qr.add_data(bytes(self))
qr.print_ascii()