MatrixAI / Polykey

Polykey Core Library
https://polykey.com
GNU General Public License v3.0
31 stars 4 forks source link

Add the ability to search across Disconnected Identities during Social Discovery #330

Open emmacasolin opened 2 years ago

emmacasolin commented 2 years ago

Specification

The identities search command was properly implemented in #320, however, it was left incomplete with only the ability to search across connected identities. The intended usage of the identities search command is as follows:

Usage: polykey identities search [options] [searchTerms...]

Searches a Provider for any Connected Identities

Arguments:
  searchTerms                         Search parameters to apply to connected identities

Options:
  -pi, --provider-id [providerId...]  Digital identity provider(s) to search on
  -ii, --identity-id [identityId]     Name of the digital identity to search for
  -d, --disconnected                  Include disconnected identities in search
  -l, --limit [number]                Limit the number of search results to display to a specific number

However, attempting to use the --disconnected flag will currently result in the ErrorProviderUnimplemented error being thrown, since we have no way of searching across disconnected identities. Like searching across connected identities, the definition of 'disconnected identities' is provider-specific. Since we currently only support GitHub as a provider, this issue only needs to define disconnected identities (and the implementation for searching across them) for GitHub.

Additional context

Tasks

  1. Modify the Provider interface to add a method for searching across disconnected identities
  2. Implement searching across disconnected identities for the GitHub provider
CMCDragonkai commented 2 months ago

Not every identity is always going to be connected… and one should be able to discover disconnected identities using the discover command. Therefore search should also work, however I'm wondering why not also default to disconnected too? Just rank the connected identities first.

Another thing is that it just continues and continues and never ends. This is a type of command that benefits from some level of pagination… but stream calls is interesting too.

CMCDragonkai commented 2 months ago

For example this is a weird situation:

cmcdragonkai ➜ matrix-ml-1  ➜ ~/Projects/Polykey-CLI
 $ ./dist/polykey.js identities list
gestalt 
  actionsList   
  identities    
    github.com:a1ec 
  nodeIds       
    veu6q4pppbeoumv9n3uj819t6c5thr8kb9jshpfco85l4cvst4c6g   

gestalt 
  actionsList   
  identities    
  nodeIds       
    vmlqap14bckq01osbh2htm7t4fuvmbpdac080qd7dgqe5nc20ratg   

cmcdragonkai ➜ matrix-ml-1  ➜ ~/Projects/Polykey-CLI
 $ ./dist/polykey.js identities search a1ec

cmcdragonkai ➜ matrix-ml-1  ➜ ~/Projects/Polykey-CLI
 $ 

You can see that I did identities discover github.com:a1ec ahead of time, but it's not a connected identity. It does get into my gestalt graph of course, because I force discovered it. And then when I try to search, it doesn't show up!! This is very confusing for end users.

I think it should search through connected THEN disconnected and just keep going. No need for an extra flag. One may provide a property to tell the end user that this identity is a the global search and isn't part of the your connected identities!

CMCDragonkai commented 2 months ago

Super important that the search function is case insensitive! It's important to also mention that identities discover is case sensitive. But search should be case insensitive.

Given the idea of STDERR being used for diagnostic messages. It also means that it makes sense that it could be used to tell you if it was successful or not. Not sure.

CMCDragonkai commented 2 months ago

Another thing is that when claiming, we often provide the ability to do identities claim github.com:CMCDragonkai, but why do we need the identity ID as well? Our provide authentication only allows one authentication, we should technically be able to automatically know what the identity of our provider token is. And thus one can should just claim identities claim github.com.