Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature value helpers #27

Merged
merged 4 commits into from Oct 20, 2023
Merged

Signature value helpers #27

merged 4 commits into from Oct 20, 2023

Conversation

jagerman
Copy link
Member

Adds helpers to make it easier to add a signature over previous values in a list/dict.

  • producer append_signature takes a callback that works out the value to be signed then calls a callback to make the signature and appends that as a string.
    • for a list, this is a signature over the l and the previous values
    • for a dict, this is a signature over the d and the previous string/value pairs
  • consumer consume_signature (and require_signature) do the opposite: the parse the current value as a string, work out what the signed portion of the parsed string should be, then calls the callback to verify them.
    • consumer next_signature returns a 3-tuple (key, msg, sig).

This is already being done (manually) in libsession-util; lokinet will also make use of this.

It seemed oddly positioned in the middle of consume_* functions.
This doesn't appear to have ever been used.  It's also not something we
really want to expose; the internal string_view is meant to be a private
implementation detail of the consumer.
Lokinet and libsession-util are each manually dealing with adding a
signature value; this makes it easier by moving the logic for what/how
to sign into bt_producer.
This is the counterpart to bt_*_producer's `append_signature` that aids
in verifying the correct signing value as added by append_signature.
@jagerman jagerman merged commit a7de637 into oxen-io:dev Oct 20, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants