Skip to content

Commit

Permalink
Rename attest (credential) to issue everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
macterra committed May 23, 2024
1 parent c16cbb9 commit 4a8fd51
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Options:
Commands:
accept-credential <did> [name] Save verifiable credential for current ID
add-name <name> <did> Adds a name for a DID
attest-credential <file> [registry] [name] Sign and encrypt a bound credential file
issue-credential <file> [registry] [name] Sign and encrypt a bound credential file
backup-id Backup the current ID to its registry
backup-wallet Backup wallet to encrypted DID
bind-credential <file> <did> Create bound credential for a user
Expand Down
8 changes: 4 additions & 4 deletions doc/CLI-user-manual/05-credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The basic workflow involves three actors: Alice (the Issuer), Bob (the Holder),

1. The Issuer (Alice) creates a Credential. The Credential is like a type or a class; it describes the Credential, and specifies a schema. Each Verified Credential is an instance of a Credential.
1. The Issuer binds a Credential to a Holder
1. The Issuer attest a Credential, creating a Verifiable Credential (VC), by signing and encrypting a Bound Credential.
1. The Issuer issues a Credential, creating a Verifiable Credential (VC), by signing and encrypting a Bound Credential.
1. The Holder (Bob) accepts the VC (adding it to their wallet for future use).
1. The Verifier (Carol) creates a Challenge. A Challenge is a list of Credentials and trusted Issuers.
1. The Holder creates a Response to the Challenge. A Response contains a list of Verified Presentations that correspond to the Credentials and trusted Issuers listed in the Challenge. If the User's wallet contains the right Verified Credentials, then it will be possible to create a valid Response to the Challenge. The Response is encrypted for the Verifier.
Expand Down Expand Up @@ -190,7 +190,7 @@ $ cat bob-twitter.json
The credential, bound and populated with the subject's information, must now be signed by the issuer and encrypted to the subject's keys:

```sh
$ kc attest-credential bob-twitter.json
$ kc issue-credential bob-twitter.json
did:mdip:test:z3v8AuaZAWJuERtD5CwDu2mNpLHjJ6imdNGTwdZpfKY6FK5ASk2
```

Expand Down Expand Up @@ -278,7 +278,7 @@ $ kc show-wallet

## Revoking a credential

The issuer of a credential can revoke their attestation at any time. This will blank out the VC's credential content data and set the `didDocumentMetadata.deactivated` property to true.
The issuer of a credential can revoke their credential at any time. This will blank out the VC's credential content data and set the `didDocumentMetadata.deactivated` property to true.

