9 Commits

Author SHA1 Message Date
Boris Nagaev
87a9670bd3 l402: make TokenID.String() a value method
If a TokenID is passed by value to logging functions (such as the Printf family)
the pointer-based String() method is not used. As a result, the token is logged
as an array when using %v and as binary when using %s, which is inconvenient.
2025-05-10 23:22:03 -03:00
Elle Mouton
90941dc033 multi: update btclog, lnd and lndclient deps
Update the deps so that structured logging is available in aperture.
2025-03-05 11:12:29 +02:00
Elle Mouton
c4aa21f487 tools+golangci: update linter 2025-02-27 15:19:27 +02:00
Boris Nagaev
683093cf9e l402: migration of lsat.token* files
This is needed to preserve old identifiers of nodes that have ever paid
for a Loop or Pool token.
2024-04-23 09:27:49 -03:00
Boris Nagaev
94bd1924c0 l402: remove unnecessary regexp MatchString call
The same regexp is then used in a call of FindStringSubmatch method
and the outcome is the same, if nothing is found there.
2024-04-23 09:27:49 -03:00
Boris Nagaev
fb02e3f030 auth: send LSAT and L402 Authorization headers
Again, as with WWW-Authenticate header, existing aperture instances
expect LSAT, and the protocol defines it is L402, so send both, LSAT
first, to maintain backward compatibility.

The header "Authorization: LSAT..." can be removed in the future,
when all aperture instances are upgraded.
2024-04-23 09:27:49 -03:00
Boris Nagaev
709463fe5b proxy: LSAT and L402 WWW-Authenticate headers
Old clients expect "L402 macaroon=..." in the first WWW-Authenticate, while
the protocol [1] says it should be "WWW-Authenticate: L402 macaroon=...",
so send both LSAT and L402. LSAT must be sent first, to maintain backward
compatibility with older clients.

[1] https://github.com/lightninglabs/L402/blob/master/protocol-specification.md
2024-04-23 09:27:49 -03:00
Boris Nagaev
728707ba5c l402: use L402 sub system name in logs 2024-04-16 19:34:12 -03:00
Boris Nagaev
a4431801ef multi: replace LSAT with L402
auth: LsatAuthenticator -> L402Authenticator
sed -i 's/LsatAuthenticator/L402Authenticator/g' aperture.go auth/authenticator.go auth/authenticator_test.go

rename package lsat to l402
git mv lsat/ l402
sed 's@aperture/lsat@aperture/l402@g' -i `git grep -l aperture/lsat`
sed -i 's@package lsat@package l402@' `git grep -l 'package lsat'`
sed -i 's@lsat\.@l402.@g' -i `git grep -l 'lsat\.'`
sed 's@l402.Id@lsat.Id@' -i mint/mint_test.go

replace lsat with l402 in the code
sed 's@lsat@l402@' -i mint/mint_test.go
sed 's@Lsat@L402@' -i l402/client_interceptor.go
sed 's@lsatstore@l402store@' -i l402/store_test.go

replace LSAT to L402 in comments
sed '/\/\//s@LSAT@L402@g' -i `git grep -l '//.*LSAT'`

replace LSAT -> L402 in the code, skip when a string starts with it
sed 's@\([^"/]\)LSAT@\1L402@g' -i `git grep -l LSAT`
2024-04-16 19:33:03 -03:00