如何将此java转换为NodeJS
byte[] decodedKey = Hex.decodeHesecretKey.toCharArray());
SecretKeySpec keySpec = new SecretKeySpec(decodedKey, algorithm);
Mac mac = Mac.getInstance(algorithm);
mac.init(keySpec);
byte[] dataBytes = data.getBytes("UTF-8");
byte[] signatureBytes = mac.doFinal(dataBytes);
String signature = new String(Base64.encodeBase64(signatureBytes),"UTF-8");
return signature;