pvfr.passeport_credential package¶
Module contents¶
Library for generating verifiable credentials for the Passeport vacances Fribourg
This library is used to generate verifiable serial numbers or verifiable passwords for the Passeport vacances Fribourg. It is also used to check if a serial number or a password is valid.
Typical usage example:
from pvfr.passeport_credential import Signer, SerialNumber, Password
s = Signer("f09d837b265d7ff95d724c7f9dcc8b51dc6a357db5630eedff48b6c1659e2181")
serialGen = SerialNumber(s)
print(serialGen.serial(0))
print(serialGen.check("000100994252"))
pwGen = Password(s)
print(pwGen.password(0))
print(pwGen.check(0,"yd2f-ktfb-dyru"))
-
class
pvfr.passeport_credential.
Credential
(signer: pvfr.passeport_credential.Signer)[source]¶ Bases:
object
The Credential is the base class for SerialNumber and Password
-
class
pvfr.passeport_credential.
Password
(signer: pvfr.passeport_credential.Signer, blocks: int = 3, size: int = 4)[source]¶ Bases:
pvfr.passeport_credential.Credential
Class to generate and verify Passwords
The passwords are composed of blocks of digits and lettres, excluding the characters that can easily be mistaken (such as 0 and O or 1 and l).
-
__init__
(signer: pvfr.passeport_credential.Signer, blocks: int = 3, size: int = 4)[source]¶ Initialize the password
Parameters: - signer (Signer) – The signer associated with the credential.
- blocks (int) – The number of blocks composing the password.
- size (int) – The size (length) of each blocks.
-
-
class
pvfr.passeport_credential.
SerialNumber
(signer: pvfr.passeport_credential.Signer, size: int = 8)[source]¶ Bases:
pvfr.passeport_credential.Credential
Class to generate and verify Serial Numbers
-
__init__
(signer: pvfr.passeport_credential.Signer, size: int = 8)[source]¶ Initialize the serial number
Parameters: - signer (Signer) – The signer associated with the credential.
- size (int) – The size (length) of the serial number.
-
-
class
pvfr.passeport_credential.
Signer
(key: str, length: int = 4)[source]¶ Bases:
object
The Signer is able to produce a HMAC signature, based on a secret key, for an integer