crypto

package
v1.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

Package crypto provides a Node.js-compatible crypto module backed by the Go standard library and golang.org/x/crypto. It is registered by jsruntime as both "crypto" and "node:crypto" when NodeJS mode is enabled.

The implementation covers the commonly used subset: hash/HMAC, random generation, PBKDF2/scrypt, symmetric ciphers (AES-CBC/CTR/ECB/GCM and ChaCha20-Poly1305), timing-safe comparison and RSA/ECDSA/Ed25519 sign/verify with PEM keys. See the jsruntime README for compatibility notes and known deviations.

Index

Constants

View Source
const ModuleName = "crypto"

ModuleName is the CommonJS name of the Node.js crypto compatibility module.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

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

Module implements the crypto module host services. It keeps the bridge runtime so asynchronous variants (randomBytes, pbkdf2, scrypt, sign, ...) can schedule callbacks on the JavaScript event loop.

func New

func New(runtime *bridge.Runtime) *Module

New creates a crypto module bound to the given runtime services.

func (*Module) Load

func (m *Module) Load(vm *goja.Runtime, module *goja.Object)

Load registers the Node.js-compatible crypto module exports.

Jump to

Keyboard shortcuts

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