@signature-kit/i18n 0.1.0 → 0.1.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
+ ## @signature-kit/i18n@0.1.1
2
+
3
+ ### Runtime updates and signature inspection
4
+
5
+ Update to stable Effect 4 and current compatible dependencies. Error classes use the native branded Schema.TaggedError constructor. Use TypeScript 7 for builds and checks with the official TypeScript 6 API compatibility alias. Upgrade direct ASN.1 dependencies to v4, interchange SDK values through DER, and encode timestamp requests with the native RFC 3161 schema. Packages do not require a consumer ASN.1 override.
6
+
7
+ Add per-signature PDF verification, certificate-validity inspection through the Effect clock, and cancellable polling for final request states in all five remote signers. Applications control polling deadlines and retry policy; a terminal request is not necessarily completed.
8
+
9
+ Update the documentation runtime, use the loading task for PDF.js cleanup, and fix dynamic Node routes by forwarding Request.duplex in the Hono adapter. Keep the app and Fumapress on a single Waku runtime.
10
+
11
+ Reject non-finite domain numbers, validate XML signature methods before WebCrypto verification, and preserve unexpected SDK failures as defects. Strengthen native Effect and accessibility lint checks.
12
+
13
+ Add branded PDF stamps with proportional PNG logos and handwriting, theme/title controls, and a PDF-rendered preview. Run browser PDF preparation and preview rendering through native Effect worker RPC with scoped termination and typed validation failures. Preserve caller buffers and signing dates across the worker boundary.
14
+
15
+ Fix structured batch stamp option conflicts, reject badges without usable drawing space, and prevent premeasured text from wrapping into adjacent rows. Restore signer interaction after React StrictMode mount replay and register localized Fumapress demo routes through the framework's native locale option. Add real worker, StrictMode, PDF text-stream, cropped/rotated page, cancellation, and invalid-image regressions.
16
+
1
17
  # Changelog
2
18
 
19
+ ## Unreleased
20
+
21
+ - Keep `errorMessage` a pure lookup over typed `ErrorMessageOptions`; callers decode untrusted values explicitly with `ErrorMessageOptionsSchema`.
22
+
3
23
  ## 0.1.0
4
24
 
5
25
  - Initial release for localized SignatureKit error-message resolution after the
package/README.md CHANGED
@@ -16,6 +16,8 @@ bun add @signature-kit/i18n effect
16
16
 
17
17
  `errorMessage(error, options)` reads `_tag` and `code` structurally. Consumers do not need `instanceof`, `.code` helper wrappers, or reason-string matching.
18
18
 
19
+ `errorMessage` is a pure lookup over the Schema-derived `ErrorMessageOptions` type. Decode untrusted options explicitly with `ErrorMessageOptionsSchema` before calling it.
20
+
19
21
  Resolution order for a known code:
20
22
 
21
23
  1. `overrides[locale][code]`
