Skip to content
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

Docs improvements #1488

Merged
merged 25 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7da1736
trust registry naming changes
chiarapaskulin Aug 1, 2023
e67a4db
replacing template for credential template
chiarapaskulin Aug 1, 2023
2a22b43
more replacing template for credential template
chiarapaskulin Aug 1, 2023
4b32449
revert examples deletion
chiarapaskulin Aug 1, 2023
e22afcb
Issue directly and send improvements
chiarapaskulin Sep 4, 2023
981a3bb
Merge branch 'main' into cp/docs-improvements
chiarapaskulin Sep 4, 2023
bc71597
Apply automatic changes
chiarapaskulin Sep 4, 2023
1392284
Update docs/examples/1-issue-direct-send.md
tmarkovski Sep 7, 2023
59ecd87
Update docs/examples/1-issue-direct-send.md
tmarkovski Sep 8, 2023
6dcaa28
Change to mkdocs docmark
chiarapaskulin Sep 15, 2023
5df3783
MkDocs docmark
chiarapaskulin Sep 15, 2023
fc1f8c6
merge main
chiarapaskulin Sep 15, 2023
f461960
revert mkdocs change
chiarapaskulin Sep 15, 2023
104b0c6
Merge remote-tracking branch 'origin' into cp/docs-improvements
chiarapaskulin Sep 15, 2023
c7142f7
example changes
chiarapaskulin Sep 15, 2023
566041d
Apply automatic changes
chiarapaskulin Sep 15, 2023
c8d16b1
credential offer samples
chiarapaskulin Sep 15, 2023
ca75f27
Merge branch 'cp/docs-improvements' of https://github.com/trinsic-id/…
chiarapaskulin Sep 15, 2023
1bd4ada
fix test
chiarapaskulin Sep 15, 2023
4382f5a
update some samples
chiarapaskulin Sep 19, 2023
2d964a2
Merge branch 'main' of https://github.com/trinsic-id/sdk into cp/docs…
chiarapaskulin Sep 22, 2023
f3af259
Apply automatic changes
chiarapaskulin Sep 22, 2023
7f6922b
standardize docs
chiarapaskulin Sep 22, 2023
2b2314b
Merge branch 'cp/docs-improvements' of https://github.com/trinsic-id/…
chiarapaskulin Sep 22, 2023
d719901
Apply automatic changes
chiarapaskulin Sep 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/src/proto/services/trustregistry/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub mod unregister_member_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnregisterMemberResponse {}
/// Request to fetch member status in governance framework for a specific credential schema.
/// Request to fetch member status in Trust Registry for a specific credential schema.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -143,7 +143,7 @@ pub struct AuthorizedMemberSchema {
#[prost(uint64, tag = "5")]
pub valid_until: u64,
}
/// Request to get a member of the governance framework
/// Request to get a member of the Trust Registry
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
2 changes: 1 addition & 1 deletion dart/example/vaccine_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Future runVaccineDemo() async {
// }

// storeCredential() {
// Alice stores the credential in her cloud wallet.
// Allison stores the credential in her cloud wallet.
trinsic.serviceOptions.authToken = allison.authToken;
// insertItemWallet() {
var insertResponse = await trinsic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ class UnregisterMemberResponse extends $pb.GeneratedMessage {
static UnregisterMemberResponse? _defaultInstance;
}

/// Request to fetch member status in governance framework for a specific credential schema.
/// Request to fetch member status in Trust Registry for a specific credential schema.
class GetMemberAuthorizationStatusRequest extends $pb.GeneratedMessage {
factory GetMemberAuthorizationStatusRequest({
$core.String? didUri,
Expand Down Expand Up @@ -971,7 +971,7 @@ class AuthorizedMemberSchema extends $pb.GeneratedMessage {

enum GetMemberRequest_Member { didUri, walletId, email, notSet }

/// Request to get a member of the governance framework
/// Request to get a member of the Trust Registry
class GetMemberRequest extends $pb.GeneratedMessage {
factory GetMemberRequest({
$core.String? didUri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class IssueFromTemplateRequest extends $pb.GeneratedMessage {
void clearExpirationDate() => clearField(5);

/// If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's
/// governance framework.
/// Trust Registry.
@$pb.TagNumber(6)
$core.bool get includeGovernance => $_getBF(4);
@$pb.TagNumber(6)
Expand Down Expand Up @@ -1394,7 +1394,7 @@ class CreateCredentialOfferRequest extends $pb.GeneratedMessage {
void clearHolderBinding() => clearField(3);

/// If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's
/// governance framework.
/// Trust Registry.
@$pb.TagNumber(4)
$core.bool get includeGovernance => $_getBF(3);
@$pb.TagNumber(4)
Expand Down
8 changes: 4 additions & 4 deletions docs/_static/proto.json
Original file line number Diff line number Diff line change
Expand Up @@ -6381,7 +6381,7 @@
"services.trustregistry.v1.GetMemberAuthorizationStatusRequest": {
"name": "GetMemberAuthorizationStatusRequest",
"full_name": "services.trustregistry.v1.GetMemberAuthorizationStatusRequest",
"description": "Request to fetch member status in governance framework for a specific credential schema.",
"description": "Request to fetch member status in Trust Registry for a specific credential schema.",
"fields": [
"services.trustregistry.v1.GetMemberAuthorizationStatusRequest.did_uri",
"services.trustregistry.v1.GetMemberAuthorizationStatusRequest.schema_uri"
Expand All @@ -6402,7 +6402,7 @@
"services.trustregistry.v1.GetMemberRequest": {
"name": "GetMemberRequest",
"full_name": "services.trustregistry.v1.GetMemberRequest",
"description": "Request to get a member of the governance framework",
"description": "Request to get a member of the Trust Registry",
"fields": [
"services.trustregistry.v1.GetMemberRequest.did_uri",
"services.trustregistry.v1.GetMemberRequest.wallet_id",
Expand Down Expand Up @@ -10375,7 +10375,7 @@
"label": "LABEL_OPTIONAL",
"type": "bool",
"full_type": "bool",
"description": "If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's\ngovernance framework."
"description": "If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's\nTrust Registry."
},
"services.verifiablecredentials.v1.CreateCredentialOfferRequest.signature_type": {
"name": "signature_type",
Expand Down Expand Up @@ -10498,7 +10498,7 @@
"label": "LABEL_OPTIONAL",
"type": "bool",
"full_type": "bool",
"description": "If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's\ngovernance framework."
"description": "If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's\nTrust Registry."
},
"services.verifiablecredentials.v1.IssueFromTemplateRequest.save_copy": {
"name": "save_copy",
Expand Down
4 changes: 2 additions & 2 deletions docs/dart/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Alternatively, you can simply instantiate this service with or without parameter
```dart
import 'package:trinsic_dart/trinsic.dart';
// ...
var trinsicService = TrinsicService(null);
var trinsic = TrinsicService(null);
// Or, if you have an auth token
var trinsicService = TrinsicService(trinsicConfig(authToken: "<auth_token>"));
var trinsic = TrinsicService(trinsicConfig(authToken: "<auth_token>"));
```
4 changes: 2 additions & 2 deletions docs/dotnet/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public MyController(TrinsicService trinsicService)
Alternatively, you can simply instantiate this service with or without parameters

```cs
var trinsicService = new TrinsicService();
var trinsic = new TrinsicService();

// or

var trinsicService = new TrinsicService(new ServiceOptions
var trinsic = new TrinsicService(new ServiceOptions
{
AuthToken = "<auth_token>"
});
Expand Down
17 changes: 9 additions & 8 deletions docs/examples/issue-direct-send.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ const issueResponse = await trinsic.credential().issueFromTemplate({
console.dir(JSON.parse(issueResponse.documentJson), { depth: null, });
```

Let's look at some of the input fields for the issue from template request.
Let's look at some of the input fields for the `issueFromTemplate()` request.

: `templateId` is a required field and refers to the template ID that we want to use.
: `valuesJson` is a required field and must be an object with fields and their values. This object must be passed as JSON stringified value.
: `signatureType` is optional field that specifies type of signature that will be used to sign the credential. There are currently two types supported: `Standard` will use NIST approved cryptographic curves, specifically the Ed25519 curve with EDDSA signature. The `Experimental` signature type will use BBS Signatures with BLS12381 curve.
: `includeGovernance` is optional field that specifies if we'd like governance attestation about the issuer to be included with the credential. This will indicate that the issuer is authorized member of the governance framework for the given ecosystem.
- `templateId` is a required field and refers to the template ID that we want to use.
- `valuesJson` is a required field and must be an object with fields and their values. This object must be passed as JSON stringified value.
- `signatureType` is optional field that specifies type of signature that will be used to sign the credential. There are currently two types supported: `Standard` will use NIST approved cryptographic curves, specifically the Ed25519 curve with EDDSA signature. The `Experimental` signature type will use BBS Signatures with BLS12381 curve.
- `includeGovernance` is optional field that specifies if we'd like governance attestation about the issuer to be included with the credential. This will indicate that the issuer is authorized member of the governance framework for the given ecosystem.

Without governance information:
```json
Expand All @@ -107,17 +107,18 @@ Let's look at some of the input fields for the issue from template request.
}
```

: `expirationDate` is optional and specifies the validity period of the issed credential. If specified, this field must be in ISO 8601 format
: `saveCopy` is optional and will save a copy of the issued credential in the issuer wallet that will be marked as `IssuedVerifiableCredential`. This copy will not contain any cryptographic data or signatures and it's purpose is to allow the issuers to track the issued credentials and their metadata. This metadata is required if the issuer wants to change the status of the credential and revoke it's validity. This is controlled using the data found in the `credentialStatus` field.
- `expirationDate` is optional and specifies the validity period of the issed credential. If specified, this field must be in ISO 8601 format
- `saveCopy` is optional and will save a copy of the issued credential in the issuer wallet that will be marked as `IssuedVerifiableCredential`. This copy will not contain any cryptographic data or signatures and it's purpose is to allow the issuers to track the issued credentials and their metadata. This metadata is required if the issuer wants to change the status of the credential and revoke it's validity. This is controlled using the data found in the `credentialStatus` field.

### Send the credential

Finally, we can just send the credentil to the user's wallet by specifying the email address of the user.
Finally, we can just send the credential to the user's wallet by specifying its email address. If you want to send an email notification that a credential has been sent to the user's wallet, just set `sendNotification` to true.

```js
await trinsic.credential().send({
documentJson: issueResponse.documentJson,
email: "<EMAIL>",
sendNotification: true,
});

```
Expand Down
4 changes: 2 additions & 2 deletions docs/node/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let { TrinsicService } = require("@trinsic/trinsic");

You must instantiate the trinsic service first:
```js
const trinsicService = new TrinsicService({
const trinsic = new TrinsicService({
/** Trinsic API endpoint. Defaults to `prod.trinsic.cloud` */
serverEndpoint: "prod.trinsic.cloud",
/** Trinsic API port; defaults to `443` */
Expand All @@ -38,7 +38,7 @@ const trinsicService = new TrinsicService({

Now you can use the SDK:
```js
const newWallet = await trinsicService.wallet().createWallet();
const newWallet = await trinsic.wallet().createWallet();
console.log(JSON.stringify(newWallet, null, 4));
```

Expand Down
8 changes: 4 additions & 4 deletions docs/reference/proto/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ Response to `CheckStatusRequest`
| template_id | [string](/reference/proto#string) | ID of template to use |
| values_json | [string](/reference/proto#string) | JSON document string with keys corresponding to the fields of the template referenced by `template_id` |
| holder_binding | [bool](/reference/proto#bool) | If true, the credential will be issued with holder binding by specifying the holder DID in the credential subject |
| include_governance | [bool](/reference/proto#bool) | If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's governance framework. |
| include_governance | [bool](/reference/proto#bool) | If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's Trust Registry. |
| generate_share_url | [bool](/reference/proto#bool) | If true, a short URL link will be generated that can be used to share the credential offer with the holder. This link will point to the credential offer in the wallet app. |
| signature_type | [SignatureType](/reference/proto#services-verifiablecredentials-v1-SignatureType) | The type of signature to use when signing the credential. Defaults to `EXPERIMENTAL`. |

Expand Down Expand Up @@ -1200,7 +1200,7 @@ Request to create and sign a JSON-LD Verifiable Credential from a template using
| values_json | [string](/reference/proto#string) | JSON document string with keys corresponding to the fields of the template referenced by `template_id` |
| save_copy | [bool](/reference/proto#bool) | Save a copy of the issued credential to this user's wallet. This copy will only contain the credential data, but not the secret proof value. Issuers may use this data to keep track of the details for revocation status. |
| expiration_date | [string](/reference/proto#string) | The ISO8601 expiration UTC date of the credential. This is a reserved field in the VC specification. If specified, the issued credential will contain an expiration date. https://www.w3.org/TR/vc-data-model/#expiration |
| include_governance | [bool](/reference/proto#bool) | If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's governance framework. |
| include_governance | [bool](/reference/proto#bool) | If true, the issued credential will contain an attestation of the issuer's membership in the ecosystem's Trust Registry. |
| signature_type | [SignatureType](/reference/proto#services-verifiablecredentials-v1-SignatureType) | The type of signature to use when signing the credential. Defaults to `EXPERIMENTAL`. |


Expand Down Expand Up @@ -2208,7 +2208,7 @@ How to display a URI value when rendering a credential.
<a name="services-trustregistry-v1-GetMemberAuthorizationStatusRequest"></a>

### GetMemberAuthorizationStatusRequest
Request to fetch member status in governance framework for a specific credential schema.
Request to fetch member status in Trust Registry for a specific credential schema.


| Field | Type | Description |
Expand Down Expand Up @@ -2239,7 +2239,7 @@ Response to `GetMemberAuthorizationStatusRequest`
<a name="services-trustregistry-v1-GetMemberRequest"></a>

### GetMemberRequest
Request to get a member of the governance framework
Request to get a member of the Trust Registry


| Field | Type | Description |
Expand Down
29 changes: 27 additions & 2 deletions docs/reference/services/credential-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ By utilizing the "Create Offer" endpoint, the issuing party can initiate a reque

Furthermore, the "Create Offer" endpoint enables the issuing party to define and configure the holder binding properties of the credential. This means that the issued credential will be bound to the intended holder, making it non-transferable and restricted for use solely by the authorized holder.

{{ proto_sample_start() }}
=== "TypeScript"
<!--codeinclude-->
```typescript
[Create Credential Offer](../../../web/test/WalletService.test.ts) inside_block:createCredentialOffer
```
<!--/codeinclude-->

{{ proto_method_tabs("services.verifiablecredentials.v1.VerifiableCredential.CreateCredentialOffer") }}

---
Expand All @@ -104,13 +112,29 @@ The purpose of the "Accept Offer" method is for the user to formally accept the

The "Accept Offer" method is a mandatory step in the issuance process, as it solidifies the user's commitment to acquiring the verifiable credential. During this step, if the issuer requested binding information, the user's wallet will submit a proof of DID ownership bind the credential to the user and make it non-transferable. The verifiable credential is then securely generated and delivered to the user, officially establishing their possession and ownership of the credential.

{{ proto_sample_start() }}
=== "TypeScript"
<!--codeinclude-->
```typescript
[Accept Credential](../../../web/test/WalletService.test.ts) inside_block:acceptCredential
```
<!--/codeinclude-->

{{ proto_method_tabs("services.verifiablecredentials.v1.VerifiableCredential.AcceptCredential") }}

---

## Reject Credential

This endpoint allows users to decline or reject an offered verifiable credential. By utilizing this endpoint, users can explicitly communicate their decision not to accept the credential being offered to them. By offering this option in your application, your platform promotes user empowerment and supports a transparent workflow for the acceptance or rejection of verifiable credentials.

{{ proto_sample_start() }}
=== "TypeScript"
<!--codeinclude-->
```typescript
[Reject Credential](../../../web/test/WalletService.test.ts) inside_block:rejectCredential
```
<!--/codeinclude-->

{{ proto_method_tabs("services.verifiablecredentials.v1.VerifiableCredential.RejectCredential") }}

Expand Down Expand Up @@ -364,8 +388,9 @@ The specified email address must be tied to an existing account in the same ecos

```typescript
await trinsic.credential().send(SendRequest.fromPartial({
email: "",
documentJson: JSON.stringify({}),
documentJson: issueResponse.documentJson,
email: "<EMAIL>",
sendNotification: true,
}));
```

Expand Down
12 changes: 6 additions & 6 deletions dotnet/Tests/HostTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public async Task TestGenericHost() {

await host.StartAsync();

var trinsicService = host.Services.GetRequiredService<TrinsicService>();
var providerService = trinsicService.Provider;
var accountService = trinsicService.Wallet;
var trinsic = host.Services.GetRequiredService<TrinsicService>();
var providerService = trinsic.Provider;
var accountService = trinsic.Wallet;

providerService.Should().NotBeNull();
accountService.Should().NotBeNull();
Expand Down Expand Up @@ -51,9 +51,9 @@ public async Task TestConfiguredGenericHost() {

await host.StartAsync();

var trinsicService = host.Services.GetRequiredService<TrinsicService>();
var providerService = trinsicService.Provider;
var walletService = trinsicService.Wallet;
var trinsic = host.Services.GetRequiredService<TrinsicService>();
var providerService = trinsic.Provider;
var walletService = trinsic.Wallet;

providerService.Should().NotBeNull();
walletService.Should().NotBeNull();
Expand Down
12 changes: 8 additions & 4 deletions dotnet/Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,24 @@ public async Task TestWalletService() {
// Read the JSON credential data

// issueCredentialSample() {
var credential = await trinsic.Credential.IssueFromTemplateAsync(new() {
var issueResponse = await trinsic.Credential.IssueFromTemplateAsync(new() {
TemplateId = template.Data.Id,
ValuesJson = JsonConvert.SerializeObject(new {
field = 123
})
});
// }

_testOutputHelper.WriteLine($"Credential:\n{credential.DocumentJson}");
_testOutputHelper.WriteLine($"Credential:\n{issueResponse.DocumentJson}");

try
{
// sendCredential() {
var sendResponse = await trinsic.Credential.SendAsync(new() { Email = "example@trinsic.id" });
var sendResponse = await trinsic.Credential.SendAsync(new() {
Email = "<EMAIL>",
DocumentJson = issueResponse.DocumentJson,
SendNotification = true,
});
// }
} catch
{
Expand All @@ -123,7 +127,7 @@ public async Task TestWalletService() {
trinsic = new TrinsicService(_options.CloneWithAuthToken(allison.AuthToken));

var insertItemResponse =
await trinsic.Wallet.InsertItemAsync(new() { ItemJson = credential.DocumentJson });
await trinsic.Wallet.InsertItemAsync(new() { ItemJson = issueResponse.DocumentJson });
var itemId = insertItemResponse.ItemId;

// getItem() {
Expand Down
Loading