Skip to main content Link Search Menu Expand Document (external link)

WireguardKey overview

Wireguard key schemas and helpers

Added in v1.0.0


Table of contents


Crypto

generateKeyPair

Generates a wireguard public private key pair.

Signature

export declare const generateKeyPair: () => { readonly privateKey: WireguardKey; readonly publicKey: WireguardKey }

Example

import { generateKeyPair } from "the-wireguard-effect/WireguardKey"
const { privateKey, publicKey } = generateKeyPair()

Added in v1.0.0

generatePreshareKey

Generates a wireguard preshare key.

Signature

export declare const generatePreshareKey: () => WireguardKey

Example

import { generatePreshareKey } from "the-wireguard-effect/WireguardKey"
const preshareKey = generatePreshareKey()

Added in v1.0.0

Schemas

WireguardKey

A wireguard key, which is a 44 character base64 string.

Signature

export declare const WireguardKey: Schema.brand<
  Schema.refine<string, Schema.Schema<string, string, never>>,
  "WireguardKey"
>

Added in v1.0.0

Unbranded Types

WireguardKey (type alias)

Signature

export type WireguardKey = Schema.Schema.Type<typeof WireguardKey>

Added in v1.0.0