Liking cljdoc? Tell your friends :D

dk.simongray.podcast.nostr.secp256k1

Schnorr signatures over the curve secp256k1, as BIP-340 defines them, on both platforms. Nostr signs each event with such a signature.

Each key, message and signature is hexadecimal text, which is how Nostr writes them. A secret key can be a hidden text of dk.simongray.wary-fetch.secret. A verification reads no secret key, so the time that it takes tells nothing that's secret, but the time of anything that reads a secret key depends on it.

The numbers are BigInteger on the JVM and BigInt in JavaScript. A point of the curve is a vector of x, y and z in Jacobian coordinates, and nil is the point at infinity.

Schnorr signatures over the curve secp256k1, as BIP-340 defines them,
on both platforms. Nostr signs each event with such a signature.

Each key, message and signature is hexadecimal text, which is how Nostr
writes them. A secret key can be a hidden text of
dk.simongray.wary-fetch.secret. A verification reads no secret key,
so the time that it takes tells nothing that's secret, but the time of
anything that reads a secret key depends on it.

The numbers are BigInteger on the JVM and BigInt in JavaScript. A point
of the curve is a vector of x, y and z in Jacobian coordinates, and nil
is the point at infinity.
raw docstring

public-keyclj/s

(public-key secret-key)

The public key of the secret-key, both hexadecimal text of 32 bytes, or nil for a text that isn't a secret key.

The section Public Key Generation of BIP-340 defines it: the x coordinate of the secret number times the generator.

The public key of the `secret-key`, both hexadecimal text of 32 bytes,
or nil for a text that isn't a secret key.

The section Public Key Generation of BIP-340 defines it: the x
coordinate of the secret number times the generator.
sourceraw docstring

public-key?clj/s

(public-key? x)

Whether x is a public key of BIP-340: hexadecimal text of 32 bytes that is the x coordinate of a point of the curve.

Whether `x` is a public key of BIP-340: hexadecimal text of 32 bytes
that is the x coordinate of a point of the curve.
sourceraw docstring

shared-xclj/s

(shared-x secret-key public-key)

The x coordinate of the point that the owner of secret-key shares with the owner of public-key, as hexadecimal text of 32 bytes.

It's nil for a text that isn't a key, and for a public key that isn't a point of the curve. The point is the secret number times the point of the public key, which is the key agreement of Diffie and Hellman on the curve. The two owners get the same point, each from their own secret key and the public key of the other. NIP-44 uses the x coordinate as it is, without a hash.

The result is as secret as the secret key, so it's a hidden text of dk.simongray.wary-fetch.secret. The time that this takes depends on the secret key.

The x coordinate of the point that the owner of `secret-key` shares
with the owner of `public-key`, as hexadecimal text of 32 bytes.

It's nil for a text that isn't a key, and for a public key that isn't a
point of the curve. The point is the secret number times the point of
the public key, which is the key agreement of Diffie and Hellman on the
curve. The two owners get the same point, each from their own secret
key and the public key of the other. NIP-44 uses the x coordinate as it
is, without a hash.

The result is as secret as the secret key, so it's a hidden text of
dk.simongray.wary-fetch.secret. The time that this takes depends on
the secret key.
sourceraw docstring

signclj/s

(sign secret-key message aux)

The signature of the message with the secret-key and the random aux, as hexadecimal text of 64 bytes, or nil for a text that isn't a secret key.

The message is hexadecimal text of any length. The aux is hexadecimal text of 32 bytes that nobody can guess, new for each signature. The algorithm is Sign of BIP-340, in its section Default Signing, which also checks the signature before it gives it.

The time that signing takes depends on the secret key, so sign only where no stranger measures that time.

The signature of the `message` with the `secret-key` and the random
`aux`, as hexadecimal text of 64 bytes, or nil for a text that isn't a
secret key.

The `message` is hexadecimal text of any length. The `aux` is
hexadecimal text of 32 bytes that nobody can guess, new for each
signature. The algorithm is Sign of BIP-340, in its section Default
Signing, which also checks the signature before it gives it.

The time that signing takes depends on the secret key, so sign only
where no stranger measures that time.
sourceraw docstring

verifyclj/s

(verify public-key message signature)

Whether signature is the signature of the message by the owner of public-key, all hexadecimal text, or false for other values.

The signature has 64 bytes, the message any length and the public key 32 bytes. The check is the algorithm Verify of BIP-340, in its section Verification. A public key is the x coordinate of a point with an even y coordinate.

Whether `signature` is the signature of the `message` by the owner of
`public-key`, all hexadecimal text, or false for other values.

The signature has 64 bytes, the message any length and the public key
32 bytes. The check is the algorithm Verify of BIP-340, in its section
Verification. A public key is the x coordinate of a point with an even
y coordinate.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close