@@ -48,7 +50,7 @@ const message = errorMessage(error, {
48
50
 
49
51
  ## Errors and i18n
50
52
 
51
- This package is the display layer. Package-specific message catalogs remain beside their `TaggedErrorClass` definitions: `signatureKitErrorMessages`, `pdfErrorMessages`, `xmlErrorMessages`, `cmsErrorMessages`, `cryptoErrorMessages`, and `asn1ErrorMessages`.
53
+ This package is the display layer. Package-specific message catalogs remain beside their `TaggedError` definitions: `signatureKitErrorMessages`, `pdfErrorMessages`, `xmlErrorMessages`, `cmsErrorMessages`, `cryptoErrorMessages`, and `asn1ErrorMessages`.
52
54
 
53
55
  Docs: <https://signaturekit.dev/en-US/docs/signing/errors>.
54
56
 
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,QAAA,MAAM,yBAAyB,8CAA8C,CAAC;AAC9E,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,eAAO,MAAM,sBAAsB,6EAA0D,CAAC;AAC9F,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAIvE,eAAO,MAAM,yBAAyB;;;;;EAKpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAO7E,eAAO,MAAM,8BAA8B,kDAA0C,CAAC;AACtF,MAA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C"}
package/dist/i18n.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Result, Schema } from "effect";
1
+ import { Schema } from "effect";
2
2
  const LocalizedMessageMapSchema = Schema.Record(Schema.String, Schema.String);
3
3
  export const LocalizedCatalogSchema = Schema.Record(Schema.String, LocalizedMessageMapSchema);
4
4
  const ErrorMessageFallbackLocaleSchema = Schema.Literals(["en-US"]);
@@ -35,19 +35,16 @@ const getMessageFromCatalog = (catalog, locale, code) => {
35
35
  };
36
36
  const genericErrorCode = "i18n.GENERIC_ERROR";
37
37
  export const errorMessage = (error, options) => {
38
- const validOptions = Result.getOrThrow(Schema.decodeUnknownResult(ErrorMessageOptionsSchema)(options));
39
- const fallbackLocale = validOptions.fallbackLocale ?? "en-US";
38
+ const fallbackLocale = options.fallbackLocale ?? "en-US";
40
39
  const code = Schema.is(TaggedErrorShapeSchema)(error) ? error.code : undefined;
41
- const overrides = validOptions.overrides;
40
+ const overrides = options.overrides;
42
41
  if (code !== undefined) {
43
- const explicitOverride = overrides === undefined
44
- ? undefined
45
- : getMessageFromCatalog(overrides, validOptions.locale, code);
42
+ const explicitOverride = overrides === undefined ? undefined : getMessageFromCatalog(overrides, options.locale, code);
46
43
  if (explicitOverride !== undefined) {
47
44
  return explicitOverride;
48
45
  }
49
- for (const catalog of validOptions.catalogs) {
50
- const catalogMessage = getMessageFromCatalog(catalog, validOptions.locale, code);
46
+ for (const catalog of options.catalogs) {
47
+ const catalogMessage = getMessageFromCatalog(catalog, options.locale, code);
51
48
  if (catalogMessage !== undefined) {
52
49
  return catalogMessage;
53
50
  }
@@ -56,14 +53,14 @@ export const errorMessage = (error, options) => {
56
53
  if (fallbackLocaleOverride !== undefined) {
57
54
  return fallbackLocaleOverride;
58
55
  }
59
- for (const catalog of validOptions.catalogs) {
56
+ for (const catalog of options.catalogs) {
60
57
  const fallbackCatalogMessage = getMessageFromCatalog(catalog, fallbackLocale, code);
61
58
  if (fallbackCatalogMessage !== undefined) {
62
59
  return fallbackCatalogMessage;
63
60
  }
64
61
  }
65
62
  }
66
- return (getMessageFromCatalog(localizedErrorMessageFallbacks, validOptions.locale, genericErrorCode) ??
63
+ return (getMessageFromCatalog(localizedErrorMessageFallbacks, options.locale, genericErrorCode) ??
67
64
  getMessageFromCatalog(localizedErrorMessageFallbacks, fallbackLocale, genericErrorCode) ??
68
65
  getMessageFromCatalog(localizedErrorMessageFallbacks, "en-US", genericErrorCode) ??
69
66
  "Something went wrong.");
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@signature-kit/i18n",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Licitei/signature-kit.git"
8
+ },
5
9
  "files": [
6
10
  "dist",
7
11
  "README.md",
@@ -22,27 +26,37 @@
22
26
  "access": "public"
23
27
  },
24
28
  "scripts": {
25
- "build": "tsc -b tsconfig.json",
26
- "typecheck": "tsc -p tsconfig.json --noEmit",
27
- "test": "vitest run"
29
+ "test": "vitest run --root ../.. core/i18n/__tests__"
28
30
  },
29
31
  "dependencies": {
30
- "effect": "4.0.0-beta.86"
32
+ "effect": "4.0.5"
31
33
  },
32
34
  "devDependencies": {
33
35
  "@signature-kit/crypto": "^0.2.1",
34
- "@signature-kit/signatures": "^0.1.0"
36
+ "@signature-kit/signatures": "^0.2.0"
35
37
  },
36
38
  "nx": {
37
39
  "implicitDependencies": [
38
- "!@signature-kit/signatures",
39
- "!@signature-kit/crypto"
40
+ "!@signature-kit/crypto",
41
+ "!@signature-kit/signatures"
40
42
  ],
41
43
  "targets": {
44
+ "test": {
45
+ "dependsOn": [
46
+ "build",
47
+ {
48
+ "projects": [
49
+ "@signature-kit/crypto",
50
+ "@signature-kit/signatures"
51
+ ],
52
+ "target": "build"
53
+ }
54
+ ]
55
+ },
42
56
  "npm-pack": {
43
57
  "executor": "nx:run-commands",
44
58
  "options": {
45
- "command": "npm pack --dry-run --json",
59
+ "command": "bun pm pack --dry-run",
46
60
  "cwd": "{projectRoot}"
47
61
  }
48
62
  },