summaryrefslogtreecommitdiff
path: root/otp2289/generator.py
diff options
context:
space:
mode:
authorSimeon Simeonov2020-04-07 12:24:52 +0200
committerSimeon Simeonov2020-04-07 12:24:52 +0200
commit49b1c3e2cfb9b0224712e6891a12950f725c3b13 (patch)
tree97e42ec2a43f9a17a68ea10e613945bb845e7e18 /otp2289/generator.py
parente297c0696cf594f8f700dd82fdcdda582e348eda (diff)
Improve README.md and docstrings for Sphinx
Diffstat (limited to 'otp2289/generator.py')
-rw-r--r--otp2289/generator.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/otp2289/generator.py b/otp2289/generator.py
index ac3bb3c..4623dc0 100644
--- a/otp2289/generator.py
+++ b/otp2289/generator.py
@@ -310,7 +310,6 @@ class OTPGenerator:
310 """ 310 """
311 Constructs an OTPGenerator object with a given password and seed. 311 Constructs an OTPGenerator object with a given password and seed.
312 312
313 Keyword Arguments:
314 :param password: The password string 313 :param password: The password string
315 :type password: bytes 314 :type password: bytes
316 315
@@ -320,7 +319,7 @@ class OTPGenerator:
320 :param hash_algo: The hash algo, defaults to OTP_ALGO_MD5 319 :param hash_algo: The hash algo, defaults to OTP_ALGO_MD5
321 :type hash_algo: int or str 320 :type hash_algo: int or str
322 321
323 :raises OTPGeneratorException: In case the input does not validate 322 :raises otp2289.OTPGeneratorException: If the input does not validate
324 """ 323 """
325 # enforce the rfc2289 constraints 324 # enforce the rfc2289 constraints
326 self._seed = seed 325 self._seed = seed
@@ -389,7 +388,7 @@ class OTPGenerator:
389 :param challenge: The challenge string described in RFC-2289 388 :param challenge: The challenge string described in RFC-2289
390 :type challenge: str 389 :type challenge: str
391 390
392 :raises OTPChallengeException: When the challenge string is invalid 391 :raises otp2289.OTPChallengeException: If the challenge is invalid
393 392
394 :return: (seed, hash_algo, step) tuple. 393 :return: (seed, hash_algo, step) tuple.
395 :rtype: tuple 394 :rtype: tuple
@@ -485,7 +484,7 @@ class OTPGenerator:
485 :param tokens_str: String representing 6 words tokens 484 :param tokens_str: String representing 6 words tokens
486 :type tokens_str: str 485 :type tokens_str: str
487 486
488 :raises OTPGeneratorException: When the tokens_str is invalid 487 :raises otp2289.OTPGeneratorException: When the tokens_str is invalid
489 488
490 :return: 6 words tokens 489 :return: 6 words tokens
491 :rtype: bytes 490 :rtype: bytes
@@ -529,7 +528,7 @@ class OTPGenerator:
529 :param hash_algo: The hash algo, defaults to OTP_ALGO_MD5 528 :param hash_algo: The hash algo, defaults to OTP_ALGO_MD5
530 :type hash_algo: int or str 529 :type hash_algo: int or str
531 530
532 :raises OTPGeneratorException: In case hash_algo does not validate 531 :raises otp2289.OTPGeneratorException: If hash_algo does not validate
533 532
534 :return: The validated hash_algo in str-form 533 :return: The validated hash_algo in str-form
535 :rtype: str 534 :rtype: str
@@ -556,7 +555,7 @@ class OTPGenerator:
556 :param seed: The seed received from the challenge, defaults to '' 555 :param seed: The seed received from the challenge, defaults to ''
557 :type seed: str 556 :type seed: str
558 557
559 :raises OTPGeneratorException: In case seed does not validate 558 :raises otp2289.OTPGeneratorException: If seed does not validate
560 559
561 :return: The validated (and very same) seed 560 :return: The validated (and very same) seed
562 :rtype: str 561 :rtype: str
@@ -580,7 +579,7 @@ class OTPGenerator:
580 :param seed: The step received from the challenge 579 :param seed: The step received from the challenge
581 :type seed: int 580 :type seed: int
582 581
583 :raises OTPGeneratorException: In case step does not validate 582 :raises otp2289.OTPGeneratorException: If step does not validate
584 583
585 :return: The validated (and very same) step 584 :return: The validated (and very same) step
586 :rtype: int 585 :rtype: int
@@ -595,7 +594,6 @@ class OTPGenerator:
595 """ 594 """
596 Generates the OTP hexdigest for the given step. 595 Generates the OTP hexdigest for the given step.
597 596
598 Keyword Arguments:
599 :param step: The step to generate OTP for 597 :param step: The step to generate OTP for
600 :type step: int 598 :type step: int
601 599
@@ -614,7 +612,6 @@ class OTPGenerator:
614 extract these parameters. The syntax of the challenge is: 612 extract these parameters. The syntax of the challenge is:
615 otp-<algorithm identifier> <sequence integer> <seed> 613 otp-<algorithm identifier> <sequence integer> <seed>
616 614
617 Keyword Arguments:
618 :param challenge: The challenge string 615 :param challenge: The challenge string
619 :type challenge: str 616 :type challenge: str
620 617
@@ -630,7 +627,6 @@ class OTPGenerator:
630 """ 627 """
631 Generates the OTP six words token for the given step. 628 Generates the OTP six words token for the given step.
632 629
633 Keyword Arguments:
634 :param step: The step to generate OTP for 630 :param step: The step to generate OTP for
635 :type step: int 631 :type step: int
636 632
@@ -649,7 +645,6 @@ class OTPGenerator:
649 extract these parameters. The syntax of the challenge is: 645 extract these parameters. The syntax of the challenge is:
650 otp-<algorithm identifier> <sequence integer> <seed> 646 otp-<algorithm identifier> <sequence integer> <seed>
651 647
652 Keyword Arguments:
653 :param challenge: The challenge string 648 :param challenge: The challenge string
654 :type challenge: str 649 :type challenge: str
655 650
@@ -709,7 +704,6 @@ class OTPGenerator:
709 """ 704 """
710 Generates the OTP bytes for the given step. 705 Generates the OTP bytes for the given step.
711 706
712 Keyword Arguments:
713 :param step: The step to generate OTP for 707 :param step: The step to generate OTP for
714 :type step: int 708 :type step: int
715 709