opticedge-cloud-utils 1.0.44 → 1.0.45

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.
@@ -6,6 +6,7 @@ export declare enum CardApprovalStatus {
6
6
  Approving = 999
7
7
  }
8
8
  export declare enum CardGradingType {
9
+ UNKNOWN = 0,
9
10
  COLLECTION = 1,
10
11
  ADDED = 2,
11
12
  SOLD = 3,
@@ -11,6 +11,7 @@ var CardApprovalStatus;
11
11
  })(CardApprovalStatus || (exports.CardApprovalStatus = CardApprovalStatus = {}));
12
12
  var CardGradingType;
13
13
  (function (CardGradingType) {
14
+ CardGradingType[CardGradingType["UNKNOWN"] = 0] = "UNKNOWN";
14
15
  CardGradingType[CardGradingType["COLLECTION"] = 1] = "COLLECTION";
15
16
  CardGradingType[CardGradingType["ADDED"] = 2] = "ADDED";
16
17
  CardGradingType[CardGradingType["SOLD"] = 3] = "SOLD";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opticedge-cloud-utils",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "Common utilities for cloud functions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/types/card.ts CHANGED
@@ -7,10 +7,11 @@ export enum CardApprovalStatus {
7
7
  }
8
8
 
9
9
  export enum CardGradingType {
10
+ UNKNOWN = 0,
10
11
  COLLECTION = 1,
11
12
  ADDED = 2,
12
13
  SOLD = 3,
13
- CARD_CENTERING = 6,
14
+ CARD_CENTERING = 6
14
15
  }
15
16
 
16
17
  export type MarketReport = {
@@ -1 +0,0 @@
1
- export declare function isValidWebhookSignature(secret: string, body: string, signature: string): boolean;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isValidWebhookSignature = isValidWebhookSignature;
7
- const crypto_1 = __importDefault(require("crypto"));
8
- function isValidWebhookSignature(secret, body, signature) {
9
- const computedSignature = crypto_1.default.createHmac('sha256', secret).update(body).digest('hex');
10
- return computedSignature === signature;
11
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const thirdweb_1 = require("./thirdweb");
7
- const crypto_1 = __importDefault(require("crypto"));
8
- describe('isValidWebhookSignature', () => {
9
- const secret = 'test_secret';
10
- const body = '{"message":"hello"}';
11
- it('returns true for a valid signature', () => {
12
- const validSignature = crypto_1.default.createHmac('sha256', secret).update(body).digest('hex');
13
- expect((0, thirdweb_1.isValidWebhookSignature)(secret, body, validSignature)).toBe(true);
14
- });
15
- it('returns false for an invalid signature', () => {
16
- const invalidSignature = 'invalidsignature123';
17
- expect((0, thirdweb_1.isValidWebhookSignature)(secret, body, invalidSignature)).toBe(false);
18
- });
19
- it('returns false if body or secret is tampered', () => {
20
- const originalSignature = crypto_1.default.createHmac('sha256', secret).update(body).digest('hex');
21
- // wrong body
22
- expect((0, thirdweb_1.isValidWebhookSignature)(secret, '{"message":"tampered"}', originalSignature)).toBe(false);
23
- // wrong secret
24
- expect((0, thirdweb_1.isValidWebhookSignature)('wrong_secret', body, originalSignature)).toBe(false);
25
- });
26
- });