keygen-py 0.0.1.dev7__tar.gz → 0.1.0__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.
Files changed (62) hide show
  1. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/.github/workflows/py-machineid.yaml +2 -1
  2. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/.github/workflows/winregistry.yaml +1 -0
  3. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/.gitignore +5 -0
  4. keygen_py-0.1.0/CODE_OF_CONDUCT.md +75 -0
  5. keygen_py-0.1.0/CONTRIBUTING.md +68 -0
  6. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/Cargo.lock +27 -17
  7. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/Cargo.toml +5 -3
  8. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/PKG-INFO +24 -11
  9. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/README.md +23 -11
  10. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/examples/offline_verification.py +3 -1
  11. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/examples/online_validation.py +2 -1
  12. keygen_py-0.1.0/poetry.lock +148 -0
  13. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/pyproject.toml +5 -1
  14. keygen_py-0.1.0/python/keygen_sh/__init__.py +38 -0
  15. keygen_py-0.1.0/python/keygen_sh/_errors.pyi +3 -0
  16. keygen_py-0.1.0/python/keygen_sh/certificate.pyi +4 -0
  17. keygen_py-0.1.0/python/keygen_sh/component.pyi +15 -0
  18. keygen_py-0.1.0/python/keygen_sh/config.pyi +35 -0
  19. keygen_py-0.1.0/python/keygen_sh/entitlement.pyi +9 -0
  20. keygen_py-0.1.0/python/keygen_sh/errors.py +678 -0
  21. keygen_py-0.1.0/python/keygen_sh/license.pyi +45 -0
  22. keygen_py-0.1.0/python/keygen_sh/license_file.pyi +55 -0
  23. keygen_py-0.1.0/python/keygen_sh/machine.pyi +35 -0
  24. keygen_py-0.1.0/python/keygen_sh/machine_file.pyi +62 -0
  25. keygen_py-0.1.0/src/certificate.rs +33 -0
  26. keygen_py-0.1.0/src/component.rs +58 -0
  27. keygen_py-0.1.0/src/config.rs +149 -0
  28. keygen_py-0.1.0/src/date.rs +34 -0
  29. keygen_py-0.1.0/src/entitlement.rs +38 -0
  30. keygen_py-0.1.0/src/errors.rs +318 -0
  31. keygen_py-0.1.0/src/json.rs +45 -0
  32. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/src/lib.rs +31 -24
  33. keygen_py-0.1.0/src/license.rs +221 -0
  34. keygen_py-0.1.0/src/license_file.rs +105 -0
  35. keygen_py-0.1.0/src/machine.rs +125 -0
  36. keygen_py-0.1.0/src/machine_file.rs +112 -0
  37. keygen_py-0.1.0/src/utils.rs +50 -0
  38. keygen_py-0.1.0/test/config_fixture.py +29 -0
  39. keygen_py-0.1.0/test/test_certificate.py +3 -0
  40. keygen_py-0.1.0/test/test_component.py +3 -0
  41. keygen_py-0.1.0/test/test_config.py +14 -0
  42. keygen_py-0.1.0/test/test_entitlement.py +3 -0
  43. keygen_py-0.1.0/test/test_errors.py +3 -0
  44. keygen_py-0.1.0/test/test_license.py +23 -0
  45. keygen_py-0.1.0/test/test_license_file.py +4 -0
  46. keygen_py-0.1.0/test/test_machine.py +3 -0
  47. keygen_py-0.1.0/test/test_machine_file.py +4 -0
  48. keygen_py-0.0.1.dev7/keygen_sh.pyi +0 -64
  49. keygen_py-0.0.1.dev7/poetry.lock +0 -46
  50. keygen_py-0.0.1.dev7/src/config.rs +0 -55
  51. keygen_py-0.0.1.dev7/src/date.rs +0 -17
  52. keygen_py-0.0.1.dev7/src/license.rs +0 -45
  53. keygen_py-0.0.1.dev7/src/utils.rs +0 -11
  54. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/.github/workflows/pr-checks.yml +0 -0
  55. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/.github/workflows/release.yml +0 -0
  56. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/LICENSE +0 -0
  57. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/conda-recipes/LICENSE +0 -0
  58. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/conda-recipes/deps/py-machineid/recipe.yaml +0 -0
  59. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/conda-recipes/deps/winregistry/LICENSE +0 -0
  60. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/conda-recipes/deps/winregistry/recipe.yaml +0 -0
  61. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/conda-recipes/recipe.yaml +0 -0
  62. {keygen_py-0.0.1.dev7 → keygen_py-0.1.0}/conda-recipes/variants.yaml +0 -0
