How to use the HmacSHA384 function from crypto-js

Find comprehensive JavaScript crypto-js.HmacSHA384 code examples handpicked from public code repositorys.

8
9
10
11
12
13
14
15
16
17
}

get(action, callback, data = {}) {
    let dataJSON = JSON.stringify(data);

    let sign = CryptoJS.HmacSHA384(dataJSON, this.privateKey);
    sign = CryptoJS.enc.Base64.stringify(sign);

    request.post(this.apiUrl + action, {
        headers: {
fork icon20
star icon27
watch icon4

+ 3 other calls in file

15
16
17
18
19
20
21
22
23
24
  const nonce = Date.now().toString();
  const bodyStr = body ? JSON.stringify(body) : '';
  return {
    'btse-api': API_KEY,
    'btse-nonce': nonce,
    'btse-sign': HmacSHA384(`${endpoint}${nonce}${bodyStr}`, API_SECRET_KEY).toString(),
  };
};

module.exports = {
fork icon16
star icon8
watch icon2

+ 5 other calls in file

45
46
47
48
49
50
51
52
53
54
try {
    if (!this.ifAuthenticated) {
        await this.getApiKeys();
        const authNonce = Math.floor(Date.now() / 100) + "00000000000000000" + Math.floor(Date.now() / 100);
        const authPayload = 'AUTH' + authNonce
        const authSig = crypto.HmacSHA384(authPayload, this.apiParams.apiSecret).toString(crypto.enc.Hex);
        const payload = {
            apiKey: this.apiParams.apiKey,
            authSig,
            authNonce,
fork icon13
star icon16
watch icon7

72
73
74
75
76
77
78
79
80
    payload.authNonce = +nonce
  } else {
    console.warn('Only wss v2 is now supported, sorry!')
    return {}
  }
  payload.authSig = HmacSHA384(payload.authPayload, apiSecret).toString(enc.Hex)

  return payload
}
fork icon2
star icon3
watch icon0

+ 2 other calls in file

89
90
91
92
93
94
95
96
97
98
},
hmacsha256() {
  return CryptoJS.HmacSHA256(this.text, this.serect).toString();
},
hmacsha384() {
  return CryptoJS.HmacSHA384(this.text, this.serect).toString();
},
hmacsha512() {
  return CryptoJS.HmacSHA512(this.text, this.serect).toString();
},
fork icon0
star icon1
watch icon1

+ 17 other calls in file

127
128
129
130
131
132
133
134
135
136
};

/* SHA384 hashing */
exports.SHA384 = function(text, key) {
    try {
        return typeof key !== undefined ? CryptoJS.HmacSHA384(text, key) : CryptoJS.SHA384(text);
    }
    catch (err) {
        throw "ERROR - utils/utilidades.js _ SHA384 method";
    }
fork icon1
star icon0
watch icon2

+ 3 other calls in file

6
7
8
9
10
11
12
13
14
15

var request = JSON.stringify({
    orderId: 'BACKEND-16a92e0f94e5f100' //NODE: We can only cancel orders that belong to the source associated with our API key
});

var signature = CryptoJS.HmacSHA384(request, SECRET).toString(CryptoJS.enc.Hex);

var a = Request.post(
    {
        headers: {
fork icon1
star icon0
watch icon4

+ 5 other calls in file

8
9
10
11
12
13
14
15
16
17

// Variable d'environnement 
require('dotenv').config();

exports.signup = (req, res, next) => {
    const emailCryptoJs = cryptoJs.HmacSHA384(req.body.email, `${process.env.crypto_key}`).toString();
    bcrypt.hash(req.body.password, 12)
        .then(hash => {
            const user = new User({
                email: emailCryptoJs,
fork icon0
star icon0
watch icon1

+ 7 other calls in file

6
7
8
9
10
11
12
13
14
15

const requestUrl = "/external/v3/app-report?startDate=2022-10-08&endDate=2022-10-09";
const requestMethod = "GET";

// The authentication signature is hashed using the apiSecret
const signature = CryptoJS.HmacSHA384(`${apiKey}.${nonce}.${requestUrl}.${requestMethod}`, apiSecret).toString();

//example request
fetch(`https://api.reklamup.com${requestUrl}`, {
    method: requestMethod,
fork icon0
star icon0
watch icon1