Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/earthstar/deps.ts>ed.Point#toX25519

Earthstar is a tool for private, undiscoverable, offline-first networks.
Go to Latest
method ed.Point.prototype.toX25519
import { ed } from "https://deno.land/x/earthstar@v10.0.0-beta.7/deps.ts";
const { Point } = ed;

Converts to Montgomery; aka x coordinate of curve25519. We don't have fromX25519, because we don't know sign.

u, v: curve25519 coordinates
x, y: ed25519 coordinates
(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)
(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))

https://blog.filippo.io/using-ed25519-keys-for-encryption

Returns

Uint8Array

u coordinate of curve25519 point