@@ -1,4 +1,4 @@
1
- name: Release pymachineid
1
+ name: Release py-machineid
2
2
 
3
3
  on:
4
4
  push:
@@ -6,6 +6,7 @@ on:
6
6
  - main
7
7
  paths:
8
8
  - conda-recipes/deps/py-machineid/*
9
+ - .github/workflows/py-machineid.yaml
9
10
 
10
11
  jobs:
11
12
  build:
@@ -6,6 +6,7 @@ on:
6
6
  - main
7
7
  paths:
8
8
  - conda-recipes/deps/winregistry/*
9
+ - .github/workflows/winregistry.yaml
9
10
 
10
11
  jobs:
11
12
  build:
@@ -8,3 +8,8 @@ dist
8
8
  output
9
9
 
10
10
  dist
11
+
12
+
13
+ python/keygen_sh/*.so
14
+
15
+ .env
@@ -0,0 +1,75 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ - Demonstrating empathy and kindness toward other people
14
+ - Being respectful of differing opinions, viewpoints, and experiences
15
+ - Giving and gracefully accepting constructive feedback
16
+ - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ - Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ - Trolling, insulting or derogatory comments, and personal or political attacks
23
+ - Public or private harassment
24
+ - Publishing others’ private information, such as a physical or email address, without their explicit permission
25
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [YOUR_EMAIL_ADDRESS]. All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+
49
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50
+
51
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52
+
53
+ ### 2. Warning
54
+
55
+ **Community Impact**: A violation through a single incident or series of actions.
56
+
57
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
+
59
+ ### 3. Temporary Ban
60
+
61
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
62
+
63
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
+
65
+ ### 4. Permanent Ban
66
+
67
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
+
69
+ **Consequence**: A permanent ban from any sort of public interaction within the project community.
70
+
71
+ ## Attribution
72
+
73
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
74
+
75
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).
@@ -0,0 +1,68 @@
1
+ # Contributing to keygen-py
2
+
3
+ We welcome contributions to `keygen-py`. Whether you want to report a bug, improve the documentation, or contribute code, your help is greatly appreciated!
4
+
5
+ ## How to Contribute
6
+
7
+ ### Reporting Bugs
8
+
9
+ If you find a bug, please report it by [creating an issue](https://github.com/terra-quantum-public/keygen-py/issues). Please include as much detail as possible to help us understand and fix the issue.
10
+
11
+ ### Suggesting Enhancements
12
+
13
+ If you have an idea to improve the SDK, please share it by [creating an issue](https://github.com/terra-quantum-public/keygen-py/issues) and describing the enhancement. We are open to suggestions!
14
+
15
+ ### Submitting Code
16
+
17
+ 1. **Fork the repository**: Click the "Fork" button at the top right of the repository page.
18
+
19
+ 2. **Clone your fork**:
20
+ ```sh
21
+ git clone https://github.com/<YOUR_USERNAME>/keygen-py.git
22
+ ```
23
+
24
+ 3. **Add the upstream remote**:
25
+ ```sh
26
+ cd keygen-py
27
+ git remote add upstream https://github.com/terra-quantum-public/keygen-py.git
28
+ ```
29
+
30
+ 4. **Create a branch**:
31
+ ```sh
32
+ git checkout -b feature/your-feature-name
33
+ ```
34
+
35
+ 5. **Make your changes**: Implement your feature or fix the bug.
36
+
37
+ 6. **Commit your changes**:
38
+ ```sh
39
+ git add .
40
+ git commit -m "Describe your changes"
41
+ ```
42
+
43
+ 7. **Push to your fork**:
44
+ ```sh
45
+ git push origin feature/your-feature-name
46
+ ```
47
+
48
+ 8. **Sync with upstream**:
49
+ ```sh
50
+ git fetch upstream
51
+ git rebase upstream/main
52
+ ```
53
+
54
+ 9. **Create a Pull Request**: Go to the original repository and click the "New Pull Request" button. Provide a detailed description of your changes.
55
+
56
+ ## Coding Standards
57
+
58
+ - Follow the [PEP 8](https://pep8.org/) coding style for Python.
59
+ - Write meaningful commit messages and PR descriptions.
60
+ - Include unit tests if applicable.
61
+
62
+ ## Code of Conduct
63
+
64
+ Our project is dedicated to providing a respectful and harassment-free experience for everyone. Please review our [Code of Conduct](CODE_OF_CONDUCT.md) to understand the expectations we have for everyone who contributes to the project.
65
+
66
+ ## Thank You
67
+
68
+ Thank you for considering contributing to `keygen-py`! Your contributions make this project better for everyone.
@@ -458,6 +458,12 @@ version = "0.3.31"
458
458
  source = "registry+https://github.com/rust-lang/crates.io-index"
459
459
  checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
460
460
 
461
+ [[package]]
462
+ name = "futures-timer"
463
+ version = "3.0.3"
464
+ source = "registry+https://github.com/rust-lang/crates.io-index"
465
+ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
466
+
461
467
  [[package]]
462
468
  name = "futures-util"
463
469
  version = "0.3.31"
@@ -551,9 +557,9 @@ checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
551
557
 
552
558
  [[package]]
553
559
  name = "heck"
554
- version = "0.4.1"
560
+ version = "0.5.0"
555
561
  source = "registry+https://github.com/rust-lang/crates.io-index"
556
- checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
562
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
557
563
 
558
564
  [[package]]
559
565
  name = "hermit-abi"
@@ -728,13 +734,15 @@ dependencies = [
728
734
  "openssl",
729
735
  "pyo3",
730
736
  "pyo3-async-runtimes",
737
+ "serde",
738
+ "serde_json",
731
739
  ]
732
740
 
733
741
  [[package]]
734
742
  name = "keygen-rs"
735
- version = "0.2.2"
743
+ version = "0.3.0"
736
744
  source = "registry+https://github.com/rust-lang/crates.io-index"
737
- checksum = "fe649e2120918483dbad72d38a33a3c74fd8857dc4cfe1a46c087a109d482458"
745
+ checksum = "364356bdcc37ef7859d74099029e2afce7d755747af607af8c88da2d3fdb203c"
738
746
  dependencies = [
739
747
  "aes-gcm",
740
748
  "async-trait",
@@ -743,6 +751,7 @@ dependencies = [
743
751
  "dotenv",
744
752
  "ed25519-dalek",
745
753
  "futures",
754
+ "futures-timer",
746
755
  "hex",
747
756
  "hostname",
748
757
  "lazy_static",
@@ -1061,27 +1070,28 @@ dependencies = [
1061
1070
 
1062
1071
  [[package]]
1063
1072
  name = "pyo3"
1064
- version = "0.21.2"
1073
+ version = "0.23.1"
1065
1074
  source = "registry+https://github.com/rust-lang/crates.io-index"
1066
- checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
1075
+ checksum = "7ebb0c0cc0de9678e53be9ccf8a2ab53045e6e3a8be03393ceccc5e7396ccb40"
1067
1076
  dependencies = [
1068
1077
  "cfg-if",
1069
1078
  "indoc",
1070
1079
  "libc",
1071
1080
  "memoffset",
1072
- "parking_lot",
1081
+ "once_cell",
1073
1082
  "portable-atomic",
1074
1083
  "pyo3-build-config",
1075
1084
  "pyo3-ffi",
1076
1085
  "pyo3-macros",
1086
+ "serde",
1077
1087
  "unindent",
1078
1088
  ]
1079
1089
 
1080
1090
  [[package]]
1081
1091
  name = "pyo3-async-runtimes"
1082
- version = "0.21.0"
1092
+ version = "0.23.0"
1083
1093
  source = "registry+https://github.com/rust-lang/crates.io-index"
1084
- checksum = "96fe0b015461c5136532f42908d6bf4b079da1aedfbffa8b0b5d4cbc59c2fdf8"
1094
+ checksum = "977dc837525cfd22919ba6a831413854beb7c99a256c03bf8624ad707e45810e"
1085
1095
  dependencies = [
1086
1096
  "futures",
1087
1097
  "once_cell",
@@ -1092,9 +1102,9 @@ dependencies = [
1092
1102
 
1093
1103
  [[package]]
1094
1104
  name = "pyo3-build-config"
1095
- version = "0.21.2"
1105
+ version = "0.23.1"
1096
1106
  source = "registry+https://github.com/rust-lang/crates.io-index"
1097
- checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50"
1107
+ checksum = "80e3ce69c4ec34476534b490e412b871ba03a82e35604c3dfb95fcb6bfb60c09"
1098
1108
  dependencies = [
1099
1109
  "once_cell",
1100
1110
  "target-lexicon",
@@ -1102,9 +1112,9 @@ dependencies = [
1102
1112
 
1103
1113
  [[package]]
1104
1114
  name = "pyo3-ffi"
1105
- version = "0.21.2"
1115
+ version = "0.23.1"
1106
1116
  source = "registry+https://github.com/rust-lang/crates.io-index"
1107
- checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403"
1117
+ checksum = "3b09f311c76b36dfd6dd6f7fa6f9f18e7e46a1c937110d283e80b12ba2468a75"
1108
1118
  dependencies = [
1109
1119
  "libc",
1110
1120
  "pyo3-build-config",
@@ -1112,9 +1122,9 @@ dependencies = [
1112
1122
 
1113
1123
  [[package]]
1114
1124
  name = "pyo3-macros"
1115
- version = "0.21.2"
1125
+ version = "0.23.1"
1116
1126
  source = "registry+https://github.com/rust-lang/crates.io-index"
1117
- checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c"
1127
+ checksum = "fd4f74086536d1e1deaff99ec0387481fb3325c82e4e48be0e75ab3d3fcb487a"
1118
1128
  dependencies = [
1119
1129
  "proc-macro2",
1120
1130
  "pyo3-macros-backend",
@@ -1124,9 +1134,9 @@ dependencies = [
1124
1134
 
1125
1135
  [[package]]
1126
1136
  name = "pyo3-macros-backend"
1127
- version = "0.21.2"
1137
+ version = "0.23.1"
1128
1138
  source = "registry+https://github.com/rust-lang/crates.io-index"
1129
- checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c"
1139
+ checksum = "9e77dfeb76b32bbf069144a5ea0a36176ab59c8db9ce28732d0f06f096bbfbc8"
1130
1140
  dependencies = [
1131
1141
  "heck",
1132
1142
  "proc-macro2",
@@ -3,11 +3,13 @@ name = "keygen-py"
3
3
  edition = "2021"
4
4
 
5
5
  [dependencies]
6
- keygen-rs = "0.2.2"
7
- pyo3 = { version = "0.21.2", features = ["extension-module"] }
8
- pyo3-async-runtimes = { version = "0.21.0", features = ["tokio-runtime"] }
6
+ keygen-rs = "0.3.0"
7
+ pyo3 = { version = "0.23.1", features = ["extension-module", "serde"] }
8
+ pyo3-async-runtimes = { version = "0.23.0", features = ["tokio-runtime"] }
9
9
  chrono = "0.4.38"
10
10
  openssl = { version = "0.10", features = ["vendored"] }
11
+ serde = "1.0"
12
+ serde_json = "1.0"
11
13
 
12
14
  [lib]
13
15
  name = "keygen_sh"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: keygen-py
3
- Version: 0.0.1.dev7
3
+ Version: 0.1.0
4
4
  License-File: LICENSE
5
5
  Summary: Unofficial Keygen SDK for Python. Integrate license activation and offline licensing. Wrapper around keygen-rs rust crate
6
6
  Author-email: Terra Quantum AG <info@terraquantum.swiss>, Cedric Kring <ck@terraquantum.swiss>, Steven Beckers <sb@terraquantum.swiss>
@@ -10,9 +10,20 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
10
10
 
11
11
  # Unofficial Keygen Python SDK
12
12
 
13
+ ## Table of Contents
13
14
 
14
- The `keygen-py` package allows Python programs to license using the [keygen.sh](https://keygen.sh) service.
15
- This is a wrapper around the rust package [keygen-rs](https://github.com/ahonn/keygen-rs) (so a lot of kudos there) to provide python bindings.
15
+ - [Installing](#installing)
16
+ - [Config](#config)
17
+ - [Usage](#usage)
18
+ - [Examples](#examples)
19
+ - [Testing](#testing)
20
+ - [Inspired by](#inspired-by)
21
+ - [License](#license)
22
+
23
+
24
+ The `keygen-py` package allows Python programs to manage licenses using the [keygen.sh](https://keygen.sh) service.
25
+
26
+ This is a wrapper around the Rust package [keygen-rs](https://github.com/ahonn/keygen-rs) to provide Python bindings.
16
27
 
17
28
  ## Installing
18
29
 
@@ -20,17 +31,17 @@ Add this to your `pyproject.toml`:
20
31
 
21
32
  ```toml
22
33
  [dependencies]
23
- keygen-py = "0.0.1.dev1"
34
+ keygen-py = "0.1.0"
24
35
  ```
25
36
 
26
37
  ## Config
27
38
 
28
39
  ### KeygenConfig
29
40
 
30
- Use `KeygenConfig` to configure the SDK globally. You should set this before making any API calls.
41
+ Use `KeygenConfig` to configure the SDK globally. Set this before making any API calls.
31
42
 
32
43
  ```python
33
- from keygen_sh import set_config, KeygenConfig
44
+ from keygen_sh.config import set_config, KeygenConfig
34
45
 
35
46
  set_config(KeygenConfig(
36
47
  api_url="https://api.keygen.sh",
@@ -47,8 +58,8 @@ set_config(KeygenConfig(
47
58
 
48
59
  ### Validate a License
49
60
 
50
- To validate a license, configure `KeygenConfig` with your Keygen account details. Then call the `validate` function with a device fingerprint
51
- (you can use [py-machineid](https://github.com/keygen-sh/py-machineid/tree/master) for this) or keep it empty depending on your policy:
61
+ To validate a license, configure `KeygenConfig` with your Keygen account details. Then call the `validate` function with a device fingerprint.
62
+ (You can use [py-machineid](https://github.com/keygen-sh/py-machineid/tree/master) for this) or keep it empty depending on your policy:
52
63
 
53
64
  ```python
54
65
  import asyncio
@@ -66,10 +77,11 @@ if __name__ == '__main__':
66
77
 
67
78
  ### Offline License Key Verification
68
79
 
69
- To verify a signed license key offline:
80
+ To verify a signed license key offline, use the following:
70
81
 
71
82
  ```python
72
- from keygen_sh import verify, SchemeCode
83
+ from keygen_sh import verify
84
+ from keygen_sh.license import SchemeCode
73
85
 
74
86
  data = verify(SchemeCode.Ed25519Sign, "A_KEYGEN_LICENSE_KEY")
75
87
 
@@ -80,7 +92,7 @@ print(data)
80
92
 
81
93
  ## Examples
82
94
 
83
- For more detailed examples, please refer to the `examples` directory in the repository.
95
+ For more detailed examples, refer to the `examples` directory in the repository.
84
96
 
85
97
  ## Testing
86
98
 
@@ -93,3 +105,4 @@ When implementing a testing strategy for your licensing integration, we recommen
93
105
  ## License
94
106
 
95
107
  This project is licensed under the MIT License.
108
+
@@ -1,8 +1,19 @@
1
1
  # Unofficial Keygen Python SDK
2
2
 
3
+ ## Table of Contents
3
4
 
4
- The `keygen-py` package allows Python programs to license using the [keygen.sh](https://keygen.sh) service.
5
- This is a wrapper around the rust package [keygen-rs](https://github.com/ahonn/keygen-rs) (so a lot of kudos there) to provide python bindings.
5
+ - [Installing](#installing)
6
+ - [Config](#config)
7
+ - [Usage](#usage)
8
+ - [Examples](#examples)
9
+ - [Testing](#testing)
10
+ - [Inspired by](#inspired-by)
11
+ - [License](#license)
12
+
13
+
14
+ The `keygen-py` package allows Python programs to manage licenses using the [keygen.sh](https://keygen.sh) service.
15
+
16
+ This is a wrapper around the Rust package [keygen-rs](https://github.com/ahonn/keygen-rs) to provide Python bindings.
6
17
 
7
18
  ## Installing
8
19
 
@@ -10,17 +21,17 @@ Add this to your `pyproject.toml`:
10
21
 
11
22
  ```toml
12
23
  [dependencies]
13
- keygen-py = "0.0.1.dev1"
24
+ keygen-py = "0.1.0"
14
25
  ```
15
26
 
16
27
  ## Config
17
28
 
18
29
  ### KeygenConfig
19
30
 
20
- Use `KeygenConfig` to configure the SDK globally. You should set this before making any API calls.
31
+ Use `KeygenConfig` to configure the SDK globally. Set this before making any API calls.
21
32
 
22
33
  ```python
23
- from keygen_sh import set_config, KeygenConfig
34
+ from keygen_sh.config import set_config, KeygenConfig
24
35
 
25
36
  set_config(KeygenConfig(
26
37
  api_url="https://api.keygen.sh",
@@ -37,8 +48,8 @@ set_config(KeygenConfig(
37
48
 
38
49
  ### Validate a License
39
50
 
40
- To validate a license, configure `KeygenConfig` with your Keygen account details. Then call the `validate` function with a device fingerprint
41
- (you can use [py-machineid](https://github.com/keygen-sh/py-machineid/tree/master) for this) or keep it empty depending on your policy:
51
+ To validate a license, configure `KeygenConfig` with your Keygen account details. Then call the `validate` function with a device fingerprint.
52
+ (You can use [py-machineid](https://github.com/keygen-sh/py-machineid/tree/master) for this) or keep it empty depending on your policy:
42
53
 
43
54
  ```python
44
55
  import asyncio
@@ -56,10 +67,11 @@ if __name__ == '__main__':
56
67
 
57
68
  ### Offline License Key Verification
58
69
 
59
- To verify a signed license key offline:
70
+ To verify a signed license key offline, use the following:
60
71
 
61
72
  ```python
62
- from keygen_sh import verify, SchemeCode
73
+ from keygen_sh import verify
74
+ from keygen_sh.license import SchemeCode
63
75
 
64
76
  data = verify(SchemeCode.Ed25519Sign, "A_KEYGEN_LICENSE_KEY")
65
77
 
@@ -70,7 +82,7 @@ print(data)
70
82
 
71
83
  ## Examples
72
84
 
73
- For more detailed examples, please refer to the `examples` directory in the repository.
85
+ For more detailed examples, refer to the `examples` directory in the repository.
74
86
 
75
87
  ## Testing
76
88
 
@@ -82,4 +94,4 @@ When implementing a testing strategy for your licensing integration, we recommen
82
94
 
83
95
  ## License
84
96
 
85
- This project is licensed under the MIT License.
97
+ This project is licensed under the MIT License.
@@ -1,6 +1,8 @@
1
1
  import os
2
2
 
3
- from keygen_sh import KeygenConfig, set_config, verify, SchemeCode
3
+ from keygen_sh import verify
4
+ from keygen_sh.license import SchemeCode
5
+ from keygen_sh.config import KeygenConfig, set_config
4
6
 
5
7
  set_config(
6
8
  KeygenConfig(
@@ -2,7 +2,8 @@ import asyncio
2
2
  import os
3
3
  import uuid
4
4
 
5
- from keygen_sh import set_config, validate, KeygenConfig
5
+ from keygen_sh import validate
6
+ from keygen_sh.config import set_config, KeygenConfig
6
7
 
7
8
  set_config(
8
9
  KeygenConfig(
@@ -0,0 +1,148 @@
1
+ # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
2
+
3
+ [[package]]
4
+ name = "colorama"
5
+ version = "0.4.6"
6
+ description = "Cross-platform colored terminal text."
7
+ optional = false
8
+ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
9
+ files = [
10
+ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
11
+ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
12
+ ]
13
+
14
+ [[package]]
15
+ name = "exceptiongroup"
16
+ version = "1.2.2"
17
+ description = "Backport of PEP 654 (exception groups)"
18
+ optional = false
19
+ python-versions = ">=3.7"
20
+ files = [
21
+ {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
22
+ {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
23
+ ]
24
+
25
+ [package.extras]
26
+ test = ["pytest (>=6)"]
27
+
28
+ [[package]]
29
+ name = "iniconfig"
30
+ version = "2.0.0"
31
+ description = "brain-dead simple config-ini parsing"
32
+ optional = false
33
+ python-versions = ">=3.7"
34
+ files = [
35
+ {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
36
+ {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
37
+ ]
38
+
39
+ [[package]]
40
+ name = "maturin"
41
+ version = "1.7.4"
42
+ description = "Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages"
43
+ optional = false
44
+ python-versions = ">=3.7"
45
+ files = [
46
+ {file = "maturin-1.7.4-py3-none-linux_armv6l.whl", hash = "sha256:eb7b7753b733ae302c08f80bca7b0c3fda1eea665c2b1922c58795f35a54c833"},
47
+ {file = "maturin-1.7.4-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0182a9638399c8835afd39d2aeacf56908e37cba3f7abb15816b9df6774fab81"},
48
+ {file = "maturin-1.7.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:41a29c5b23f3ebdfe7633637e3de256579a1b2700c04cd68c16ed46934440c5a"},
49
+ {file = "maturin-1.7.4-py3-none-manylinux_2_12_i686.manylinux2010_i686.musllinux_1_1_i686.whl", hash = "sha256:23fae44e345a2da5cb391ae878726fb793394826e2f97febe41710bd4099460e"},
50
+ {file = "maturin-1.7.4-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl", hash = "sha256:8b441521c151f0dbe70ed06fb1feb29b855d787bda038ff4330ca962e5d56641"},
51
+ {file = "maturin-1.7.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:7ccb66d0c5297cf06652c5f72cb398f447d3a332eccf5d1e73b3fe14dbc9498c"},
52
+ {file = "maturin-1.7.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_1_armv7l.whl", hash = "sha256:71f668f19e719048605dbca6a1f4d0dc03b987c922ad9c4bf5be03b9b278e4c3"},
53
+ {file = "maturin-1.7.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.musllinux_1_1_ppc64le.whl", hash = "sha256:c179fcb2b494f19186781b667320e43d95b3e71fcb1c98fffad9ef6bd6e276b3"},
54
+ {file = "maturin-1.7.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:fd5b4b95286f2f376437340f8a4908f4761587212170263084455be8099099a7"},
55
+ {file = "maturin-1.7.4-py3-none-win32.whl", hash = "sha256:35487a424467d1fda4567cbb02d21f09febb10eda22f5fd647b130bc0767dc61"},
56
+ {file = "maturin-1.7.4-py3-none-win_amd64.whl", hash = "sha256:f70c1c8ec9bd4749a53c0f3ae8fdbb326ce45be4f1c5551985ee25a6d7150328"},
57
+ {file = "maturin-1.7.4-py3-none-win_arm64.whl", hash = "sha256:f3d38a6d0c7fd7b04bec30dd470b2173cf9bd184ab6220c1acaf49df6b48faf5"},
58
+ {file = "maturin-1.7.4.tar.gz", hash = "sha256:2b349d742a07527d236f0b4b6cab26f53ebecad0ceabfc09ec4c6a396e3176f9"},
59
+ ]
60
+
61
+ [package.dependencies]
62
+ tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
63
+
64
+ [package.extras]
65
+ patchelf = ["patchelf"]
66
+ zig = ["ziglang (>=0.10.0,<0.13.0)"]
67
+
68
+ [[package]]
69
+ name = "packaging"
70
+ version = "24.2"
71
+ description = "Core utilities for Python packages"
72
+ optional = false
73
+ python-versions = ">=3.8"
74
+ files = [
75
+ {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"},
76
+ {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"},
77
+ ]
78
+
79
+ [[package]]
80
+ name = "pluggy"
81
+ version = "1.5.0"
82
+ description = "plugin and hook calling mechanisms for python"
83
+ optional = false
84
+ python-versions = ">=3.8"
85
+ files = [
86
+ {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"},
87
+ {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"},
88
+ ]
89
+
90
+ [package.extras]
91
+ dev = ["pre-commit", "tox"]
92
+ testing = ["pytest", "pytest-benchmark"]
93
+
94
+ [[package]]
95
+ name = "pytest"
96
+ version = "8.3.3"
97
+ description = "pytest: simple powerful testing with Python"
98
+ optional = false
99
+ python-versions = ">=3.8"
100
+ files = [
101
+ {file = "pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2"},
102
+ {file = "pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181"},
103
+ ]
104
+
105
+ [package.dependencies]
106
+ colorama = {version = "*", markers = "sys_platform == \"win32\""}
107
+ exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
108
+ iniconfig = "*"
109
+ packaging = "*"
110
+ pluggy = ">=1.5,<2"
111
+ tomli = {version = ">=1", markers = "python_version < \"3.11\""}
112
+
113
+ [package.extras]
114
+ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
115
+
116
+ [[package]]
117
+ name = "pytest-asyncio"
118
+ version = "0.24.0"
119
+ description = "Pytest support for asyncio"
120
+ optional = false
121
+ python-versions = ">=3.8"
122
+ files = [
123
+ {file = "pytest_asyncio-0.24.0-py3-none-any.whl", hash = "sha256:a811296ed596b69bf0b6f3dc40f83bcaf341b155a269052d82efa2b25ac7037b"},
124
+ {file = "pytest_asyncio-0.24.0.tar.gz", hash = "sha256:d081d828e576d85f875399194281e92bf8a68d60d72d1a2faf2feddb6c46b276"},
125
+ ]
126
+
127
+ [package.dependencies]
128
+ pytest = ">=8.2,<9"
129
+
130
+ [package.extras]
131
+ docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"]
132
+ testing = ["coverage (>=6.2)", "hypothesis (>=5.7.1)"]
133
+
134
+ [[package]]
135
+ name = "tomli"
136
+ version = "2.1.0"
137
+ description = "A lil' TOML parser"
138
+ optional = false
139
+ python-versions = ">=3.8"
140
+ files = [
141
+ {file = "tomli-2.1.0-py3-none-any.whl", hash = "sha256:a5c57c3d1c56f5ccdf89f6523458f60ef716e210fc47c4cfb188c5ba473e0391"},
142
+ {file = "tomli-2.1.0.tar.gz", hash = "sha256:3f646cae2aec94e17d04973e4249548320197cfabdf130015d023de4b74d8ab8"},
143
+ ]
144
+
145
+ [metadata]
146
+ lock-version = "2.0"
147
+ python-versions = ">=3.9,<3.13"
148
+ content-hash = "a7cae761bc87df336a7f23d07fc99a9a30dc51946d8785533e14934846af58dc"