Skip to content

Commit

Permalink
fix: use keys from db
Browse files Browse the repository at this point in the history
  • Loading branch information
Krish120003 committed Jan 11, 2025
1 parent 8a7151a commit 7dcc08c
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 8 deletions.
81 changes: 77 additions & 4 deletions src/app/api/wallet/apple/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,83 @@ export const GET = async (
try {
/** Each, but last, can be either a string or a Buffer. See API Documentation for more */

const wwdr = env.APPLE_WWDR;
const signerCert = env.APPLE_SIGNER_CERT;
const signerKey = env.APPLE_SIGNER_KEY;
const signerKeyPassphrase = env.APPLE_SIGNER_KEY_PASSPHRASE;
// const wwdr = env.APPLE_WWDR;
// const signerCert = env.APPLE_SIGNER_CERT;
// const signerKey = env.APPLE_SIGNER_KEY;
// const signerKeyPassphrase = env.APPLE_SIGNER_KEY_PASSPHRASE;

// await prisma.config.create({
// data: {
// name: "APPLE_WWDR",
// value: wwdr,
// },
// });

// await prisma.config.create({
// data: {
// name: "APPLE_SIGNER_CERT",
// value: signerCert,
// },
// });

// await prisma.config.create({
// data: {
// name: "APPLE_SIGNER_KEY",
// value: signerKey,
// },
// });

// await prisma.config.create({
// data: {
// name: "APPLE_SIGNER_KEY_PASSPHRASE",
// value: signerKeyPassphrase,
// },
// });

// throw new Error("Not implemented");

const wwdr = (
await prisma.config.findFirst({
where: {
name: "APPLE_WWDR",
},
})
)?.value;

const signerCert = (
await prisma.config.findFirst({
where: {
name: "APPLE_SIGNER_CERT",
},
})
)?.value;

const signerKey = (
await prisma.config.findFirst({
where: {
name: "APPLE_SIGNER_KEY",
},
})
)?.value;

const signerKeyPassphrase = (
await prisma.config.findFirst({
where: {
name: "APPLE_SIGNER_KEY_PASSPHRASE",
},
})
)?.value;

console.log("IS WWDR SAME?", wwdr === env.APPLE_WWDR);
console.log(wwdr);
console.log(env.APPLE_WWDR);
console.log("=================================");
console.log("IS SIGNER CERT SAME?", signerCert === env.APPLE_SIGNER_CERT);
console.log("IS SIGNER KEY SAME?", signerKey === env.APPLE_SIGNER_KEY);
console.log(
"IS SIGNER KEY PASS SAME?",
signerKeyPassphrase === env.APPLE_SIGNER_KEY_PASSPHRASE
);

// const { wwdr, signerCert, signerKey, signerKeyPassphrase } = getCertificatesContentsSomehow();

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
8 changes: 4 additions & 4 deletions src/env/schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export const serverSchema = z.object({
R2_BUCKET_NAME: z.string(),

// Apple Wallet Configuration
APPLE_WWDR: z.string(),
APPLE_SIGNER_CERT: z.string(),
APPLE_SIGNER_KEY: z.string(),
APPLE_SIGNER_KEY_PASSPHRASE: z.string(),
// APPLE_WWDR: z.string(),
// APPLE_SIGNER_CERT: z.string(),
// APPLE_SIGNER_KEY: z.string(),
// APPLE_SIGNER_KEY_PASSPHRASE: z.string(),
});

/**
Expand Down

0 comments on commit 7dcc08c

Please sign in to comment.