leoauth 0.1.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0rc1 — Release candidate
4
+
5
+ - Standard six-digit, 30-second HMAC-SHA1 TOTP and custom LeoAuth RAK v1.
6
+ - Public `otp`, `leo` and `auto_verify` interfaces; secret generation,
7
+ verification, timecode retrieval and provisioning URI generation.
8
+ - Consistent credential parsing, Base32 validation and timestamp boundaries.
9
+ - Regression tests covering RFC 6238 vectors and existing RAK v1 behavior.
10
+ - PyPI build metadata, distribution manifest and licensing documentation.
11
+
12
+ No changes to the audited authentication algorithms are introduced by packaging.
13
+ This is a proposed initial package version; no public release is implied.
@@ -0,0 +1,55 @@
1
+ LeoAuth Software License
2
+ Copyright (c) 2026 LeoManage. All rights reserved in proprietary components.
3
+
4
+ 1. Scope
5
+ This license applies to the proprietary portions of the LeoAuth Python package
6
+ and its accompanying documentation (the Software). Nothing in this license
7
+ restricts rights granted under any applicable third-party license.
8
+
9
+ 2. Noncommercial use
10
+ Subject to this license, the copyright holder grants you a non-exclusive,
11
+ royalty-free, non-transferable license to download, install, copy and use the
12
+ Software for your own personal, educational or other noncommercial purposes.
13
+ You may make copies and local modifications reasonably necessary for such use.
14
+ Noncommercial use means use not directed primarily toward commercial advantage,
15
+ business operations, professional services or monetary compensation.
16
+
17
+ 3. Commercial use
18
+ Commercial use of the proprietary Software requires a separate written commercial
19
+ license from the copyright holder. This includes use in business operations,
20
+ commercial products or services, paid consulting, and deployment on behalf of
21
+ commercial customers, whether or not the Software is separately sold or charged
22
+ for. A separate commercial agreement governs the scope, fees, term, support and
23
+ other rights for licensed commercial use. No commercial license is granted merely
24
+ by downloading or installing this package.
25
+
26
+ 4. Distribution and ownership
27
+ Except as expressly authorized in a separate written agreement or permitted by
28
+ applicable law, you may not redistribute, sublicense, sell or publicly make
29
+ available the proprietary Software or modified versions of it. Preserve the
30
+ applicable copyright and license notices in authorized copies. All rights not
31
+ expressly granted are reserved. No rights to use LeoManage or LeoAuth trademarks
32
+ are granted by this license, except as necessary to identify the Software accurately.
33
+
34
+ 5. Termination
35
+ The permissions granted by this license terminate if you materially breach its
36
+ terms. Upon termination, cease use and delete copies of the proprietary Software
37
+ unless otherwise authorized by a separate agreement or applicable law. Third-party
38
+ license rights remain governed by their respective terms.
39
+
40
+ 6. Warranty and liability
41
+ To the maximum extent permitted by applicable law, the Software is provided AS IS,
42
+ without warranties of any kind, express or implied, including merchantability,
43
+ fitness for a particular purpose and noninfringement. To the maximum extent
44
+ permitted by applicable law, the copyright holder is not liable for loss of data,
45
+ profits, or indirect, incidental, special or consequential damages arising out of
46
+ use of the Software. Nothing in this license excludes or limits rights or liability
47
+ that cannot lawfully be excluded or limited. A separate written commercial
48
+ agreement may provide different terms.
49
+
50
+ 7. Commercial licensing inquiries
51
+ LeoAuth is free for noncommercial use under the terms above. For commercial
52
+ licensing details or additional permissions, contact LeoManage:
53
+
54
+ Website: https://leomanage.com
55
+ Email: hello@leomanage.com
@@ -0,0 +1,9 @@
1
+ include README.md LICENSE NOTICE SECURITY.md CHANGELOG.md AUDIT.md RELEASE.md
2
+ recursive-include tests *.py
3
+ prune build
4
+ prune dist
5
+ prune .venv
6
+ prune .git
7
+ prune .github
8
+ exclude test.py .env .pypirc
9
+ global-exclude *.py[cod] *.pem *.key *.pfx *.p12 .DS_Store
@@ -0,0 +1,9 @@
1
+ LeoAuth
2
+ Copyright (c) 2026 LeoManage. All rights reserved in proprietary components.
3
+
4
+ Free for noncommercial use under LICENSE. Commercial use requires a separate
5
+ written commercial license. For licensing details, contact LeoManage:
6
+ https://leomanage.com
7
+ hello@leomanage.com
8
+
9
+ Protocol reference: RFC 6238 (https://www.rfc-editor.org/rfc/rfc6238.html).
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.4
2
+ Name: leoauth
3
+ Version: 0.1.0rc1
4
+ Summary: Standard TOTP and customizable LeoAuth RAK authentication.
5
+ Author-email: LeoManage <hello@leomanage.com>
6
+ License-Expression: LicenseRef-LeoAuth-Proprietary
7
+ Project-URL: Homepage, https://leomanage.com
8
+ Project-URL: Commercial licensing, https://leomanage.com
9
+ Keywords: authentication,totp,otp,mfa,hmac,leoauth,rak
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Security
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ License-File: NOTICE
22
+ Dynamic: license-file
23
+
24
+ ```text
25
+ __ __________ ___ __ __________ __
26
+ / / / ____/ __ \/ | / / / /_ __/ / / /
27
+ / / / __/ / / / / /| |/ / / / / / / /_/ /
28
+ / /___/ /___/ /_/ / ___ / /_/ / / / / __ /
29
+ /_____/_____/\____/_/ |_\____/ /_/ /_/ /_/
30
+ ```
31
+ By LeoManage
32
+
33
+ **Customizable, time-based authentication. Flexible and independent.**
34
+
35
+ LeoAuth is an authentication library designed for developers, individuals and enterprises. It provides standard time-based one-time password (TOTP) authentication and a separate, custom mechanism for automatically rotating alphanumeric passwords.
36
+ LeoAuth operates locally, eliminating the need for dedicated authentication servers, external API requests or continuous internet connectivity.
37
+
38
+ ## Features
39
+ - Standard TOTP authentication compatible with Google Authenticator.
40
+ - Custom LeoAuth time-based passwords.
41
+ - Configurable password lengths of up to 30 characters.
42
+ - Uppercase letters, lowercase letters and numeric characters.
43
+ - Credential-specific password complexity policies.
44
+ - Automatic password rotation every 30 seconds.
45
+ - Offline password generation and verification.
46
+ - Lightweight developer integration.
47
+ - Python SDK (standard library only; no runtime dependencies).
48
+
49
+ ## LeoAuth vs. Traditional TOTP
50
+ | Feature | Traditional TOTP | LeoAuth |
51
+ |---------------------------|----------------------|-----------------------------------|
52
+ | Password length | Typically 6–8 digits | Custom: from 3-30 characters |
53
+ | Numeric characters | Yes | Yes |
54
+ | Uppercase letters | No | Yes |
55
+ | Lowercase letters | No | Yes |
56
+ | Custom complexity | No | Yes |
57
+ | Offline operation | Yes | Yes |
58
+ | Dedicated server required | No | No |
59
+
60
+ ## Installation
61
+ Python 3.10 or newer is required (the release candidate has been tested on Python 3.13.5). After a stable version is published to PyPI:
62
+ ```bash
63
+ pip install leoauth
64
+ ```
65
+
66
+ For the proposed initial pre-release, once published: `pip install --pre leoauth`.
67
+
68
+ ## Usage
69
+
70
+ ```python
71
+ import leoauth
72
+
73
+ # Standard TOTP (SHA1, six digits, 30-second interval).
74
+ secret = leoauth.otp.generate_secret()
75
+ code = leoauth.otp.now(secret)
76
+ assert leoauth.otp.verify(secret, code)
77
+
78
+ # Custom LeoAuth RAK authentication.
79
+ credential = leoauth.leo.generate_secret(
80
+ lower_case_letters=True,
81
+ upper_case_letters=True,
82
+ integers=True,
83
+ length=16
84
+ )
85
+ password = leoauth.leo.now(credential)
86
+ assert leoauth.auto_verify(secret=credential, otp=password)
87
+ ```
88
+
89
+ Both modules expose `generate_secret`, `now`, `at`, `verify`,
90
+ `verify_and_get_timecode`, `validate_secret` and `provisioning_uri`.
91
+ `auto_verify(secret, otp, timestamp=None)` detects the credential type and delegates
92
+ verification. It does not provide replay protection by itself.
93
+
94
+ Use `at` and explicit `timestamp` values for testing or controlled operations.
95
+ Live authentication must use the verifier's trusted clock.
96
+
97
+ Standard TOTP generates 160-bit or longer secrets; legacy imported secrets as short
98
+ as 80 bits remain supported for compatibility. Imported TOTP secrets must have valid,
99
+ canonical Base32 encoding (case-insensitive, correctly padded or unpadded) and no more
100
+ than 128 characters including padding.
101
+
102
+ LeoAuth credentials use `:SECRET:RAK:POLICY:`. Each key is independently generated,
103
+ 32–128 Base32 characters (divisible by eight). `L`, `U` and `I` denote required
104
+ lowercase letters, uppercase letters and digits. The policy ends with the password
105
+ length. The order of policy letters is part of the v1 algorithm.
106
+
107
+ ## How It Works
108
+ LeoAuth uses a shared secret and the current time window to generate deterministic, time-based passwords.
109
+ Each LeoAuth credential contains configuration information defining the length and complexity of the generated password.
110
+ Applications can independently generate and verify passwords without communicating with an external authentication service.
111
+
112
+ ## Use Cases
113
+ - Multi-factor authentication.
114
+ - Web application authentication.
115
+ - Enterprise authentication.
116
+ - Rotating application credentials.
117
+ - Internal software authentication.
118
+ - Custom authentication integrations.
119
+ - Authentication integrations using independently managed security controls.
120
+
121
+ ## Enterprise Roadmap
122
+ LeoAuth is designed with enterprise deployment in mind. Planned capabilities include:
123
+ - Command-line credential provisioning.
124
+ - Remote credential deployment through PowerShell.
125
+ - Windows Hello integration.
126
+ - Centralized credential management.
127
+ - Mobile authenticator applications.
128
+ - Additional programming language SDKs.
129
+
130
+ ## Security
131
+
132
+ LeoAuth RAK v1 uses HMAC-SHA256 with domain-separated key derivation and deterministic
133
+ rejection sampling. It is a custom mechanism, not a standard or an independently
134
+ reviewed cryptographic protocol. Standard TOTP implements the six-digit HMAC-SHA1,
135
+ 30-second RFC 6238 profile directly, using Python's standard library.
136
+
137
+ Production integrations must:
138
+
139
+ - Retrieve the credential from trusted server-side storage for the account being authenticated.
140
+ - Protect shared credentials and provisioning URIs as secrets. Never log them or send them to a third-party QR service.
141
+ - Use TLS, a trusted synchronized verifier clock and account-based rate limiting.
142
+ - Use `verify_and_get_timecode` and atomically accept only a timecode greater than the last accepted one, stored per credential. `None` means verification failed; zero is a valid timecode.
143
+ - Keep the acceptance window narrow (zero by default; use adjacent windows only when clock drift requires it).
144
+ - Enforce a strong output policy at enrollment. The supported range of 3–30 characters is a format capability, not a security recommendation. For RAK, prefer at least 16 characters with all three character classes where compatible. Short policies can be weaker than six-digit TOTP.
145
+ - Prefer phishing-resistant authentication where the threat model requires it. Neither OTP mechanism binds the code to the relying party or prevents real-time phishing.
146
+
147
+ The Python package does not implement server-side credential storage, rate limiting,
148
+ replay state, authorization, or license enforcement. Its stateless verification functions
149
+ must be integrated with these controls as appropriate. See `AUDIT.md` for the current
150
+ release blockers and review scope.
151
+
152
+ ## Licensing
153
+ LeoAuth is free for noncommercial use under the terms of `LICENSE`.
154
+ Commercial use, including internal business use, requires a separate written commercial license.
155
+ For commercial licensing details, contact LeoManage at https://leomanage.com or hello@leomanage.com.
156
+
157
+ ## Developer
158
+ Developed and maintained by **LeoManage**.
159
+ Website: https://leomanage.com
160
+ Copyright © 2026 LeoManage. All rights reserved regarding proprietary LeoAuth components.
@@ -0,0 +1,137 @@
1
+ ```text
2
+ __ __________ ___ __ __________ __
3
+ / / / ____/ __ \/ | / / / /_ __/ / / /
4
+ / / / __/ / / / / /| |/ / / / / / / /_/ /
5
+ / /___/ /___/ /_/ / ___ / /_/ / / / / __ /
6
+ /_____/_____/\____/_/ |_\____/ /_/ /_/ /_/
7
+ ```
8
+ By LeoManage
9
+
10
+ **Customizable, time-based authentication. Flexible and independent.**
11
+
12
+ LeoAuth is an authentication library designed for developers, individuals and enterprises. It provides standard time-based one-time password (TOTP) authentication and a separate, custom mechanism for automatically rotating alphanumeric passwords.
13
+ LeoAuth operates locally, eliminating the need for dedicated authentication servers, external API requests or continuous internet connectivity.
14
+
15
+ ## Features
16
+ - Standard TOTP authentication compatible with Google Authenticator.
17
+ - Custom LeoAuth time-based passwords.
18
+ - Configurable password lengths of up to 30 characters.
19
+ - Uppercase letters, lowercase letters and numeric characters.
20
+ - Credential-specific password complexity policies.
21
+ - Automatic password rotation every 30 seconds.
22
+ - Offline password generation and verification.
23
+ - Lightweight developer integration.
24
+ - Python SDK (standard library only; no runtime dependencies).
25
+
26
+ ## LeoAuth vs. Traditional TOTP
27
+ | Feature | Traditional TOTP | LeoAuth |
28
+ |---------------------------|----------------------|-----------------------------------|
29
+ | Password length | Typically 6–8 digits | Custom: from 3-30 characters |
30
+ | Numeric characters | Yes | Yes |
31
+ | Uppercase letters | No | Yes |
32
+ | Lowercase letters | No | Yes |
33
+ | Custom complexity | No | Yes |
34
+ | Offline operation | Yes | Yes |
35
+ | Dedicated server required | No | No |
36
+
37
+ ## Installation
38
+ Python 3.10 or newer is required (the release candidate has been tested on Python 3.13.5). After a stable version is published to PyPI:
39
+ ```bash
40
+ pip install leoauth
41
+ ```
42
+
43
+ For the proposed initial pre-release, once published: `pip install --pre leoauth`.
44
+
45
+ ## Usage
46
+
47
+ ```python
48
+ import leoauth
49
+
50
+ # Standard TOTP (SHA1, six digits, 30-second interval).
51
+ secret = leoauth.otp.generate_secret()
52
+ code = leoauth.otp.now(secret)
53
+ assert leoauth.otp.verify(secret, code)
54
+
55
+ # Custom LeoAuth RAK authentication.
56
+ credential = leoauth.leo.generate_secret(
57
+ lower_case_letters=True,
58
+ upper_case_letters=True,
59
+ integers=True,
60
+ length=16
61
+ )
62
+ password = leoauth.leo.now(credential)
63
+ assert leoauth.auto_verify(secret=credential, otp=password)
64
+ ```
65
+
66
+ Both modules expose `generate_secret`, `now`, `at`, `verify`,
67
+ `verify_and_get_timecode`, `validate_secret` and `provisioning_uri`.
68
+ `auto_verify(secret, otp, timestamp=None)` detects the credential type and delegates
69
+ verification. It does not provide replay protection by itself.
70
+
71
+ Use `at` and explicit `timestamp` values for testing or controlled operations.
72
+ Live authentication must use the verifier's trusted clock.
73
+
74
+ Standard TOTP generates 160-bit or longer secrets; legacy imported secrets as short
75
+ as 80 bits remain supported for compatibility. Imported TOTP secrets must have valid,
76
+ canonical Base32 encoding (case-insensitive, correctly padded or unpadded) and no more
77
+ than 128 characters including padding.
78
+
79
+ LeoAuth credentials use `:SECRET:RAK:POLICY:`. Each key is independently generated,
80
+ 32–128 Base32 characters (divisible by eight). `L`, `U` and `I` denote required
81
+ lowercase letters, uppercase letters and digits. The policy ends with the password
82
+ length. The order of policy letters is part of the v1 algorithm.
83
+
84
+ ## How It Works
85
+ LeoAuth uses a shared secret and the current time window to generate deterministic, time-based passwords.
86
+ Each LeoAuth credential contains configuration information defining the length and complexity of the generated password.
87
+ Applications can independently generate and verify passwords without communicating with an external authentication service.
88
+
89
+ ## Use Cases
90
+ - Multi-factor authentication.
91
+ - Web application authentication.
92
+ - Enterprise authentication.
93
+ - Rotating application credentials.
94
+ - Internal software authentication.
95
+ - Custom authentication integrations.
96
+ - Authentication integrations using independently managed security controls.
97
+
98
+ ## Enterprise Roadmap
99
+ LeoAuth is designed with enterprise deployment in mind. Planned capabilities include:
100
+ - Command-line credential provisioning.
101
+ - Remote credential deployment through PowerShell.
102
+ - Windows Hello integration.
103
+ - Centralized credential management.
104
+ - Mobile authenticator applications.
105
+ - Additional programming language SDKs.
106
+
107
+ ## Security
108
+
109
+ LeoAuth RAK v1 uses HMAC-SHA256 with domain-separated key derivation and deterministic
110
+ rejection sampling. It is a custom mechanism, not a standard or an independently
111
+ reviewed cryptographic protocol. Standard TOTP implements the six-digit HMAC-SHA1,
112
+ 30-second RFC 6238 profile directly, using Python's standard library.
113
+
114
+ Production integrations must:
115
+
116
+ - Retrieve the credential from trusted server-side storage for the account being authenticated.
117
+ - Protect shared credentials and provisioning URIs as secrets. Never log them or send them to a third-party QR service.
118
+ - Use TLS, a trusted synchronized verifier clock and account-based rate limiting.
119
+ - Use `verify_and_get_timecode` and atomically accept only a timecode greater than the last accepted one, stored per credential. `None` means verification failed; zero is a valid timecode.
120
+ - Keep the acceptance window narrow (zero by default; use adjacent windows only when clock drift requires it).
121
+ - Enforce a strong output policy at enrollment. The supported range of 3–30 characters is a format capability, not a security recommendation. For RAK, prefer at least 16 characters with all three character classes where compatible. Short policies can be weaker than six-digit TOTP.
122
+ - Prefer phishing-resistant authentication where the threat model requires it. Neither OTP mechanism binds the code to the relying party or prevents real-time phishing.
123
+
124
+ The Python package does not implement server-side credential storage, rate limiting,
125
+ replay state, authorization, or license enforcement. Its stateless verification functions
126
+ must be integrated with these controls as appropriate. See `AUDIT.md` for the current
127
+ release blockers and review scope.
128
+
129
+ ## Licensing
130
+ LeoAuth is free for noncommercial use under the terms of `LICENSE`.
131
+ Commercial use, including internal business use, requires a separate written commercial license.
132
+ For commercial licensing details, contact LeoManage at https://leomanage.com or hello@leomanage.com.
133
+
134
+ ## Developer
135
+ Developed and maintained by **LeoManage**.
136
+ Website: https://leomanage.com
137
+ Copyright © 2026 LeoManage. All rights reserved regarding proprietary LeoAuth components.
@@ -0,0 +1,101 @@
1
+ # PyPI release guide
2
+
3
+ Run commands from the repository root (the directory containing pyproject.toml).
4
+ This archive contains packaging and documentation files only. Copy them into the
5
+ existing repository root, preserving your Git history, audited source and tests.
6
+ Review the diff and commit the intended files. Keep local test.py private if it
7
+ contains real credentials. Remove obsolete precautionary attribution files from
8
+ the previous packaging draft only after confirming source provenance.
9
+
10
+ ## 1. Approve the release metadata and terms
11
+
12
+ - `0.1.0rc1` is a proposed release-candidate version. Confirm the name `leoauth`
13
+ is available or belongs to your account on both indexes. It has not been reserved.
14
+ - LICENSE contains proposed personal/noncommercial use terms and requires a
15
+ separate written agreement for commercial use, including internal business use.
16
+ Redistribution of proprietary code requires permission. Confirm the actual
17
+ legal rights holder (LeoManage may be a trading name), copyright, terms and
18
+ commercial agreement with qualified counsel before any public upload.
19
+ - Confirm that the distributed code is independently written, or retain any
20
+ legally required third-party notices and update the license metadata as needed.
21
+ This packaging draft assumes no third-party source is incorporated.
22
+ - For commercial licensing details, contact https://leomanage.com or
23
+ hello@leomanage.com.
24
+ - Confirm the private vulnerability-reporting contact and support policy.
25
+ - Resolve the audit's release gates for production, including independent RAK
26
+ review and actual client integration tests. Test supported Python versions
27
+ (source requires 3.10+, only 3.13.5 was tested here). Do not claim certification.
28
+
29
+ ## 2. Test and build locally (Linux/macOS)
30
+
31
+ ```bash
32
+ python3 -m venv .venv
33
+ source .venv/bin/activate
34
+ python -m pip install --upgrade pip build twine
35
+ python -m unittest discover -s tests -v
36
+ python -m compileall -q leoauth
37
+ rm -rf build dist leoauth.egg-info
38
+ python -m build
39
+ python -m twine check --strict dist/*
40
+ ```
41
+
42
+ On Windows use `py -m venv .venv`, activate with `.venv\Scripts\Activate.ps1`,
43
+ and remove stale build directories using the equivalent PowerShell commands.
44
+ Build tools are developer-only; the SDK has no runtime dependencies.
45
+
46
+ Expected output for the proposed version:
47
+
48
+ - `dist/leoauth-0.1.0rc1-py3-none-any.whl`
49
+ - `dist/leoauth-0.1.0rc1.tar.gz`
50
+
51
+ Inspect both archives for expected package modules and license notices and for
52
+ absence of private keys, local tests, tokens and real credentials.
53
+
54
+ ## 3. Install and test the wheel in a clean environment
55
+
56
+ ```bash
57
+ python -m venv /tmp/leoauth-wheel-check
58
+ /tmp/leoauth-wheel-check/bin/python -m pip install --no-deps dist/leoauth-0.1.0rc1-py3-none-any.whl
59
+ (cd /tmp && /tmp/leoauth-wheel-check/bin/python -I -c 'import leoauth; from importlib.metadata import version; s=leoauth.otp.generate_secret(); assert leoauth.otp.verify(s, leoauth.otp.at(s, 59), timestamp=59); print(version("leoauth"))')
60
+ ```
61
+
62
+ Repeat the tests across all Python versions you intend to support. Build the
63
+ wheel from the source distribution as well and exercise it in a clean environment.
64
+
65
+ ## 4. TestPyPI (after licensing approval)
66
+
67
+ Create an account at https://test.pypi.org/ and enable account security including
68
+ 2FA. Create an API token. Use Twine's interactive prompt rather than putting a
69
+ token in the command or repository. TestPyPI is public and separate from PyPI.
70
+
71
+ ```bash
72
+ python -m twine upload --repository testpypi -u __token__ dist/*
73
+ ```
74
+
75
+ In a fresh virtual environment, verify the uploaded distribution:
76
+
77
+ ```bash
78
+ python -m pip install --index-url https://test.pypi.org/simple/ --no-deps --pre leoauth==0.1.0rc1
79
+ ```
80
+
81
+ ## 5. Publish to PyPI (after approval and release gates)
82
+
83
+ Create or sign in to https://pypi.org/, enable 2FA, and generate a PyPI API token
84
+ (separate from TestPyPI). An account-scoped token may be needed for the first
85
+ upload; use a project-scoped token thereafter. If using CI, prefer PyPI Trusted
86
+ Publishing. Publish only the reviewed artifacts for the intended release:
87
+
88
+ ```bash
89
+ python -m twine upload -u __token__ dist/*
90
+ ```
91
+
92
+ If releasing a candidate, users must opt in with `pip install --pre leoauth` or
93
+ pin `leoauth==0.1.0rc1`. When ready for stable, change version in pyproject.toml
94
+ (e.g. `0.1.0`), update CHANGELOG.md and SECURITY.md, rebuild from a clean tree,
95
+ retest, check and upload. PyPI does not allow reusing an uploaded file name;
96
+ use a new version for corrections. For stable releases, `pip install leoauth`.
97
+
98
+ References:
99
+ - https://packaging.python.org/en/latest/tutorials/packaging-projects/
100
+ - https://packaging.python.org/en/latest/guides/using-testpypi/
101
+ - https://packaging.python.org/en/latest/specifications/license-expression/
@@ -0,0 +1,30 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ Version 0.1.0rc1 is a release candidate, not a certified production release.
6
+ A stable-version support policy will be established by LeoManage before stable
7
+ release. No maintenance period or response-time SLA is promised here.
8
+
9
+ ## Reporting a vulnerability
10
+
11
+ Contact LeoManage privately through https://leomanage.com and request a secure
12
+ channel for a vulnerability report. Include the affected version, affected API,
13
+ reproduction steps using synthetic credentials, and security impact. Please
14
+ coordinate disclosure with the maintainer. Do not send live secrets, RAK values,
15
+ provisioning URIs, API tokens or personal information in an initial report.
16
+
17
+ ## Integration requirements
18
+
19
+ - Obtain credentials from trusted account-specific storage and use the verifier's clock.
20
+ - Rate limit authentication attempts and atomically enforce replay prevention
21
+ using `verify_and_get_timecode` and a stored last accepted counter per credential.
22
+ - Protect enrollment, recovery, provisioning URIs and credentials, and use TLS.
23
+ - Choose strong password policies. Three-character policies are supported for
24
+ compatibility, not recommended for production; prefer LUI16 or stronger.
25
+ - Neither mechanism is phishing-resistant. Use an appropriate phishing-resistant
26
+ factor when required by the threat model.
27
+
28
+ RAK v1 is a custom HMAC-SHA256 construction; independent cryptographic review
29
+ and actual client interoperability tests are outstanding. See AUDIT.md in the
30
+ source distribution for review scope and remaining release gates.
@@ -0,0 +1,3 @@
1
+ """
2
+ Internal implementation of LeoAuth RAK authentication.
3
+ """
@@ -0,0 +1,56 @@
1
+ from leoauth._LEO.verify import validate_secret_func
2
+ from urllib.parse import quote, urlencode
3
+
4
+ def provisioning_uri_func (secret: str, name: str, issuer: str | None = None) -> (str):
5
+ """
6
+ This function is meant to generate a LeoAuth provisioning URI.
7
+
8
+ :param secret: The LeoAuth secret.
9
+ :type secret: str
10
+
11
+ :param name: The account name.
12
+ :type name: str
13
+
14
+ :param issuer: The organization or service name.
15
+ :type issuer: str | None
16
+
17
+ :return: The generated provisioning URI.
18
+ :rtype: str
19
+ """
20
+
21
+ # Check if the secret is valid.
22
+ if (not validate_secret_func(secret)):
23
+ raise ValueError("Invalid LeoAuth secret")
24
+
25
+ # Check if the account name and issuer have valid types.
26
+ if (not isinstance(name, str) or (issuer is not None and not isinstance(issuer, str))):
27
+ raise TypeError("Account name and issuer must be strings")
28
+
29
+ # Check if the account name was provided.
30
+ if (not name or ":" in name):
31
+ raise ValueError("Invalid account name")
32
+
33
+ # Create the account label.
34
+ label = quote(name, safe="")
35
+
36
+ # Create the URI parameters.
37
+ parameters = {
38
+ "secret": secret,
39
+ "algorithm": "SHA256",
40
+ "version": 1,
41
+ "period": 30
42
+ }
43
+
44
+ # Check if an issuer was provided.
45
+ if (issuer):
46
+
47
+ # Validate the issuer.
48
+ if (":" in issuer):
49
+ raise ValueError("Invalid issuer")
50
+
51
+ # Set the issuer.
52
+ label = quote(issuer, safe="") + ":" + label
53
+ parameters["issuer"] = issuer
54
+
55
+ # Return the provisioning URI.
56
+ return f"leoauth://rak/{label}?{urlencode(parameters, quote_via=quote)}"