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

Libquic integration #83

Open
wants to merge 283 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
283 commits
Select commit Hold shift + click to select a range
43eae3a
Add some linux builds; fix bionic
jagerman Apr 9, 2024
11a0804
drone job name lipstick
jagerman Apr 9, 2024
1683e58
bullseye backports
jagerman Apr 9, 2024
94fa3ad
Add ngtcp2 CI dep
jagerman Apr 9, 2024
f23bf01
make oxen repo default
jagerman Apr 9, 2024
3c7a9f1
fix libngtcp2-dev package name and depend on crypto package
jagerman Apr 9, 2024
019c1e9
Add test image deps
jagerman Apr 10, 2024
d7ac1e2
more dep fixing
jagerman Apr 10, 2024
3549438
libquic bump
jagerman Apr 10, 2024
3aea8a5
Remove bionic; disable win-x86
jagerman Apr 10, 2024
6c78690
libquic bump
jagerman Apr 10, 2024
ffe6211
use CHECK(thing) and CHECK_FALSE(thing) instead of == true/false
jagerman Apr 10, 2024
13b6731
libquic bump
jagerman Apr 10, 2024
e734a5c
Reworked network to be instance-based
mpretty-cyro Apr 12, 2024
d523633
Merge branch 'more-libquic' into libquic
mpretty-cyro Apr 12, 2024
1c4667b
Added a function to replace the secret key used for the network
mpretty-cyro Apr 12, 2024
7651967
Fixed up lambda variable capture, ip formatting
mpretty-cyro Apr 15, 2024
2bf8291
Updated to the latest stable libQuic commit
mpretty-cyro Apr 15, 2024
d598b2e
Ran the formatter and fixed a weird namespace mistake
mpretty-cyro Apr 15, 2024
0829d2b
Switch to libquic `stable` branch && bump required system lib version
jagerman Apr 15, 2024
3aa5385
Fix oxen::logging dependencies
jagerman Apr 15, 2024
b065609
Remove duplicate Windows build
jagerman Apr 15, 2024
3358960
Removed backported starts_with and ends_with
mpretty-cyro Apr 17, 2024
d61746d
Implemented the snode pool cache logic, PR comments
mpretty-cyro Apr 23, 2024
e3bfd89
Resolved remaining PR comments and minor tweaks
mpretty-cyro Apr 24, 2024
cc2d8fc
Used 'RemoteAddress' instead of a custom service_node
mpretty-cyro Apr 26, 2024
587588e
Ran the formatter and fixed some CI build errors
mpretty-cyro Apr 26, 2024
aee7ea6
Fixed more CI warnings
mpretty-cyro Apr 26, 2024
f76bc9e
More tweaks to resolve CI errors (warnings)
mpretty-cyro Apr 28, 2024
5dbf1ac
Further tweaks for CI errors
mpretty-cyro Apr 28, 2024
efb5263
Additional tweaks for CI warnings
mpretty-cyro Apr 28, 2024
6d54d8d
Missed the 'snode destination' onion request call in the previous commit
mpretty-cyro Apr 28, 2024
fdc2a1f
Pointing at the latest dev libQuic
mpretty-cyro Apr 29, 2024
0ae1c77
Reverted to a previous `dev` commit
mpretty-cyro Apr 29, 2024
6c86cc0
Added a function to retrieve the current old hashes without pushing
mpretty-cyro Apr 29, 2024
aae9ab6
Use oxen-encoding via libquic
jagerman Apr 30, 2024
67eb146
oxenc 1.1.0 compatibility
jagerman Apr 30, 2024
dad4311
Tweaked 'with_path' behaviour, added ability to reset/create endpoint
mpretty-cyro May 1, 2024
c7c68fb
Fixed the get_endpoint and paths changed callback memory
mpretty-cyro May 2, 2024
6dc24d2
Ran the formatter
mpretty-cyro May 2, 2024
e49e379
Fixed a build error
mpretty-cyro May 2, 2024
0bacafa
Fixed more issues found by the CI
mpretty-cyro May 2, 2024
31bf2ba
Ran the linter, bubble up path building errors
mpretty-cyro May 2, 2024
4494ebe
Bubble up snode pool errors
mpretty-cyro May 2, 2024
56e75ac
Tweaks to try and fix the CI test failures
mpretty-cyro May 2, 2024
0b6400d
remove comment for removed argument
jagerman May 7, 2024
c75357d
Replace callback logger; de-header oxen-logging and spdlog
jagerman May 7, 2024
e3a824e
Mildly simplify hash() implementation
jagerman May 7, 2024
c0cd3ee
Renamed the C API for the logger functions, fixed build errors
mpretty-cyro May 8, 2024
6c4ea3c
Fixed an issue where the network status wouldn't get updated in some …
mpretty-cyro May 8, 2024
4636134
logging: add level controls; add tests
jagerman May 8, 2024
a97e510
C network API doc tweaks & typedef
jagerman May 8, 2024
5f24da2
Remove unneeded specific values
jagerman May 8, 2024
64e996d
Re-join disk writing thread during destruction
jagerman May 8, 2024
99dab99
`#include` cleanups
jagerman May 8, 2024
b41b469
Minor API doc wording tweaks
jagerman May 8, 2024
5578583
Replace crappy config logger with oxen-logging
jagerman May 8, 2024
8d3adff
Change unmerged_index() to optional<size_t>
jagerman May 8, 2024
afa6d75
Fix flakey oxen-logging source dir stripping
jagerman May 9, 2024
9439323
Add fix for test case premature timeout
jagerman May 9, 2024
a8012aa
Use libquic's (relatively new) string_view-accepting opt::alpns
jagerman May 9, 2024
c8f0c83
More input validity checks
jagerman May 9, 2024
0a70ba1
Drop `oxen::` prefix from various things
jagerman May 9, 2024
5492941
Remove custom comparison for Address compare
jagerman May 9, 2024
091b58f
PR comments and logger testing
mpretty-cyro May 9, 2024
4e4b399
Unbreak compilation
jagerman May 9, 2024
9d001e9
Add missing test file
jagerman May 9, 2024
6744a7d
Added a function to manually trigger a log for debugging purposes
mpretty-cyro May 9, 2024
269126e
Split out sodium utils into a dedicated header
jagerman May 9, 2024
1784e0d
Add file helpers; push more std::filesystem::path
jagerman May 9, 2024
610965b
Build fix
mpretty-cyro May 10, 2024
ac50ef4
Fixed an issue when merging the current config into itself
mpretty-cyro May 10, 2024
469a72c
Ran formatter, catch exceptions thrown when loading cache, disable 'o…
mpretty-cyro May 10, 2024
60b3021
Combined the snode_pool and build_paths loopers
mpretty-cyro May 10, 2024
f4bca74
Combined the path building and snode pool logic
mpretty-cyro May 10, 2024
163a2fe
Set badbits but not failbit after opening
jagerman May 10, 2024
6e89b4b
Bump to latest libquic & oxen-logging
jagerman May 10, 2024
0dea82b
Add hack to hide broken log path with xcode 15
jagerman May 10, 2024
b36c727
Fix Loop variable initialization
jagerman May 10, 2024
ebb6188
Updated the unit tests for Apple builds (file path differs)
mpretty-cyro May 12, 2024
6695f83
Silly autocomplete mistake
mpretty-cyro May 12, 2024
a335598
Testing debian test failure 1
mpretty-cyro May 13, 2024
0c30c54
Testing debian test failure 2
mpretty-cyro May 13, 2024
3eeb56d
Testing debian test failure 3
mpretty-cyro May 13, 2024
a92f800
Testing debian test failure 4
mpretty-cyro May 13, 2024
9bf1ff6
Testing debian test failure 5
mpretty-cyro May 13, 2024
6992d1f
Testing debian test failure 6
mpretty-cyro May 13, 2024
d083294
Testing debian test failure 7
mpretty-cyro May 13, 2024
49a76c7
Testing debian test failure 8
mpretty-cyro May 13, 2024
5605edc
Ensured network status changes run in the network looper
mpretty-cyro May 13, 2024
9961c01
Testing debian test failure 9
mpretty-cyro May 13, 2024
845134d
Testing debian test failure 10
mpretty-cyro May 13, 2024
39ecc58
Testing debian test failure 11
mpretty-cyro May 13, 2024
f92caaa
Testing debian test failure 12 (Try std::moving `info` everywhere)
mpretty-cyro May 13, 2024
052c593
Reverted the previous change, added check to fix logging test
mpretty-cyro May 13, 2024
d252eef
Added a preprocessor macro to identify the release build for tests
mpretty-cyro May 13, 2024
ad21e73
Another tweak to logging test
mpretty-cyro May 13, 2024
d113e77
Made a number of changes based on iOS crash logs
mpretty-cyro May 22, 2024
b66e54b
Removed a couple of debug logs
mpretty-cyro May 23, 2024
d0b03ec
Made a few changes to fix some race conditions in network recovery
mpretty-cyro May 31, 2024
8b4477a
Wrapped a few throwing functions in try/catches in the C API
mpretty-cyro Jun 1, 2024
a391147
Fixing CI errors
mpretty-cyro Jun 2, 2024
a734015
Updated the C API config error handling logic
mpretty-cyro Jun 3, 2024
ea1b1df
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Jun 3, 2024
b20b0ff
Updated get_connection_info vars to be shared_ptrs to prevent bg crash
mpretty-cyro Jun 3, 2024
0c4d178
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Jun 3, 2024
70a39f6
Updated to the latest libQuic
mpretty-cyro Jun 5, 2024
7023026
Added separate paths for uploading/downloading files, fixed a few bugs
mpretty-cyro Jun 7, 2024
68d732a
Fixed bugs which recovering connections and error handling
mpretty-cyro Jun 11, 2024
714230c
Fixed the broken tests
mpretty-cyro Jun 11, 2024
d219096
Looking to fix CI errors
mpretty-cyro Jun 12, 2024
9a867d5
A couple more bug fixes and added auth for versioning API call
mpretty-cyro Jun 17, 2024
fdfd9db
Added a bunch of trace logs to help better debug network issues
mpretty-cyro Jun 18, 2024
c61333f
Added back the 'ENABLE_ONIONREQ' flag
mpretty-cyro Jun 24, 2024
c9a98db
Fixed an issue where bad nodes might not get dropped in some cases
mpretty-cyro Jun 24, 2024
d4b2c66
Merge remote-tracking branch 'origin/dev' into libquic
Bilb Jun 27, 2024
3ad5920
Removed the path "recovery" logic (just rebuild instead)
mpretty-cyro Jun 28, 2024
dfcd3ae
Reverted the removal of the path "recovery" logic
mpretty-cyro Jul 1, 2024
18e7fb8
fix build
Bilb Jun 27, 2024
cffdbde
fix: dirty fix TO BE REMOVED to make needs_dump true when need to dump
Bilb Jul 4, 2024
c0cf732
Wrapped a few more functions in the exception wrapper
mpretty-cyro Jul 5, 2024
2163461
Added custom handling for a HTML 400 error
mpretty-cyro Jul 15, 2024
449c86d
Optimisations to the path building logic
mpretty-cyro Jul 17, 2024
8d944ab
Delete C++ object in network_free
jagerman Jul 17, 2024
c829255
Fixed an issue in the C++ to C conversion of a service node
mpretty-cyro Jul 19, 2024
13c2f35
Added a version check for the final path node and a couple other fixes
mpretty-cyro Jul 23, 2024
38c9fad
Merge remote-tracking branch 'origin/prioritise-updated-final-node' i…
mpretty-cyro Jul 26, 2024
7f5e302
Fixed a bug with the version check API auth generation
mpretty-cyro Jul 26, 2024
94cf7e3
Merge pull request #1 from Bilb/fix/build-without-onionreq
mpretty-cyro Jul 26, 2024
38c55de
Additional invite/promotion state and missing C functions
mpretty-cyro Jul 17, 2024
06c4709
Renamed a couple of functions, updated docs, fixed 'promotion_x' funcs
mpretty-cyro Jul 17, 2024
64fa7fa
Fix C free functions
jagerman Jul 17, 2024
ad32b75
Small docs change
mpretty-cyro Jul 17, 2024
b5b06b9
Ran the formatter -_-
mpretty-cyro Jul 18, 2024
a05a5be
Added 'set_{x}_truncated' functions so clients have non-throwing vers…
mpretty-cyro Jul 4, 2024
caab7a8
Ran the formatter
mpretty-cyro Jul 5, 2024
e956d9d
Added a utf8_truncate function and use it when truncating user content
mpretty-cyro Jul 17, 2024
a15533e
Added some tests for the new utf8 truncation logic
mpretty-cyro Jul 18, 2024
d3a2eca
feat: moved community url max length and qs_pubkey to cpp header
yougotwill Jul 24, 2024
94d53ba
allow protobuf to come from the system lib
jagerman Jul 25, 2024
84f258b
Added missing headers
mpretty-cyro Jun 17, 2024
7e20d43
Added new sodium_array header changes
mpretty-cyro Jun 17, 2024
7664449
Addressed PR comments
mpretty-cyro Jul 23, 2024
6a6c9d8
Added a missing import
mpretty-cyro Jul 24, 2024
e452022
Updated the docs to be correct, and explicit about a unix timestamp
mpretty-cyro Jul 24, 2024
659b408
Avoid reuse of cleared_uc64 data
jagerman Jul 25, 2024
9d1b1f7
Fixed a few issues resulting from merges
mpretty-cyro Jul 26, 2024
d6147ef
Fixed merge bug, removed extra timeout threshold, needs_dump fix
mpretty-cyro Jul 27, 2024
23c943d
Fixed a few bugs
mpretty-cyro Jul 31, 2024
59a4de4
Compilation error/warning fixes
jagerman Aug 2, 2024
f0016f5
Removed some duplicate code
mpretty-cyro Aug 2, 2024
0f79e97
Removed the 'paths_and_pool_loop' and refactored the path build logic
mpretty-cyro Aug 6, 2024
bf0076d
PR feedback tweaks round 1
mpretty-cyro Aug 6, 2024
bdbdb17
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Aug 6, 2024
367ab1f
Attempt to fix a couple of CI build issues
mpretty-cyro Aug 6, 2024
7467ee0
Fixed another CI error
mpretty-cyro Aug 6, 2024
bd1ecec
Added a bunch of network unit tests, fixed some warnings
mpretty-cyro Aug 7, 2024
638616d
Fixed one of the broken tests
mpretty-cyro Aug 7, 2024
b368c47
Drop 'not found' nodes immediately, additional PR feedback tweaks
mpretty-cyro Aug 8, 2024
2966cc3
Split the resume_queues function and fixed broken tests
mpretty-cyro Aug 13, 2024
bdfa6fd
Updated libquic submodule
mpretty-cyro Aug 13, 2024
fd218a9
Fixed a bug and the broken tests
mpretty-cyro Aug 14, 2024
3650fdc
Fixed a couple of bugs
mpretty-cyro Aug 15, 2024
1967646
Fixed a build error
mpretty-cyro Aug 15, 2024
ecba02b
Fixed a few bugs found when testing
mpretty-cyro Aug 15, 2024
cc539e3
Updated decrypt_ons_response to support decrypting legacy ONS values
mpretty-cyro Aug 19, 2024
116256a
Merge remote-tracking branch 'origin/fix/add-legacy-ons-decryption' i…
mpretty-cyro Aug 19, 2024
3e584f8
Updated logic to keep dropped paths around until their requests finish
mpretty-cyro Aug 20, 2024
0ce9762
Fixed a bug with the C API ONS lookup function
mpretty-cyro Aug 21, 2024
de6f226
Merge remote-tracking branch 'origin/fix/add-legacy-ons-decryption' i…
mpretty-cyro Aug 21, 2024
8c3bd7e
Ran formatter, fixed array size issue
mpretty-cyro Aug 21, 2024
3798669
Merge remote-tracking branch 'origin/fix/add-legacy-ons-decryption' i…
mpretty-cyro Aug 21, 2024
faec15a
Fixed issue breaking tests when testnet is busted, fixed some CI warn…
mpretty-cyro Aug 21, 2024
ba7919d
Exposes functions to clear the oxen::log sinks
mpretty-cyro Aug 21, 2024
af0ab99
Updated the docs for legacy group decrypt function to reduce misuse
mpretty-cyro Aug 23, 2024
2bf8c81
Reverted 64-byte legacy group secret key decryption (only need 32 bytes)
mpretty-cyro Aug 27, 2024
de7d8a6
Fixed an incorrect size for the curve25519 secret key
mpretty-cyro Aug 29, 2024
12df14a
Updated libQuic and cleaned up 'wrap_exceptions' usage
mpretty-cyro Sep 4, 2024
e1a76eb
Added a function to compute a message hash
mpretty-cyro Sep 5, 2024
ac34aa2
Added code to calculate swarms locally instead of fetching
mpretty-cyro Sep 6, 2024
c3aa3b9
Added a timeout mechanism which takes the path build time into account
mpretty-cyro Sep 6, 2024
1d20f5e
Improvements to attachment upload/download behaviours
mpretty-cyro Sep 6, 2024
789f9f6
Expose response headers in network request functions
mpretty-cyro Sep 9, 2024
1188aaf
Tweaks to try to fix CI errors
mpretty-cyro Sep 9, 2024
2f81c69
Another tweak for CI errors
mpretty-cyro Sep 9, 2024
6bc86ad
Further tweaks to make CI happy
mpretty-cyro Sep 9, 2024
6a1ab51
More CI platform specific tweaks
mpretty-cyro Sep 9, 2024
12ed513
Another tweak for CI test build issues
mpretty-cyro Sep 9, 2024
f3f273c
Fixed a cache refresh bug, logging tweaks, CI build tweaks
mpretty-cyro Sep 10, 2024
c057cd9
Fixed a bug with onion_path pending requests func and logging tweaks
mpretty-cyro Sep 12, 2024
f19df11
Reverted change causing test crashes on CI, tweak for 32-bit CI error
mpretty-cyro Sep 12, 2024
776bac0
Fixed up the iOS build script
mpretty-cyro Sep 20, 2024
e0316db
Merge branch 'fix/group-member-status-bug' into libquic
mpretty-cyro Oct 2, 2024
10f15ae
Added a function to retrieve the current snode cache size
mpretty-cyro Oct 7, 2024
5ce7e4d
Add blind version signing for a generic request
Aerilym Oct 24, 2024
3a4eb57
Change body hash to body
Aerilym Oct 24, 2024
7f5faca
Create headers for blind version signing
Aerilym Oct 28, 2024
e73c72a
blind_version_sign_request C API and CPP test
tewinget Oct 28, 2024
01b97f7
more correct string reserve, also lint
tewinget Oct 29, 2024
5685948
use string_view instead of ustring_view where reasonable
tewinget Oct 31, 2024
a5ea057
size_t -> uint64_t in C API in a couple places (timestamp)
tewinget Oct 31, 2024
2593214
feat: add is_destroyed flag to UserGroupsConfig
Bilb Nov 6, 2024
82526fc
fix: merge kicked & destroyed group status into removed_status
Bilb Nov 7, 2024
278183d
Merge pull request #1 from Bilb/feat/destroy-flag-on-usergroup
Bilb Nov 12, 2024
c422ccb
chore: fix comment for blind_version_key_pair returning a seed
Bilb Nov 15, 2024
48f769e
Make windows-x86 static "allow fail"
jagerman Nov 15, 2024
0f86849
Merge pull request #4 from Aerilym/blind_version_sign_request
jagerman Nov 15, 2024
43c2d44
chore: replace oxen-io urls with session-foundation
Bilb Nov 13, 2024
c29c934
Merge pull request #2 from Bilb/move-to-session-foundation
Bilb Nov 17, 2024
06fe06e
Consolidated the group member status read funcs into an enum
mpretty-cyro Nov 22, 2024
cd5bc85
Fixed a couple of typos
mpretty-cyro Nov 22, 2024
bc0a2a6
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Nov 22, 2024
010c4c5
Fixed some inconsistently naming, added C API group_member_status
mpretty-cyro Nov 25, 2024
a651590
Fixed another silly typo
mpretty-cyro Nov 25, 2024
c679fbf
Merge pull request #5 from mpretty-cyro/feature/consolidated_group_me…
mpretty-cyro Nov 25, 2024
4f5a4a8
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Nov 25, 2024
1cac850
fix: member::status() can be marked as const
Bilb Nov 25, 2024
1ed9170
Merge pull request #7 from Bilb/fix-status-is-const
jagerman Nov 25, 2024
c1c915e
Added a missing C func
mpretty-cyro Nov 26, 2024
f87d88b
Added a couple missing function definitions to a C header
mpretty-cyro Nov 26, 2024
fcbe015
Merge pull request #8 from mpretty-cyro/fix/add-missing-c-func
Bilb Nov 26, 2024
5058514
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Nov 26, 2024
0e9f301
Split set_invited func, renamed some constants, renamed some functions
mpretty-cyro Nov 28, 2024
a37b19d
Update include/session/config/groups/members.hpp
mpretty-cyro Nov 28, 2024
43b1c6c
Merge pull request #10 from mpretty-cyro/group-function-standardisation
mpretty-cyro Nov 28, 2024
106c12d
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Dec 10, 2024
c79507d
Initial version of the `local_pending_send` flag
mpretty-cyro Dec 11, 2024
0047e1b
extra_data: use dict producer/consumer
jagerman Dec 11, 2024
d7abf75
Addressed code feedback
mpretty-cyro Dec 11, 2024
aa0f75b
Fixed a couple of build issues
mpretty-cyro Dec 11, 2024
a252c7e
Further tweaks for CI errors
mpretty-cyro Dec 11, 2024
3298310
Added the C header changes I had missed
mpretty-cyro Dec 11, 2024
e34519d
Yet another change I missed bringing across
mpretty-cyro Dec 11, 2024
fef8e3d
Function change for CI error
mpretty-cyro Dec 11, 2024
894ca52
Fixed some broken tests, fixed a bug with erasing a member
mpretty-cyro Dec 12, 2024
f11f1ba
Add two-step ConfigBase init via default-ctor+init()
jagerman Dec 16, 2024
b7427ae
use single letter for keys dump()
Bilb Dec 17, 2024
a4ac5db
add pending_state get/set and fix unit tests
Bilb Dec 17, 2024
f10026f
set_pending_send marks config as needing dump on change
Bilb Dec 17, 2024
f12b91b
Merge pull request #3 from Bilb/feature/local_members_sending_state
mpretty-cyro Dec 17, 2024
774985d
Merge remote-tracking branch 'origin/feature/local_members_sending_st…
mpretty-cyro Dec 17, 2024
5049cb0
chore: fixed some typo
Bilb Dec 19, 2024
8ab2cc3
chore: run ./utils/format.sh
Bilb Dec 19, 2024
5806b91
Merge pull request #12 from mpretty-cyro/feature/local_members_sendin…
stfsession Dec 19, 2024
7dfe790
feat: allow to mark a member invite state as not sent
Bilb Dec 19, 2024
3959cd3
Merge pull request #16 from Bilb/allow-mark-not-sent
stfsession Dec 19, 2024
3ee3db8
Added C API for new `set_invite_not_sent` function
mpretty-cyro Jan 5, 2025
b1bd153
Merge pull request #18 from mpretty-cyro/fix/add-missing-c-api
stfsession Jan 6, 2025
ce94486
Merge remote-tracking branch 'upstream/dev' into libquic
mpretty-cyro Jan 6, 2025
bf7c010
Fixed an incorrect variable
mpretty-cyro Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SpacesInAngles: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: c++17
Standard: c++20
UseTab: Never
SortIncludes: true
ColumnLimit: 100
Expand Down
7 changes: 6 additions & 1 deletion .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local submodules = {

local apt_get_quiet = 'apt-get -o=Dpkg::Use-Pty=0 -q';

local libngtcp2_deps = ['libgnutls28-dev', 'libprotobuf-dev'];
local libngtcp2_deps = ['libgnutls28-dev', 'libprotobuf-dev', 'libngtcp2-dev', 'libngtcp2-crypto-gnutls-dev'];

local default_deps_nocxx = [
'nlohmann-json3-dev',
Expand Down Expand Up @@ -276,13 +276,15 @@ local static_build(name,
oxen_repo=false,
kitware_repo=''/* ubuntu codename, if wanted */,
cmake_extra='',
allow_fail=false,
jobs=6)
= debian_pipeline(
name,
image,
arch=arch,
deps=deps,
oxen_repo=oxen_repo,
allow_fail=allow_fail,
build=[
'export JOBS=' + jobs,
'./utils/static-bundle.sh build ' + archive_name + ' -DSTATIC_LIBSTD=ON ' + cmake_extra,
Expand Down Expand Up @@ -362,11 +364,14 @@ local static_build(name,
'libsession-util-windows-x64-TAG.zip',
deps=['g++-mingw-w64-x86-64-posix'],
cmake_extra='-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-x86-64-toolchain.cmake'),
/* currently broken:
static_build('Static Windows x86',
docker_base + 'debian-win32-cross',
'libsession-util-windows-x86-TAG.zip',
deps=['g++-mingw-w64-i686-posix'],
allow_fail=true,
cmake_extra='-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-i686-toolchain.cmake'),
*/
debian_pipeline(
'Static Android',
docker_base + 'android',
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/build*/
/compile_commands.json
/.cache/
/.vscode/
/.vscode/
.DS_STORE
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "external/oxen-encoding"]
path = external/oxen-encoding
url = https://github.com/oxen-io/oxen-encoding.git
[submodule "external/libsodium-internal"]
path = external/libsodium-internal
url = https://github.com/jagerman/libsodium-internal.git
url = https://github.com/session-foundation/libsodium-internal.git
[submodule "tests/Catch2"]
path = tests/Catch2
url = https://github.com/catchorg/Catch2
Expand All @@ -16,6 +13,9 @@
[submodule "external/nlohmann-json"]
path = external/nlohmann-json
url = https://github.com/nlohmann/json.git
[submodule "external/oxen-libquic"]
path = external/oxen-libquic
url = https://github.com/oxen-io/oxen-libquic.git
[submodule "external/protobuf"]
path = external/protobuf
url = https://github.com/protocolbuffers/protobuf.git
22 changes: 18 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14...3.23)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Has to be set before `project()`, and ignored on non-macos:
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "macOS deployment target (Apple clang only)")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15 CACHE STRING "macOS deployment target (Apple clang only)")

set(LANGS C CXX)
find_program(CCACHE_PROGRAM ccache)
Expand All @@ -16,7 +16,6 @@ if(CCACHE_PROGRAM)
endforeach()
endif()


project(libsession-util
VERSION 1.2.0
DESCRIPTION "Session client utility library"
Expand All @@ -41,7 +40,7 @@ else()
endif()


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down Expand Up @@ -81,7 +80,7 @@ option(STATIC_LIBSTD "Statically link libstdc++/libgcc" ${default_static_libstd}

option(USE_LTO "Use Link-Time Optimization" ${use_lto_default})

# Provide this as an option for now because GMP and iOS are sometimes unhappy with each other.
# Provide this as an option for now because GMP and Desktop are sometimes unhappy with each other.
option(ENABLE_ONIONREQ "Build with onion request functionality" ON)

if(USE_LTO)
Expand Down Expand Up @@ -118,6 +117,21 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)


add_subdirectory(external)

if(ENABLE_ONIONREQ)
if(NOT TARGET nettle::nettle)
if(BUILD_STATIC_DEPS)
message(FATAL_ERROR "Internal error: nettle::nettle target (expected via libquic BUILD_STATIC_DEPS) not found")
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(NETTLE REQUIRED IMPORTED_TARGET nettle)
add_library(nettle INTERFACE)
target_link_libraries(nettle INTERFACE PkgConfig::NETTLE)
add_library(nettle::nettle ALIAS nettle)
endif()
endif()
endif()

add_subdirectory(src)
add_subdirectory(proto)

Expand Down
28 changes: 25 additions & 3 deletions cmake/AddStaticBundleLib.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@

set(LIBSESSION_STATIC_BUNDLE_LIBS "" CACHE INTERNAL "list of libs to go into the static bundle lib")

function(_libsession_static_bundle_append tgt)
list(APPEND LIBSESSION_STATIC_BUNDLE_LIBS "${tgt}")
set(LIBSESSION_STATIC_BUNDLE_LIBS "${LIBSESSION_STATIC_BUNDLE_LIBS}" CACHE INTERNAL "")
endfunction()

# Call as:
#
# libsession_static_bundle(target [target2 ...])
#
# to append the given target(s) to the list of libraries that will be combined to make the static
# bundled libsession-util.a.
function(libsession_static_bundle)
list(APPEND LIBSESSION_STATIC_BUNDLE_LIBS "${ARGN}")
list(REMOVE_DUPLICATES LIBSESSION_STATIC_BUNDLE_LIBS)
set(LIBSESSION_STATIC_BUNDLE_LIBS "${LIBSESSION_STATIC_BUNDLE_LIBS}" CACHE INTERNAL "")
foreach(tgt IN LISTS ARGN)
if(TARGET "${tgt}" AND NOT "${tgt}" IN_LIST LIBSESSION_STATIC_BUNDLE_LIBS)
get_target_property(tgt_type ${tgt} TYPE)

if(tgt_type STREQUAL STATIC_LIBRARY)
message(STATUS "Adding ${tgt} to libsession-util bundled library list")
_libsession_static_bundle_append("${tgt}")
endif()

if(tgt_type STREQUAL INTERFACE_LIBRARY)
get_target_property(tgt_link_deps ${tgt} INTERFACE_LINK_LIBRARIES)
else()
get_target_property(tgt_link_deps ${tgt} LINK_LIBRARIES)
endif()

if(tgt_link_deps)
libsession_static_bundle(${tgt_link_deps})
endif()
endif()
endforeach()
endfunction()
41 changes: 0 additions & 41 deletions cmake/StaticBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@

set(LOCAL_MIRROR "" CACHE STRING "local mirror path/URL for lib downloads")

set(GMP_VERSION 6.3.0 CACHE STRING "gmp version")
set(GMP_MIRROR ${LOCAL_MIRROR} https://gmplib.org/download/gmp
CACHE STRING "gmp mirror(s)")
set(GMP_SOURCE gmp-${GMP_VERSION}.tar.xz)
set(GMP_HASH SHA512=e85a0dab5195889948a3462189f0e0598d331d3457612e2d3350799dba2e244316d256f8161df5219538eb003e4b5343f989aaa00f96321559063ed8c8f29fd2
CACHE STRING "gmp source hash")

set(NETTLE_VERSION 3.9.1 CACHE STRING "nettle version")
set(NETTLE_MIRROR ${LOCAL_MIRROR} https://ftp.gnu.org/gnu/nettle
CACHE STRING "nettle mirror(s)")
set(NETTLE_SOURCE nettle-${NETTLE_VERSION}.tar.gz)
set(NETTLE_HASH SHA512=5939c4b43cf9ff6c6272245b85f123c81f8f4e37089fa4f39a00a570016d837f6e706a33226e4bbfc531b02a55b2756ff312461225ed88de338a73069e031ced
CACHE STRING "nettle source hash")


include(ExternalProject)

set(DEPS_DESTDIR ${CMAKE_BINARY_DIR}/static-deps)
Expand Down Expand Up @@ -230,32 +215,6 @@ elseif(gmp_build_host STREQUAL "")
set(gmp_build_host "--build=${CMAKE_LIBRARY_ARCHITECTURE}")
endif()

if(ENABLE_ONIONREQ)
build_external(gmp
CONFIGURE_COMMAND ./configure ${gmp_build_host} --disable-shared --prefix=${DEPS_DESTDIR} --with-pic
"CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS}${apple_cflags_arch}" "CXXFLAGS=${deps_CXXFLAGS}${apple_cxxflags_arch}"
"LDFLAGS=${apple_ldflags_arch}" ${cross_rc} CC_FOR_BUILD=cc CPP_FOR_BUILD=cpp
)
add_static_target(gmp gmp_external libgmp.a)

build_external(nettle
CONFIGURE_COMMAND ./configure ${gmp_build_host} --disable-shared --prefix=${DEPS_DESTDIR} --libdir=${DEPS_DESTDIR}/lib
--with-pic --disable-openssl
"CC=${deps_cc}" "CXX=${deps_cxx}"
"CFLAGS=${deps_CFLAGS}${apple_cflags_arch}" "CXXFLAGS=${deps_CXXFLAGS}${apple_cxxflags_arch}"
"CPPFLAGS=-I${DEPS_DESTDIR}/include"
"LDFLAGS=-L${DEPS_DESTDIR}/lib${apple_ldflags_arch}"

DEPENDS gmp_external
BUILD_BYPRODUCTS
${DEPS_DESTDIR}/lib/libnettle.a
${DEPS_DESTDIR}/lib/libhogweed.a
${DEPS_DESTDIR}/include/nettle/version.h
)
add_static_target(nettle nettle_external libnettle.a gmp)
add_static_target(hogweed nettle_external libhogweed.a nettle)
endif()

link_libraries(-static-libstdc++)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
link_libraries(-static-libgcc)
Expand Down
2 changes: 1 addition & 1 deletion docs/api/make-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if (m{^\s*<script>\s*$} .. m{^\s*</script>\s*$}) {
<script>
window.\$docsify = {
name: "Libsession Utils API",
repo: "https://github.com/oxen-io/libsession-util",
repo: "https://github.com/session-foundation/libsession-util",
loadSidebar: "sidebar.md",
subMaxLevel: 2,
homepage: "index.md",
Expand Down
41 changes: 31 additions & 10 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(SUBMODULE_CHECK)
message(STATUS "Checking submodules")
check_submodule(ios-cmake)
check_submodule(libsodium-internal)
check_submodule(oxen-encoding)
check_submodule(oxen-libquic external/oxen-logging external/oxen-encoding)
check_submodule(nlohmann-json)
check_submodule(zstd)
check_submodule(protobuf)
Expand All @@ -37,7 +37,7 @@ if(NOT BUILD_STATIC_DEPS AND NOT FORCE_ALL_SUBMODULES)
find_package(PkgConfig REQUIRED)
endif()

macro(system_or_submodule BIGNAME smallname pkgconf subdir)
macro(libsession_system_or_submodule BIGNAME smallname pkgconf subdir)
option(FORCE_${BIGNAME}_SUBMODULE "force using ${smallname} submodule" OFF)
if(NOT BUILD_STATIC_DEPS AND NOT FORCE_${BIGNAME}_SUBMODULE AND NOT FORCE_ALL_SUBMODULES)
pkg_check_modules(${BIGNAME} ${pkgconf} IMPORTED_TARGET GLOBAL)
Expand All @@ -57,6 +57,9 @@ macro(system_or_submodule BIGNAME smallname pkgconf subdir)
if(TARGET ${smallname} AND NOT TARGET ${smallname}::${smallname})
add_library(${smallname}::${smallname} ALIAS ${smallname})
endif()
if(BUILD_STATIC_DEPS AND STATIC_BUNDLE)
libsession_static_bundle(${smallname}::${smallname})
endif()
endmacro()


Expand All @@ -65,11 +68,6 @@ set(cross_host "")
set(cross_rc "")
if(CMAKE_CROSSCOMPILING)
if(APPLE_TARGET_TRIPLE)
if(PLATFORM MATCHES "OS64" OR PLATFORM MATCHES "SIMULATORARM64")
set(APPLE_TARGET_TRIPLE aarch64-apple-ios)
elseif(PLATFORM MATCHES "SIMULATOR64")
set(APPLE_TARGET_TRIPLE x86_64-apple-ios)
endif()
set(cross_host "--host=${APPLE_TARGET_TRIPLE}")
elseif(ANDROID)
if(CMAKE_ANDROID_ARCH_ABI MATCHES x86_64)
Expand Down Expand Up @@ -102,8 +100,31 @@ if(CMAKE_CROSSCOMPILING)
endif()
endif()

set(LIBQUIC_BUILD_TESTS OFF CACHE BOOL "")
if(ENABLE_ONIONREQ)
libsession_system_or_submodule(OXENQUIC quic liboxenquic>=1.1.0 oxen-libquic)
endif()

if(NOT TARGET oxenc::oxenc)
# The oxenc target will already exist if we load libquic above via submodule
set(OXENC_BUILD_TESTS OFF CACHE BOOL "")
set(OXENC_BUILD_DOCS OFF CACHE BOOL "")
libsession_system_or_submodule(OXENC oxenc liboxenc>=1.1.0 oxen-libquic/external/oxen-encoding)
endif()

system_or_submodule(OXENC oxenc liboxenc>=1.0.10 oxen-encoding)
if(NOT TARGET oxen::logging)
add_subdirectory(oxen-libquic/external/oxen-logging)
endif()

oxen_logging_add_source_dir("${PROJECT_SOURCE_DIR}")

# Apple xcode 15 has a completely broken std::source_location; we can't fix it, but at least we can
# hack up the source locations to hide the path that it uses (which is the useless path to
# oxen/log.hpp where the info/critical/etc. bodies are).
if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL AppleClang AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)
message(WARNING "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is broken: filenames in logging statements will not display properly")
oxen_logging_add_source_dir("${CMAKE_CURRENT_SOURCE_DIR}/oxen-libquic/external/oxen-logging/include/oxen")
endif()


if(CMAKE_C_COMPILER_LAUNCHER)
Expand Down Expand Up @@ -143,7 +164,7 @@ set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(protobuf_ABSL_PROVIDER "module" CACHE STRING "" FORCE)
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "")
set(protobuf_BUILD_PROTOBUF_BINARIES ON CACHE BOOL "" FORCE)
system_or_submodule(PROTOBUF_LITE protobuf_lite protobuf-lite>=3.21 protobuf)
libsession_system_or_submodule(PROTOBUF_LITE protobuf_lite protobuf-lite>=3.21 protobuf)
if(TARGET PkgConfig::PROTOBUF_LITE AND NOT TARGET protobuf::libprotobuf-lite)
add_library(protobuf::libprotobuf-lite ALIAS PkgConfig::PROTOBUF_LITE)
endif()
Expand Down Expand Up @@ -172,4 +193,4 @@ libsession_static_bundle(libzstd_static)

set(JSON_BuildTests OFF CACHE INTERNAL "")
set(JSON_Install ON CACHE INTERNAL "") # Required to export targets that we use
system_or_submodule(NLOHMANN nlohmann_json nlohmann_json>=3.7.0 nlohmann-json)
libsession_system_or_submodule(NLOHMANN nlohmann_json nlohmann_json>=3.7.0 nlohmann-json)
1 change: 0 additions & 1 deletion external/oxen-encoding
Submodule oxen-encoding deleted from a7de63
1 change: 1 addition & 0 deletions external/oxen-libquic
Submodule oxen-libquic added at 79d3f8
16 changes: 15 additions & 1 deletion include/session/blinding.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ LIBSESSION_EXPORT bool session_blind25_sign(
size_t msg_len,
unsigned char* blinded_sig_out /* 64 byte output buffer */);

/// Computes a verifiable version-blinded signature that validates with the version-blinded pubkey
/// that would be returned from blind_version_key_pair.
///
/// Takes the Ed25519 secret key (64 bytes), unix timestamp, method, path, and optional body.
/// Returns a version-blinded signature.
LIBSESSION_EXPORT bool session_blind_version_sign_request(
const unsigned char* ed25519_seckey, /* 64 bytes */
uint64_t timestamp,
const char* method,
const char* path,
const unsigned char* body, /* optional */
size_t body_len,
unsigned char* blinded_sig_out /* 64 byte output buffer */);

/// Computes a verifiable version-blinded signature that validates with the version-blinded pubkey
/// that would be returned from blind_version_key_pair.
///
Expand All @@ -121,7 +135,7 @@ LIBSESSION_EXPORT bool session_blind25_sign(
LIBSESSION_EXPORT bool session_blind_version_sign(
const unsigned char* ed25519_seckey, /* 64 bytes */
CLIENT_PLATFORM platform,
size_t timestamp,
uint64_t timestamp,
unsigned char* blinded_sig_out /* 64 byte output buffer */);

/// API: crypto/session_blind25_sign
Expand Down
16 changes: 15 additions & 1 deletion include/session/blinding.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <optional>
#include <string>
#include <string_view>

Expand Down Expand Up @@ -142,7 +143,7 @@ std::pair<uc32, cleared_uc32> blind25_key_pair(
/// Computes a version-blinded key pair.
///
/// Takes the Ed25519 secret key (64 bytes, or 32-byte seed). Returns the blinded public key and
/// private key (NOT a seed).
/// blinded libsodium seed value.
///
/// It is recommended to pass the full 64-byte libsodium-style secret key for `ed25519_sk` (i.e.
/// seed + appended pubkey) as with just the 32-byte seed the public key has to be recomputed.
Expand All @@ -168,6 +169,19 @@ ustring blind15_sign(ustring_view ed25519_sk, std::string_view server_pk_in, ust
/// seed + appended pubkey) as with just the 32-byte seed the public key has to be recomputed.
ustring blind25_sign(ustring_view ed25519_sk, std::string_view server_pk, ustring_view message);

/// Computes a verifiable version-blinded signature that validates with the version-blinded pubkey
/// that would be returned from blind_version_key_pair.
///
/// Takes the Ed25519 secret key (64 bytes, or 32-byte seed), unix timestamp, method, path, and
/// optional body.
/// Returns the version-blinded signature.
ustring blind_version_sign_request(
ustring_view ed25519_sk,
uint64_t timestamp,
std::string_view method,
std::string_view path,
std::optional<ustring_view> body);

/// Computes a verifiable version-blinded signature that validates with the version-blinded pubkey
/// that would be returned from blind_version_key_pair.
///
Expand Down
Loading