Skip to content

CryptoJS equivalent #220

Closed
Closed
@whittlem

Description

@whittlem

I'm trying to get CryptoJS to do the same as this from the "crypto" library...

const what = timestamp + method.toUpperCase() + path + body;
const key = Buffer.from(auth.secret, 'base64');
const hmac = crypto.createHmac('sha256', key);
const signature = hmac.update(what).digest('base64');

This is what I have...

const what = `${timestamp}${method}${path}${body}`;
const hmac = CryptoJS.HmacSHA512(what, secret).toString();
const wordArray = CryptoJS.enc.Utf8.parse(signed);
const signature = CryptoJS.enc.Base64.stringify(wordArray);

I'm sure it is something small but I can't seem to get it working.

Is someone able to help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions