crypto

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 18 Imported by: 0

README

xk6-crypto

A k6 extension for using extended crypto functions, mostly from golang.org/x/crypto.

Built for k6 using xk6.

Usage

Import an entire module's contents:

import * as xcrypto from "k6/x/crypto";

Import a single export from a module:

import { hkdf } from "k6/x/crypto";

API

Functions:

For complete API documentation click here!

Build

To build a k6 binary with this extension, first ensure you have the prerequisites:

Then:

  1. Install xk6:
$ go install go.k6.io/xk6/cmd/xk6@latest
  1. Build the binary:
$ xk6 build --with github.com/rammstein4o/xk6-crypto@latest

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedHash      = errors.New("unsupported hash")
	ErrInvalidKeyLen        = errors.New("invalid keylen")
	ErrUnsupportedAlgorithm = errors.New("unsupported algorithm")
)

Functions

This section is empty.

Types

type Crypto

type Crypto struct {
	// contains filtered or unexported fields
}

func (*Crypto) Ecdh

func (c *Crypto) Ecdh(algorithm string, privateKey, publicKey goja.ArrayBuffer) (interface{}, error)

func (*Crypto) GenerateKeyPair

func (c *Crypto) GenerateKeyPair(algorithm string, seedIn interface{}) (*KeyPair, error)

func (*Crypto) Hkdf

func (c *Crypto) Hkdf(hash string, secretIn, saltIn, infoIn interface{}, keylen int) (interface{}, error)

func (*Crypto) Pbkdf2

func (c *Crypto) Pbkdf2(passwordIn, saltIn interface{}, iter, keylen int, hash string) (interface{}, error)

type KeyPair

type KeyPair struct {
	PrivateKey interface{} `js:"privateKey"`
	PublicKey  interface{} `js:"publicKey"`
}

type ModuleInstance

type ModuleInstance struct {
	// contains filtered or unexported fields
}

ModuleInstance represents an instance of the JS module.

func (*ModuleInstance) Exports

func (mi *ModuleInstance) Exports() modules.Exports

Exports implements the modules.Instance interface and returns the exported types for the JS module.

type RootModule

type RootModule struct{}

RootModule is the global module instance that will create module instances for each VU.

func New

func New() *RootModule

New returns a pointer to a new RootModule instance.

func (*RootModule) NewModuleInstance

func (*RootModule) NewModuleInstance(vu modules.VU) modules.Instance

NewModuleInstance implements the modules.Module interface returning a new instance for each VU.

Jump to

Keyboard shortcuts

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