Warning
This extension is deprecated. In the meantime, k6 supports webcrypto, it is advisable to use it in new tests. If you need this extension because of your old tests or if you want to continue development, feel free to fork it.
A k6 extension for Javascript Object Signing and Encryption (JOSE) standards.
Features
- parse JSON Web Key
- generate new JSON Web Key
- adopt existing JSON Web Key
- sign JSON Web Token
- verify JSON Web Token signature
- decode JSON Web Token without signature verification
For complete API documentation click here!
The underlying implementation is https://github.com/square/go-jose
Import an entire module's contents:
import * as jwt from "k6/x/jose/jwt";
Import a single export from a module:
import { sign } from "k6/x/jose/jwt";
To build a k6
binary with this extension, first ensure you have the prerequisites:
- Go toolchain
- Git
Then:
- Install
xk6
:
$ go install go.k6.io/xk6/cmd/xk6@latest
- Build the binary:
$ xk6 build --with github.com/szkiba/xk6-jose@latest