Skip to main content
Module

x/bwt/deps.ts>Curve25519

Better Web Token - an iteration of web tokens with a bunch of improvements
Latest
class Curve25519
import { Curve25519 } from "https://deno.land/x/bwt@v0.6.0/deps.ts";

Curve25519 class.

Constructors

new
Curve25519()

Creates a curve25519.

Properties

_121665: Int32Array
_9: Uint8Array
D: Int32Array
D2: Int32Array
gf0: Int32Array
gf1: Int32Array
I: Int32Array

Methods

private
A(
o: Int32Array,
a: Int32Array,
b: Int32Array,
): void
private
add(p: Array<Int32Array>, q: Array<Int32Array>): void
private
car25519(o: Int32Array): void
private
crypto_scalarmult(
q: Uint8Array,
s: Uint8Array,
p: Uint8Array,
): void
private
cswap(
p: Array<Int32Array>,
q: Array<Int32Array>,
b: number,
): void
private
gf(init?: Array<number>): Int32Array
private
inv25519(o: Int32Array, i: Int32Array): void
private
M(
o: Int32Array,
a: Int32Array,
b: Int32Array,
): void
private
neq25519(a: Int32Array, b: Int32Array): boolean
private
pack25519(o: Uint8Array, n: Int32Array): void
private
par25519(a: Int32Array): number
private
pow2523(o: Int32Array, i: Int32Array): void
private
S(o: Int32Array, a: Int32Array): void
private
sel25519(
p: Int32Array,
q: Int32Array,
b: number,
): void
private
set25519(r: Int32Array, a: Int32Array): void
private
unpack25519(o: Int32Array, n: Uint8Array): void
private
unpackNeg(r: Array<Int32Array>, p: Uint8Array): number
private
Z(
o: Int32Array,
a: Int32Array,
b: Int32Array,
): void
generateKeys(seed: Uint8Array): null | { secretKey: Uint8Array; publicKey: Uint8Array; }

Generates a curve 25519 keypair.

seed is a 32 byte cryptographic secure random array. This is basically the secret key Returns an object containing a secret and public key as 32 byte typed arrays

scalarMult(secretKey: Uint8Array, publicKey: Uint8Array): Uint8Array

Generates the common key as the produkt of secretKey1 * publicKey2.

secretKey must be a 32 byte secret key of pair 1 publicKey must be a 32 byte public key of pair 2 Returns secretKey * publicKey

selftest(): boolean