package encipher

import (
	"os"

	"git.apinb.com/bsm-sdk/engine/env"
	"git.apinb.com/bsm-sdk/engine/exception"
	"git.apinb.com/bsm-sdk/engine/types"
)

func NewCertKey(privateKey []byte, publicKey []byte) {
	if certBytes == nil {
		certBytes = &types.CertFileBytes{
			Private: privateKey,
			Public:  publicKey,
		}
	}
}

func GetKeyFile(filePath string) ([]byte, error) {
	keyBytes, err := os.ReadFile(env.MeshEnv.Prefix + filePath)
	if err != nil {
		return nil, exception.ErrDataLoss
	}
	return keyBytes, nil
}