@0xpolygonid/js-sdk 1.18.4 → 1.19.0
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/dist/browser/esm/index.js +14 -2
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +14 -2
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/identity/common.js +14 -2
- package/dist/node/esm/identity/common.js +14 -2
- package/dist/types/iden3comm/types/packer.d.ts +1 -1
- package/dist/types/identity/common.d.ts +2 -2
- package/dist/types/identity/identity-wallet.d.ts +5 -5
- package/dist/types/proof/proof-service.d.ts +0 -1
- package/dist/types/proof/provers/inputs-generator.d.ts +2 -2
- package/dist/types/storage/entities/identity.d.ts +1 -1
- package/package.json +1 -1
|
@@ -20438,14 +20438,26 @@ const defineMerklizedRootPosition = (metadata, position) => {
|
|
|
20438
20438
|
* Returns profile DID based on did and profile nonce
|
|
20439
20439
|
*
|
|
20440
20440
|
* @param {DID} [did] - did from which profile will be derived
|
|
20441
|
-
* @param {number} [profileNonce] - profile nonce
|
|
20441
|
+
* @param {number | string} [profileNonce] - profile nonce
|
|
20442
20442
|
* @returns {DID}
|
|
20443
20443
|
*/
|
|
20444
20444
|
const generateProfileDID = (did, profileNonce) => {
|
|
20445
20445
|
const id = DID.idFromDID(did);
|
|
20446
|
-
|
|
20446
|
+
profileNonce = profileNonce ?? 0;
|
|
20447
|
+
if (!isBigInt(profileNonce)) {
|
|
20448
|
+
throw new Error('profile must be number or decimal string');
|
|
20449
|
+
}
|
|
20450
|
+
const profile = Id$1.profileId(id, BigInt(profileNonce));
|
|
20447
20451
|
return DID.parseFromId(profile);
|
|
20448
20452
|
};
|
|
20453
|
+
const isBigInt = (x) => {
|
|
20454
|
+
try {
|
|
20455
|
+
return BigInt(x).toString() === x.toString();
|
|
20456
|
+
}
|
|
20457
|
+
catch {
|
|
20458
|
+
return false; // conversion to BigInt failed, surely it is not a BigInt
|
|
20459
|
+
}
|
|
20460
|
+
};
|
|
20449
20461
|
|
|
20450
20462
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
20451
20463
|
// require the crypto API and do not support built-in fallback to lower quality random number
|