```sh
$ kc revoke-credential did:mdip:test:z3v8AuaZAWJuERtD5CwDu2mNpLHjJ6imdNGTwdZpfKY6FK5ASk2
Expand All @@ -302,4 +302,4 @@ $ kc resolve-did did:mdip:test:z3v8AuaZAWJuERtD5CwDu2mNpLHjJ6imdNGTwdZpfKY6FK5AS
"version": 1
}
}
```
```
8 changes: 4 additions & 4 deletions doc/CLI-user-manual/06-manifests.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ sidebar_label: DID Manifest
slug: manifests
---

###
###

The DID Manifest is a public data container that is returned with the DID document data. Users can chose to publish or reveal any attestation they receive. All information in the manifest is publicly viewable.
The DID Manifest is a public data container that is returned with the DID document data. Users can chose to publish or reveal any credential they receive. All information in the manifest is publicly viewable.

Example of `didDocumentData` with a manifest :

Expand Down Expand Up @@ -42,7 +42,7 @@ Example of `didDocumentData` with a manifest :

### Publishing a Verifiable Credential

Publishing a VC to a DID Manifest will make it known that the DID holder has received a particular Verifiable Credential without revealing the credential's values. In this example, we know that Bob has a social-media attestation, but we do not know the details:
Publishing a VC to a DID Manifest will make it known that the DID holder has received a particular Verifiable Credential without revealing the credential's values. In this example, we know that Bob has a social-media credential, but we do not know the details:

```sh
$ kc add-name bob-twitter did:mdip:test:z3v8Auaf3eZEUqJEu8xu1uUwxK3ZTLLXsfg9U7p6awPzyuD1AAT
Expand Down Expand Up @@ -182,4 +182,4 @@ At any time, a VC holder can decide to remove VCs published on their DID Manifes
```sh
$ kc unpublish-credential bob-twitter
OK
```
```
6 changes: 3 additions & 3 deletions doc/CLI-user-manual/07-challenge-responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ When presented with a challenge, a user can prepare a Verifiable Presentation of

> [!NOTE]
>If you're testing as both Alice and Bob from a single wallet, you can skip this step.
1. Then the user can create a repsonse:
```sh
$ kc create-response sm-challenge
did:mdip:test:z3v8AuadZ56m4x2UTpeY3HhSFvFQnrCUyASBYA77vqrqQr9SR99
```
The command above mapped the Challenge with previously received VCs and found one matching the request for Bob's twitter account attestation. The resulting DID document contains a Verifiable Presentation revealing the twitter account VC data encrypted to the requesting party (Alice).
The command above mapped the Challenge with previously received VCs and found one matching the request for Bob's twitter account credential. The resulting DID document contains a Verifiable Presentation revealing the twitter account VC data encrypted to the requesting party (Alice).

## Verifying a VP Response

Expand Down Expand Up @@ -113,4 +113,4 @@ kc verify-response did:mdip:test:z3v8AuadZ56m4x2UTpeY3HhSFvFQnrCUyASBYA77vqrqQr9
}
}
]
```
```
6 changes: 3 additions & 3 deletions doc/CLI-user-manual/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Keychain-MDIP CLI is a user-facing tool used to interact with the MDIP sub-s
The Keychain CLI brings together functionality from three important sub-components:

1. Decentralized Identity (DID) registration and management as defined by W3C DID Core.
1. Verifiable Credential (VC) attestation and management as defined by W3C VC Data Model.
1. Verifiable Credential (VC) credential and management as defined by W3C VC Data Model.
1. Crypto keys and wallet management.

All the CLI commands are self-documented using the `--help` flag, or by running `kc` with no flags:
Expand All @@ -33,7 +33,7 @@ Options:
Commands:
accept-credential <did> [name] Save verifiable credential for current ID
add-name <name> <did> Adds a name for a DID
attest-credential <file> [registry] [name] Sign and encrypt a bound credential file
issue-credential <file> [registry] [name] Sign and encrypt a bound credential file
backup-id Backup the current ID to its registry
backup-wallet Backup wallet to encrypted DID
bind-credential <file> <did> Create bound credential for a user
Expand Down Expand Up @@ -110,4 +110,4 @@ The long string returned starting with `did` will be unique to you. This is your
Think of a DID as a secure reference. Only the owner of the reference can change what it points to. What makes it decentralized is that anyone can discover what it points to without involving a third party.
Creating a new ID automatically creates a new wallet for your ID, which we will describe next.
Creating a new ID automatically creates a new wallet for your ID, which we will describe next.
2 changes: 1 addition & 1 deletion doc/DID-scheme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,4 @@ function resolveDid(did, asOfTime=now):

For security reasons, MDIP provides no support for storing private keys. We recommend that MDIP clients use BIP-39 to generate a master seed phrase consisting of at least 12 words, and that users safely store the recovery phrase.

If a user loses a device that contains their wallet, they should be able to install the wallet software on a new device, initialize it with their seed phrase and recover their DID along with all their attestations. This implies that a "vault" of the attestations should be stored with the agent DID document, though it should be encrypted with the DID's current private key for privacy.
If a user loses a device that contains their wallet, they should be able to install the wallet software on a new device, initialize it with their seed phrase and recover their DID along with all their credentials. This implies that a "vault" of the credentials should be stored with the agent DID document, though it should be encrypted with the DID's current private key for privacy.
72 changes: 36 additions & 36 deletions kc-completion.bash
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
#/usr/bin/env bash
#/usr/bin/env bash
_kc_completions()
{
COMPREPLY+=("create-wallet")
COMPREPLY+=("import-wallet")
COMPREPLY+=("show-wallet")
COMPREPLY+=("show-mnemonic")
COMPREPLY+=("backup-wallet")
COMPREPLY+=("show-wallet")
COMPREPLY+=("show-mnemonic")
COMPREPLY+=("backup-wallet")
COMPREPLY+=("recover-wallet")
COMPREPLY+=("create-id")
COMPREPLY+=("resolve-id")
COMPREPLY+=("backup-id")
COMPREPLY+=("resolve-id")
COMPREPLY+=("backup-id")
COMPREPLY+=("recover-id")
COMPREPLY+=("remove-id")
COMPREPLY+=("list-ids")
COMPREPLY+=("use-id")
COMPREPLY+=("rotate-keys")
COMPREPLY+=("resolve-did")
COMPREPLY+=("encrypt-msg")
COMPREPLY+=("encrypt-file")
COMPREPLY+=("decrypt-did")
COMPREPLY+=("decrypt-json")
COMPREPLY+=("sign-file")
COMPREPLY+=("verify-file")
COMPREPLY+=("create-credential")
COMPREPLY+=("create-challenge")
COMPREPLY+=("create-challenge-cc")
COMPREPLY+=("issue-challenge")
COMPREPLY+=("bind-credential")
COMPREPLY+=("attest-credential")
COMPREPLY+=("revoke-credential")
COMPREPLY+=("accept-credential")
COMPREPLY+=("publish-credential")
COMPREPLY+=("reveal-credential")
COMPREPLY+=("unpublish-credential")
COMPREPLY+=("create-response")
COMPREPLY+=("verify-response")
COMPREPLY+=("add-name")
COMPREPLY+=("remove-name")
COMPREPLY+=("list-names")
COMPREPLY+=("export-did")
COMPREPLY+=("import-did")
COMPREPLY+=("help")
COMPREPLY+=("remove-id")
COMPREPLY+=("list-ids")
COMPREPLY+=("use-id")
COMPREPLY+=("rotate-keys")
COMPREPLY+=("resolve-did")
COMPREPLY+=("encrypt-msg")
COMPREPLY+=("encrypt-file")
COMPREPLY+=("decrypt-did")
COMPREPLY+=("decrypt-json")
COMPREPLY+=("sign-file")
COMPREPLY+=("verify-file")
COMPREPLY+=("create-credential")
COMPREPLY+=("create-challenge")
COMPREPLY+=("create-challenge-cc")
COMPREPLY+=("issue-challenge")
COMPREPLY+=("bind-credential")
COMPREPLY+=("issue-credential")
COMPREPLY+=("revoke-credential")
COMPREPLY+=("accept-credential")
COMPREPLY+=("publish-credential")
COMPREPLY+=("reveal-credential")
COMPREPLY+=("unpublish-credential")
COMPREPLY+=("create-response")
COMPREPLY+=("verify-response")
COMPREPLY+=("add-name")
COMPREPLY+=("remove-name")
COMPREPLY+=("list-names")
COMPREPLY+=("export-did")
COMPREPLY+=("import-did")
COMPREPLY+=("help")
}

2 changes: 1 addition & 1 deletion keychain-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ program
});

program
.command('attest-credential <file> [registry] [name]')
.command('issue-credential <file> [registry] [name]')
.description('Sign and encrypt a bound credential file')
.action(async (file, registry, name) => {
try {
Expand Down
10 changes: 5 additions & 5 deletions keymaster-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,8 @@ async function findMatchingCredential(credential) {
continue;
}

if (credential.attestors) {
if (!credential.attestors.includes(doc.issuer)) {
if (credential.issuers) {
if (!credential.issuers.includes(doc.issuer)) {
// Attestor not trusted by Verifier
continue;
}
Expand Down Expand Up @@ -979,9 +979,9 @@ export async function verifyResponse(responseDID, challengeDID) {
continue;
}

// Check if issuer of VP is in the trusted attestor list
if (credential.attestors && credential.attestors.length > 0) {
if (!credential.attestors.includes(vp.issuer)) {
// Check if issuer of VP is in the trusted issuer list
if (credential.issuers && credential.issuers.length > 0) {
if (!credential.issuers.includes(vp.issuer)) {
continue;
}
}
Expand Down
14 changes: 7 additions & 7 deletions keymaster.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ describe('issueCredential', () => {
mockFs.restore();
});

it('should attest a bound credential when user is issuer', async () => {
it('should issue a bound credential when user is issuer', async () => {
mockFs({});

const userDid = await keymaster.createId('Bob');
Expand Down Expand Up @@ -1274,7 +1274,7 @@ describe('createChallenge', () => {
credentials: [
{
schema: credentialDid,
attestors: [alice, bob]
issuers: [alice, bob]
}
]
};
Expand Down Expand Up @@ -1351,7 +1351,7 @@ describe('createResponse', () => {
credentials: [
{
schema: credentialDid,
attestors: [alice]
issuers: [alice]
}
]
};
Expand Down Expand Up @@ -1577,19 +1577,19 @@ describe('verifyResponse', () => {
credentials: [
{
schema: credential1,
attestors: [alice]
issuers: [alice]
},
{
schema: credential2,
attestors: [alice]
issuers: [alice]
},
{
schema: credential3,
attestors: [bob]
issuers: [bob]
},
{
schema: credential4,
attestors: [bob]
issuers: [bob]
},
]
};
Expand Down
16 changes: 8 additions & 8 deletions workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ async function runWorkflow() {
const vc1 = await keymaster.issueCredential(bc1);
const vc2 = await keymaster.issueCredential(bc2);

console.log(`Alice attested vc1 for Carol ${vc1}`);
console.log(`Alice attested vc2 for Carol ${vc2}`);
console.log(`Alice issued vc1 for Carol ${vc1}`);
console.log(`Alice issued vc2 for Carol ${vc2}`);

keymaster.setCurrentId('Bob');

Expand All @@ -64,8 +64,8 @@ async function runWorkflow() {
const vc3 = await keymaster.issueCredential(bc3);
const vc4 = await keymaster.issueCredential(bc4);

console.log(`Bob attested vc3 for Carol ${vc3}`);
console.log(`Bob attested vc4 for Carol ${vc4}`);
console.log(`Bob issued vc3 for Carol ${vc3}`);
console.log(`Bob issued vc4 for Carol ${vc4}`);

keymaster.setCurrentId('Carol');

Expand All @@ -82,19 +82,19 @@ async function runWorkflow() {
credentials: [
{
schema: credential1,
attestors: [alice]
issuers: [alice]
},
{
schema: credential2,
attestors: [alice]
issuers: [alice]
},
{
schema: credential3,
attestors: [bob]
issuers: [bob]
},
{
schema: credential4,
attestors: [bob]
issuers: [bob]
},
]
};
Expand Down

0 comments on commit 4a8fd51

Please sign in to comment.