The olpc-json crate's CanonicalFormatter does not escape certain
control characters, including new lines. This means that when a COB
gets serialized that includes new lines, those new lines are
serialized verbatim. Upon deserialization `serde_json` -- and any
other JSON deserializer -- will fail due to the encounter of these
control characters.
This behaviour was prevented in radicle-link with the definition of
its own CanoncialFormatter that encodes the control characters
correctly.
Inline this definition of the formatter, under MIT license, to ensure
the correct and remove oplc-cjson.
The behaviour is checked using a multiline test in the issue COB.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
The assign, id, and unassign help messages were missing from the rad
help command.
Add them to complete the list.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
The `From` implementation would allow someone to create a `Home` in an
incorrect fashion, for example the path is not canonical.
Exchange `From` for a `TryFrom` implementation.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Instead of showing just public keys we need to show the fully qualified
spec for a NID which is prefixed by `did🔑` While we want to maintain
`Author` and `ActorId` for internal use.
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
Adds helper for parsing the Id type in CLI arguments.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
The CLI commands and output use PublicKey, ActorId, and NodeId for
peer identifiers.
Instead Did should be standardised for use in CLI arguments and
outputs.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Adds a standard for parsing the Did type for the CLI commands.
It attempts to parse the Did type. If it fails then it checks if the
operator passed a PublicKey and suggests using `did:key` instead.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Add conversion from Did to PublicKey through a From implementation.
Add FromStr implementation.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
If a path was passed to `Home` in non-canonical form it would not use
the right path for any initialisation or use.
The aim is to use the `canonicalize` function for paths. However, this
may return an error if none of the paths exist. To ensure that the
path exists the `new` constructor for `Home` creates the directory and
canonicalizes the path.
Since `new` now initialises the home directory, it would be useful if
it also initialised all the necessary subdirectories -- which removes
the need for the `init` method.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit allows to checkout a patch created
with `rad patch open` in a new branch
named `patch/{short_patch_id}`.
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit includes a simplification in finding the
long patch id in order to perform operations like
`patch show <id>` and `patch checkou <id>`.
Actual output
```
➜ rio git:(main) rad patch list
- YOU PROPOSED -
patch text 8c94760699e R0 f1b2740 (macros/rad_patch) ahead 1, behind 0
└─ * opened by z6MkuvfwAkZ6yD6Z5TT6YXfJjFNPMQz9fPi9BSU7gwhS9s2x (you) 12 minutes ago
└─ * patch id 8c94760699e3e2da64aa9f14f4d2cecfe7b754ad
patch text 78e0fb5ad45 R0 f1b2740 (macros/rad_patch) ahead 1, behind 0
└─ * opened by z6MkuvfwAkZ6yD6Z5TT6YXfJjFNPMQz9fPi9BSU7gwhS9s2x (you) 24 minutes ago
└─ * patch id 78e0fb5ad45481d225a6fb45f51422e468b55c94
- OTHERS PROPOSED -
Nothing to show.
```
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
The `list` and `show` commands were missing from the HELP message.
Add them to the HELP message.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Add the resulting SHA of the new Identity when performing `rad id
commit`.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
`Doc::commit` used `git2::Signature::now` when committing the document
to the repository. This results in the commits always changing and not
allowing us to test outputs of our CLI commands that would wish to
output the SHA.
Make `Doc::commit` reproducible in debug mode using `debug_assertions`
and checking the `RAD_COMMIT_TIME` environment variable.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Introduces the `rad id` subcommand for interacting with the identity
proposal cob.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
In order to make identity changes where the threshold is higher than
1, it is necessary to gather signatures of delegates to surpass that
threshold.
To achieve this the Proposal cob is introduced for proposing changes
and gathering the signatures over those changes.
Once a quorum is reached the Proposal can be published, committing the
new identity document to storage.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
The signatures for Radicle identities were using the documents
content.
It is standard to use the hash of the content instead, since signing
and verification is faster on a smaller set of data.
Use the resulting Git blob's object id, i.e. `git hash-object`, as the
signing and verifying payload.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
The macro in the trailers module existed since there were multiple
trailers before the refactoring, so it minimised boilerplate code.
After the refactoring of the code there was only one trailer
left. Remove the macro generation code and replace it with just the
necessary code for the ResourceCommitTrailer.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett