Finish renaming attestation to approval.

- See 49b7f25cc4.

  - Fixes #417.
This commit is contained in:
Neal H. Walfield 2024-11-06 20:48:18 +01:00
parent cf09d2f7a2
commit 2ae1885971
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3
3 changed files with 53 additions and 54 deletions

View File

@ -66,8 +66,7 @@ Trust.
This command emits the certificate with the new certification. The \
updated certificate has to be distributed, preferably by sending it to \
the certificate holder for attestation. See also `sq key \
approvals`.
the certificate holder for approval. See also `sq key approvals`.
By default a certification expires after {} years. \
Using the `--expiration` argument specific validity periods may be defined. \

View File

@ -121,8 +121,8 @@ fn update(
// Get a signer.
let mut pk_signer = sq.get_primary_key(&key, None)?;
// Now, create new attestation signatures.
let mut attestation_signatures = Vec::new();
// Now, create new approval signatures.
let mut approval_signatures = Vec::new();
// For the selected user IDs.
let uid_filter = make_userid_filter(
@ -246,7 +246,7 @@ fn update(
wprintln!(" no certifications");
}
attestation_signatures.append(&mut uid.attest_certifications2(
approval_signatures.append(&mut uid.attest_certifications2(
sq.policy,
sq.time,
&mut pk_signer,
@ -255,7 +255,7 @@ fn update(
}
// Finally, add the new signatures.
let key = key.insert_packets(attestation_signatures)?;
let key = key.insert_packets(approval_signatures)?;
if let Some(sink) = command.output {
let path = sink.path().map(Clone::clone);

View File

@ -38,18 +38,18 @@ fn update_files() -> Result<()> {
&[ public, &alice_pgp ][..], None,
&*priv_file);
let attestation_file = sq.scratch_file(
&*format!("{}-attestation", public.display()));
let approval_file = sq.scratch_file(
&*format!("{}-approval", public.display()));
let attestation = sq.key_approvals_update(
&priv_file, &["--add-all"], &*attestation_file);
let approval = sq.key_approvals_update(
&priv_file, &["--add-all"], &*approval_file);
eprintln!("{}", sq.inspect(&attestation_file));
eprintln!("{}", sq.inspect(&approval_file));
assert_eq!(attestation.bad_signatures().count(), 0);
assert_eq!(approval.bad_signatures().count(), 0);
let attestation_ua = attestation.userids().next().unwrap();
assert_eq!(attestation_ua.attestations().count(), 1);
let approval_ua = approval.userids().next().unwrap();
assert_eq!(approval_ua.attestations().count(), 1);
};
@ -97,13 +97,13 @@ fn update_all() -> Result<()> {
let (alice, bob) = make_keys(&sq)?;
// Attest the zero certifications.
let attestation = sq.key_approvals_update(
let approval = sq.key_approvals_update(
alice.key_handle(), &["--add-all"], None);
assert_eq!(attestation.bad_signatures().count(), 0);
let attestation_ua = attestation.userids().next().unwrap();
assert_eq!(attestation_ua.attestations().count(), 1);
assert_eq!(attestation_ua.with_policy(STANDARD_POLICY, None).unwrap()
assert_eq!(approval.bad_signatures().count(), 0);
let approval_ua = approval.userids().next().unwrap();
assert_eq!(approval_ua.attestations().count(), 1);
assert_eq!(approval_ua.with_policy(STANDARD_POLICY, None).unwrap()
.attested_certifications().count(), 0);
// Have Bob certify Alice.
@ -115,23 +115,23 @@ fn update_all() -> Result<()> {
assert_eq!(alice2.fingerprint(), alice.fingerprint());
// Attest Bob's certification.
let attestation = sq.key_approvals_update(
let approval = sq.key_approvals_update(
&alice.key_handle(), &["--add-all"], None);
assert_eq!(attestation.bad_signatures().count(), 0);
let attestation_ua = attestation.userids().next().unwrap();
assert_eq!(attestation_ua.attestations().count(), 2);
assert_eq!(attestation_ua.with_policy(STANDARD_POLICY, None).unwrap()
assert_eq!(approval.bad_signatures().count(), 0);
let approval_ua = approval.userids().next().unwrap();
assert_eq!(approval_ua.attestations().count(), 2);
assert_eq!(approval_ua.with_policy(STANDARD_POLICY, None).unwrap()
.attested_certifications().count(), 1);
// Drop the approval of Bob's certification.
let attestation = sq.key_approvals_update(
let approval = sq.key_approvals_update(
&alice.key_handle(), &["--remove-all"], None);
assert_eq!(attestation.bad_signatures().count(), 0);
let attestation_ua = attestation.userids().next().unwrap();
assert_eq!(attestation_ua.attestations().count(), 3);
assert_eq!(attestation_ua.with_policy(STANDARD_POLICY, None).unwrap()
assert_eq!(approval.bad_signatures().count(), 0);
let approval_ua = approval.userids().next().unwrap();
assert_eq!(approval_ua.attestations().count(), 3);
assert_eq!(approval_ua.with_policy(STANDARD_POLICY, None).unwrap()
.attested_certifications().count(), 0);
Ok(())
@ -148,13 +148,13 @@ fn update_by() -> Result<()> {
let bob_fp = bob.fingerprint().to_string();
// Attest the zero certifications.
let attestation = sq.key_approvals_update(
let approval = sq.key_approvals_update(
alice.key_handle(), &["--add-by", &bob_fp], None);
assert_eq!(attestation.bad_signatures().count(), 0);
let attestation_ua = attestation.userids().next().unwrap();
assert_eq!(attestation_ua.attestations().count(), 1);
assert_eq!(attestation_ua.with_policy(STANDARD_POLICY, None).unwrap()
assert_eq!(approval.bad_signatures().count(), 0);
let approval_ua = approval.userids().next().unwrap();
assert_eq!(approval_ua.attestations().count(), 1);
assert_eq!(approval_ua.with_policy(STANDARD_POLICY, None).unwrap()
.attested_certifications().count(), 0);
// Have Bob certify Alice.
@ -166,23 +166,23 @@ fn update_by() -> Result<()> {
assert_eq!(alice2.fingerprint(), alice.fingerprint());
// Attest Bob's certification.
let attestation = sq.key_approvals_update(
let approval = sq.key_approvals_update(
&alice.key_handle(), &["--add-by", &bob_fp], None);
assert_eq!(attestation.bad_signatures().count(), 0);
let attestation_ua = attestation.userids().next().unwrap();
assert_eq!(attestation_ua.attestations().count(), 2);
assert_eq!(attestation_ua.with_policy(STANDARD_POLICY, None).unwrap()
assert_eq!(approval.bad_signatures().count(), 0);
let approval_ua = approval.userids().next().unwrap();
assert_eq!(approval_ua.attestations().count(), 2);
assert_eq!(approval_ua.with_policy(STANDARD_POLICY, None).unwrap()
.attested_certifications().count(), 1);
// Drop the approval of Bob's certification.
let attestation = sq.key_approvals_update(
let approval = sq.key_approvals_update(
&alice.key_handle(), &["--remove-by", &bob_fp], None);
assert_eq!(attestation.bad_signatures().count(), 0);
let attestation_ua = attestation.userids().next().unwrap();
assert_eq!(attestation_ua.attestations().count(), 3);
assert_eq!(attestation_ua.with_policy(STANDARD_POLICY, None).unwrap()
assert_eq!(approval.bad_signatures().count(), 0);
let approval_ua = approval.userids().next().unwrap();
assert_eq!(approval_ua.attestations().count(), 3);
assert_eq!(approval_ua.with_policy(STANDARD_POLICY, None).unwrap()
.attested_certifications().count(), 0);
Ok(())
@ -208,13 +208,13 @@ fn update_authenticated() -> Result<()> {
assert_eq!(alice2.fingerprint(), alice.fingerprint());
// Attest the zero certifications.
let attestation = sq.key_approvals_update(
let approval = sq.key_approvals_update(
alice.key_handle(), &["--add-authenticated"], None);
assert_eq!(attestation.bad_signatures().count(), 0);
let attestation_ua = attestation.userids().next().unwrap();
assert_eq!(attestation_ua.attestations().count(), 1);
assert_eq!(attestation_ua.with_policy(STANDARD_POLICY, None).unwrap()
assert_eq!(approval.bad_signatures().count(), 0);
let approval_ua = approval.userids().next().unwrap();
assert_eq!(approval_ua.attestations().count(), 1);
assert_eq!(approval_ua.with_policy(STANDARD_POLICY, None).unwrap()
.attested_certifications().count(), 0);
// Link Bob's cert to his user ID.
@ -225,13 +225,13 @@ fn update_authenticated() -> Result<()> {
sq.run(link, true);
// Attest Bob's certification.
let attestation = sq.key_approvals_update(
let approval = sq.key_approvals_update(
&alice.key_handle(), &["--add-authenticated"], None);
assert_eq!(attestation.bad_signatures().count(), 0);
let attestation_ua = attestation.userids().next().unwrap();
assert_eq!(attestation_ua.attestations().count(), 2);
assert_eq!(attestation_ua.with_policy(STANDARD_POLICY, None).unwrap()
assert_eq!(approval.bad_signatures().count(), 0);
let approval_ua = approval.userids().next().unwrap();
assert_eq!(approval_ua.attestations().count(), 2);
assert_eq!(approval_ua.with_policy(STANDARD_POLICY, None).unwrap()
.attested_certifications().count(), 1);
Ok(())