@trustvc/trustvc 1.4.7 → 1.4.9
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.
- package/README.md +15 -0
- package/dist/cjs/core/documentBuilder.js +7 -0
- package/dist/cjs/utils/gasStation/index.js +26 -0
- package/dist/cjs/utils/index.js +7 -0
- package/dist/esm/core/documentBuilder.js +7 -0
- package/dist/esm/utils/gasStation/index.js +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/types/core/documentBuilder.d.ts +11 -1
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/utils/gasStation/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -666,6 +666,16 @@ builder.renderMethod({
|
|
|
666
666
|
});
|
|
667
667
|
```
|
|
668
668
|
|
|
669
|
+
##### Define QR Code Method
|
|
670
|
+
Set the qrcode method to be used for the document.
|
|
671
|
+
|
|
672
|
+
```ts
|
|
673
|
+
builder.qrCode({
|
|
674
|
+
uri: 'https://example.com/qrcode',
|
|
675
|
+
type: 'TrustVCQRCode',
|
|
676
|
+
});
|
|
677
|
+
```
|
|
678
|
+
|
|
669
679
|
##### Sign the Document
|
|
670
680
|
To sign the document, provide a `PrivateKeyPair` from `@trustvc/trustvc`.
|
|
671
681
|
|
|
@@ -690,6 +700,7 @@ Example Output After Signing
|
|
|
690
700
|
"https://w3c-ccg.github.io/citizenship-vocab/contexts/citizenship-v1.jsonld",
|
|
691
701
|
"https://w3id.org/vc/status-list/2021/v1",
|
|
692
702
|
"https://trustvc.io/context/render-method-context.json",
|
|
703
|
+
"https://trustvc.io/context/qrcode-context.json",
|
|
693
704
|
"https://w3id.org/security/bbs/v1"
|
|
694
705
|
],
|
|
695
706
|
"type": ["VerifiableCredential"],
|
|
@@ -705,6 +716,10 @@ Example Output After Signing
|
|
|
705
716
|
"templateName": "BILL_OF_LADING"
|
|
706
717
|
}
|
|
707
718
|
],
|
|
719
|
+
"qrCode": {
|
|
720
|
+
"uri": "https://example.com/qrcode",
|
|
721
|
+
"type": "TrustVCQRCode"
|
|
722
|
+
},
|
|
708
723
|
"credentialStatus": {
|
|
709
724
|
"id": "https://example.com/status-list#<placeholder>",
|
|
710
725
|
"type": "StatusList2021Entry",
|
|
@@ -93,6 +93,13 @@ class DocumentBuilder {
|
|
|
93
93
|
this.addContext("https://trustvc.io/context/render-method-context.json");
|
|
94
94
|
return this;
|
|
95
95
|
}
|
|
96
|
+
// Defines the qrcode for the document.
|
|
97
|
+
qrCode(method) {
|
|
98
|
+
if (this.isSigned) throw new Error("Configuration Error: Document is already signed.");
|
|
99
|
+
this.document.qrCode = method;
|
|
100
|
+
this.addContext("https://trustvc.io/context/qrcode-context.json");
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
96
103
|
// Sign the document using the provided private key and an optional cryptographic suite.
|
|
97
104
|
async sign(privateKey, cryptoSuite) {
|
|
98
105
|
if (this.isSigned) throw new Error("Configuration Error: Document is already signed.");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tradetrustUtils = require('@tradetrust-tt/tradetrust-utils');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "GasStationFeeData", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return tradetrustUtils.GasStationFeeData; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "GasStationFunction", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return tradetrustUtils.GasStationFunction; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "calculateMaxFee", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return tradetrustUtils.calculateMaxFee; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "gasStation", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return tradetrustUtils.gasStation; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "scaleBigNumber", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return tradetrustUtils.scaleBigNumber; }
|
|
26
|
+
});
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var stringUtils = require('./stringUtils');
|
|
|
6
6
|
var supportedChains = require('./supportedChains');
|
|
7
7
|
var errorMessages = require('./errorMessages');
|
|
8
8
|
var documents = require('./documents');
|
|
9
|
+
var gasStation = require('./gasStation');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
@@ -45,3 +46,9 @@ Object.keys(documents).forEach(function (k) {
|
|
|
45
46
|
get: function () { return documents[k]; }
|
|
46
47
|
});
|
|
47
48
|
});
|
|
49
|
+
Object.keys(gasStation).forEach(function (k) {
|
|
50
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () { return gasStation[k]; }
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -91,6 +91,13 @@ class DocumentBuilder {
|
|
|
91
91
|
this.addContext("https://trustvc.io/context/render-method-context.json");
|
|
92
92
|
return this;
|
|
93
93
|
}
|
|
94
|
+
// Defines the qrcode for the document.
|
|
95
|
+
qrCode(method) {
|
|
96
|
+
if (this.isSigned) throw new Error("Configuration Error: Document is already signed.");
|
|
97
|
+
this.document.qrCode = method;
|
|
98
|
+
this.addContext("https://trustvc.io/context/qrcode-context.json");
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
94
101
|
// Sign the document using the provided private key and an optional cryptographic suite.
|
|
95
102
|
async sign(privateKey, cryptoSuite) {
|
|
96
103
|
if (this.isSigned) throw new Error("Configuration Error: Document is already signed.");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GasStationFeeData, GasStationFunction, calculateMaxFee, gasStation, scaleBigNumber } from '@tradetrust-tt/tradetrust-utils';
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -38,6 +38,15 @@ interface RenderMethod {
|
|
|
38
38
|
type: string;
|
|
39
39
|
templateName: string;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Configuration for the qrcoode used in a Verifiable Credential document.
|
|
43
|
+
* @property {string} uri - A unique identifier for the qrcode, typically a URL or URI.
|
|
44
|
+
* @property {string} type - The type of the qrcode method (e.g., 'TrustVCQRCode').
|
|
45
|
+
*/
|
|
46
|
+
interface qrCode {
|
|
47
|
+
uri: string;
|
|
48
|
+
type: string;
|
|
49
|
+
}
|
|
41
50
|
/**
|
|
42
51
|
* Main class responsible for building, configuring, and signing documents with credential statuses.
|
|
43
52
|
*/
|
|
@@ -59,6 +68,7 @@ declare class DocumentBuilder {
|
|
|
59
68
|
credentialStatus(config: W3CTransferableRecordsConfig | W3CVerifiableDocumentConfig): this;
|
|
60
69
|
expirationDate(date: string | Date): this;
|
|
61
70
|
renderMethod(method: RenderMethod): this;
|
|
71
|
+
qrCode(method: qrCode): this;
|
|
62
72
|
sign(privateKey: PrivateKeyPair, cryptoSuite?: string): Promise<SignedVerifiableCredential>;
|
|
63
73
|
verify(): Promise<boolean>;
|
|
64
74
|
toString(): string;
|
|
@@ -72,4 +82,4 @@ declare class DocumentBuilder {
|
|
|
72
82
|
private supportsInterface;
|
|
73
83
|
}
|
|
74
84
|
|
|
75
|
-
export { DocumentBuilder, type RenderMethod, type W3CTransferableRecordsConfig, type W3CVerifiableDocumentConfig };
|
|
85
|
+
export { DocumentBuilder, type RenderMethod, type W3CTransferableRecordsConfig, type W3CVerifiableDocumentConfig, type qrCode };
|
|
@@ -7,7 +7,7 @@ export { fetchEventTime, mergeTransfersV4, mergeTransfersV5, sortLogChain } from
|
|
|
7
7
|
export { getEndorsementChain } from './endorsement-chain/retrieveEndorsementChain.js';
|
|
8
8
|
export { EndorsementChain, ParsedLog, TitleEscrowTransferEvent, TitleEscrowTransferEventType, TokenTransferEvent, TokenTransferEventType, TradeTrustTokenEventType, TransferBaseEvent, TransferEvent, TransferEventType, TypedEvent } from './endorsement-chain/types.js';
|
|
9
9
|
export { TitleEscrowInterface, fetchEndorsementChain, getDocumentOwner, getTitleEscrowAddress, isTitleEscrowVersion } from './endorsement-chain/useEndorsementChain.js';
|
|
10
|
-
export { DocumentBuilder, RenderMethod, W3CTransferableRecordsConfig, W3CVerifiableDocumentConfig } from './documentBuilder.js';
|
|
10
|
+
export { DocumentBuilder, RenderMethod, W3CTransferableRecordsConfig, W3CVerifiableDocumentConfig, qrCode } from './documentBuilder.js';
|
|
11
11
|
import '@trustvc/w3c-vc';
|
|
12
12
|
import '@tradetrust-tt/tt-verify/dist/types/src/types/core';
|
|
13
13
|
import 'ethersV6';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export { fetchEventTime, mergeTransfersV4, mergeTransfersV5, sortLogChain } from
|
|
|
19
19
|
export { getEndorsementChain } from './core/endorsement-chain/retrieveEndorsementChain.js';
|
|
20
20
|
export { EndorsementChain, ParsedLog, TitleEscrowTransferEvent, TitleEscrowTransferEventType, TokenTransferEvent, TokenTransferEventType, TradeTrustTokenEventType, TransferBaseEvent, TransferEvent, TransferEventType, TypedEvent } from './core/endorsement-chain/types.js';
|
|
21
21
|
export { TitleEscrowInterface, fetchEndorsementChain, getDocumentOwner, getTitleEscrowAddress, isTitleEscrowVersion } from './core/endorsement-chain/useEndorsementChain.js';
|
|
22
|
-
export { DocumentBuilder, RenderMethod, W3CTransferableRecordsConfig, W3CVerifiableDocumentConfig } from './core/documentBuilder.js';
|
|
22
|
+
export { DocumentBuilder, RenderMethod, W3CTransferableRecordsConfig, W3CVerifiableDocumentConfig, qrCode } from './core/documentBuilder.js';
|
|
23
23
|
export { signOA } from './open-attestation/sign.js';
|
|
24
24
|
export { KeyPair } from './open-attestation/types.js';
|
|
25
25
|
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './open-attestation/utils.js';
|
|
@@ -35,7 +35,7 @@ export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, Ver
|
|
|
35
35
|
export { PrivateKeyPair } from '@trustvc/w3c-issuer';
|
|
36
36
|
export { i as vc } from './index-1ws_BWZW.js';
|
|
37
37
|
export { verifyW3CSignature } from './w3c/verify.js';
|
|
38
|
-
export { errorMessageHandling, CONSTANTS as errorMessages, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
|
|
38
|
+
export { GasStationFeeData, GasStationFunction, calculateMaxFee, errorMessageHandling, CONSTANTS as errorMessages, gasStation, interpretFragments, scaleBigNumber } from '@tradetrust-tt/tradetrust-utils';
|
|
39
39
|
export * from '@tradetrust-tt/tradetrust-utils/constants/network';
|
|
40
40
|
export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './utils/stringUtils/index.js';
|
|
41
41
|
export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GasStationFeeData, GasStationFunction, calculateMaxFee, gasStation, scaleBigNumber } from '@tradetrust-tt/tradetrust-utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { errorMessageHandling, CONSTANTS as errorMessages, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
|
|
1
|
+
export { GasStationFeeData, GasStationFunction, calculateMaxFee, errorMessageHandling, CONSTANTS as errorMessages, gasStation, interpretFragments, scaleBigNumber } from '@tradetrust-tt/tradetrust-utils';
|
|
2
2
|
export * from '@tradetrust-tt/tradetrust-utils/constants/network';
|
|
3
3
|
export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './stringUtils/index.js';
|
|
4
4
|
export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustvc/trustvc",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "TrustVC library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -116,10 +116,10 @@
|
|
|
116
116
|
"@tradetrust-tt/tradetrust": "^6.10.1",
|
|
117
117
|
"@tradetrust-tt/tradetrust-utils": "^2.3.0",
|
|
118
118
|
"@tradetrust-tt/tt-verify": "^9.4.0",
|
|
119
|
-
"@trustvc/w3c-context": "^1.2.
|
|
120
|
-
"@trustvc/w3c-credential-status": "^1.2.
|
|
119
|
+
"@trustvc/w3c-context": "^1.2.8",
|
|
120
|
+
"@trustvc/w3c-credential-status": "^1.2.8",
|
|
121
121
|
"@trustvc/w3c-issuer": "^1.2.2",
|
|
122
|
-
"@trustvc/w3c-vc": "^1.2.
|
|
122
|
+
"@trustvc/w3c-vc": "^1.2.12",
|
|
123
123
|
"ethers": "^5.8.0",
|
|
124
124
|
"ethersV6": "npm:ethers@^6.13.6",
|
|
125
125
|
"js-sha3": "^0.9.3",
|