package cn.skcks.matrix.v2.config;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.time.Duration;

@Slf4j
@Data
@Configuration
@ConfigurationProperties(prefix = "jwt")
public class JwtConfig{
   private final static String DEFAULT_PREFIX = "JWT";
   private final static String SEPARATOR = ":";

   // 非对称加密算法名称
   private String algorithm = "ES512";
   // redis 缓存 公钥 base91 的键名
   private String publicCacheKey = DEFAULT_PREFIX + SEPARATOR +"PublicCacheKey";
   // redis 缓存 私钥 base91 的键名
   private String privateCacheKey = DEFAULT_PREFIX + SEPARATOR +"PrivateCacheKey";
   // 过期时间 定位:秒
   private Duration expire = Duration.ofHours(24);
   // 每次启动都重新生成密钥对
   private boolean generateKeyPairEveryTime = false;
}
