Socket
Socket
Sign inDemoInstall

@metamask/ppom-validator

Package Overview
Dependencies
Maintainers
12
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/ppom-validator - npm Package Compare versions

Comparing version 0.22.0 to 0.23.0

9

CHANGELOG.md

@@ -9,2 +9,8 @@ # Changelog

## [0.23.0]
### Changed
- Metadata should be synced for only active networks ([#146](https://github.com/MetaMask/ppom-validator/pull/146))
- Delete files from storage as blockaid preference is disabled ([#145](https://github.com/MetaMask/ppom-validator/pull/145))
- Remove dangling promises ([#136](https://github.com/MetaMask/ppom-validator/pull/136))
## [0.22.0]

@@ -131,3 +137,4 @@ ### Changed

[Unreleased]: https://github.com/MetaMask/ppom-validator/compare/v0.22.0...HEAD
[Unreleased]: https://github.com/MetaMask/ppom-validator/compare/v0.23.0...HEAD
[0.23.0]: https://github.com/MetaMask/ppom-validator/compare/v0.22.0...v0.23.0
[0.22.0]: https://github.com/MetaMask/ppom-validator/compare/v0.21.0...v0.22.0

@@ -134,0 +141,0 @@ [0.21.0]: https://github.com/MetaMask/ppom-validator/compare/v0.20.0...v0.21.0

28

dist/ppom-controller.js

@@ -157,3 +157,3 @@ "use strict";

readMetadata: () => {
return JSON.parse(JSON.stringify(this.state.storageMetadata));
return [...this.state.storageMetadata];
},

@@ -272,2 +272,3 @@ writeMetadata: (metadata) => {

__classPrivateFieldGet(this, _PPOMController_instances, "m", _PPOMController_clearDataFetchIntervals).call(this);
const storageMetadata = { ...this.state.storageMetadata };
this.update((draftState) => {

@@ -289,2 +290,5 @@ draftState.versionInfo = [];

});
__classPrivateFieldGet(this, _PPOMController_storage, "f").deleteAllFiles(storageMetadata).catch((error) => {
console.error(`Error in deleting files: ${error.message}`);
});
}, _PPOMController_onNetworkChange = function _PPOMController_onNetworkChange(networkControllerState) {

@@ -426,11 +430,10 @@ const id = (0, util_1.addHexPrefix)(networkControllerState.providerConfig.chainId);

await (0, util_1.validateSignature)(fileData, fileVersionInfo.hashSignature, __classPrivateFieldGet(this, _PPOMController_blockaidPublicKey, "f"), fileVersionInfo.filePath, __classPrivateFieldGet(this, _PPOMController_nativeCrypto, "f"));
try {
await __classPrivateFieldGet(this, _PPOMController_storage, "f").writeFile({
data: fileData,
...fileVersionInfo,
});
}
catch (error) {
__classPrivateFieldGet(this, _PPOMController_storage, "f")
.writeFile({
data: fileData,
...fileVersionInfo,
})
.catch((error) => {
console.error(`Error in writing file: ${error.message}`);
}
});
return fileData;

@@ -568,4 +571,7 @@ }, _PPOMController_updateVersionInfoForChainId = function _PPOMController_updateVersionInfoForChainId(chainId) {

clearInterval(__classPrivateFieldGet(this, _PPOMController_fileScheduleInterval, "f"));
// eslint-disable-next-line @typescript-eslint/no-floating-promises
__classPrivateFieldGet(this, _PPOMController_storage, "f").syncMetadata(this.state.versionInfo);
const activeChainIds = Object.keys(this.state.chainStatus);
const versionInfoRequired = this.state.versionInfo.filter(({ chainId }) => activeChainIds.includes(chainId));
__classPrivateFieldGet(this, _PPOMController_storage, "f").syncMetadata(versionInfoRequired).catch((exp) => {
console.error(`Error while trying to sync metadata: ${exp.message}`);
});
}

@@ -572,0 +578,0 @@ }, scheduleInterval), "f");

@@ -86,2 +86,8 @@ /**

/**
* Delete all files in storage.
*
* @param metadata - List of all files in storage.
*/
deleteAllFiles(metadata: FileMetadataList): Promise<void>;
/**
* Read the file from the local storage.

@@ -88,0 +94,0 @@ * 1. Check if the file exists in the local storage.

@@ -85,2 +85,18 @@ "use strict";

/**
* Delete all files in storage.
*
* @param metadata - List of all files in storage.
*/
async deleteAllFiles(metadata) {
for (const fileMetadata of metadata) {
const { name, chainId } = fileMetadata;
try {
await __classPrivateFieldGet(this, _PPOMStorage_storageBackend, "f").delete({ name, chainId });
}
catch (exp) {
console.error(`Error in deleting file: ${name}, ${chainId}`, exp);
}
}
}
/**
* Read the file from the local storage.

@@ -87,0 +103,0 @@ * 1. Check if the file exists in the local storage.

{
"name": "@metamask/ppom-validator",
"version": "0.22.0",
"version": "0.23.0",
"description": "This module has code to integrate Blockaid PPOM with MetaMask",

@@ -78,3 +78,3 @@ "homepage": "https://github.com/MetaMask/ppom-validator#readme",

"engines": {
"node": ">=16.0.0"
"node": "^18.18 || >=20"
},

@@ -81,0 +81,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc