Skip to content

Commit

Permalink
v1.1.8: fix VerifyTools
Browse files Browse the repository at this point in the history
  • Loading branch information
seiya-git committed Nov 29, 2023
1 parent 8418d58 commit b2a191b
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 75 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Publish Python 🐍 distribution 📦 to PyPI

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: |
python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
cp -r ./py/* ./build
cp LICENSE.md ./build
cp README.md ./build
python3 -m build build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: build/dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/nstools # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: build/dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TOKEN }}
packages-dir: build/dist

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: build/dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./build/dist/*.tar.gz
./build/dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' build/dist/**
--repo '${{ github.repository }}'
70 changes: 1 addition & 69 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
name: Publish Python 🐍 distribution 📦 to TestPyPI

on: push

Expand Down Expand Up @@ -28,74 +28,6 @@ jobs:
name: python-package-distributions
path: build/dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/nstools # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: build/dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TOKEN }}
packages-dir: build/dist

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: build/dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./build/dist/*.tar.gz
./build/dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' build/dist/**
--repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
Expand Down
2 changes: 1 addition & 1 deletion build/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setuptools.setup(
name = 'nstools',
version = '1.1.7',
version = '1.1.8',
url = 'https://github.com/seiya-dev/NSTools',
long_description = long_description,
long_description_content_type = 'text/markdown',
Expand Down
9 changes: 4 additions & 5 deletions py/nstools/lib/VerifyTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def verify_key(self, nca, ticket):
f.seek(0)

ncaHeader = Nca.NcaHeader()
ncaHeader.open(Fs.File.MemoryFile(f.read(0x400), Type.Crypto.XTS, uhx(Keys.get('header_key'))))
ncaHeader.open(File.MemoryFile(f.read(0x400), Type.Crypto.XTS, uhx(Keys.get('header_key'))))

pfs0 = fs

Expand Down Expand Up @@ -218,7 +218,7 @@ def verify_key(self, nca, ticket):
f.seek(0)

ncaHeader = Nca.NcaHeader()
ncaHeader.open(Fs.File.MemoryFile(f.read(0x400), Type.Crypto.XTS, uhx(Keys.get('header_key'))))
ncaHeader.open(File.MemoryFile(f.read(0x400), Type.Crypto.XTS, uhx(Keys.get('header_key'))))
ncaHeader = f.read(0x400)

pfs0 = fs
Expand Down Expand Up @@ -250,7 +250,7 @@ def verify_key(self, nca, ticket):
f.seek(0)

ncaHeader = Nca.NcaHeader()
ncaHeader.open(Fs.File.MemoryFile(f.read(0x400), Type.Crypto.XTS, uhx(Keys.get('header_key'))))
ncaHeader.open(File.MemoryFile(f.read(0x400), Type.Crypto.XTS, uhx(Keys.get('header_key'))))
ncaHeader = f.read(0x400)

pfs0 = fs
Expand Down Expand Up @@ -375,6 +375,5 @@ def verify_nca_sig_simple(self):
return verify_data

def verify_nca_sig(self, verify_data):
# this just useless additional checks, don't bother for now...
# this is just useless additional checks, don't bother for now...
return verify_data

0 comments on commit b2a191b

Please sign in to comment.