@bsv/sdk 1.3.31 → 1.3.32

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/docs/auth.md CHANGED
@@ -334,6 +334,12 @@ Argument Details
334
334
 
335
335
  Helper function which retrieves the protocol ID and key ID for certificate field encryption.
336
336
 
337
+ For master certificate creation, no serial number is provided because entropy is required
338
+ from both the client and the certifier. In this case, the `keyID` is simply the `fieldName`.
339
+
340
+ For VerifiableCertificates verifier keyring creation, both the serial number and field name are available,
341
+ so the `keyID` is formed by concatenating the `serialNumber` and `fieldName`.
342
+
337
343
  ```ts
338
344
  static getCertificateFieldEncryptionDetails(fieldName: string, serialNumber?: string): {
339
345
  protocolID: WalletProtocol;
@@ -344,16 +350,17 @@ See also: [WalletProtocol](./wallet.md#type-walletprotocol)
344
350
 
345
351
  Returns
346
352
 
347
- An object containing the protocol ID and key ID:
353
+ An object containing:
348
354
  - `protocolID` (WalletProtocol): The protocol ID for certificate field encryption.
349
- - `keyID` (string): A unique key identifier derived from the serial number and field name.
355
+ - `keyID` (string): A unique key identifier. It is the `fieldName` if `serialNumber` is undefined,
356
+ otherwise it is a combination of `serialNumber` and `fieldName`.
350
357
 
351
358
  Argument Details
352
359
 
353
- + **serialNumber**
354
- + The serial number of the certificate.
355
360
  + **fieldName**
356
361
  + The name of the field within the certificate to be encrypted.
362
+ + **serialNumber**
363
+ + (Optional) The serial number of the certificate.
357
364
 
358
365
  #### Method sign
359
366
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/sdk",
3
- "version": "1.3.31",
3
+ "version": "1.3.32",
4
4
  "type": "module",
5
5
  "description": "BSV Blockchain Software Development Kit",
6
6
  "main": "dist/cjs/mod.js",
@@ -258,11 +258,18 @@ export default class Certificate {
258
258
  /**
259
259
  * Helper function which retrieves the protocol ID and key ID for certificate field encryption.
260
260
  *
261
- * @param serialNumber - The serial number of the certificate.
261
+ * For master certificate creation, no serial number is provided because entropy is required
262
+ * from both the client and the certifier. In this case, the `keyID` is simply the `fieldName`.
263
+ *
264
+ * For VerifiableCertificates verifier keyring creation, both the serial number and field name are available,
265
+ * so the `keyID` is formed by concatenating the `serialNumber` and `fieldName`.
266
+ *
262
267
  * @param fieldName - The name of the field within the certificate to be encrypted.
263
- * @returns An object containing the protocol ID and key ID:
268
+ * @param serialNumber - (Optional) The serial number of the certificate.
269
+ * @returns An object containing:
264
270
  * - `protocolID` (WalletProtocol): The protocol ID for certificate field encryption.
265
- * - `keyID` (string): A unique key identifier derived from the serial number and field name.
271
+ * - `keyID` (string): A unique key identifier. It is the `fieldName` if `serialNumber` is undefined,
272
+ * otherwise it is a combination of `serialNumber` and `fieldName`.
266
273
  */
267
274
  static getCertificateFieldEncryptionDetails(
268
275
  fieldName: string,
@@ -270,7 +277,7 @@ export default class Certificate {
270
277
  ): { protocolID: WalletProtocol, keyID: string } {
271
278
  return {
272
279
  protocolID: [2, 'certificate field encryption'],
273
- keyID: `${serialNumber ?? 'unknown'} ${fieldName}`
280
+ keyID: serialNumber ? `${serialNumber} ${fieldName}` : fieldName
274
281
  }
275
282
  }
276
283
  }