클라이언트에서 암호화된 이메일을 전달하고 서버에서 복호화하기
// 클라이언트
import CryptoJS from 'crypto-js';
const encryptedEmail = CryptoJS.AES.encrypt(
email,
process.env.NEXT_PUBLIC_CRYPTO_SECRET_KEY as string
).toString();
const encodedEncryptedEmail = **encodeURIComponent**(encryptedEmail);
// encryptedEmail을 인코딩하지 않고 전달하면 URL에 허용되지 않는 문자들이 포함돼 전송 오류가 발생할 수 있음
// 따라서 꼭 인코딩해서 서버에 넘기기
// encodedEncryptedEmail을 서버에 전달
// 서버
import CryptoJS from 'crypto-js';
const decodedEncryptedEmail = **decodeURIComponent**(encryptedEmail);
const bytes = CryptoJS.AES.decrypt(
decodedEncryptedEmail,
process.env.CRYPTO_SECRET_KEY as string
);
const email = bytes.toString(CryptoJS.enc.Utf8);
gpt api 사용하는 방법
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPEN_AI_API_KEY,
});
const gptResponse = await openai.chat.completions.create({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: prompt }] // prompt 문자열로 작성
});
// gptResponse.choices[0].message에 gpt 답변 담겨있음
편지지 줄 간격 늘리기 css
// tailwind.config.ts
backgroundImage: {
'mobile-lined-paper': `repeating-linear-gradient(
to bottom,
var(--beige),
var(--beige) 28px,
var(--brown) 28px,
var(--brown) 30px
)`,
},
// textarea style에 아래 속성들 추가해야함
leading-[32px]
bg-mobile-lined-paper
bg-[size:100%_32px]
아이폰 사파리 input round 제거
input {
-webkit-appearance: none;
border-radius: 0;
}
이메일 인증 로직
토큰 인증 로직
예약 메일 발송
외부 라이브러리 사용을 위해서 레이어에 추가
import nodemailer from nodemailer; 라고 잘못 호출해서 그런거였음이벤트 브릿지 일정이 아니라 규칙을 생성해야 함 !!
