stated-protocol-parser 1.0.3 → 1.0.4

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.
Files changed (46) hide show
  1. package/dist/constants.d.ts +1 -0
  2. package/dist/constants.d.ts.map +1 -0
  3. package/dist/constants.js +17 -19
  4. package/dist/constants.js.map +1 -0
  5. package/dist/hash.browser.d.ts +1 -0
  6. package/dist/hash.browser.d.ts.map +1 -0
  7. package/dist/hash.browser.js +6 -12
  8. package/dist/hash.browser.js.map +1 -0
  9. package/dist/hash.node.d.ts +1 -0
  10. package/dist/hash.node.d.ts.map +1 -0
  11. package/dist/hash.node.js +8 -17
  12. package/dist/hash.node.js.map +1 -0
  13. package/dist/hash.test.d.ts +2 -0
  14. package/dist/hash.test.d.ts.map +1 -0
  15. package/dist/hash.test.js +181 -0
  16. package/dist/hash.test.js.map +1 -0
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +47 -95
  20. package/dist/index.js.map +1 -0
  21. package/dist/index.test.d.ts +2 -0
  22. package/dist/index.test.d.ts.map +1 -0
  23. package/dist/index.test.js +293 -0
  24. package/dist/index.test.js.map +1 -0
  25. package/dist/types.d.ts +1 -0
  26. package/dist/types.d.ts.map +1 -0
  27. package/dist/types.js +2 -2
  28. package/dist/types.js.map +1 -0
  29. package/dist/utils.d.ts +1 -0
  30. package/dist/utils.d.ts.map +1 -0
  31. package/dist/utils.js +13 -17
  32. package/dist/utils.js.map +1 -0
  33. package/dist/v3.d.ts +1 -0
  34. package/dist/v3.d.ts.map +1 -0
  35. package/dist/v3.js +4 -7
  36. package/dist/v3.js.map +1 -0
  37. package/package.json +2 -1
  38. package/src/constants.ts +61 -0
  39. package/src/hash.browser.ts +65 -0
  40. package/src/hash.node.ts +47 -0
  41. package/src/hash.test.ts +217 -0
  42. package/src/index.test.ts +378 -0
  43. package/src/index.ts +678 -0
  44. package/src/types.ts +186 -0
  45. package/src/utils.ts +18 -0
  46. package/src/v3.ts +62 -0
@@ -44,3 +44,4 @@ export declare const ratingKeys: RegExp;
44
44
  export declare const BountyKeys: RegExp;
45
45
  export declare const ObservationKeys: RegExp;
46
46
  export declare const BoycottKeys: RegExp;
