package com.ygtx.web.controller.common;

import com.ygtx.common.core.domain.AjaxResult;
import com.ygtx.common.utils.CryptoUtils;
import com.ygtx.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/crypto")
public class CryptoController {

    @Autowired
    private ISysConfigService configService;

    /**
     * 获取 RSA 公钥
     */
    @GetMapping("/publicKey")
    public String getRsaPublicKey() {
        return CryptoUtils.getRsaPublicKey();
    }

    /**
     * 获取 RSA 公钥
     */
    @GetMapping("/isKey")
    public AjaxResult getIsKey() {
        String key = configService.selectConfigByKey("sys.ase.open");
        return AjaxResult.success(null, key);
    }
}
