@yoonion/mimi-seed-mcp 0.3.12 → 0.3.13

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.
@@ -5,5 +5,5 @@ export interface AppStoreCredentials {
5
5
  }
6
6
  export declare function getAppStoreCredentials(): AppStoreCredentials | null;
7
7
  export declare function saveAppStoreCredentials(creds: AppStoreCredentials): void;
8
- export declare function generateToken(creds: AppStoreCredentials): string;
9
- export declare function getAuthHeaders(): Record<string, string> | null;
8
+ export declare function generateToken(creds: AppStoreCredentials): Promise<string>;
9
+ export declare function getAuthHeaders(): Promise<Record<string, string> | null>;
@@ -1,4 +1,4 @@
1
- import jwt from 'jsonwebtoken';
1
+ import { SignJWT, importPKCS8 } from 'jose';
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import os from 'node:os';
@@ -28,26 +28,20 @@ export function saveAppStoreCredentials(creds) {
28
28
  fs.mkdirSync(dir, { recursive: true });
29
29
  fs.writeFileSync(CONFIG_PATH, JSON.stringify(creds, null, 2), { mode: 0o600 });
30
30
  }
31
- export function generateToken(creds) {
32
- const now = Math.floor(Date.now() / 1000);
33
- return jwt.sign({
34
- iss: creds.issuerId,
35
- iat: now,
36
- exp: now + 20 * 60, // 20분
37
- aud: 'appstoreconnect-v1',
38
- }, creds.privateKey, {
39
- algorithm: 'ES256',
40
- header: {
41
- alg: 'ES256',
42
- kid: creds.keyId,
43
- typ: 'JWT',
44
- },
45
- });
31
+ export async function generateToken(creds) {
32
+ const key = await importPKCS8(creds.privateKey, 'ES256');
33
+ return new SignJWT({})
34
+ .setProtectedHeader({ alg: 'ES256', kid: creds.keyId, typ: 'JWT' })
35
+ .setIssuer(creds.issuerId)
36
+ .setIssuedAt()
37
+ .setExpirationTime('20m')
38
+ .setAudience('appstoreconnect-v1')
39
+ .sign(key);
46
40
  }
47
- export function getAuthHeaders() {
41
+ export async function getAuthHeaders() {
48
42
  const creds = getAppStoreCredentials();
49
43
  if (!creds)
50
44
  return null;
51
- const token = generateToken(creds);
45
+ const token = await generateToken(creds);
52
46
  return { Authorization: `Bearer ${token}` };
53
47
  }
@@ -14,8 +14,8 @@ import crypto from 'node:crypto';
14
14
  * 4. commit — PATCH /appScreenshots/{id} { uploaded: true, sourceFileChecksum }
15
15
  */
16
16
  const BASE = 'https://api.appstoreconnect.apple.com/v1';
17
- function authHeadersOrThrow() {
18
- const headers = getAuthHeaders();
17
+ async function authHeadersOrThrow() {
18
+ const headers = await getAuthHeaders();
19
19
  if (!headers) {
20
20
  throw new Error([
21
21
  '❌ App Store Connect 인증이 필요해.',
@@ -27,7 +27,7 @@ function authHeadersOrThrow() {
27
27
  return headers;
28
28
  }
29
29
  async function req(pathOrUrl, init = {}) {
30
- const headers = authHeadersOrThrow();
30
+ const headers = await authHeadersOrThrow();
31
31
  const url = pathOrUrl.startsWith('http') ? pathOrUrl : `${BASE}${pathOrUrl}`;
32
32
  const res = await fetch(url, {
33
33
  ...init,
@@ -5,7 +5,7 @@ import { getAuthHeaders } from './auth.js';
5
5
  */
6
6
  const BASE = 'https://api.appstoreconnect.apple.com/v1';
7
7
  export async function apiGet(path, params) {
8
- const headers = getAuthHeaders();
8
+ const headers = await getAuthHeaders();
9
9
  if (!headers)
10
10
  throw new Error([
11
11
  '❌ App Store Connect 인증이 필요해.',
@@ -29,7 +29,7 @@ export async function apiGet(path, params) {
29
29
  return res.json();
30
30
  }
31
31
  async function apiPatch(path, body) {
32
- const headers = getAuthHeaders();
32
+ const headers = await getAuthHeaders();
33
33
  if (!headers)
34
34
  throw new Error([
35
35
  '❌ App Store Connect 인증이 필요해.',
@@ -51,7 +51,7 @@ async function apiPatch(path, body) {
51
51
  return text ? JSON.parse(text) : { ok: true };
52
52
  }
53
53
  async function apiPost(path, body) {
54
- const headers = getAuthHeaders();
54
+ const headers = await getAuthHeaders();
55
55
  if (!headers)
56
56
  throw new Error([
57
57
  '❌ App Store Connect 인증이 필요해.',
@@ -421,7 +421,7 @@ export async function submitVersionForReview(versionId) {
421
421
  // 자동 제출(submission)은 권장 가이드라인 (스크린샷·리뷰 노트 등)이 충족돼야 통과.
422
422
  const IAP_V2_BASE = 'https://api.appstoreconnect.apple.com/v2';
423
423
  async function apiPostV2(path, body) {
424
- const headers = getAuthHeaders();
424
+ const headers = await getAuthHeaders();
425
425
  if (!headers) {
426
426
  throw new Error('App Store Connect 인증 필요 — npx -p @yoonion/mimi-seed-mcp mimi-seed-appstore-auth');
427
427
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoonion/mimi-seed-mcp",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "description": "Mimi Seed MCP server — Firebase + AdMob + Google Play + App Store management for Claude Code / Cursor / any MCP client.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -47,12 +47,11 @@
47
47
  "@modelcontextprotocol/sdk": "^1.12.1",
48
48
  "@onesub/providers": "^0.2.0",
49
49
  "googleapis": "^171.4.0",
50
- "jsonwebtoken": "^9.0.3",
50
+ "jose": "^5.10.0",
51
51
  "open": "^10.1.0",
52
52
  "zod": "^3.24.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@types/jsonwebtoken": "^9.0.10",
56
55
  "@types/node": "^22.0.0",
57
56
  "tsx": "^4.19.0",
58
57
  "typescript": "^5.7.0"