@tdxvolt/volt-client-grpc 0.16.0-beta.3 → 0.16.0-beta.5

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/lib/index.cjs CHANGED
@@ -589,6 +589,10 @@ class VoltCredential {
589
589
  return this._cryptoCache;
590
590
  }
591
591
 
592
+ get certificate() {
593
+ return this._cryptoCache.cert;
594
+ }
595
+
592
596
  get sessionId() {
593
597
  return this._cryptoCache.session_id;
594
598
  }
@@ -1775,7 +1779,7 @@ function findDIDDocumentService(document, serviceType) {
1775
1779
  return matches;
1776
1780
  }
1777
1781
 
1778
- async function authenticateInternal(createDID = true) {
1782
+ async function authenticateInternal(useDID = true) {
1779
1783
  try {
1780
1784
  // Check if we need to resolve a Relay volt.
1781
1785
  if (
@@ -1841,13 +1845,11 @@ async function authenticateInternal(createDID = true) {
1841
1845
  );
1842
1846
  }
1843
1847
 
1844
- if (!createDID) {
1848
+ if (!useDID) {
1845
1849
  authenticateRequest.public_key = publicKeyPem;
1846
- } else {
1847
- if (!this._credential.cache.identity_id) {
1848
- // If we don't have an identity id, then we need to create a DID.
1849
- this._credential.cache.identity_id = `did:volt:${uuid.v4()}`;
1850
- }
1850
+ } else if (!this._credential.cache.identity_id) {
1851
+ // If we don't have an identity id, then we need to create a DID.
1852
+ this._credential.cache.identity_id = `did:volt:${uuid.v4()}`;
1851
1853
 
1852
1854
  const did = this._credential.cache.identity_id;
1853
1855
 
@@ -1903,6 +1905,8 @@ async function authenticateInternal(createDID = true) {
1903
1905
 
1904
1906
  log$1("did document is %s", authenticateRequest.did_document);
1905
1907
  log$1("did signature is %s", authenticateRequest.did_document_signature);
1908
+ } else {
1909
+ authenticateRequest.did = this._credential.cache.identity_id;
1906
1910
  }
1907
1911
 
1908
1912
  log$1("authenticate TTL is ", this._config.bindRequestTTL);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.16.0-beta.3",
6
+ "version": "0.16.0-beta.5",
7
7
  "description": "tdx Volt library for nodejs clients",
8
8
  "type": "module",
9
9
  "exports": {
@@ -91,7 +91,7 @@ function findDIDDocumentService(document, serviceType) {
91
91
  return matches;
92
92
  }
93
93
 
94
- export async function authenticateInternal(createDID = true) {
94
+ export async function authenticateInternal(useDID = true) {
95
95
  try {
96
96
  // Check if we need to resolve a Relay volt.
97
97
  if (
@@ -157,13 +157,11 @@ export async function authenticateInternal(createDID = true) {
157
157
  );
158
158
  }
159
159
 
160
- if (!createDID) {
160
+ if (!useDID) {
161
161
  authenticateRequest.public_key = publicKeyPem;
162
- } else {
163
- if (!this._credential.cache.identity_id) {
164
- // If we don't have an identity id, then we need to create a DID.
165
- this._credential.cache.identity_id = `did:volt:${generateId()}`;
166
- }
162
+ } else if (!this._credential.cache.identity_id) {
163
+ // If we don't have an identity id, then we need to create a DID.
164
+ this._credential.cache.identity_id = `did:volt:${generateId()}`;
167
165
 
168
166
  const did = this._credential.cache.identity_id;
169
167
 
@@ -219,6 +217,8 @@ export async function authenticateInternal(createDID = true) {
219
217
 
220
218
  log("did document is %s", authenticateRequest.did_document);
221
219
  log("did signature is %s", authenticateRequest.did_document_signature);
220
+ } else {
221
+ authenticateRequest.did = this._credential.cache.identity_id;
222
222
  }
223
223
 
224
224
  log("authenticate TTL is ", this._config.bindRequestTTL);
@@ -69,6 +69,10 @@ export class VoltCredential {
69
69
  return this._cryptoCache;
70
70
  }
71
71
 
72
+ get certificate() {
73
+ return this._cryptoCache.cert;
74
+ }
75
+
72
76
  get sessionId() {
73
77
  return this._cryptoCache.session_id;
74
78
  }