47
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;CAKtB,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;CAgB1B,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;CAS9B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,MAAkI,CAAA;AAE1J,eAAO,MAAM,QAAQ,QAAmX,CAAA;AAExY,eAAO,MAAM,4BAA4B,QAAgV,CAAA;AAEzX,eAAO,MAAM,sBAAsB,QAAqP,CAAA;AAExR,eAAO,MAAM,QAAQ,QAAwC,CAAA;AAE7D,eAAO,MAAM,uBAAuB,QAA6F,CAAA;AAEjI,eAAO,MAAM,kBAAkB,QAA6F,CAAA;AAE5H,eAAO,MAAM,YAAY,QAAuD,CAAA;AAEhF,eAAO,MAAM,cAAc,QAA2C,CAAA;AAEtE,eAAO,MAAM,UAAU,QAAyI,CAAA;AAEhK,eAAO,MAAM,UAAU,QAA8L,CAAA;AAErN,eAAO,MAAM,eAAe,QAA8J,CAAA;AAE1L,eAAO,MAAM,WAAW,QAAkE,CAAA"}
package/dist/constants.js CHANGED
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BoycottKeys = exports.ObservationKeys = exports.BountyKeys = exports.ratingKeys = exports.PDFSigningKeys = exports.responseKeys = exports.disputeContentKeys = exports.disputeAuthenticityKeys = exports.voteKeys = exports.personVerificationKeys = exports.organisationVerificationKeys = exports.pollKeys = exports.UTCFormat = exports.peopleCountBuckets = exports.statementTypes = exports.legalForms = void 0;
4
- exports.legalForms = {
1
+ export const legalForms = {
5
2
  local_government: 'local government',
6
3
  state_government: 'state government',
7
4
  foreign_affairs_ministry: 'foreign affairs ministry',
8
5
  corporation: 'corporation',
9
6
  };
10
- exports.statementTypes = {
7
+ export const statementTypes = {
11
8
  statement: 'statement',
12
9
  quotation: 'quotation',
13
10
  organisationVerification: 'organisation_verification',
@@ -24,7 +21,7 @@ exports.statementTypes = {
24
21
  bounty: "bounty",
25
22
  unsupported: "unsupported",
26
23
  };
27
- exports.peopleCountBuckets = {
24
+ export const peopleCountBuckets = {
28
25
  "0": "0-10",
29
26
  "10": "10-100",
30
27
  "100": "100-1000",
@@ -34,16 +31,17 @@ exports.peopleCountBuckets = {
34
31
  "1000000": "1,000,000+",
35
32
  "10000000": "10,000,000+",
36
33
  };
37
- exports.UTCFormat = /(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT/;
38
- exports.pollKeys = /(Type: |The poll outcome is finalized when the following nodes agree: |Voting deadline: |Poll: |Option 1: |Option 2: |Option 3: |Option 4: |Option 5: |Allow free text votes: |Who can vote: |Description: |Country scope: |City scope: |Legal form scope: |Domain scope: |All entities with the following property: |As observed by: |Link to query defining who can vote: )/g;
39
- exports.organisationVerificationKeys = /(Type: |Description: |Name: |English name: |Country: |Legal entity: |Legal form: |Department using the domain: |Owner of the domain: |Foreign domain used for publishing statements: |Province or state: |Business register number: |City: |Longitude: |Latitude: |Population: |Logo: |Employee count: |Reliability policy: |Confidence: )/g;
40
- exports.personVerificationKeys = /(Type: |Description: |Name: |Date of birth: |City of birth: |Country of birth: |Job title: |Employer: |Owner of the domain: |Foreign domain used for publishing statements: |Picture: |Verification method: |Confidence: |Reliability policy: )/g;
41
- exports.voteKeys = /(Type: |Poll id: |Poll: |Option: )/g;
42
- exports.disputeAuthenticityKeys = /(Type: |Description: |Hash of referenced statement: |Confidence: |Reliability policy: )/g;
43
- exports.disputeContentKeys = /(Type: |Description: |Hash of referenced statement: |Confidence: |Reliability policy: )/g;
44
- exports.responseKeys = /(Type: |Hash of referenced statement: |Response: )/;
45
- exports.PDFSigningKeys = /(Type: |Description: |PDF file hash: )/;
46
- exports.ratingKeys = /(Type: |Subject type: |Subject name: |URL that identifies the subject: |Document file hash: |Rated quality: |Our rating: |Comment: )/;
47
- exports.BountyKeys = /(Type: |In order to: |We will reward any entity that: |The reward is: |In case of dispute, bounty claims are judged by: |The judge will be paid per investigated case with a maxium of: )/;
48
- exports.ObservationKeys = /(Type: |Approach: |Confidence: |Reliability policy: |Subject: |Subject identity reference: |Observation reference: |Observed property: |Observed value: )/;
49
- exports.BoycottKeys = /(Type: |Description: |Subject: |Subject identity reference: )/;
34
+ export const UTCFormat = /(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT/;
35
+ export const pollKeys = /(Type: |The poll outcome is finalized when the following nodes agree: |Voting deadline: |Poll: |Option 1: |Option 2: |Option 3: |Option 4: |Option 5: |Allow free text votes: |Who can vote: |Description: |Country scope: |City scope: |Legal form scope: |Domain scope: |All entities with the following property: |As observed by: |Link to query defining who can vote: )/g;
36
+ export const organisationVerificationKeys = /(Type: |Description: |Name: |English name: |Country: |Legal entity: |Legal form: |Department using the domain: |Owner of the domain: |Foreign domain used for publishing statements: |Province or state: |Business register number: |City: |Longitude: |Latitude: |Population: |Logo: |Employee count: |Reliability policy: |Confidence: )/g;
37
+ export const personVerificationKeys = /(Type: |Description: |Name: |Date of birth: |City of birth: |Country of birth: |Job title: |Employer: |Owner of the domain: |Foreign domain used for publishing statements: |Picture: |Verification method: |Confidence: |Reliability policy: )/g;
38
+ export const voteKeys = /(Type: |Poll id: |Poll: |Option: )/g;
39
+ export const disputeAuthenticityKeys = /(Type: |Description: |Hash of referenced statement: |Confidence: |Reliability policy: )/g;
40
+ export const disputeContentKeys = /(Type: |Description: |Hash of referenced statement: |Confidence: |Reliability policy: )/g;
41
+ export const responseKeys = /(Type: |Hash of referenced statement: |Response: )/;
42
+ export const PDFSigningKeys = /(Type: |Description: |PDF file hash: )/;
43
+ export const ratingKeys = /(Type: |Subject type: |Subject name: |URL that identifies the subject: |Document file hash: |Rated quality: |Our rating: |Comment: )/;
44
+ export const BountyKeys = /(Type: |In order to: |We will reward any entity that: |The reward is: |In case of dispute, bounty claims are judged by: |The judge will be paid per investigated case with a maxium of: )/;
45
+ export const ObservationKeys = /(Type: |Approach: |Confidence: |Reliability policy: |Subject: |Subject identity reference: |Observation reference: |Observed property: |Observed value: )/;
46
+ export const BoycottKeys = /(Type: |Description: |Subject: |Subject identity reference: )/;
47
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,wBAAwB,EAAE,0BAA0B;IACpD,WAAW,EAAE,aAAa;CAC7B,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,wBAAwB,EAAE,2BAA2B;IACrD,kBAAkB,EAAE,qBAAqB;IACzC,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,2BAA2B;IAC3C,mBAAmB,EAAE,gCAAgC;IACrD,OAAO,EAAE,SAAS;IAClB,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,UAAU;IACnB,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,aAAa;CAC7B,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,gBAAgB;IACzB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE,aAAa;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAW,yHAAyH,CAAA;AAE1J,MAAM,CAAC,MAAM,QAAQ,GAAG,gXAAgX,CAAA;AAExY,MAAM,CAAC,MAAM,4BAA4B,GAAG,6UAA6U,CAAA;AAEzX,MAAM,CAAC,MAAM,sBAAsB,GAAG,kPAAkP,CAAA;AAExR,MAAM,CAAC,MAAM,QAAQ,GAAG,qCAAqC,CAAA;AAE7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,0FAA0F,CAAA;AAEjI,MAAM,CAAC,MAAM,kBAAkB,GAAG,0FAA0F,CAAA;AAE5H,MAAM,CAAC,MAAM,YAAY,GAAG,oDAAoD,CAAA;AAEhF,MAAM,CAAC,MAAM,cAAc,GAAG,wCAAwC,CAAA;AAEtE,MAAM,CAAC,MAAM,UAAU,GAAG,sIAAsI,CAAA;AAEhK,MAAM,CAAC,MAAM,UAAU,GAAG,2LAA2L,CAAA;AAErN,MAAM,CAAC,MAAM,eAAe,GAAG,2JAA2J,CAAA;AAE1L,MAAM,CAAC,MAAM,WAAW,GAAG,+DAA+D,CAAA"}
@@ -28,3 +28,4 @@ export declare const fromUrlSafeBase64: (urlSafe: string) => string;
28
28
  * @returns URL-safe base64 string without padding
29
29
  */
30
30
  export declare const toUrlSafeBase64: (base64: string) => string;
31
+ //# sourceMappingURL=hash.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.browser.d.ts","sourceRoot":"","sources":["../src/hash.browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAU,OAAO,MAAM,GAAG,UAAU,KAAG,OAAO,CAAC,MAAM,CAqBvE,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAU,SAAS,MAAM,GAAG,UAAU,EAAE,MAAM,MAAM,KAAG,OAAO,CAAC,OAAO,CAGxF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,MAKnD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAEhD,CAAA"}
@@ -1,17 +1,14 @@
1
- "use strict";
2
1
  /**
3
2
  * Browser-compatible hash utilities using Web Crypto API
4
3
  * Async operations for client-side use
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.toUrlSafeBase64 = exports.fromUrlSafeBase64 = exports.verify = exports.sha256 = void 0;
8
5
  /**
9
6
  * Compute SHA-256 hash of a string and return it as URL-safe base64
10
7
  * Works in both browser and Node.js environments
11
8
  * @param input - The string or buffer to hash
12
9
  * @returns URL-safe base64 encoded hash
13
10
  */
14
- const sha256 = async (input) => {
11
+ export const sha256 = async (input) => {
15
12
  let data;
16
13
  if (typeof input === 'string') {
17
14
  const encoder = new TextEncoder();
@@ -29,36 +26,33 @@ const sha256 = async (input) => {
29
26
  const urlSafe = base64.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
30
27
  return urlSafe;
31
28
  };
32
- exports.sha256 = sha256;
33
29
  /**
34
30
  * Verify that content matches a given hash
35
31
  * @param content - The content to verify
36
32
  * @param hash - The expected hash
37
33
  * @returns True if the hash matches
38
34
  */
39
- const verify = async (content, hash) => {
40
- const computed = await (0, exports.sha256)(content);
35
+ export const verify = async (content, hash) => {
36
+ const computed = await sha256(content);
41
37
  return computed === hash;
42
38
  };
43
- exports.verify = verify;
44
39
  /**
45
40
  * Convert URL-safe base64 back to standard base64
46
41
  * @param urlSafe - URL-safe base64 string
47
42
  * @returns Standard base64 string with padding
48
43
  */
49
- const fromUrlSafeBase64 = (urlSafe) => {
44
+ export const fromUrlSafeBase64 = (urlSafe) => {
50
45
  const base64 = urlSafe.replace(/-/g, '+').replace(/_/g, '/');
51
46
  // Add padding if needed
52
47
  const padding = '='.repeat((4 - (base64.length % 4)) % 4);
53
48
  return base64 + padding;
54
49
  };
55
- exports.fromUrlSafeBase64 = fromUrlSafeBase64;
56
50
  /**
57
51
  * Convert standard base64 to URL-safe base64
58
52
  * @param base64 - Standard base64 string
59
53
  * @returns URL-safe base64 string without padding
60
54
  */
61
- const toUrlSafeBase64 = (base64) => {
55
+ export const toUrlSafeBase64 = (base64) => {
62
56
  return base64.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
63
57
  };
64
- exports.toUrlSafeBase64 = toUrlSafeBase64;
58
+ //# sourceMappingURL=hash.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.browser.js","sourceRoot":"","sources":["../src/hash.browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,KAA0B,EAAmB,EAAE;IACxE,IAAI,IAAgB,CAAC;IAErB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAClC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;SAAM,CAAC;QACJ,IAAI,GAAG,KAAK,CAAC;IACjB,CAAC;IAED,yEAAyE;IACzE,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzD,oBAAoB;IACpB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAEvD,kEAAkE;IAClE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEjF,OAAO,OAAO,CAAC;AACnB,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAA4B,EAAE,IAAY,EAAoB,EAAE;IACzF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,QAAQ,KAAK,IAAI,CAAC;AAC7B,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAU,EAAE;IACzD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC7D,wBAAwB;IACxB,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,MAAM,GAAG,OAAO,CAAC;AAC5B,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAc,EAAU,EAAE;IACtD,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC5E,CAAC,CAAA"}
@@ -28,3 +28,4 @@ export declare const fromUrlSafeBase64: (urlSafe: string) => string;
28
28
  * @returns URL-safe base64 string without padding
29
29
  */
30
30
  export declare const toUrlSafeBase64: (base64: string) => string;
31
+ //# sourceMappingURL=hash.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.node.d.ts","sourceRoot":"","sources":["../src/hash.node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,CAAC,UAAU,KAAG,MAIjD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,SAAS,MAAM,CAAC,UAAU,EAAE,MAAM,MAAM,KAAG,OAEjE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,MAInD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAEhD,CAAA"}
package/dist/hash.node.js CHANGED
@@ -1,52 +1,43 @@
1
- "use strict";
2
1
  /**
3
2
  * Node.js-specific hash utilities using native crypto module
4
3
  * Synchronous operations for server-side use
5
4
  */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.toUrlSafeBase64 = exports.fromUrlSafeBase64 = exports.verify = exports.sha256 = void 0;
11
- const crypto_1 = __importDefault(require("crypto"));
5
+ import crypto from 'crypto';
12
6
  /**
13
7
  * Compute SHA-256 hash and return as URL-safe base64 (Node.js)
14
8
  * @param input - String or buffer to hash
15
9
  * @returns URL-safe base64 encoded hash
16
10
  */
17
- const sha256 = (input) => {
18
- const base64 = crypto_1.default.createHash('sha256').update(input).digest('base64');
11
+ export const sha256 = (input) => {
12
+ const base64 = crypto.createHash('sha256').update(input).digest('base64');
19
13
  const urlSafe = base64.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
20
14
  return urlSafe;
21
15
  };
22
- exports.sha256 = sha256;
23
16
  /**
24
17
  * Verify that content matches a given hash
25
18
  * @param content - Content to verify
26
19
  * @param hash - Expected hash
27
20
  * @returns True if hash matches
28
21
  */
29
- const verify = (content, hash) => {
30
- return hash === (0, exports.sha256)(content);
22
+ export const verify = (content, hash) => {
23
+ return hash === sha256(content);
31
24
  };
32
- exports.verify = verify;
33
25
  /**
34
26
  * Convert URL-safe base64 back to standard base64
35
27
  * @param urlSafe - URL-safe base64 string
36
28
  * @returns Standard base64 string with padding
37
29
  */
38
- const fromUrlSafeBase64 = (urlSafe) => {
30
+ export const fromUrlSafeBase64 = (urlSafe) => {
39
31
  const base64 = urlSafe.replace(/-/g, '+').replace(/_/g, '/');
40
32
  const padding = '='.repeat((4 - (base64.length % 4)) % 4);
41
33
  return base64 + padding;
42
34
  };
43
- exports.fromUrlSafeBase64 = fromUrlSafeBase64;
44
35
  /**
45
36
  * Convert standard base64 to URL-safe base64
46
37
  * @param base64 - Standard base64 string
47
38
  * @returns URL-safe base64 string without padding
48
39
  */
49
- const toUrlSafeBase64 = (base64) => {
40
+ export const toUrlSafeBase64 = (base64) => {
50
41
  return base64.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
51
42
  };
52
- exports.toUrlSafeBase64 = toUrlSafeBase64;
43
+ //# sourceMappingURL=hash.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.node.js","sourceRoot":"","sources":["../src/hash.node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAwB,EAAU,EAAE;IACvD,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAChF,OAAO,OAAO,CAAA;AAClB,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAA0B,EAAE,IAAY,EAAW,EAAE;IACxE,OAAO,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAU,EAAE;IACzD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,MAAM,GAAG,OAAO,CAAC;AAC5B,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAc,EAAU,EAAE;IACtD,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC5E,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hash.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.test.d.ts","sourceRoot":"","sources":["../src/hash.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,181 @@
1
+ import { sha256, verify, fromUrlSafeBase64, toUrlSafeBase64 } from './hash.node';
2
+ describe('Hash utilities', () => {
3
+ describe('sha256', () => {
4
+ it('should hash a simple string', () => {
5
+ const input = 'hello world';
6
+ const hash = sha256(input);
7
+ // Verify it's URL-safe (no +, /, or =)
8
+ expect(hash).not.toContain('+');
9
+ expect(hash).not.toContain('/');
10
+ expect(hash).not.toContain('=');
11
+ // Verify consistent output
12
+ const hash2 = sha256(input);
13
+ expect(hash).toBe(hash2);
14
+ });
15
+ it('should produce correct hash for known input', () => {
16
+ const input = 'hello world';
17
+ const expectedHash = 'uU0nuZNNPgilLlLX2n2r-sSE7-N6U4DukIj3rOLvzek';
18
+ const hash = sha256(input);
19
+ expect(hash).toBe(expectedHash);
20
+ });
21
+ it('should handle empty string', () => {
22
+ const hash = sha256('');
23
+ expect(hash).toBeTruthy();
24
+ expect(typeof hash).toBe('string');
25
+ });
26
+ it('should handle unicode characters', () => {
27
+ const input = '你好世界 🌍';
28
+ const hash = sha256(input);
29
+ expect(hash).toBeTruthy();
30
+ expect(typeof hash).toBe('string');
31
+ // Verify consistency
32
+ const hash2 = sha256(input);
33
+ expect(hash).toBe(hash2);
34
+ });
35
+ it('should handle Buffer input', () => {
36
+ const data = Buffer.from('hello world');
37
+ const hash = sha256(data);
38
+ // Should produce same hash as string input
39
+ const stringHash = sha256('hello world');
40
+ expect(hash).toBe(stringHash);
41
+ });
42
+ it('should produce different hashes for different inputs', () => {
43
+ const hash1 = sha256('hello');
44
+ const hash2 = sha256('world');
45
+ expect(hash1).not.toBe(hash2);
46
+ });
47
+ it('should produce 43-character URL-safe base64 string', () => {
48
+ const hash = sha256('test');
49
+ // SHA-256 produces 256 bits = 32 bytes
50
+ // Base64 encoding: 32 bytes * 4/3 = 42.67, rounded up = 43 chars (without padding)
51
+ expect(hash.length).toBe(43);
52
+ });
53
+ });
54
+ describe('verify', () => {
55
+ it('should verify correct hash', () => {
56
+ const content = 'hello world';
57
+ const hash = sha256(content);
58
+ const isValid = verify(content, hash);
59
+ expect(isValid).toBe(true);
60
+ });
61
+ it('should reject incorrect hash', () => {
62
+ const content = 'hello world';
63
+ const wrongHash = 'incorrect_hash_value_here_1234567890';
64
+ const isValid = verify(content, wrongHash);
65
+ expect(isValid).toBe(false);
66
+ });
67
+ it('should reject hash for different content', () => {
68
+ const content1 = 'hello world';
69
+ const content2 = 'goodbye world';
70
+ const hash1 = sha256(content1);
71
+ const isValid = verify(content2, hash1);
72
+ expect(isValid).toBe(false);
73
+ });
74
+ it('should work with Buffer', () => {
75
+ const data = Buffer.from('test data');
76
+ const hash = sha256(data);
77
+ const isValid = verify(data, hash);
78
+ expect(isValid).toBe(true);
79
+ });
80
+ });
81
+ describe('fromUrlSafeBase64', () => {
82
+ it('should convert URL-safe base64 to standard base64', () => {
83
+ // Use a URL-safe string that contains both - and _ characters
84
+ const urlSafe = 'abc-def_ghi';
85
+ const standard = fromUrlSafeBase64(urlSafe);
86
+ // Should replace - with + and _ with /
87
+ expect(standard).toContain('+');
88
+ expect(standard).toContain('/');
89
+ // Should add padding
90
+ expect(standard.endsWith('=')).toBe(true);
91
+ });
92
+ it('should add correct padding', () => {
93
+ // Test different padding scenarios
94
+ const testCases = [
95
+ { input: 'abc', expectedPadding: 1 },
96
+ { input: 'abcd', expectedPadding: 0 },
97
+ { input: 'abcde', expectedPadding: 3 },
98
+ { input: 'abcdef', expectedPadding: 2 },
99
+ ];
100
+ testCases.forEach(({ input, expectedPadding }) => {
101
+ const result = fromUrlSafeBase64(input);
102
+ const paddingCount = (result.match(/=/g) || []).length;
103
+ expect(paddingCount).toBe(expectedPadding);
104
+ });
105
+ });
106
+ it('should handle strings without special characters', () => {
107
+ const input = 'abcdefghijklmnop';
108
+ const result = fromUrlSafeBase64(input);
109
+ expect(result).toBeTruthy();
110
+ });
111
+ });
112
+ describe('toUrlSafeBase64', () => {
113
+ it('should convert standard base64 to URL-safe', () => {
114
+ const standard = 'uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=';
115
+ const urlSafe = toUrlSafeBase64(standard);
116
+ // Should not contain standard base64 special characters
117
+ expect(urlSafe).not.toContain('+');
118
+ expect(urlSafe).not.toContain('/');
119
+ expect(urlSafe).not.toContain('=');
120
+ // Should contain URL-safe replacements
121
+ expect(urlSafe).toContain('-');
122
+ });
123
+ it('should remove padding', () => {
124
+ const withPadding = 'abc=';
125
+ const result = toUrlSafeBase64(withPadding);
126
+ expect(result).not.toContain('=');
127
+ expect(result).toBe('abc');
128
+ });
129
+ it('should be reversible with fromUrlSafeBase64', () => {
130
+ // Start with a standard base64 string with special chars
131
+ const original = 'test+data/with==';
132
+ const urlSafe = toUrlSafeBase64(original);
133
+ const restored = fromUrlSafeBase64(urlSafe);
134
+ // Should restore to equivalent base64 (padding might differ slightly)
135
+ expect(restored.replace(/=+$/, '')).toBe(original.replace(/=+$/, ''));
136
+ });
137
+ });
138
+ describe('Round-trip conversions', () => {
139
+ it('should maintain hash integrity through URL-safe conversion', () => {
140
+ const content = 'test content for hashing';
141
+ const hash = sha256(content);
142
+ // Convert to standard base64 and back
143
+ const standard = fromUrlSafeBase64(hash);
144
+ const backToUrlSafe = toUrlSafeBase64(standard);
145
+ expect(backToUrlSafe).toBe(hash);
146
+ });
147
+ it('should verify hash after conversion', () => {
148
+ const content = 'verification test';
149
+ const hash = sha256(content);
150
+ // Convert and back
151
+ const standard = fromUrlSafeBase64(hash);
152
+ const urlSafe = toUrlSafeBase64(standard);
153
+ // Should still verify
154
+ const isValid = verify(content, urlSafe);
155
+ expect(isValid).toBe(true);
156
+ });
157
+ });
158
+ describe('Edge cases', () => {
159
+ it('should handle very long strings', () => {
160
+ const longString = 'a'.repeat(10000);
161
+ const hash = sha256(longString);
162
+ expect(hash).toBeTruthy();
163
+ expect(hash.length).toBe(43);
164
+ });
165
+ it('should handle special characters', () => {
166
+ const special = '!@#$%^&*()_+-=[]{}|;:,.<>?';
167
+ const hash = sha256(special);
168
+ expect(hash).toBeTruthy();
169
+ const isValid = verify(special, hash);
170
+ expect(isValid).toBe(true);
171
+ });
172
+ it('should handle newlines and whitespace', () => {
173
+ const withNewlines = 'line1\nline2\r\nline3\ttab';
174
+ const hash = sha256(withNewlines);
175
+ expect(hash).toBeTruthy();
176
+ const isValid = verify(withNewlines, hash);
177
+ expect(isValid).toBe(true);
178
+ });
179
+ });
180
+ });
181
+ //# sourceMappingURL=hash.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.test.js","sourceRoot":"","sources":["../src/hash.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEjF,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACnC,MAAM,KAAK,GAAG,aAAa,CAAC;YAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAE3B,uCAAuC;YACvC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAEhC,2BAA2B;YAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5B,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;YACnD,MAAM,KAAK,GAAG,aAAa,CAAC;YAC5B,MAAM,YAAY,GAAG,6CAA6C,CAAC;YACnE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YAClC,MAAM,IAAI,GAAG,MAAM,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ACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -41,3 +41,4 @@ export declare const buildObservation: ({ approach, confidence, reliabilityPolic
41
41
  export declare const parseObservation: (s: string) => Observation;
42
42
  export declare const buildBoycott: ({ description, subject, subjectReference }: Boycott) => string;
43
43
  export declare const parseBoycott: (s: string) => Boycott;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,SAAS,EACT,SAAS,EACT,IAAI,EACJ,wBAAwB,EACxB,kBAAkB,EAClB,IAAI,EACJ,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,UAAU,EACV,MAAM,EAEN,MAAM,EACN,WAAW,EACX,OAAO,EACV,MAAM,SAAS,CAAA;AAKhB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,MAAM,CAAA;AAGpB,cAAc,gBAAgB,CAAA;AAG9B,OAAO,EACH,MAAM,IAAI,UAAU,EACpB,MAAM,IAAI,UAAU,EACpB,iBAAiB,EACjB,eAAe,EAClB,MAAM,aAAa,CAAA;AAGpB,eAAO,MAAM,cAAc,GAAI,8EAA8E,SAAS,WAerH,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,kCAA0C;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,KAClH,SAAS,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAwCvD,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,oHACsB,SAAS,WAgBpE,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,KAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CAgChF,CAAA;AAED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