summaryrefslogtreecommitdiff
path: root/src/otp2289/__init__.py
diff options
context:
space:
mode:
authorSimeon Simeonov2022-03-31 07:21:33 +0200
committerSimeon Simeonov2022-03-31 07:21:33 +0200
commit4ea3c077bd4111960af1b93195cb25bfb1d6edce (patch)
tree9ed0b8fdb4398cf79a8ecc3ab39ade2d374eb65c /src/otp2289/__init__.py
parentf19fde48c6b3f65c164c931286e72a0d254c1fb3 (diff)
Restructure the project in order to replace distutils with setuptoolsv1.1.0
Diffstat (limited to 'src/otp2289/__init__.py')
-rw-r--r--src/otp2289/__init__.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/otp2289/__init__.py b/src/otp2289/__init__.py
new file mode 100644
index 0000000..59694a7
--- /dev/null
+++ b/src/otp2289/__init__.py
@@ -0,0 +1,68 @@
1# -*- coding: utf-8 -*-
2# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3#
4# Copyright (c) 2020-2022 Simeon Simeonov
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
9# are met:
10# 1. Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer.
12# 2. Redistributions in binary form must reproduce the above copyright notice,
13# this list of conditions and the following disclaimer in the documentation
14# and/or other materials provided with the distribution.
15#
16# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
17# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26"""A pure Python implementation of RFC-2289"""
27from .generator import (
28 OTP_ALGO_MD5,
29 OTP_ALGO_SHA1,
30 OTPChallengeException,
31 OTPGenerator,
32 OTPGeneratorException,
33)
34from .server import (
35 OTPInvalidResponse,
36 OTPState,
37 OTPStateException,
38 OTPStore,
39 OTPStoreException,
40)
41
42__author__ = 'Simeon Simeonov'
43__version__ = '1.1.0'
44__license__ = 'BSD 2-Clause'
45
46
47def int_or_str(value):
48 """Returns int value of value when possible"""
49 try:
50 return int(value)
51 except ValueError:
52 return value
53
54
55VERSION = tuple(map(int_or_str, __version__.split('.')))
56
57__all__ = [
58 'OTP_ALGO_MD5',
59 'OTP_ALGO_SHA1',
60 'OTPChallengeException',
61 'OTPGenerator',
62 'OTPGeneratorException',
63 'OTPInvalidResponse',
64 'OTPState',
65 'OTPStateException',
66 'OTPStore',
67 'OTPStoreException',
68]