rsa

package module
v0.0.0-...-cdc2c18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

README

xk6-rsa

An incredibly simple k6 extension for signing a collection of claims with a provided private key (PKCS8 format) using RS256.

Example

Look within example.js for an example of how to use the extension. You can pass a private key from string, or from a file path.

How To Add The Extension To Your k6 Binary.

Run the standard xk6 build command using the with flag.

xk6 build --with github.com/jmkraut/xk6-rsa
How To Compile The Custom k6 Binary Locally

Ensure you are within the xk6-rsa folder and then run the following:

xk6 build --with xk6-rsa=.

This will produce a k6 binary within the current folder. Ensure you use this binary and not an existing one on your path.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rsa

type Rsa struct{}

Rsa is the custom API type.

func (*Rsa) SignFromFilePath

func (r *Rsa) SignFromFilePath(claims map[string]any, privateKeyPath string) (string, error)

SignFromFilePath reads from a file path, and if the path is valid returns a signed JWT, or an error otherwise.

func (*Rsa) SignFromString

func (r *Rsa) SignFromString(claims map[string]any, privateKey string) (string, error)

SignFromString returns a signed JWT, or an error otherwise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL