radicle-dev / radicle-link

The second iteration of the Radicle code collaboration protocol.
Other
421 stars 39 forks source link

rad-identities #732

Closed FintanH closed 2 years ago

FintanH commented 2 years ago

The majority of the work is porting over code from copy and modifying it to be generic over the type of identity being used.

The package is split into top-level modules:

For each of those there's a corresponding module under the cli module which performs all the setup logic followed by calling the top-level function, mentioned above.

The cli module culminates in the args and main modules, where the former defines all the arguments requried for calling the evaluation functions, and the latter calling those eval functions based on the given command.

The field module captures lens-like Has traits so that we can write functionality that can be re-used across both Person and Project. These traits allow us to talk about the fields on those two identities polymorphically.

The git hierarchy provides utilities for setting up working copies.

============= Preserving previous thoughts ============= :construction: The WIP of the rad-identities CLI library :construction:

Happy to receive early feedback :)

TODO:

Once https://github.com/radicle-dev/radicle-link/pull/739 lands:

Testing:

xla commented 2 years ago

add tests to test package

:exploding_head:

FintanH commented 2 years ago

I'm marking this as ready to review and capturing the following for follow-up tasks (to avoid PR fatigue):

FintanH commented 2 years ago

Really nice, long but easy to read, like any good epic fantasy.

And just like George R. R. Martin, you'll never see my end to this adventure

FintanH commented 2 years ago

I started playing around with rad identities and realised that to create a Person I had to do the following:

rad identities person create new --payload '{"https://radicle.xyz/link/identities/person/v1": {"name": "fintohaps"}}'

So the URL has to be specified, which makes sense because it's expecting a PersonPayload. I initially thought I could throw in {"name": "fintohaps"}. The URL would probably be a pain to copy & paste (or remember for the brave) all the time. So it'd be worth thinking about how this might be made easier. My first thought of course is dhall :) There could be a base Person payload file and a constructor that takes just the name field, and it could be extended with // if wanted. Then creation could be rad identities person create new --payload $(dhall ./Person/base "fintohaps")

On a separate but slightly related note, the signer_ssh[0] function isn't working and results in this error being repeated in a loop:

180774: Agent protocol error
180775: Agent protocol error
180776: Agent protocol error
180777: Agent protocol error
180778: Agent protocol error
180779: Agent protocol error
kim commented 2 years ago

So the URL has to be specified,

Why is this? Because you want to allow extension payloads as well?

Maybe that just requires two different UIs to (basically) achieve the same thing:

rad identities person create new \
    --payload '{"name": "hax0r"}' \
    --ext '{"https://shady.ru": {"foo": "bar"}}'

vs

rad identities create \
  --payload '{"https://radicle.xyz/link/identities/person/v1": {"name": "hax0r"}}'

(btw: "create new"? can I also "create old"?)

FintanH commented 2 years ago

Maybe that just requires two different UIs to (basically) achieve the same

Foiled again to introduce dhall into the workflow :P thanks for that suggestion! Looks good so I'll have a crack at it.

(btw: "create new"? can I also "create old"?)

Not quite, you can create existing though :)