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

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
@@ -1775,7 +1775,7 @@ function findDIDDocumentService(document, serviceType) {
1775
1775
  return matches;
1776
1776
  }
1777
1777
 
1778
- async function authenticateInternal(createDID = true) {
1778
+ async function authenticateInternal(useDID = true) {
1779
1779
  try {
1780
1780
  // Check if we need to resolve a Relay volt.
1781
1781
  if (
@@ -1841,13 +1841,11 @@ async function authenticateInternal(createDID = true) {
1841
1841
  );
1842
1842
  }
1843
1843
 
1844
- if (!createDID) {
1844
+ if (!useDID) {
1845
1845
  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
- }
1846
+ } else if (!this._credential.cache.identity_id) {
1847
+ // If we don't have an identity id, then we need to create a DID.
1848
+ this._credential.cache.identity_id = `did:volt:${uuid.v4()}`;
1851
1849
 
1852
1850
  const did = this._credential.cache.identity_id;
1853
1851
 
@@ -1903,6 +1901,8 @@ async function authenticateInternal(createDID = true) {
1903
1901
 
1904
1902
  log$1("did document is %s", authenticateRequest.did_document);
1905
1903
  log$1("did signature is %s", authenticateRequest.did_document_signature);
1904
+ } else {
1905
+ authenticateRequest.did = this._credential.cache.identity_id;
1906
1906
  }
1907
1907
 
1908
1908
  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.4",
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);