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
Add to-rdf-urdna2015 subcommand #172
Conversation
0b908bd
to
e0376b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) The functionality seems to be working correctly, but some tests seem to fail:
$ cargo test
...
running 3 tests
test generate_key ... ok
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Sign(NoKeys)', cli/src/main.rs:426:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test didkit_cli ... FAILED
test resolver_option ... ok
failures:
---- didkit_cli stdout ----
thread 'didkit_cli' panicked at 'assertion failed: issue_output.status.success()', cli/tests/cli.rs:77:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
didkit_cli
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.34s
error: test failed, to rerun pass '-p didkit-cli --test cli'
(2) Build warning in main.rs
:
warning: the item `Read` is imported redundantly
--> cli/src/main.rs:553:17
|
2 | use std::io::{stdin, stdout, BufReader, BufWriter, Read, Write};
| ---- the item `Read` is already imported here
...
553 | use std::io::Read;
| ^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
(3) Additionally, it would be great to add cli/tests/auth.jsonld
to the repo so that anyone can try it out with an example if they want to.
@@ -125,6 +125,18 @@ pub enum DIDKit { | |||
#[structopt(flatten)] | |||
proof_options: ProofOptions, | |||
}, | |||
/// Convert JSON-LD to URDNA2015-canonicalized RDF N-Quads | |||
ToRdfURDNA2015 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, I'm glad it's so easy to add options
This is because of a bug where didkit attempts to use ssh-agent for signing when it shouldn't. For now, if you run
Fixed in c13fe27.
It's an ephemeral file generated by Adding example VCs and VPs to the repo could also be done if that would be useful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All works now, thanks!
This adds a CLI subcommand for converting JSON-LD to canonicalized RDF, to address #163.
This exposes the functionality used internally by many linked data signature suites. It can be useful for inspecting the data contents of a verifiable credential or presentation, linked data authorization capability, or other linked data document.
Another use for this sub-command is to construct linked data proof signing payloads for external signing. Note that for such signing payloads, the proof object and linked data document without proof object must be canonicalized separately, according to the linked data proof Create Verify Hash Algorithm. Furthermore, the proof object needs context defined for its terms which are otherwise defined in the document's parent context. Context such as that can be passed to this subcommand using the
-c, --expand-context
or-C, --more-context-json
options.-c
takes a URI (e.g. for the w3c-ccg security context, or vc-data-model base context, or a signature suite context) and corresponds to the JSON-LDexpandContext
option, while-C
takes a JSON array of values to insert into the@context
property of the payload (creating it if needed).Usage
Example
Canonicalizing proof object only: