79514370

Date: 2025-03-17 11:04:21
Score: 0.5
Natty:
Report link

Here's my updated script that finally worked, thanks to your help! I had to put the account name twice in the resources, add parentheses to the table name and update the stringToSign a bit, I had the word GET which was unnecessary.

const crypto = require('crypto');

const accountName = 'devstoreaccount1';
const accountKey = 'Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==';
const tableName = 'AuditLogs()';
const date = new Date().toUTCString();

const canonicalizedResource = `/${accountName}/${accountName}/${tableName}`;

const stringToSign = `${date}\n${canonicalizedResource}`;

const signature = crypto
    .createHmac('sha256', Buffer.from(accountKey, 'base64'))
    .update(stringToSign, 'utf8')
    .digest('base64');

const authorizationHeader = `SharedKeyLite ${accountName}:${signature}`;

console.log(`Date: ${date}`);
console.log(`Authorization: ${authorizationHeader}`);
Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Sora Teichman