crypto

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2021 License: MIT Imports: 19 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/szkiba/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{}

func New

func New() *Crypto

func (*Crypto) Ecdh

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

func (*Crypto) GenerateKeyPair

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

func (*Crypto) Hkdf

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

func (*Crypto) Pbkdf2

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

type KeyPair

type KeyPair struct {
	PrivateKey goja.ArrayBuffer `js:"privateKey"`
	PublicKey  goja.ArrayBuffer `js:"publicKey"`
}

Jump to

Keyboard shortcuts

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