@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
|
@@ -20577,14 +20577,26 @@ var PolygonIdSdk = (function (exports) {
|
|
|
20577
20577
|
* Returns profile DID based on did and profile nonce
|
|
20578
20578
|
*
|
|
20579
20579
|
* @param {DID} [did] - did from which profile will be derived
|
|
20580
|
-
* @param {number} [profileNonce] - profile nonce
|
|
20580
|
+
* @param {number | string} [profileNonce] - profile nonce
|
|
20581
20581
|
* @returns {DID}
|
|
20582
20582
|
*/
|
|
20583
20583
|
const generateProfileDID = (did, profileNonce) => {
|
|
20584
20584
|
const id = Z$2.idFromDID(did);
|
|
20585
|
-
|
|
20585
|
+
profileNonce = profileNonce ?? 0;
|
|
20586
|
+
if (!isBigInt(profileNonce)) {
|
|
20587
|
+
throw new Error('profile must be number or decimal string');
|
|
20588
|
+
}
|
|
20589
|
+
const profile = H$2.profileId(id, BigInt(profileNonce));
|
|
20586
20590
|
return Z$2.parseFromId(profile);
|
|
20587
20591
|
};
|
|
20592
|
+
const isBigInt = (x) => {
|
|
20593
|
+
try {
|
|
20594
|
+
return BigInt(x).toString() === x.toString();
|
|
20595
|
+
}
|
|
20596
|
+
catch {
|
|
20597
|
+
return false; // conversion to BigInt failed, surely it is not a BigInt
|
|
20598
|
+
}
|
|
20599
|
+
};
|
|
20588
20600
|
|
|
20589
20601
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
20590
20602
|
// require the crypto API and do not support built-in fallback to lower quality random number
|