@lit-protocol/misc-browser
Advanced tools
Comparing version
@@ -24,3 +24,3 @@ { | ||
], | ||
"version": "6.7.0", | ||
"version": "7.0.0-alpha.0", | ||
"dependencies": { | ||
@@ -30,8 +30,9 @@ "@ethersproject/abstract-provider": "5.7.0", | ||
"@lit-protocol/contracts": "^0.0.63", | ||
"@openagenda/verror": "^3.1.4", | ||
"depd": "^2.0.0", | ||
"ethers": "^5.7.1", | ||
"jszip": "^3.10.1", | ||
"siwe": "^2.0.5", | ||
"@lit-protocol/constants": "6.7.0", | ||
"@lit-protocol/types": "6.7.0", | ||
"@lit-protocol/uint8arrays": "6.7.0", | ||
"siwe": "^2.3.2", | ||
"@lit-protocol/constants": "7.0.0-alpha.0", | ||
"@lit-protocol/types": "7.0.0-alpha.0", | ||
"@lit-protocol/uint8arrays": "7.0.0-alpha.0", | ||
"tslib": "1.14.1" | ||
@@ -38,0 +39,0 @@ }, |
@@ -21,7 +21,7 @@ "use strict"; | ||
if (!item) { | ||
return (0, constants_1.ELeft)({ | ||
message: `Failed to get ${key} from local storage`, | ||
errorKind: constants_1.LIT_ERROR.LOCAL_STORAGE_ITEM_NOT_FOUND_EXCEPTION.kind, | ||
errorCode: constants_1.LIT_ERROR.LOCAL_STORAGE_ITEM_NOT_FOUND_EXCEPTION.name, | ||
}); | ||
return (0, constants_1.ELeft)(new constants_1.LocalStorageItemNotFoundException({ | ||
info: { | ||
storageKey: key, | ||
}, | ||
}, `Failed to get %s from local storage`, key)); | ||
} | ||
@@ -44,6 +44,7 @@ return (0, constants_1.ERight)(item); | ||
catch (e) { | ||
return (0, constants_1.ELeft)({ | ||
message: `Failed to set ${key} in local storage`, | ||
error: constants_1.LIT_ERROR.LOCAL_STORAGE_ITEM_NOT_SET_EXCEPTION, | ||
}); | ||
return (0, constants_1.ELeft)(new constants_1.LocalStorageItemNotSetException({ | ||
info: { | ||
storageKey: key, | ||
}, | ||
}, `Failed to set %s in local storage`, key)); | ||
} | ||
@@ -65,6 +66,7 @@ }; | ||
catch (e) { | ||
return (0, constants_1.ELeft)({ | ||
message: `Failed to remove ${key} from local storage`, | ||
error: constants_1.LIT_ERROR.LOCAL_STORAGE_ITEM_NOT_REMOVED_EXCEPTION, | ||
}); | ||
return (0, constants_1.ELeft)(new constants_1.LocalStorageItemNotRemovedException({ | ||
info: { | ||
storageKey: key, | ||
}, | ||
}, `Failed to remove %s from local storage`, key)); | ||
} | ||
@@ -155,7 +157,15 @@ }; | ||
// data urls are not safe, refuse to do this | ||
throw new Error('You can not inject an iFrame with a data url. Try a regular https URL.'); | ||
throw new constants_1.InvalidArgumentException({ | ||
info: { | ||
fileUrl, | ||
}, | ||
}, 'You can not inject an iFrame with a data url. Try a regular https URL.'); | ||
} | ||
const url = new URL(fileUrl); | ||
if (url.host.toLowerCase() === window.location.host.toLowerCase()) { | ||
throw new Error('You cannot host a LIT on the same domain as the parent webpage. This is because iFrames with the same origin have access to localstorage and cookies in the parent webpage which is unsafe'); | ||
throw new constants_1.InvalidArgumentException({ | ||
info: { | ||
fileUrl, | ||
}, | ||
}, 'You cannot host a LIT on the same domain as the parent webpage. This is because iFrames with the same origin have access to localstorage and cookies in the parent webpage which is unsafe'); | ||
} | ||
@@ -162,0 +172,0 @@ const iframe = Object.assign(document.createElement('iframe'), { |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
15577
2.78%273
3.8%11
10%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated