Skip to content

Commit

Permalink
docstring: Improve docstring of hostpubkey_gen
Browse files Browse the repository at this point in the history
  • Loading branch information
real-or-random committed Oct 1, 2024
1 parent 4617da4 commit 27386c1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,15 @@ def hostpubkey_gen(hostseckey: bytes) -> bytes

Compute the participant's host public key from the host secret key.

This is the long-term cryptographic identity of the participant.
The host public key is the long-term cryptographic identity of the
participant.

This function interprets `hostseckey` as big-endian integer, and computes
the corresponding "plain" public key in compressed serialization (33 bytes,
starting with 0x02 or 0x03). This is the key generation procedure
traditionally used in Bitcoin, e.g., for ECDSA. In other words, this
function is equivalent to `IndividualPubkey` as defined in [[BIP327](https://github.com/bitcoin/bips/blob/master/bip-0327.mediawiki#key-generation-of-an-individual-signer)].
TODO Refer to the FROST signing BIP instead, once that one has a number.

*Arguments*:

Expand All @@ -599,16 +607,16 @@ This is the long-term cryptographic identity of the participant.
successful participant in a session can be recovered from (a backup
of) the key and per-session recovery data.

The same secret key (and thus host public key) can be used in
multiple DKG sessions. A host public key can be correlated to the
threshold public key resulting from a DKG session only by parties
who observed the session, namely the participants, the coordinator
(and any eavesdropper).
The same host secret key (and thus the same host public key) can be
used in multiple DKG sessions. A host public key can be correlated
to the threshold public key resulting from a DKG session only by
parties who observed the session, namely the participants, the
coordinator (and any eavesdropper).


*Returns*:

The host public key.
The host public key (33 bytes).


*Raises*:
Expand Down
22 changes: 15 additions & 7 deletions python/chilldkg_ref/chilldkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,15 @@ def certeq_coordinator_step(sigs: List[bytes]) -> bytes:
def hostpubkey_gen(hostseckey: bytes) -> bytes:
"""Compute the participant's host public key from the host secret key.
This is the long-term cryptographic identity of the participant.
The host public key is the long-term cryptographic identity of the
participant.
This function interprets `hostseckey` as big-endian integer, and computes
the corresponding "plain" public key in compressed serialization (33 bytes,
starting with 0x02 or 0x03). This is the key generation procedure
traditionally used in Bitcoin, e.g., for ECDSA. In other words, this
function is equivalent to `IndividualPubkey` as defined in [[BIP327](https://github.com/bitcoin/bips/blob/master/bip-0327.mediawiki#key-generation-of-an-individual-signer)].
TODO Refer to the FROST signing BIP instead, once that one has a number.
Arguments:
hostseckey: This participant's long-term secret key (32 bytes).
Expand All @@ -135,14 +143,14 @@ def hostpubkey_gen(hostseckey: bytes) -> bytes:
successful participant in a session can be recovered from (a backup
of) the key and per-session recovery data.
The same secret key (and thus host public key) can be used in
multiple DKG sessions. A host public key can be correlated to the
threshold public key resulting from a DKG session only by parties
who observed the session, namely the participants, the coordinator
(and any eavesdropper).
The same host secret key (and thus the same host public key) can be
used in multiple DKG sessions. A host public key can be correlated
to the threshold public key resulting from a DKG session only by
parties who observed the session, namely the participants, the
coordinator (and any eavesdropper).
Returns:
The host public key.
The host public key (33 bytes).
Raises:
SecretKeyError: If the length of `hostseckey` is not 32 bytes.
Expand Down

0 comments on commit 27386c1

Please sign in to comment.