-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
760 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,48 @@ | ||
name: main | ||
|
||
on: [push] | ||
on: [ push ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.7'] | ||
python-version: [ 3.7, 3.8, 3.9, "3.10" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- uses: Gr1N/setup-poetry@v8 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "poetry" | ||
|
||
- name: Check dependencies | ||
run: make doctor | ||
- name: Install poetry dependencies | ||
run: poetry install | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | ||
- name: Check dependencies | ||
run: make doctor | ||
|
||
- name: Install dependencies | ||
run: make install | ||
- uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | ||
|
||
- name: Check code | ||
run: make check | ||
- name: Install dependencies | ||
run: make install | ||
|
||
- name: Test code | ||
run: make test | ||
- name: Check code | ||
run: make check | ||
|
||
- name: Upload coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
fail_ci_if_error: true | ||
- name: Test code | ||
run: make test | ||
|
||
# - name: Upload coverage | ||
# uses: codecov/codecov-action@v1 | ||
# with: | ||
# fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/psf/black | ||
rev: 22.12.0 | ||
hooks: | ||
- id: black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.7.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../CHANGELOG.md |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../CONTRIBUTING.md |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../LICENSE.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mkdocs==1.3.1 ; python_full_version >= "3.7.2" and python_version < "3.12" | ||
pygments==2.16.1 ; python_full_version >= "3.7.2" and python_version < "3.12" | ||
jinja2==3.1.2 ; python_full_version >= "3.7.2" and python_version < "3.12" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
from python_anvil_encryption import encryption | ||
|
||
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
|
||
def main(): | ||
# Read your public and private keys | ||
public_key = None | ||
private_key = None | ||
with open(os.path.join(CURRENT_PATH, "keys/public.pub"), "rb") as pub_file: | ||
public_key = pub_file.read() | ||
|
||
with open(os.path.join(CURRENT_PATH, "./keys/private.pem"), "rb") as priv_file: | ||
private_key = priv_file.read() | ||
|
||
# RSA | ||
message = b"Super secret message" | ||
encrypted_message = encryption.encrypt_rsa(public_key, message) | ||
decrypted_message = encryption.decrypt_rsa(private_key, encrypted_message) | ||
assert decrypted_message == message | ||
print(f"Are equal? {decrypted_message == message}") | ||
|
||
# AES | ||
aes_key = encryption.generate_aes_key() | ||
aes_encrypted_message = encryption.encrypt_aes(aes_key, message) | ||
# The aes key in the first parameter is required to be in a hex | ||
# byte string format. | ||
decrypted_message = encryption.decrypt_aes( | ||
aes_key.hex().encode(), aes_encrypted_message | ||
) | ||
assert decrypted_message == message | ||
print(f"Are equal? {decrypted_message == message}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
print(CURRENT_PATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQChxcVVacwOBjGL | ||
vNlDCZyeD4eaS8Rkhrwb5HcFonjgc7qVtrNq/VnmbALsc8QZ3pLFO8LWia3zGY5c | ||
mirCbFl+RpBX1lmdFSaBQZhH0obVDNgqwG1R2Pho1xEyyUXGggQoY7AqvfliGTmL | ||
8LerdmUBF+o2fSgpRXCiUWZ+nUyLni8NH5nI7mX25+SPRFwvbLkK17frTNnUFGaM | ||
Ah05XOHVDQPFOKeWkQusIDCjdKZbLq+1Rlf/5/F4balGhCkLsuiV23rnNJUEWGKr | ||
686VkcRBuMe8PQzdePs6lUJd9I8qHPeIDUj8vEEyA2jHBLu+f1GINvzfDVEATV+2 | ||
KAc+XK8TAgMBAAECggEBAJ9ut023h/imV/wc8Y5lEaqhKYaCd5qPQyLGJhsyhajH | ||
xbK5LdgaupgiCTuZ2EGantGtVRd09y+oFyricZPNjuGpj6ZRxV3Ps3Qd/oOCU4nz | ||
L7Pqk5Lfn+pLU1LXFGJQTuKzZLKrKfVpYNKvOYTNmTvbouNys7sBCcGfMcFFK2RI | ||
vA5QGjH75KTzYkgeRuEOkMDSn7XNZup8D6HOD8rqMEqmqf0T7LK/+Ui+Lv+0SFHW | ||
bBsHE8WGpvf02szLv8yr5PlVjj/2krrjuxj7TxyDf8bFBcSR+YFCD2IV9DqHfVAL | ||
v5xRETxPXrIuUdRE12ywXX9Rs1gDBtbi8IUAdJs0wrkCgYEA5+hSXMxJ90VaAPxa | ||
yE7oxwjssqOu/XODzae3eVh/RQIw0iVcu9eQmLByAZRC0yRtmL38UDOxPglquQR8 | ||
MAQv9G5yhDY/3tK1vXWpaibBiDzv3OAv4Sh6+rKgdfP4RaWozmGWGT+4REPN1Iwh | ||
hrSQGpa1Loo+ysB2WF+LtcRFepcCgYEAspQuF8PdT3g0t3lGLW0x57ZydcRN/zmW | ||
b17UPUplAXdRm1IcZn5lytb25UtvYus69+DWzLwfwhGKWGagzcojOWJHMzVNd9R5 | ||
kEEEyXKq4Yzadzy/H+wqiaL+euoELuJlnbCBJQYAX417wM81NK0P3o3Z9cT8IBYA | ||
e0aL6zQY6uUCgYEAycw7f0y1QFo0y47MYGlp3WhCr+AHMb0HADnlSc5cUOxrFzIz | ||
07DsvjErw3wD+j9ErxkDKbcRkG4ZVA43EoFSSVyigbHDOl4Yj1iHpzs6RRbhkk3y | ||
2/ahrO0q+/jkHZbdoVkBh88OxThLL50Qv2r3ymtCFdFueneng5cAt5am7tkCgYAH | ||
LWF03xBkA0bLIPqrFLpuv6x2Az/HRD9BlqQdGoJYvrzu6yvtCqN4tY8SxCdj6GRk | ||
VgsMC3uTRzUyPF22J6umwMZvznKgoE+KdrKEjjFEA288X5qm480J3x0vP3yPjdXb | ||
sp5eKJGXRY51v146EcKThUv/Tr17ZKb8TWeOOnfN6QKBgGBJH2XywacG1VPS6Yg2 | ||
T4JoRWiwsaH/8En/dDUO6/YOOPasA28i4VW1xtNZPqk2Kd4Fg+zWZE1pt5w4MKyb | ||
6kSISSo9NOC3LN3WyEqBa3XcRYFb2cggK0EvaJQ+a8bzhcSSzrGvbKFgk9O1QGud | ||
ZjGQrTXebogFV+uB2sUsL5oR | ||
-----END PRIVATE KEY----- |
Oops, something went wrong.