Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pushprotocol/restapi

Package Overview
Dependencies
Maintainers
1
Versions
251
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pushprotocol/restapi - npm Package Compare versions

Comparing version 1.2.11 to 1.2.12

20

CHANGELOG.md

@@ -5,2 +5,22 @@ # Changelog

## [1.2.12](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.2.11...restapi-1.2.12) (2023-05-08)
### Bug Fixes
* change preid to alpha ([#358](https://github.com/ethereum-push-notification-service/push-sdk/issues/358)) ([6ac2c23](https://github.com/ethereum-push-notification-service/push-sdk/commit/6ac2c23c5e4a9f54f8bd6ae99aeb77c96417aae3))
* changed AdditionalMeta structure ([#349](https://github.com/ethereum-push-notification-service/push-sdk/issues/349)) ([ee8ca02](https://github.com/ethereum-push-notification-service/push-sdk/commit/ee8ca022b2d948d08fa8503616898ff6c773062e))
## [1.2.12](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.2.11...restapi-1.2.12) (2023-05-08)
### Bug Fixes
* change preid to alpha ([#358](https://github.com/ethereum-push-notification-service/push-sdk/issues/358)) ([6ac2c23](https://github.com/ethereum-push-notification-service/push-sdk/commit/6ac2c23c5e4a9f54f8bd6ae99aeb77c96417aae3))
* changed AdditionalMeta structure ([#349](https://github.com/ethereum-push-notification-service/push-sdk/issues/349)) ([ee8ca02](https://github.com/ethereum-push-notification-service/push-sdk/commit/ee8ca022b2d948d08fa8503616898ff6c773062e))
## [1.2.11](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-beta.1...restapi-1.2.11) (2023-05-08)

@@ -7,0 +27,0 @@

2

package.json
{
"name": "@pushprotocol/restapi",
"version": "1.2.11",
"version": "1.2.12",
"type": "commonjs",

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

@@ -10,3 +10,3 @@ export declare const API_BASE_URL: {

};
export declare type ALIAS_CHAIN = 'POLYGON' | 'BSC' | 'OPTIMISM';
export declare type ALIAS_CHAIN = 'POLYGON' | 'BSC' | 'OPTIMISM' | 'POLYGONZKEVM';
export declare const ALIAS_CHAIN_ID: {

@@ -31,2 +31,8 @@ POLYGON: {

};
POLYGONZKEVM: {
prod: number;
staging: number;
dev: number;
local: number;
};
};

@@ -33,0 +39,0 @@ export interface ConfigType {

@@ -25,2 +25,4 @@ "use strict";

OPTIMISM_MAINNET: 'eip155:10',
POLYGON_ZK_EVM_TESTNET: 'eip155:1442',
POLYGON_ZK_EVM_MAINNET: 'eip155:1101'
};

@@ -46,2 +48,8 @@ exports.ALIAS_CHAIN_ID = {

},
POLYGONZKEVM: {
[ENV.PROD]: 1101,
[ENV.STAGING]: 1442,
[ENV.DEV]: 1442,
[ENV.LOCAL]: 420,
}
};

@@ -64,4 +72,8 @@ const CONFIG = {

API_BASE_URL: exports.API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa'
},
[BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_MAINNET]: {
API_BASE_URL: exports.API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa'
}
},

@@ -83,4 +95,8 @@ [ENV.STAGING]: {

API_BASE_URL: exports.API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa'
},
[BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: {
API_BASE_URL: exports.API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa'
}
},

@@ -102,4 +118,8 @@ [ENV.DEV]: {

API_BASE_URL: exports.API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x4305D572F2bf38Fc2AE8D0172055b1EFd18F57a6',
EPNS_COMMUNICATOR_CONTRACT: '0x4305D572F2bf38Fc2AE8D0172055b1EFd18F57a6'
},
[BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: {
API_BASE_URL: exports.API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572'
}
},

@@ -123,2 +143,6 @@ [ENV.LOCAL]: {

},
[BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: {
API_BASE_URL: exports.API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572'
}
},

@@ -125,0 +149,0 @@ };

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

DEV_CHAIN_ID: 99999,
NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420],
NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101],
ETH_CHAINS: [1, 5],

@@ -27,0 +27,0 @@ ENC_TYPE_V1: 'x25519-xsalsa20-poly1305',

@@ -17,3 +17,5 @@ import * as metamaskSigUtil from '@metamask/eth-sig-util';

additionalMeta?: {
password?: string;
NFTPGP_V1?: {
password: string;
};
};

@@ -47,4 +49,6 @@ progressHook?: (progress: ProgressHookType) => void;

export declare const decryptV2: (encryptedData: encryptedPrivateKeyTypeV2, secret: Uint8Array, additionalData?: Uint8Array | undefined) => Promise<Uint8Array>;
export declare const encryptPGPKey: (encryptionType: string, privateKey: string, wallet: walletType, addtionalMeta?: {
password?: string | undefined;
export declare const encryptPGPKey: (encryptionType: string, privateKey: string, wallet: walletType, additionalMeta?: {
NFTPGP_V1?: {
password: string;
} | undefined;
} | undefined) => Promise<encryptedPrivateKeyType>;

@@ -51,0 +55,0 @@ export declare const preparePGPPublicKey: (encryptionType: string, publicKey: string, wallet: walletType) => Promise<string>;

@@ -133,4 +133,4 @@ "use strict";

let password = null;
if (additionalMeta === null || additionalMeta === void 0 ? void 0 : additionalMeta.password) {
password = additionalMeta.password;
if (additionalMeta === null || additionalMeta === void 0 ? void 0 : additionalMeta.NFTPGP_V1) {
password = additionalMeta.NFTPGP_V1.password;
}

@@ -322,4 +322,4 @@ else {

exports.decryptV2 = decryptV2;
const encryptPGPKey = (encryptionType, privateKey, wallet, addtionalMeta) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
var _c, _d;
const encryptPGPKey = (encryptionType, privateKey, wallet, additionalMeta) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
var _c, _d, _e;
let encryptedPrivateKey;

@@ -352,3 +352,3 @@ switch (encryptionType) {

case constants_1.default.ENC_TYPE_V4: {
if (!(addtionalMeta === null || addtionalMeta === void 0 ? void 0 : addtionalMeta.password)) {
if (!((_e = additionalMeta === null || additionalMeta === void 0 ? void 0 : additionalMeta.NFTPGP_V1) === null || _e === void 0 ? void 0 : _e.password)) {
throw new Error('Password is required!');

@@ -358,3 +358,3 @@ }

const encodedPrivateKey = enc.encode(privateKey);
encryptedPrivateKey = yield (0, exports.encryptV2)(encodedPrivateKey, (0, exports.hexToBytes)((0, exports.stringToHex)(addtionalMeta === null || addtionalMeta === void 0 ? void 0 : addtionalMeta.password)));
encryptedPrivateKey = yield (0, exports.encryptV2)(encodedPrivateKey, (0, exports.hexToBytes)((0, exports.stringToHex)(additionalMeta.NFTPGP_V1.password)));
encryptedPrivateKey.version = constants_1.default.ENC_TYPE_V4;

@@ -361,0 +361,0 @@ encryptedPrivateKey.preKey = '';

@@ -14,2 +14,4 @@ export interface ChainIdToSourceType {

OPTIMISM_TESTNET: string;
POLYGON_ZK_EVM_TESTNET: string;
POLYGON_ZK_EVM_MAINNET: string;
THE_GRAPH: string;

@@ -16,0 +18,0 @@ PUSH_VIDEO: string;

@@ -5,10 +5,12 @@ "use strict";

exports.CHAIN_ID_TO_SOURCE = {
1: 'ETH_MAINNET',
5: 'ETH_TEST_GOERLI',
137: 'POLYGON_MAINNET',
80001: 'POLYGON_TEST_MUMBAI',
56: 'BSC_MAINNET',
97: 'BSC_TESTNET',
10: 'OPTIMISM_MAINNET',
420: 'OPTIMISM_TESTNET',
1: "ETH_MAINNET",
5: "ETH_TEST_GOERLI",
137: "POLYGON_MAINNET",
80001: "POLYGON_TEST_MUMBAI",
56: "BSC_MAINNET",
97: "BSC_TESTNET",
10: "OPTIMISM_MAINNET",
420: "OPTIMISM_TESTNET",
1442: "POLYGON_ZK_EVM_TESTNET",
1101: "POLYGON_ZK_EVM_MAINNET"
};

@@ -24,2 +26,4 @@ exports.SOURCE_TYPES = {

OPTIMISM_TESTNET: 'OPTIMISM_TESTNET',
POLYGON_ZK_EVM_TESTNET: 'POLYGON_ZK_EVM_TESTNET',
POLYGON_ZK_EVM_MAINNET: 'POLYGON_ZK_EVM_MAINNET',
THE_GRAPH: 'THE_GRAPH',

@@ -26,0 +30,0 @@ PUSH_VIDEO: 'PUSH_VIDEO',

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

// EVM based chains
if ([1, 5, 42, 137, 80001, 56, 97, 10, 420].includes(chainId)) {
if ([1, 5, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101].includes(chainId)) {
return `eip155:${chainId}:${address}`;

@@ -215,0 +215,0 @@ }

@@ -9,3 +9,5 @@ import Constants, { ENV } from '../constants';

additionalMeta?: {
password?: string;
NFTPGP_V1?: {
password: string;
};
};

@@ -12,0 +14,0 @@ progressHook?: (progress: ProgressHookType) => void;

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

const create = (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
const { env = constants_1.default.ENV.PROD, account = null, signer = null, version = constants_1.default.ENC_TYPE_V3, additionalMeta, progressHook, } = options || {};
var _a, _b;
const passPrefix = '$0Pc'; //password prefix to ensure password validation
const { env = constants_1.default.ENV.PROD, account = null, signer = null, version = constants_1.default.ENC_TYPE_V3, additionalMeta = {
NFTPGP_V1: {
password: passPrefix + (0, helpers_1.generateRandomSecret)(10),
},
}, progressHook, } = options || {};
try {

@@ -20,4 +26,4 @@ if (account == null && signer == null) {

}
if (additionalMeta && additionalMeta.password) {
(0, helpers_2.validatePssword)(additionalMeta.password);
if ((_a = additionalMeta === null || additionalMeta === void 0 ? void 0 : additionalMeta.NFTPGP_V1) === null || _a === void 0 ? void 0 : _a.password) {
(0, helpers_2.validatePssword)(additionalMeta.NFTPGP_V1.password);
}

@@ -58,12 +64,5 @@ const caip10 = (0, helpers_2.walletToPCAIP10)(address);

});
let password;
if (!(additionalMeta === null || additionalMeta === void 0 ? void 0 : additionalMeta.password)) {
password = (0, helpers_1.generateRandomSecret)(10);
}
else {
password = additionalMeta.password;
}
const encryptedPrivateKey = yield (0, helpers_2.encryptPGPKey)(encryptionType, keyPairs.privateKeyArmored, wallet, { password: password });
const encryptedPrivateKey = yield (0, helpers_2.encryptPGPKey)(encryptionType, keyPairs.privateKeyArmored, wallet, additionalMeta);
if (encryptionType === constants_1.default.ENC_TYPE_V4) {
const encryptedPassword = yield (0, helpers_2.encryptPGPKey)(constants_1.default.ENC_TYPE_V3, password, wallet, additionalMeta);
const encryptedPassword = yield (0, helpers_2.encryptPGPKey)(constants_1.default.ENC_TYPE_V3, (_b = additionalMeta.NFTPGP_V1) === null || _b === void 0 ? void 0 : _b.password, wallet, additionalMeta);
encryptedPrivateKey.encryptedPassword = encryptedPassword;

@@ -70,0 +69,0 @@ }

@@ -8,3 +8,5 @@ import { ENV } from '../constants';

additionalMeta?: {
password?: string;
NFTPGP_V1?: {
password: string;
};
};

@@ -11,0 +13,0 @@ progressHook?: (progress: ProgressHookType) => void;

@@ -20,2 +20,3 @@ "use strict";

const upgrade = (options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
var _a;
const { env = constants_1.default.ENV.PROD, account = null, signer = null, additionalMeta, progressHook, } = options || {};

@@ -77,3 +78,3 @@ try {

if (encryptionType === constants_1.default.ENC_TYPE_V4) {
const encryptedPassword = yield (0, helpers_2.encryptPGPKey)(constants_1.default.ENC_TYPE_V3, additionalMeta === null || additionalMeta === void 0 ? void 0 : additionalMeta.password, wallet, additionalMeta);
const encryptedPassword = yield (0, helpers_2.encryptPGPKey)(constants_1.default.ENC_TYPE_V3, (_a = additionalMeta === null || additionalMeta === void 0 ? void 0 : additionalMeta.NFTPGP_V1) === null || _a === void 0 ? void 0 : _a.password, wallet, additionalMeta);
encryptedPrivateKey.encryptedPassword = encryptedPassword;

@@ -80,0 +81,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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