This is to tolerate unknown rules sent from the autopilot for the
`autopilot features` command.
Otherwise, when trying to register a feature that requires an upgrade, a
more user friendly error is returned.
For autopilot session registration, we accept default recommendations
from autopilot in order to weaken privacy obfuscation for the requested
features. Default privacy flags are supplied by ListFeatures and by
flags passed to the AddAutopilotSession request.
Privacy flags are ORed to combine to the weakest aggregated privacy
obfuscation in order to allow for multiple feature registration. In
order to preserve high privacy settings for a feature it should be
registered in an isolated manner.
We obfuscate pubkeys, channel points and ids entered in configurations.
The channel id lengths for different block heights can be checked with:
```python
len(str(1 << 40 | 2923 << 16 | 30))
len(str(10_000_000 << 40 | 2923 << 16 | 30))
```
This commit expands the RealToPseudo methods to take in a privacy map db
reader. This allows the methods to check if the privacy map db already
contains an entry for a "real" string before generating a new one.
For now, only an empty PrivacyMapReader is ever provided to the
RealToPseudo call. This will be changed in the following commit.
Add the new `GroupID1` field to the `Session` struct and ensure that the
new fields are properly serialised and deserialised. The `GroupID` is
the ID of the first Session in a set of linked sessions.
This commit does a few things:
1. Instead of deriving IDs using the first 4 bytes of the session's
serialised local pub key, we instead use bytes [1:5] in order to skip
the first byte which is either 0x02 or 0x03. This results in a
greater entropy set.
2. We also add a new index from ID to key and we write to this index
each time a new session is added.
3. We add a `ReserveNewSessionID` method to the session store which will
grind through private keys until it finds one that does not clash
with the current ID set.
4. A migration is added to back-fill the ID-to-key index. If any old
sessions are found that _do_ have a colliding ID, they are sorted by
created time and all but the newest session is revoked. Only an entry
for the newest session will be added to the ID-to-key index.
In this commit, a special case is added to the creation of a custom
session to allow the user to specify custom URIs as well as the
permissions for all read-only endpoints.
With this commit, a user can now specify a regex when specifying custom
permissions for an LNC session. This regex will be used to select
permissions for URIs that match the regex.
In this commit, a new PermissionsManager is added. It handles all the
active permissions that Lit has access to. This moves us away from using
global variables for permission lists. This change might seem overkill
on its own but hugely simplifies the permission management once we add
lnd subserver permissions.
In this commit, we add a deadline for the initial connection of an LNC
connection. So with this, the user is forced to use their pairing phrase
within a certain time frame. After this initial connection, future
connections are made with the second handshake version meaning that the
pairing phrase is rendered useless. By adding a time limit to the time
in which a user can use their pairing phrase, we reduce the risk created
by the users pairing phrase being leaked. The default time limit is set
to 10 minutes but can be customsed with the new `firstlncconndeadline`
flag.
Bake the session expiry into the macaroon as a caveat. This will allow
the client of a session to get an idea of how long they will be able to
use the session for.
Let sessionRpcServer handle the session db and session server instead of
LightningTerminal handling those direclty. Then start the
sessionRpcServer as if it was a subserver like loop/pool.
In this commit, we update the go mod to point to the version of LNC that
contains the logic for handshake version 2. This requires that we pass
in a call back that LNC can call to persist the remote static key once
it is received. This then needs to be provided each time we start up the
session again.