Skip to content

Commit

Permalink
fixed wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
jontyms committed Jan 8, 2025
1 parent 64f093e commit 1d5e387
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions app/routes/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from typing import Optional

import requests
from airpress import PKPass
from fastapi import APIRouter, Cookie, Depends, Request, Response
from fastapi.responses import RedirectResponse
from google.auth import crypt, jwt
from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from neo_airpress import PKPass
from sqlalchemy.orm import selectinload
from sqlmodel import select

Expand Down Expand Up @@ -378,7 +378,8 @@ def apple_wallet(user_data):

# Add locally stored credentials
key_path = Settings().apple_wallet.pki_dir / "hackucf.key"
cert_path = Settings().apple_wallet.pki_dir / "hackucf.pem" # Assuming a different cert file
cert_path = Settings().apple_wallet.pki_dir / "hackucf.pem"
wwdr_path = Settings().apple_wallet.pki_dir / "wwdr.pem"

# Check if files exist before opening them
if not key_path.exists():
Expand All @@ -389,15 +390,19 @@ def apple_wallet(user_data):
logger.error(f"File not found: {cert_path}")
raise FileNotFoundError(f"File not found: {cert_path}")

if not wwdr_path.exists():
logger.error(f"File not found: {cert_path}")
raise FileNotFoundError(f"File not found: {cert_path}")

# Open the files
with key_path.open("rb") as key, cert_path.open("rb") as cert:
with key_path.open("rb") as key, cert_path.open("rb") as cert, wwdr_path.open("rb") as wwdr:
# Add credentials to pass package
p.key = key.read()
p.cert = cert.read()
p.sign(wwdr=wwdr.read())

# As we've added credentials to pass package earlier we don't need to supply them to `.sign()`
# This is an alternative to calling .sign() method with credentials as arguments.
p.sign()

return p

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
neo-airpress==1.1.0
neo-airpress==2.0.0
asyncio==3.4.3
commonmark==0.9.1
fastapi[standard]==0.115.6
Expand Down

0 comments on commit 1d5e387

Please sign in to comment.