oca_package 1.2.3 → 1.3.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/cjs/index.js CHANGED
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.OcaPackage = void 0;
6
+ exports.VerifyOcaPackage = exports.OcaPackage = void 0;
7
7
  var oca_package_js_1 = require("./oca_package.js");
8
8
  Object.defineProperty(exports, "OcaPackage", { enumerable: true, get: function () { return __importDefault(oca_package_js_1).default; } });
9
+ var verify_js_1 = require("./verify.js");
10
+ Object.defineProperty(exports, "VerifyOcaPackage", { enumerable: true, get: function () { return verify_js_1.VerifyOcaPackage; } });
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const extensions_js_1 = __importDefault(require("./oca_extensions/extensions.js"));
7
+ // import { saidify, verify } from 'saidify';
7
8
  const saidify_1 = require("saidify");
8
9
  class OcaPackage {
9
10
  constructor(extension_input_json, oca_bundle) {
@@ -34,5 +35,16 @@ class OcaPackage {
34
35
  GenerateOcaPackage() {
35
36
  return JSON.stringify(this.Saidifying());
36
37
  }
38
+ /**
39
+ * Verifies the OCA package against a digest.
40
+ * @param oca_package - The OCA package to verify.
41
+ * @param digest - The digest to verify against.
42
+ * @returns {boolean} - Returns true if the verification is successful, otherwise false.
43
+ */
44
+ VerifyOcaPackage(oca_package, digest) {
45
+ const label = 'd';
46
+ // prefixed is set to true this avoid d = '' to be considered as a valid self-addressing data
47
+ return (0, saidify_1.verify)(oca_package, digest, label, saidify_1.SAIDDex.Blake3_256, saidify_1.Serials.JSON, true);
48
+ }
37
49
  }
38
50
  exports.default = OcaPackage;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VerifyOcaPackage = VerifyOcaPackage;
4
+ const saidify_1 = require("saidify");
5
+ /**
6
+ * Verifies the OCA package against a digest.
7
+ * @param oca_package - The OCA package to verify.
8
+ * @param digest - The digest to verify against.
9
+ * @returns {boolean} - Returns true if the verification is successful, otherwise false.
10
+ */
11
+ function VerifyOcaPackage(oca_package, digest) {
12
+ const label = 'd';
13
+ // prefixed is set to true this avoid d = '' to be considered as a valid self-addressing data
14
+ return (0, saidify_1.verify)(oca_package, digest, label, saidify_1.SAIDDex.Blake3_256, saidify_1.Serials.JSON, true);
15
+ }
package/dist/esm/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export { default as OcaPackage } from './oca_package.js';
2
+ export { VerifyOcaPackage } from './verify.js';
@@ -1,5 +1,6 @@
1
1
  import ExtensionBox from './oca_extensions/extensions.js';
2
- import { saidify } from 'saidify';
2
+ // import { saidify, verify } from 'saidify';
3
+ import { saidify, verify, SAIDDex, Serials } from 'saidify';
3
4
  class OcaPackage {
4
5
  constructor(extension_input_json, oca_bundle) {
5
6
  this.extensions_box = new ExtensionBox(extension_input_json, oca_bundle);
@@ -29,5 +30,16 @@ class OcaPackage {
29
30
  GenerateOcaPackage() {
30
31
  return JSON.stringify(this.Saidifying());
31
32
  }
33
+ /**
34
+ * Verifies the OCA package against a digest.
35
+ * @param oca_package - The OCA package to verify.
36
+ * @param digest - The digest to verify against.
37
+ * @returns {boolean} - Returns true if the verification is successful, otherwise false.
38
+ */
39
+ VerifyOcaPackage(oca_package, digest) {
40
+ const label = 'd';
41
+ // prefixed is set to true this avoid d = '' to be considered as a valid self-addressing data
42
+ return verify(oca_package, digest, label, SAIDDex.Blake3_256, Serials.JSON, true);
43
+ }
32
44
  }
33
45
  export default OcaPackage;
@@ -0,0 +1,12 @@
1
+ import { verify, SAIDDex, Serials } from 'saidify';
2
+ /**
3
+ * Verifies the OCA package against a digest.
4
+ * @param oca_package - The OCA package to verify.
5
+ * @param digest - The digest to verify against.
6
+ * @returns {boolean} - Returns true if the verification is successful, otherwise false.
7
+ */
8
+ export function VerifyOcaPackage(oca_package, digest) {
9
+ const label = 'd';
10
+ // prefixed is set to true this avoid d = '' to be considered as a valid self-addressing data
11
+ return verify(oca_package, digest, label, SAIDDex.Blake3_256, Serials.JSON, true);
12
+ }
@@ -1,2 +1,3 @@
1
1
  export { default as OcaPackage } from './oca_package.js';
2
+ export { VerifyOcaPackage } from './verify.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
@@ -14,6 +14,13 @@ declare class OcaPackage implements IOcaPackage {
14
14
  Said(): string;
15
15
  private toJSON;
16
16
  GenerateOcaPackage(): string;
17
+ /**
18
+ * Verifies the OCA package against a digest.
19
+ * @param oca_package - The OCA package to verify.
20
+ * @param digest - The digest to verify against.
21
+ * @returns {boolean} - Returns true if the verification is successful, otherwise false.
22
+ */
23
+ VerifyOcaPackage(oca_package: IOcaPackage, digest: string): boolean;
17
24
  }
18
25
  export default OcaPackage;
19
26
  //# sourceMappingURL=oca_package.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oca_package.d.ts","sourceRoot":"","sources":["../../src/oca_package.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,YAAY,CAAC;IAC7B,kBAAkB,IAAI,MAAM,CAAC;IAC7B,IAAI,IAAI,MAAM,CAAC;CAChB;AAED,cAAM,UAAW,YAAW,WAAW;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,YAAY,CAAC;gBAExB,oBAAoB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM;IAKxE,OAAO,CAAC,UAAU;IAKX,IAAI,IAAI,MAAM;IAKrB,OAAO,CAAC,MAAM;IAaP,kBAAkB,IAAI,MAAM;CAGpC;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"oca_package.d.ts","sourceRoot":"","sources":["../../src/oca_package.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIpE,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,YAAY,CAAC;IAC7B,kBAAkB,IAAI,MAAM,CAAC;IAC7B,IAAI,IAAI,MAAM,CAAC;CAChB;AAED,cAAM,UAAW,YAAW,WAAW;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,YAAY,CAAC;gBAExB,oBAAoB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM;IAKxE,OAAO,CAAC,UAAU;IAKX,IAAI,IAAI,MAAM;IAKrB,OAAO,CAAC,MAAM;IAaP,kBAAkB,IAAI,MAAM;IAInC;;;;;OAKG;IACI,gBAAgB,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;CAK3E;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Verifies the OCA package against a digest.
3
+ * @param oca_package - The OCA package to verify.
4
+ * @param digest - The digest to verify against.
5
+ * @returns {boolean} - Returns true if the verification is successful, otherwise false.
6
+ */
7
+ export declare function VerifyOcaPackage(oca_package: any, digest: string): boolean;
8
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/verify.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAI1E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oca_package",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "description": "The wrapper of OCA bundle to generate OCA Package at ADC",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",