Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

168
Visualizações
Creating HMAC Hash with CryptoJs

I need to create a signature using a sha256 HMAC algorithm for my API request. The message to be encrypted is a concatenation of timestamp, uppercase http method, URI without hostname + request body if there is one.

I have tried the following:

const endpoint = pm.request.url.toString().split("{{BASE_URL}}").pop()
var ts = Math.floor(Date.now() / 1000)

var message = ts + pm.request.method.toUpperCase() + endpoint + pm.request.body

var hmac = CryptoJs.algo.HMAC.create(CryptoJs.algo.SHA256, "{{SECRET_KEY}}")
hmac.update(message)
var hash = hmac.finalize()

However the API refuses saying the signature does not match the request. In my analogous implementation using crypto I don't have any problems. What am I doing wrong?


Edit:

The Question How to implement hmacSHA256 with Javascipt using CryptoJS suggested in the comments is asking how to implement hmac from scratch using cryptojs - I am trying to understand why my usage of the inbuild cryptojs hmac function is not working

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda