Files
tra-app/certificate/ios/自动化打包/payload.json
T
2025-07-31 09:45:36 +08:00

27 lines
643 B
JSON

import jwt
import time
key_id = "X0R2V2N9G2XP" # 替换为您的 Key ID
issuer_id = "69a6de7f-3378-47e3-e053-5b8c7c11a4d1" # 待验证的 Issuer ID
private_key_path = "./ApiKey_X0R2V2N9G2XP.p8"
with open(private_key_path, "r") as f:
private_key = f.read()
# 生成当前时间戳(有效期 20 分钟)
issued_at = int(time.time()) - 60 # 前推 1 分钟避免时钟偏差
expires = issued_at + 1200
token = jwt.encode(
{
"iss": issuer_id,
"iat": issued_at,
"exp": expires,
"aud": "appstoreconnect-v1",
},
private_key,
algorithm="ES256",
headers={"kid": key_id},
)
print(token)