Skip to content

Commit

Permalink
docs: update README for wallet-cli (#1467)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrii Holovko <[email protected]>
  • Loading branch information
aholovko authored Oct 11, 2023
1 parent 113cc82 commit a165dca
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 9 deletions.
59 changes: 51 additions & 8 deletions component/wallet-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It emulates the Wallet behavior against VC services.

## Build

Run the following commands from the root of the repository to build the wallet-cli:
Run the following commands from the root of the repository to build the `wallet-cli` executable:
```bash
$ cd component/wallet-cli
$ go build .
Expand All @@ -35,7 +35,7 @@ Wallet can be created using `create` command. The following CLI arguments are su

Examples:

* Create wallet using leveldb storage option and default parameters (ED25519 key type, did:ion method):
* Create wallet using `leveldb` storage and default parameters (`ED25519` key type, `did:ion` method):
```bash
./wallet-cli create --leveldb-path "/mnt/wallet.db"
```
Expand All @@ -52,6 +52,11 @@ the most recently created DID is used. To select a specific DID, set its index w
Note: adding `--did-key-type ECDSAP256DER` to the command above will result in error as the Wallet already initialized
with the key type ED25519 (EdDSA signature type).

* Create wallet using `mongodb` storage, `did:ion` method and `ECDSAP384DER` key type:
```bash
./wallet-cli create --mongodb-connection-string "mongodb://localhost:27017" --did-method ion --did-key-type ECDSAP384DER
```

### Receiving Verifiable Credential using OIDC4VCI exchange protocol

Once the Wallet is created, it can be used to receive Verifiable Credentials from the Issuer. The `oidc4vci` command is
Expand Down Expand Up @@ -80,16 +85,55 @@ used for this purpose. The following CLI arguments are supported:
Examples:
* Receive VC from the Issuer using pre-authorized code flow:
* Receive VC from the Issuer using `pre-authorized_code` flow:
```bash
./wallet-cli oidc4vci \
--leveldb-path "/mnt/wallet.db" \
--qr-code-path "qr.png" \
--grant-type urn:ietf:params:oauth:grant-type:pre-authorized_code \
--credential-type VerifiedEmployee \
--credential-format jwt_vc_json-ld
```
* Receive VC from the Issuer using `authorization_code` flow:
```bash
./wallet-cli oidc4vci --leveldb-path "/mnt/wallet.db" --qr-code-path "/mnt/qr.png" --grant-type urn:ietf:params:oauth:grant-type:pre-authorized_code --credential-type VerifiedEmployee --credential-format jwt_vc_json-ld
./wallet-cli oidc4vci \
--leveldb-path "/mnt/wallet.db" \
--qr-code-path "qr.png" \
--grant-type authorization_code \
--client-id oidc4vc_client \
--credential-type VerifiedEmployee \
--credential-format ldp_vc
```
* Receive VC from the Issuer using authorization code flow:
For the `wallet-initiated` flow, you must include the `--issuer-state` argument. It has the following format:
https://<gateway>/vcs/oidc/idp/<profile_id>/<profile_version>
```bash
./wallet-cli oidc4vci --leveldb-path "/mnt/wallet.db" --qr-code-path "/mnt/qr.png" --grant-type authorization_code --client-id oidc4vc_client --credential-type PermanentResidentCard --credential-format ldp_vc
./wallet-cli oidc4vci \
--leveldb-path "/mnt/wallet.db" \
--grant-type authorization_code \
--client-id oidc4vc_client \
--credential-type VerifiedEmployee \
--issuer-state https://<gateway>/vcs/oidc/idp/<profile_id>/<profile_version>
```
For other flows one of `--qr-code-path`, `--credential-offer` or `--demo-issuer-url` is required.
Use `--user-login` and `--user-password` arguments to provide user credentials for the Issuer IdP and skip the login
page in `authorization_code` flow:
```bash
./wallet-cli oidc4vci \
--leveldb-path "/mnt/wallet.db" \
--credential-offer "openid-credential-offer://?credential_offer_uri=https%3A%2F%2Fgateway%2Ffdd4f13f-d701-42d4-ad79-898915c25c85.jwt" \
--grant-type authorization_code \
--client-id oidc4vc_client \
--credential-type VerifiedEmployee \
--user-login "<login>" \
--user-password "<password>"
```
To enable HTTP tracing between `wallet-cli` and `vcs`, append the `--enable-tracing` flag to your argument list.
### Presenting Verifiable Credential using OIDC4VP exchange protocol
Use the `oidc4vp` command to present Verifiable Credential to the Verifier:
Expand All @@ -107,11 +151,10 @@ Examples:
* Present VC to the Verifier with linked domain verification:
```bash
./wallet-cli oidc4vp --leveldb-path "/mnt/wallet.db" --qr-code-path "/mnt/qr.png" --enable-linked-domain-verification
./wallet-cli oidc4vp --leveldb-path "/mnt/wallet.db" --qr-code-path "qr.png" --enable-linked-domain-verification
```
## Contributing
We appreciate your help! For contributors, please follow our [community contribution guidelines](https:/trustbloc/community/blob/main/CONTRIBUTING.md)
to understand our code of conduct and the process for submitting pull requests.
Expand Down
2 changes: 1 addition & 1 deletion component/wallet-cli/internal/storage/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewProvider(storageType string, opts ...Opt) (storage.Provider, error) {
return nil, fmt.Errorf("mongodb connection string is empty")
}

p, err := mongodb.NewProvider(options.connectionString, nil)
p, err := mongodb.NewProvider(options.connectionString)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit a165dca

Please sign in to comment.