keygen-py 0.0.1.dev4__tar.gz → 0.0.1.dev6__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.
- keygen_py-0.0.1.dev6/.github/workflows/pr-checks.yml +130 -0
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/.github/workflows/release.yml +72 -91
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/.gitignore +4 -1
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/PKG-INFO +1 -1
- keygen_py-0.0.1.dev6/conda-recipe/LICENSE +21 -0
- keygen_py-0.0.1.dev6/conda-recipe/recipe.yaml +46 -0
- keygen_py-0.0.1.dev6/conda-recipe/variants.yaml +5 -0
- keygen_py-0.0.1.dev6/examples/offline_verification.py +23 -0
- keygen_py-0.0.1.dev6/examples/online_validation.py +34 -0
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/keygen_sh.pyi +6 -4
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/pyproject.toml +1 -1
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/src/config.rs +5 -4
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/src/lib.rs +2 -2
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/src/license.rs +3 -3
- keygen_py-0.0.1.dev4/.github/workflows/test.yml +0 -38
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/Cargo.lock +0 -0
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/Cargo.toml +0 -0
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/LICENSE +0 -0
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/README.md +0 -0
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/poetry.lock +0 -0
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/src/date.rs +0 -0
- {keygen_py-0.0.1.dev4 → keygen_py-0.0.1.dev6}/src/utils.rs +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
name: PR checks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
types: [opened, synchronize, reopened]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
# Make sure CI fails on all warnings, including Clippy lints
|
|
13
|
+
env:
|
|
14
|
+
RUSTFLAGS: "-Dwarnings"
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- name: Run Clippy
|
|
22
|
+
run: cargo clippy --all-targets --all-features
|
|
23
|
+
|
|
24
|
+
build:
|
|
25
|
+
name: ${{ matrix.platform.runner }} ${{ matrix.platform.target }} ${{ matrix.platform.manylinux }}
|
|
26
|
+
needs:
|
|
27
|
+
- lint
|
|
28
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
29
|
+
strategy:
|
|
30
|
+
fail-fast: true
|
|
31
|
+
matrix:
|
|
32
|
+
platform:
|
|
33
|
+
- runner: ubuntu-latest
|
|
34
|
+
target: x86_64
|
|
35
|
+
target-platform: linux-64
|
|
36
|
+
before: 'yum install --assumeyes perl-core'
|
|
37
|
+
manylinux: 'auto'
|
|
38
|
+
create-conda-package: true
|
|
39
|
+
- runner: ubuntu-latest
|
|
40
|
+
target: x86_64
|
|
41
|
+
before: 'apt update && apt install -y libssl-dev'
|
|
42
|
+
manylinux: 'musllinux_1_2'
|
|
43
|
+
- runner: ubuntu-latest
|
|
44
|
+
target: x64
|
|
45
|
+
before: 'yum install --assumeyes perl-core'
|
|
46
|
+
manylinux: 'auto'
|
|
47
|
+
- runner: ubuntu-latest
|
|
48
|
+
target: x86
|
|
49
|
+
before: 'apt update && apt install -y libssl-dev'
|
|
50
|
+
manylinux: 'musllinux_1_2'
|
|
51
|
+
- runner: ubuntu-latest
|
|
52
|
+
target: aarch64
|
|
53
|
+
before: 'apt update && apt install -y libssl-dev'
|
|
54
|
+
- runner: ubuntu-latest
|
|
55
|
+
target: aarch64
|
|
56
|
+
before: 'apt update && apt install -y libssl-dev'
|
|
57
|
+
manylinux: 'auto'
|
|
58
|
+
- runner: ubuntu-latest
|
|
59
|
+
target: aarch64
|
|
60
|
+
before: 'apt update && apt install -y libssl-dev'
|
|
61
|
+
manylinux: 'musllinux_1_2'
|
|
62
|
+
- runner: ubuntu-latest
|
|
63
|
+
target: armv7
|
|
64
|
+
before: 'apt update && apt install -y libssl-dev'
|
|
65
|
+
manylinux: 'auto'
|
|
66
|
+
- runner: ubuntu-latest
|
|
67
|
+
target: armv7
|
|
68
|
+
before: 'apt update && apt install -y libssl-dev'
|
|
69
|
+
manylinux: 'musllinux_1_2'
|
|
70
|
+
- runner: windows-latest
|
|
71
|
+
target: x64
|
|
72
|
+
target-platform: win-64
|
|
73
|
+
create-conda-package: true
|
|
74
|
+
- runner: windows-latest
|
|
75
|
+
target: x86
|
|
76
|
+
- runner: macos-latest
|
|
77
|
+
target: x86_64
|
|
78
|
+
target-platform: osx-64
|
|
79
|
+
create-conda-package: true
|
|
80
|
+
- runner: macos-latest
|
|
81
|
+
target: aarch64
|
|
82
|
+
target-platform: osx-arm64
|
|
83
|
+
create-conda-package: true
|
|
84
|
+
steps:
|
|
85
|
+
- uses: actions/checkout@v4
|
|
86
|
+
- uses: actions/setup-python@v5
|
|
87
|
+
if: runner.os == 'Windows'
|
|
88
|
+
with:
|
|
89
|
+
python-version: |
|
|
90
|
+
3.9
|
|
91
|
+
3.10
|
|
92
|
+
3.11
|
|
93
|
+
3.12
|
|
94
|
+
architecture: ${{ matrix.platform.target }}
|
|
95
|
+
- uses: actions/setup-python@v5
|
|
96
|
+
if: runner.os != 'Windows'
|
|
97
|
+
with:
|
|
98
|
+
python-version: |
|
|
99
|
+
3.9
|
|
100
|
+
3.10
|
|
101
|
+
3.11
|
|
102
|
+
3.12
|
|
103
|
+
- name: Build wheels
|
|
104
|
+
uses: PyO3/maturin-action@v1
|
|
105
|
+
with:
|
|
106
|
+
target: ${{ matrix.platform.target }}
|
|
107
|
+
args: --release --out dist --find-interpreter
|
|
108
|
+
sccache: 'true'
|
|
109
|
+
manylinux: ${{ matrix.platform.manylinux }}
|
|
110
|
+
before-script-linux: ${{ matrix.platform.before }}
|
|
111
|
+
- name: Build conda package
|
|
112
|
+
if: matrix.platform.create-conda-package
|
|
113
|
+
uses: prefix-dev/rattler-build-action@v0.2.19
|
|
114
|
+
with:
|
|
115
|
+
upload-artifact: false
|
|
116
|
+
artifact-name: conda-${{ matrix.platform.runner }}-${{ matrix.platform.target }}
|
|
117
|
+
recipe-path: 'conda-recipe/recipe.yaml'
|
|
118
|
+
build-args: '--target-platform ${{ matrix.platform.target-platform }} --experimental'
|
|
119
|
+
|
|
120
|
+
sdist:
|
|
121
|
+
runs-on: ubuntu-latest
|
|
122
|
+
needs:
|
|
123
|
+
- lint
|
|
124
|
+
steps:
|
|
125
|
+
- uses: actions/checkout@v4
|
|
126
|
+
- name: Build sdist
|
|
127
|
+
uses: PyO3/maturin-action@v1
|
|
128
|
+
with:
|
|
129
|
+
command: sdist
|
|
130
|
+
args: --out dist
|
|
@@ -9,7 +9,8 @@ permissions:
|
|
|
9
9
|
contents: read
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
|
-
|
|
12
|
+
build:
|
|
13
|
+
name: ${{ matrix.platform.runner }} ${{ matrix.platform.target }} ${{ matrix.platform.manylinux }}
|
|
13
14
|
runs-on: ${{ matrix.platform.runner }}
|
|
14
15
|
strategy:
|
|
15
16
|
fail-fast: true
|
|
@@ -17,126 +18,95 @@ jobs:
|
|
|
17
18
|
platform:
|
|
18
19
|
- runner: ubuntu-latest
|
|
19
20
|
target: x86_64
|
|
21
|
+
target-platform: linux-64
|
|
20
22
|
before: 'yum install --assumeyes perl-core'
|
|
23
|
+
manylinux: 'auto'
|
|
24
|
+
create-conda-package: true
|
|
25
|
+
- runner: ubuntu-latest
|
|
26
|
+
target: x86_64
|
|
27
|
+
before: 'apt update && apt install -y libssl-dev'
|
|
28
|
+
manylinux: 'musllinux_1_2'
|
|
21
29
|
- runner: ubuntu-latest
|
|
22
30
|
target: x64
|
|
23
31
|
before: 'yum install --assumeyes perl-core'
|
|
32
|
+
manylinux: 'auto'
|
|
24
33
|
- runner: ubuntu-latest
|
|
25
|
-
target:
|
|
34
|
+
target: x86
|
|
26
35
|
before: 'apt update && apt install -y libssl-dev'
|
|
36
|
+
manylinux: 'musllinux_1_2'
|
|
27
37
|
- runner: ubuntu-latest
|
|
28
|
-
target:
|
|
38
|
+
target: aarch64
|
|
29
39
|
before: 'apt update && apt install -y libssl-dev'
|
|
30
|
-
steps:
|
|
31
|
-
- uses: actions/checkout@v4
|
|
32
|
-
- uses: actions/setup-python@v5
|
|
33
|
-
with:
|
|
34
|
-
python-version: 3.*
|
|
35
|
-
- name: Build wheels
|
|
36
|
-
uses: PyO3/maturin-action@v1
|
|
37
|
-
with:
|
|
38
|
-
target: ${{ matrix.platform.target }}
|
|
39
|
-
args: --release --out dist --find-interpreter
|
|
40
|
-
sccache: 'true'
|
|
41
|
-
manylinux: 'auto'
|
|
42
|
-
before-script-linux: ${{ matrix.platform.before }}
|
|
43
|
-
- name: Upload wheels
|
|
44
|
-
uses: actions/upload-artifact@v4
|
|
45
|
-
with:
|
|
46
|
-
name: wheels-linux-${{ matrix.platform.target }}
|
|
47
|
-
path: dist
|
|
48
|
-
|
|
49
|
-
musllinux:
|
|
50
|
-
runs-on: ${{ matrix.platform.runner }}
|
|
51
|
-
strategy:
|
|
52
|
-
fail-fast: true
|
|
53
|
-
matrix:
|
|
54
|
-
platform:
|
|
55
40
|
- runner: ubuntu-latest
|
|
56
|
-
target:
|
|
41
|
+
target: aarch64
|
|
57
42
|
before: 'apt update && apt install -y libssl-dev'
|
|
43
|
+
manylinux: 'auto'
|
|
58
44
|
- runner: ubuntu-latest
|
|
59
|
-
target:
|
|
45
|
+
target: aarch64
|
|
60
46
|
before: 'apt update && apt install -y libssl-dev'
|
|
47
|
+
manylinux: 'musllinux_1_2'
|
|
61
48
|
- runner: ubuntu-latest
|
|
62
|
-
target:
|
|
49
|
+
target: armv7
|
|
63
50
|
before: 'apt update && apt install -y libssl-dev'
|
|
51
|
+
manylinux: 'auto'
|
|
64
52
|
- runner: ubuntu-latest
|
|
65
53
|
target: armv7
|
|
66
54
|
before: 'apt update && apt install -y libssl-dev'
|
|
67
|
-
|
|
68
|
-
- uses: actions/checkout@v4
|
|
69
|
-
- uses: actions/setup-python@v5
|
|
70
|
-
with:
|
|
71
|
-
python-version: 3.*
|
|
72
|
-
- name: Build wheels
|
|
73
|
-
uses: PyO3/maturin-action@v1
|
|
74
|
-
with:
|
|
75
|
-
target: ${{ matrix.platform.target }}
|
|
76
|
-
args: --release --out dist --find-interpreter
|
|
77
|
-
sccache: 'true'
|
|
78
|
-
manylinux: musllinux_1_2
|
|
79
|
-
before-script-linux: ${{ matrix.platform.before }}
|
|
80
|
-
- name: Upload wheels
|
|
81
|
-
uses: actions/upload-artifact@v4
|
|
82
|
-
with:
|
|
83
|
-
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
84
|
-
path: dist
|
|
85
|
-
|
|
86
|
-
windows:
|
|
87
|
-
runs-on: ${{ matrix.platform.runner }}
|
|
88
|
-
strategy:
|
|
89
|
-
fail-fast: true
|
|
90
|
-
matrix:
|
|
91
|
-
platform:
|
|
55
|
+
manylinux: 'musllinux_1_2'
|
|
92
56
|
- runner: windows-latest
|
|
93
57
|
target: x64
|
|
58
|
+
target-platform: win-64
|
|
59
|
+
create-conda-package: true
|
|
94
60
|
- runner: windows-latest
|
|
95
61
|
target: x86
|
|
96
|
-
steps:
|
|
97
|
-
- uses: actions/checkout@v4
|
|
98
|
-
- uses: actions/setup-python@v5
|
|
99
|
-
with:
|
|
100
|
-
python-version: 3.*
|
|
101
|
-
architecture: ${{ matrix.platform.target }}
|
|
102
|
-
- name: Build wheels
|
|
103
|
-
uses: PyO3/maturin-action@v1
|
|
104
|
-
with:
|
|
105
|
-
target: ${{ matrix.platform.target }}
|
|
106
|
-
args: --release --out dist --find-interpreter
|
|
107
|
-
sccache: 'true'
|
|
108
|
-
- name: Upload wheels
|
|
109
|
-
uses: actions/upload-artifact@v4
|
|
110
|
-
with:
|
|
111
|
-
name: wheels-windows-${{ matrix.platform.target }}
|
|
112
|
-
path: dist
|
|
113
|
-
|
|
114
|
-
macos:
|
|
115
|
-
runs-on: ${{ matrix.platform.runner }}
|
|
116
|
-
strategy:
|
|
117
|
-
fail-fast: true
|
|
118
|
-
matrix:
|
|
119
|
-
platform:
|
|
120
62
|
- runner: macos-latest
|
|
121
63
|
target: x86_64
|
|
64
|
+
target-platform: osx-64
|
|
65
|
+
create-conda-package: true
|
|
122
66
|
- runner: macos-latest
|
|
123
67
|
target: aarch64
|
|
68
|
+
target-platform: osx-arm64
|
|
69
|
+
create-conda-package: true
|
|
124
70
|
steps:
|
|
125
71
|
- uses: actions/checkout@v4
|
|
126
72
|
- uses: actions/setup-python@v5
|
|
73
|
+
if: runner.os == 'Windows'
|
|
74
|
+
with:
|
|
75
|
+
python-version: |
|
|
76
|
+
3.9
|
|
77
|
+
3.10
|
|
78
|
+
3.11
|
|
79
|
+
3.12
|
|
80
|
+
architecture: ${{ matrix.platform.target }}
|
|
81
|
+
- uses: actions/setup-python@v5
|
|
82
|
+
if: runner.os != 'Windows'
|
|
127
83
|
with:
|
|
128
|
-
python-version:
|
|
84
|
+
python-version: |
|
|
85
|
+
3.9
|
|
86
|
+
3.10
|
|
87
|
+
3.11
|
|
88
|
+
3.12
|
|
129
89
|
- name: Build wheels
|
|
130
90
|
uses: PyO3/maturin-action@v1
|
|
131
91
|
with:
|
|
132
92
|
target: ${{ matrix.platform.target }}
|
|
133
93
|
args: --release --out dist --find-interpreter
|
|
134
94
|
sccache: 'true'
|
|
95
|
+
manylinux: ${{ matrix.platform.manylinux }}
|
|
96
|
+
before-script-linux: ${{ matrix.platform.before }}
|
|
135
97
|
- name: Upload wheels
|
|
136
98
|
uses: actions/upload-artifact@v4
|
|
137
99
|
with:
|
|
138
|
-
name: wheels
|
|
100
|
+
name: wheels-${{ matrix.platform.runner }}-${{ matrix.platform.manylinux }}-${{ matrix.platform.target }}
|
|
139
101
|
path: dist
|
|
102
|
+
- name: Build conda package
|
|
103
|
+
if: matrix.platform.create-conda-package
|
|
104
|
+
uses: prefix-dev/rattler-build-action@v0.2.19
|
|
105
|
+
with:
|
|
106
|
+
upload-artifact: true
|
|
107
|
+
artifact-name: conda-${{ matrix.platform.runner }}-${{ matrix.platform.target }}
|
|
108
|
+
recipe-path: 'conda-recipe/recipe.yaml'
|
|
109
|
+
build-args: '--target-platform ${{ matrix.platform.target-platform }} --experimental'
|
|
140
110
|
|
|
141
111
|
sdist:
|
|
142
112
|
runs-on: ubuntu-latest
|
|
@@ -153,30 +123,41 @@ jobs:
|
|
|
153
123
|
name: wheels-sdist
|
|
154
124
|
path: dist
|
|
155
125
|
|
|
126
|
+
|
|
156
127
|
release:
|
|
157
128
|
name: Release
|
|
158
129
|
runs-on: ubuntu-latest
|
|
159
|
-
|
|
160
|
-
needs: [linux, musllinux, windows, macos, sdist]
|
|
130
|
+
needs: [build, sdist]
|
|
161
131
|
permissions:
|
|
162
|
-
# Use to sign the release artifacts
|
|
163
132
|
id-token: write
|
|
164
|
-
# Used to upload release artifacts
|
|
165
133
|
contents: write
|
|
166
|
-
# Used to generate artifact attestation
|
|
167
134
|
attestations: write
|
|
168
135
|
steps:
|
|
169
136
|
- uses: actions/checkout@v4
|
|
137
|
+
- name: Install rattler-build
|
|
138
|
+
run: |
|
|
139
|
+
mkdir -p ${{ runner.temp }}/rattler-build
|
|
140
|
+
curl -Ls \
|
|
141
|
+
https://github.com/prefix-dev/rattler-build/releases/latest/download/rattler-build-x86_64-unknown-linux-musl \
|
|
142
|
+
-o ${{ runner.temp }}/rattler-build/rattler-build
|
|
143
|
+
chmod +x ${{ runner.temp }}/rattler-build/rattler-build
|
|
144
|
+
echo ${{ runner.temp }}/rattler-build >> $GITHUB_PATH
|
|
170
145
|
- uses: actions/download-artifact@v4
|
|
171
146
|
- name: Generate artifact attestation
|
|
172
147
|
uses: actions/attest-build-provenance@v1
|
|
173
148
|
with:
|
|
174
|
-
subject-path:
|
|
175
|
-
|
|
149
|
+
subject-path: |
|
|
150
|
+
wheels-*/*
|
|
151
|
+
conda-*/*
|
|
176
152
|
- name: Get project version
|
|
177
153
|
id: 'pyproject_version'
|
|
178
154
|
run: echo "version=v$(grep -m 1 version pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)" >> $GITHUB_OUTPUT
|
|
179
|
-
|
|
155
|
+
- name: Publish to prefix.dev channel
|
|
156
|
+
run: |
|
|
157
|
+
for pkg in $(find conda-*/* -type f \( -name "*.conda" -o -name "*.tar.bz2" \) ); do
|
|
158
|
+
echo "Uploading ${pkg}"
|
|
159
|
+
rattler-build upload prefix -c terraquantumag "${pkg}"
|
|
160
|
+
done
|
|
180
161
|
- name: Publish to PyPI
|
|
181
162
|
uses: PyO3/maturin-action@v1
|
|
182
163
|
env:
|
|
@@ -208,4 +189,4 @@ jobs:
|
|
|
208
189
|
uses: softprops/action-gh-release@v2
|
|
209
190
|
with:
|
|
210
191
|
body: ${{ steps.build_changelog.outputs.changelog }}
|
|
211
|
-
tag_name: ${{ steps.pyproject_version.outputs.version }}
|
|
192
|
+
tag_name: ${{ steps.pyproject_version.outputs.version }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: keygen-py
|
|
3
|
-
Version: 0.0.1.
|
|
3
|
+
Version: 0.0.1.dev6
|
|
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>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Terra Quantum AG
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
schema_version: 1
|
|
2
|
+
|
|
3
|
+
context:
|
|
4
|
+
name: ${{ load_from_file("pyproject.toml").project.name }}
|
|
5
|
+
version: ${{ load_from_file("pyproject.toml").project.version }}
|
|
6
|
+
|
|
7
|
+
package:
|
|
8
|
+
name: ${{ name|lower }}
|
|
9
|
+
version: ${{ version }}
|
|
10
|
+
|
|
11
|
+
source:
|
|
12
|
+
path: ../dist
|
|
13
|
+
use_gitignore: false
|
|
14
|
+
|
|
15
|
+
build:
|
|
16
|
+
script: pip install --find-links . keygen-py
|
|
17
|
+
number: 0
|
|
18
|
+
|
|
19
|
+
requirements:
|
|
20
|
+
build:
|
|
21
|
+
- python
|
|
22
|
+
host:
|
|
23
|
+
- python
|
|
24
|
+
- pip
|
|
25
|
+
- setuptools
|
|
26
|
+
- wheel
|
|
27
|
+
run:
|
|
28
|
+
- python
|
|
29
|
+
|
|
30
|
+
tests:
|
|
31
|
+
- python:
|
|
32
|
+
imports:
|
|
33
|
+
- keygen_sh
|
|
34
|
+
pip_check: true
|
|
35
|
+
|
|
36
|
+
about:
|
|
37
|
+
summary: Unofficial Keygen SDK for Python. Integrate license activation and offline licensing. Wrapper around keygen-rs rust crate
|
|
38
|
+
license: MIT
|
|
39
|
+
license_file: LICENSE
|
|
40
|
+
homepage: https://github.com/terra-quantum-public/keygen-py
|
|
41
|
+
|
|
42
|
+
extra:
|
|
43
|
+
recipe-maintainers:
|
|
44
|
+
- sbtq
|
|
45
|
+
- cedrictq
|
|
46
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from keygen_sh import KeygenConfig, set_config, verify, SchemeCode
|
|
4
|
+
|
|
5
|
+
set_config(
|
|
6
|
+
KeygenConfig(
|
|
7
|
+
api_url="https://api.keygen.sh",
|
|
8
|
+
api_prefix="v1",
|
|
9
|
+
api_version="v1.7",
|
|
10
|
+
account=os.getenv("KEYGEN_ACCOUNT_ID"),
|
|
11
|
+
product=os.getenv("KEYGEN_PRODUCT_ID"),
|
|
12
|
+
license_key=os.getenv("KEYGEN_LICENSE_KEY"),
|
|
13
|
+
public_key=os.getenv("KEYGEN_PUBLIC_KEY"),
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
_LICENSE_KEY = os.getenv("OFFLINE_LICENSE_KEY")
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
data = verify(SchemeCode.Ed25519Sign, signed_key=_LICENSE_KEY)
|
|
21
|
+
print(f"License is valid and contains the following data {data}")
|
|
22
|
+
except RuntimeError:
|
|
23
|
+
print("License could not be verified.")
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import os
|
|
3
|
+
import uuid
|
|
4
|
+
|
|
5
|
+
from keygen_sh import set_config, validate, KeygenConfig
|
|
6
|
+
|
|
7
|
+
set_config(
|
|
8
|
+
KeygenConfig(
|
|
9
|
+
api_url="https://api.keygen.sh",
|
|
10
|
+
api_prefix="v1",
|
|
11
|
+
api_version="v1.7",
|
|
12
|
+
account=os.getenv("KEYGEN_ACCOUNT_ID"),
|
|
13
|
+
product=os.getenv("KEYGEN_PRODUCT_ID"),
|
|
14
|
+
license_key=os.getenv("KEYGEN_LICENSE_KEY"),
|
|
15
|
+
public_key=os.getenv("KEYGEN_PUBLIC_KEY"),
|
|
16
|
+
)
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async def amain():
|
|
21
|
+
fingerprint = str(uuid.getnode())
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
license = await validate(fingerprints=[fingerprint])
|
|
25
|
+
# or if the license is not bound to a specific machine identity
|
|
26
|
+
license = await validate()
|
|
27
|
+
|
|
28
|
+
print(f"License {license.id}:{license.name} is valid")
|
|
29
|
+
except RuntimeError:
|
|
30
|
+
print("License is not valid")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
asyncio.run(amain())
|
|
@@ -32,18 +32,20 @@ class License:
|
|
|
32
32
|
status: Optional[str]
|
|
33
33
|
policy: Optional[str]
|
|
34
34
|
|
|
35
|
-
def verify(scheme: SchemeCode,
|
|
35
|
+
def verify(scheme: SchemeCode, signed_key: str) -> str:
|
|
36
36
|
"""
|
|
37
37
|
Verify an offline key.
|
|
38
38
|
|
|
39
39
|
:param scheme: the scheme code
|
|
40
|
-
:param
|
|
40
|
+
:param signed_key: the key to verify
|
|
41
41
|
:return: the data in the key
|
|
42
|
-
:raises:
|
|
42
|
+
:raises: RuntimeError if the key is invalid
|
|
43
43
|
"""
|
|
44
44
|
...
|
|
45
45
|
|
|
46
|
-
async def validate(
|
|
46
|
+
async def validate(
|
|
47
|
+
fingerprints: Optional[list[str]] = None, entitlements: Optional[list[str]] = None
|
|
48
|
+
) -> License:
|
|
47
49
|
"""
|
|
48
50
|
Validate a license.
|
|
49
51
|
|
|
@@ -13,6 +13,7 @@ impl KeygenConfig {
|
|
|
13
13
|
#[pyo3(signature = (api_url, api_version, api_prefix, account, product, package=None, environment=None, license_key=None, token=None, public_key=None, platform=None, user_agent=None, max_clock_drift=5)
|
|
14
14
|
)]
|
|
15
15
|
#[new]
|
|
16
|
+
#[allow(clippy::too_many_arguments)]
|
|
16
17
|
pub fn new(api_url: String,
|
|
17
18
|
api_version: String,
|
|
18
19
|
api_prefix: String,
|
|
@@ -34,7 +35,7 @@ impl KeygenConfig {
|
|
|
34
35
|
api_prefix,
|
|
35
36
|
account,
|
|
36
37
|
product,
|
|
37
|
-
package: package.
|
|
38
|
+
package: package.unwrap_or("".to_string()),
|
|
38
39
|
environment,
|
|
39
40
|
license_key,
|
|
40
41
|
token,
|
|
@@ -47,8 +48,8 @@ impl KeygenConfig {
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
impl
|
|
51
|
-
fn
|
|
52
|
-
|
|
51
|
+
impl From<KeygenConfig> for config::KeygenConfig {
|
|
52
|
+
fn from(val: KeygenConfig) -> Self {
|
|
53
|
+
val.inner
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -29,8 +29,8 @@ fn validate<'a>(py: Python<'a>, fingerprints: Option<Bound<'a, PyList>>, entitle
|
|
|
29
29
|
let fingerprints = fingerprints.unwrap_or_else(|| PyList::empty_bound(py));
|
|
30
30
|
let entitlements = entitlements.unwrap_or_else(|| PyList::empty_bound(py));
|
|
31
31
|
|
|
32
|
-
let fingerprints_vec = pylist_to_string_slice(fingerprints
|
|
33
|
-
let entitlements_vec = pylist_to_string_slice(entitlements
|
|
32
|
+
let fingerprints_vec = pylist_to_string_slice(fingerprints)?;
|
|
33
|
+
let entitlements_vec = pylist_to_string_slice(entitlements)?;
|
|
34
34
|
|
|
35
35
|
pyo3_async_runtimes::tokio::future_into_py(py, async move {
|
|
36
36
|
let result = keygen_rs::validate(&fingerprints_vec, &entitlements_vec).await;
|
|
@@ -36,9 +36,9 @@ impl License {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
impl
|
|
40
|
-
fn
|
|
41
|
-
match
|
|
39
|
+
impl From<SchemeCode> for license::SchemeCode {
|
|
40
|
+
fn from(val: SchemeCode) -> Self {
|
|
41
|
+
match val {
|
|
42
42
|
SchemeCode::Ed25519Sign => license::SchemeCode::Ed25519Sign,
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
name: Test
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches: [ main ]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ${{ matrix.os }}
|
|
10
|
-
strategy:
|
|
11
|
-
matrix:
|
|
12
|
-
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
|
|
13
|
-
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v4
|
|
17
|
-
|
|
18
|
-
- name: Set up Rust
|
|
19
|
-
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
20
|
-
|
|
21
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
-
uses: actions/setup-python@v5
|
|
23
|
-
with:
|
|
24
|
-
python-version: ${{ matrix.python-version }}
|
|
25
|
-
|
|
26
|
-
- name: Install and configure Poetry
|
|
27
|
-
uses: snok/install-poetry@v1
|
|
28
|
-
with:
|
|
29
|
-
version: '1.8.3'
|
|
30
|
-
|
|
31
|
-
- name: Install dependencies
|
|
32
|
-
run: poetry install
|
|
33
|
-
shell: bash
|
|
34
|
-
|
|
35
|
-
- name: Build wheel for lib
|
|
36
|
-
run: poetry run maturin build
|
|
37
|
-
shell: bash
|
|
38
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|