Skip to content

Instantly share code, notes, and snippets.

View DJDANNY123's full-sized avatar

Daniel Jackson DJDANNY123

  • Hargreaves Lansdown
View GitHub Profile
@DJDANNY123
DJDANNY123 / signing-utils.test.ts
Last active June 14, 2024 11:20
K6 Subtle Webcrypto Jwt Signing, this simple example is for ES256 (ECDSA with the P-256 Elliptic Curve), but the same technique should be applicable with different keys
import {
describe,
expect,
// @ts-expect-error importing from url
} from 'https://jslib.k6.io/k6chaijs/4.3.4.3/index.js';
import { crypto } from 'k6/experimental/webcrypto';
import {
encodeJwt,
printArrayBuffer,
string2ArrayBuffer,