@trustvc/trustvc 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +29 -7
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -691,7 +691,7 @@ function rejectTransferOwners(bytes calldata _remark) external;
691
691
  For more information on Token Registry and Title Escrow contracts **version v5**, please visit the readme of [TradeTrust Token Registry V5](https://github.com/TradeTrust/token-registry/blob/master/README.md)
692
692
 
693
693
  ### 8. **Document Builder**
694
- > The `DocumentBuilder` class helps build and manage W3C Verifiable Credentials (VCs) with credential status features, implementing the **W3C VC Data Model 2.0** specification. It supports creating documents with two types of credential statuses: `transferableRecords` and `verifiableDocument`. It can sign the document using a private key, verify its signature, and serialize the document to a JSON format. Additionally, it allows for configuration of document rendering methods and expiration dates.
694
+ > The `DocumentBuilder` class helps build and manage W3C Verifiable Credentials (VCs) with credential status features, implementing the **W3C VC Data Model 2.0** specification. It supports creating documents with two types of credential statuses: `transferableRecords` and `verifiableDocument`. It can sign the document using modern cryptographic signature schemes including **ECDSA-SD-2023** (default) and **BBS-2023**, verify its signature, and serialize the document to a JSON format. Additionally, it allows for configuration of document rendering methods and expiration dates.
695
695
 
696
696
  #### Usage
697
697
 
@@ -778,23 +778,45 @@ builder.qrCode({
778
778
  ```
779
779
 
780
780
  ##### Sign the Document
781
- To sign the document, provide a `PrivateKeyPair` from `@trustvc/trustvc`. The builder uses ECDSA key for signing by default.
781
+ To sign the document, provide a `PrivateKeyPair` from `@trustvc/trustvc`. The builder supports both **ECDSA-SD-2023** (default) and **BBS-2023** cryptographic signature schemes.
782
+
783
+ **ECDSA-SD-2023 Signing (Default)**
782
784
 
783
785
  ```ts
784
- const privateKey: PrivateKeyPair = {
786
+ const ecdsaKeyPair: PrivateKeyPair = {
785
787
  '@context': 'https://w3id.org/security/multikey/v1',
786
788
  id: 'did:web:example.com#multikey-1',
787
789
  type: VerificationType.Multikey,
788
790
  controller: 'did:web:example.com',
789
- publicKeyMultibase: 'your-public-key-multibase',
790
- secretKeyMultibase: 'your-secret-key-multibase',
791
+ publicKeyMultibase: 'your-ecdsa-public-key-multibase',
792
+ secretKeyMultibase: 'your-ecdsa-secret-key-multibase',
793
+ }
794
+
795
+ // Sign with default ECDSA-SD-2023 cryptosuite
796
+ const signedDocument = await builder.sign(ecdsaKeyPair);
797
+ console.log(signedDocument);
798
+ ```
799
+
800
+ **BBS-2023 Signing**
801
+
802
+ ```ts
803
+ import { CryptoSuite } from '@trustvc/trustvc';
804
+
805
+ const bbs2023KeyPair: PrivateKeyPair = {
806
+ '@context': 'https://w3id.org/security/multikey/v1',
807
+ id: 'did:web:example.com#multikey-2',
808
+ type: VerificationType.Multikey,
809
+ controller: 'did:web:example.com',
810
+ publicKeyMultibase: 'your-bbs-public-key-multibase',
811
+ secretKeyMultibase: 'your-bbs-secret-key-multibase',
791
812
  }
792
813
 
793
- const signedDocument = await builder.sign(privateKey);
814
+ // Sign with BBS-2023 cryptosuite by passing CryptoSuite.Bbs2023
815
+ const signedDocument = await builder.sign(bbs2023KeyPair, CryptoSuite.Bbs2023);
794
816
  console.log(signedDocument);
795
817
  ```
796
818
 
797
- Example Output After Signing
819
+ **Example Output After Signing (ECDSA-SD-2023)**
798
820
  ```json
799
821
  {
800
822
  "@context": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustvc/trustvc",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "TrustVC library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -120,7 +120,7 @@
120
120
  "@tradetrust-tt/token-registry-v4": "npm:@tradetrust-tt/token-registry@^4.16.0",
121
121
  "@tradetrust-tt/token-registry-v5": "npm:@tradetrust-tt/token-registry@^5.5.0",
122
122
  "@tradetrust-tt/tradetrust": "^6.10.2",
123
- "@tradetrust-tt/tradetrust-utils": "^2.4.2",
123
+ "@tradetrust-tt/tradetrust-utils": "^2.4.4",
124
124
  "@tradetrust-tt/tt-verify": "^9.6.0",
125
125
  "@trustvc/w3c": "^1.3.0-alpha.17",
126
126
  "@trustvc/w3c-context": "^1.3.0-alpha.12",