-
Notifications
You must be signed in to change notification settings - Fork 4
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
Growing the Gestalt Graph and Implementing Social Discovery #320
Conversation
Previously I had been confused as to why some of the |
While I had originally thought that we would need to call type IdentityData = {
providerId: ProviderId;
identityId: IdentityId;
name?: string;
email?: string;
url?: string;
}; and The benefit to doing it this way is that we don't need to inject |
identitiesInfoGetConnected
RPC Handler
In terms of the CLI command for |
Since we want to check that an identity is authenticated (similarly for nodes being valid) before adding it to our gestalt graph, we would need to throw some sort of error back to the client if the provided identity is invalid/unauthenticated. There is an existing error |
Since |
Yep this is worth giving a comment on. |
No, untrusting doesn't delete it from the GG, it just removes the trust relationship. GG garbage collection can be a separate issue. |
Not sure what you mean by checking if it is authenticated. Yes you need to check if the identity exists. And in some cases you need to check if cryptolink claim that led you there is valid. If if someone is specifically pointing to a given identity to add to the gestalt graph, there is no cryptolink to check. As for exceptions, new exceptions could be added into the identities domain when checking for the existence of an identity. Perhaps a new method on our identity providers? I reckon getIdentityInfo is sufficient. Also in this case no exception is needed if you're returning the info only, simply return the sentinel value. Only have exceptions if it the returned value is expected to exist and carried to another procedure. |
Can you show this through possible PK CLI commands. It's a bit hard to visualise the workflow. |
I think we discussed over Skype. The discovery module is like a background spidering process. So we should be able to push a job/task onto the queue which will be iterated on in the background. |
Yeah just checking that an identity is valid. If we want to trust an identity we first need to add it to the gestalt graph, but we need to check it's a valid identity before doing so since it's just user-entered data.
There's already a method called |
Yeah sure. So currently the My suggestion is that instead of returning your own identity id,
I can't think of a use case for needing to retrieve your own authenticated identity id(s), unless you wanted to check if you were authenticated? But in that case it should probably be a functionality that's part of |
There's actually a problem with setting identities into the GG in the same handler as trusting the identity. This is because you can't just trust an identity on its own - you're trusting a gestalt BY one of its identities. So if an identity has only just been set into the GG (and is not connected to any nodes, since we expect this to be done in the background by Discovery), then we won't be able to set permissions for it. This is only a problem for identities (not nodes), but I think the process of trusting should be the same for both identities and nodes so if it doesn't work for identities we should come up with a different solution for both. |
Returning undefined is the correct response here. We don't use exceptions to indicate non-existence if the command is about fetching something. Value based errors is better in these scenarios. An exception could be thrown inside the service handler as that's where the exception is, the expectation that identity exists is not fulfilled. |
A gestalt can be consist of just a single identity. In fact all vertexes start out single and then progressively build up relationships after that. So if the gestalt is just 1 identity then a permission can still be added. When that gestalt builds, the permissions are merged together. |
I think there are several possible uses here:
Should a single command be capable of doing them all or separate these ideas?
BTW, I remember now that we made a decision to group all gestalt-related functionality within the |
At the moment, the GG pretty much just acts as an interface for the ACL. So it won't allow you to set permissions for just an identity since the ACL only stores permissions for nodes and vaults. For example this is the method for setting permissions by identity (this is the closest method in the GG to setting permissions for an identity, which I think is slightly different): @ready(new gestaltsErrors.ErrorGestaltsGraphNotRunning())
public async setGestaltActionByIdentity(
providerId: ProviderId,
identityId: IdentityId,
action: GestaltAction,
): Promise<void> {
return await this._transaction(async () => {
return await this.acl._transaction(async () => {
const identityKey = gestaltsUtils.keyFromIdentity(
providerId,
identityId,
);
if (
(await this.db.get<IdentityInfo>(
this.graphIdentitiesDbDomain,
identityKey,
)) == null
) {
throw new gestaltsErrors.ErrorGestaltsGraphIdentityIdMissing();
}
const gestaltKeySet = (await this.db.get(
this.graphMatrixDbDomain,
identityKey,
)) as GestaltKeySet;
let nodeId: NodeId | undefined;
for (const nodeKey in gestaltKeySet) {
nodeId = gestaltsUtils.ungestaltKey(nodeKey as GestaltNodeKey).nodeId;
break;
}
// If there are no linked nodes, this cannot proceed
if (nodeId == null) {
throw new gestaltsErrors.ErrorGestaltsGraphNodeIdMissing();
}
await this.acl.setNodeAction(nodeId, action);
});
});
} It needs to find a linked node to set the permissions for. If we want to be able to set permissions for just an identity on its own then we need to rethink the current methods in the GG. |
I was thinking about this and was wondering if maybe the gestalts-related behaviour could go under something like
It works better for some than others, but I think it's still clearer than using |
How's something like this?
Example usage:
|
Interesting. So this means using But if you combine it with search terms it would have to apply the filter to the resulting list of identities even if that list only has 1 identity. I suggest that Also this command should stream out the results which means output formatter has to be used in a loop. That is rather than outputting the entire array in own go, you would output it line by line in a stream as you read off from the grpc stream. |
Also standardised names for limiting results is |
Not all gestalt related work has to do with permissions. And I think we do have an ACL subcommand. To prevent confusion it should either stay in identities or become its own subcommand as gestalts. |
Ok I must have forgotten how ACL works. But yes for now we can only set permissions on nodes. Therefore the identities we set permissions for must be augmented. We are meant to detect if the identity is augmented yet. I want to separate the job of finding identities from the job of querying the gestalt graph. So one can use the identity provider to know if an identity is augmented. It's the discovery modules job to build the gestalt graph and maintain it. So if the identity is augmented you can give it a permission. If it isn't yet, you can't do it yet. Btw does this also mean notification permissions cannot be set for an identity too? |
Yeah that's correct - notification permissions cannot be set for an (unaugmented) identity. So how should setting permissions for identities work for the CLI? Because right now you can run |
There isn't an ACL subcommand yet as far as I can see, but I agree that |
Incorporating this feedback:
And yes, using |
The "sanity check the final build" one? I'm not entirely sure what this refers to, but my assumption is it's the pipeline, in which case I've checked over that.
Oh ok! I'll double check all of that now. |
242a85e
to
69747e1
Compare
It's about running |
I completed my review of this PR over the weekend - everything else looks fine to me.
Never mind - all fine, it was a problem on my end. |
8f05d59
to
a360302
Compare
Rebased on master. All tests are still passing and everything has been lintfixed again. All that's left for this PR is this remaining issue: #320 (comment) At the moment I've implented the ability to lookup your own authenticated identity ids using the command |
This should fix #310 (comment)
However the splitting of that will be in #311. Same with |
|
Unattended background discovery for Discovery domain Adding trusted nodes/identities to the Gestalt Graph
73c6d0f
to
3bdaaf1
Compare
Merged. @emmacasolin remember to avoid using full stops in our comments, mainly as it's not used in other places. Docblocks can use it for very long commentary, but I usually do this:
So no full stops ever used. So #311 will have more things to do, can you update the PR description there to include fixing tests:
Also new issue(s) for |
Description
The PR will change the way that the gestalt graph grows and shrinks by exposing this to the CLI. The
identities trust
andvaults share
commands will add the trusted node/identity to the gestalt graph and the discovery domain crawl these to build the gestalt graph. This will involve converting theDiscovery
domain fromCreateDestroy
toCreateDestroyStartStop
, such that it has underlying state (a queue of nodes/identities to crawl) and constantly discovers gestalts in the background.This PR will also expose
indentitiesInfoGetConnected
to the CLI such that users can search providers for identities, which can then subsequently be trusted and crawled.Issues Fixed
Tasks
identitiesInfoGetConnected
identities trust
which are injected with theGestaltGraph
to allow trusted nodes/identities to be added to the gestalt graphGestaltGraph
into the handler forvaults share
to allow trusted nodes/identities to be added to the gestalt graph (wait until Introducing vault sharing and the restrictions of pulling and cloning with vault permissions #266 is merged)Discovery
domain toCreateDestroyStartStop
and add a queue of nodes/identities to discoverstart
is calledidentitiesInfoGetConnected
and discovery testsFinal checklist