@sebastienrousseau/crypto-server 0.0.2 → 0.0.8

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 (136) hide show
  1. package/README.md +292 -123
  2. package/dist/@types/types.d.ts +34 -14
  3. package/dist/@types/types.d.ts.map +1 -1
  4. package/dist/@types/types.js +15 -0
  5. package/dist/config/auth-policy.d.ts +2 -0
  6. package/dist/config/auth-policy.d.ts.map +1 -0
  7. package/dist/config/auth-policy.js +18 -0
  8. package/dist/config/constants.d.ts +54 -0
  9. package/dist/config/constants.d.ts.map +1 -0
  10. package/dist/config/constants.js +101 -0
  11. package/dist/config/env.d.ts +16 -0
  12. package/dist/config/env.d.ts.map +1 -0
  13. package/dist/config/env.js +74 -0
  14. package/dist/enterprise/metering.d.ts +19 -0
  15. package/dist/enterprise/metering.d.ts.map +1 -0
  16. package/dist/enterprise/metering.js +159 -0
  17. package/dist/enterprise/types.d.ts +78 -0
  18. package/dist/enterprise/types.d.ts.map +1 -0
  19. package/dist/enterprise/types.js +3 -0
  20. package/dist/index.js +38 -74
  21. package/dist/lib/auth.d.ts +14 -0
  22. package/dist/lib/auth.d.ts.map +1 -0
  23. package/dist/lib/auth.js +120 -0
  24. package/dist/lib/logger.d.ts.map +1 -1
  25. package/dist/lib/logger.js +6 -5
  26. package/dist/lib/telemetry.d.ts +4 -0
  27. package/dist/lib/telemetry.d.ts.map +1 -0
  28. package/dist/lib/telemetry.js +92 -0
  29. package/dist/lib/version.d.ts +2 -0
  30. package/dist/lib/version.d.ts.map +1 -0
  31. package/dist/lib/version.js +7 -0
  32. package/dist/routes/index.d.ts.map +1 -1
  33. package/dist/routes/index.js +19 -4
  34. package/dist/routes/probes.d.ts +4 -0
  35. package/dist/routes/probes.d.ts.map +1 -0
  36. package/dist/routes/probes.js +52 -0
  37. package/dist/routes/v1/decrypt.d.ts +2 -2
  38. package/dist/routes/v1/decrypt.d.ts.map +1 -1
  39. package/dist/routes/v1/decrypt.js +49 -6
  40. package/dist/routes/v1/encrypt.d.ts +2 -2
  41. package/dist/routes/v1/encrypt.d.ts.map +1 -1
  42. package/dist/routes/v1/encrypt.js +48 -6
  43. package/dist/routes/v1/generate.d.ts +2 -2
  44. package/dist/routes/v1/generate.d.ts.map +1 -1
  45. package/dist/routes/v1/generate.js +85 -13
  46. package/dist/routes/v1/index.d.ts +4 -0
  47. package/dist/routes/v1/index.d.ts.map +1 -0
  48. package/dist/routes/v1/index.js +19 -0
  49. package/dist/routes/v1/revoke.d.ts +2 -2
  50. package/dist/routes/v1/revoke.d.ts.map +1 -1
  51. package/dist/routes/v1/revoke.js +57 -5
  52. package/dist/routes/v1/verify.d.ts +4 -0
  53. package/dist/routes/v1/verify.d.ts.map +1 -0
  54. package/dist/routes/v1/verify.js +60 -0
  55. package/dist/routes/v2/algorithms.d.ts +4 -0
  56. package/dist/routes/v2/algorithms.d.ts.map +1 -0
  57. package/dist/routes/v2/algorithms.js +15 -0
  58. package/dist/routes/v2/compliance.d.ts +31 -0
  59. package/dist/routes/v2/compliance.d.ts.map +1 -0
  60. package/dist/routes/v2/compliance.js +223 -0
  61. package/dist/routes/v2/encrypt.d.ts +4 -0
  62. package/dist/routes/v2/encrypt.d.ts.map +1 -0
  63. package/dist/routes/v2/encrypt.js +62 -0
  64. package/dist/routes/v2/hash.d.ts +4 -0
  65. package/dist/routes/v2/hash.d.ts.map +1 -0
  66. package/dist/routes/v2/hash.js +34 -0
  67. package/dist/routes/v2/index.d.ts +4 -0
  68. package/dist/routes/v2/index.d.ts.map +1 -0
  69. package/dist/routes/v2/index.js +44 -0
  70. package/dist/routes/v2/kdf.d.ts +4 -0
  71. package/dist/routes/v2/kdf.d.ts.map +1 -0
  72. package/dist/routes/v2/kdf.js +54 -0
  73. package/dist/routes/v2/key-wrap.d.ts +4 -0
  74. package/dist/routes/v2/key-wrap.d.ts.map +1 -0
  75. package/dist/routes/v2/key-wrap.js +97 -0
  76. package/dist/routes/v2/keys.d.ts +4 -0
  77. package/dist/routes/v2/keys.d.ts.map +1 -0
  78. package/dist/routes/v2/keys.js +88 -0
  79. package/dist/routes/v2/mac.d.ts +4 -0
  80. package/dist/routes/v2/mac.d.ts.map +1 -0
  81. package/dist/routes/v2/mac.js +102 -0
  82. package/dist/routes/v2/multi-recipient.d.ts +4 -0
  83. package/dist/routes/v2/multi-recipient.d.ts.map +1 -0
  84. package/dist/routes/v2/multi-recipient.js +88 -0
  85. package/dist/routes/v2/password-encrypt.d.ts +4 -0
  86. package/dist/routes/v2/password-encrypt.d.ts.map +1 -0
  87. package/dist/routes/v2/password-encrypt.js +92 -0
  88. package/dist/routes/v2/password.d.ts +4 -0
  89. package/dist/routes/v2/password.d.ts.map +1 -0
  90. package/dist/routes/v2/password.js +109 -0
  91. package/dist/routes/v2/pq-hash-sign.d.ts +4 -0
  92. package/dist/routes/v2/pq-hash-sign.d.ts.map +1 -0
  93. package/dist/routes/v2/pq-hash-sign.js +131 -0
  94. package/dist/routes/v2/pq-sign.d.ts +4 -0
  95. package/dist/routes/v2/pq-sign.d.ts.map +1 -0
  96. package/dist/routes/v2/pq-sign.js +117 -0
  97. package/dist/routes/v2/pq.d.ts +4 -0
  98. package/dist/routes/v2/pq.d.ts.map +1 -0
  99. package/dist/routes/v2/pq.js +149 -0
  100. package/dist/routes/v2/sealedbox.d.ts +4 -0
  101. package/dist/routes/v2/sealedbox.d.ts.map +1 -0
  102. package/dist/routes/v2/sealedbox.js +145 -0
  103. package/dist/routes/v2/secretbox.d.ts +4 -0
  104. package/dist/routes/v2/secretbox.d.ts.map +1 -0
  105. package/dist/routes/v2/secretbox.js +94 -0
  106. package/dist/routes/v2/signing.d.ts +4 -0
  107. package/dist/routes/v2/signing.d.ts.map +1 -0
  108. package/dist/routes/v2/signing.js +66 -0
  109. package/dist/routes/v2/stream.d.ts +4 -0
  110. package/dist/routes/v2/stream.d.ts.map +1 -0
  111. package/dist/routes/v2/stream.js +206 -0
  112. package/dist/server.d.ts +4 -0
  113. package/dist/server.d.ts.map +1 -0
  114. package/dist/server.js +124 -0
  115. package/dist/utils/route-helpers.d.ts +15 -0
  116. package/dist/utils/route-helpers.d.ts.map +1 -0
  117. package/dist/utils/route-helpers.js +42 -0
  118. package/dist/utils/validation.d.ts +29 -0
  119. package/dist/utils/validation.d.ts.map +1 -0
  120. package/dist/utils/validation.js +162 -0
  121. package/package.json +103 -140
  122. package/dist/@types/types.js.map +0 -1
  123. package/dist/COPYRIGHT +0 -14
  124. package/dist/Report.txt +0 -90
  125. package/dist/config/endpoints.config.d.ts +0 -7
  126. package/dist/config/endpoints.config.d.ts.map +0 -1
  127. package/dist/config/endpoints.config.js +0 -8
  128. package/dist/config/endpoints.config.js.map +0 -1
  129. package/dist/index.js.map +0 -1
  130. package/dist/lib/logger.js.map +0 -1
  131. package/dist/package.json +0 -141
  132. package/dist/routes/index.js.map +0 -1
  133. package/dist/routes/v1/decrypt.js.map +0 -1
  134. package/dist/routes/v1/encrypt.js.map +0 -1
  135. package/dist/routes/v1/generate.js.map +0 -1
  136. package/dist/routes/v1/revoke.js.map +0 -1
@@ -0,0 +1,15 @@
1
+ import type { FastifyReply } from "fastify";
2
+ import { ValidationResult } from "./validation";
3
+ export declare function collectValidation<T extends Record<string, ValidationResult<unknown>>>(results: T, reply: FastifyReply): {
4
+ [K in keyof T]: T[K] extends ValidationResult<infer V> ? V : never;
5
+ } | null;
6
+ export declare function classifyCryptoError(error: unknown, request: {
7
+ log: {
8
+ error: (err: unknown, msg: string) => void;
9
+ };
10
+ }, reply: {
11
+ status: (code: number) => {
12
+ send: (body: unknown) => unknown;
13
+ };
14
+ }, operation: string): unknown;
15
+ //# sourceMappingURL=route-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/route-helpers.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAGL,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAOtB,wBAAgB,iBAAiB,CAC/B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAEnD,OAAO,EAAE,CAAC,EACV,KAAK,EAAE,YAAY,GAEjB;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,gBAAgB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CAAE,GACtE,IAAI,CAmBP;AAUD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;IAAE,GAAG,EAAE;QAAE,KAAK,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAA;CAAE,EAChE,KAAK,EAAE;IAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK;QAAE,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAA;KAAE,CAAA;CAAE,EACzE,SAAS,EAAE,MAAM,GAChB,OAAO,CAkBT"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.collectValidation = collectValidation;
4
+ exports.classifyCryptoError = classifyCryptoError;
5
+ const validation_1 = require("./validation");
6
+ function collectValidation(results, reply) {
7
+ const errors = [];
8
+ for (const key of Object.keys(results)) {
9
+ const r = results[key];
10
+ if (!r.valid)
11
+ errors.push(r.error);
12
+ }
13
+ if (errors.length > 0) {
14
+ (0, validation_1.sendValidationError)(reply, errors);
15
+ return null;
16
+ }
17
+ const out = {};
18
+ for (const key of Object.keys(results)) {
19
+ const r = results[key];
20
+ if (r.valid)
21
+ out[key] = r.value;
22
+ }
23
+ return out;
24
+ }
25
+ function classifyCryptoError(error, request, reply, operation) {
26
+ const msg = error instanceof Error ? error.message : String(error);
27
+ const isInputError = /invalid hex/i.test(msg) ||
28
+ /must be \d+ bytes/i.test(msg) ||
29
+ /too short/i.test(msg) ||
30
+ /unsupported/i.test(msg) ||
31
+ /expected.*length/i.test(msg) ||
32
+ /of length \d+ expected/i.test(msg);
33
+ if (isInputError) {
34
+ request.log.error(error, `${operation} input error`);
35
+ return reply
36
+ .status(400)
37
+ .send({ error: `${operation} failed: invalid input` });
38
+ }
39
+ request.log.error(error, `${operation} failed`);
40
+ return reply.status(500).send({ error: `${operation} failed` });
41
+ }
42
+ //# sourceMappingURL=route-helpers.js.map
@@ -0,0 +1,29 @@
1
+ import { FastifyReply } from "fastify";
2
+ export interface ValidationError {
3
+ field: string;
4
+ message: string;
5
+ }
6
+ export type ValidationResult<T> = {
7
+ valid: true;
8
+ value: T;
9
+ } | {
10
+ valid: false;
11
+ error: ValidationError;
12
+ };
13
+ export declare function validateRequiredString(value: unknown, fieldName: string): ValidationResult<string>;
14
+ export declare function validateRequiredNumber(value: unknown, fieldName: string, options?: {
15
+ min?: number;
16
+ max?: number;
17
+ }): ValidationResult<number>;
18
+ export declare function validateOptionalNumber(value: unknown, defaultValue: number, fieldName: string, options?: {
19
+ min?: number;
20
+ max?: number;
21
+ }): ValidationResult<number>;
22
+ export declare function validateBase64(value: unknown, fieldName: string): ValidationResult<string>;
23
+ export declare function validateEmail(value: unknown, fieldName: string): ValidationResult<string>;
24
+ export declare function validateEnum<T extends string>(value: unknown, fieldName: string, allowedValues: readonly T[]): ValidationResult<T>;
25
+ export declare function validateDateString(value: unknown, fieldName: string): ValidationResult<Date>;
26
+ export declare function sendValidationError(reply: FastifyReply, errors: ValidationError[]): void;
27
+ export declare function anonymousAllowed(): boolean;
28
+ export declare function validateApiKey(apiKey: unknown, expectedKey: string | undefined): boolean;
29
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvC,MAAM,WAAW,eAAe;IAE9B,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAC1B;IAEE,KAAK,EAAE,IAAI,CAAC;IAEZ,KAAK,EAAE,CAAC,CAAC;CACV,GACD;IAEE,KAAK,EAAE,KAAK,CAAC;IAEb,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAKN,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,gBAAgB,CAAC,MAAM,CAAC,CAiB1B;AAKD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACvC,gBAAgB,CAAC,MAAM,CAAC,CAoC1B;AAKD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACvC,gBAAgB,CAAC,MAAM,CAAC,CAK1B;AAKD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,gBAAgB,CAAC,MAAM,CAAC,CAgB1B;AAKD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,gBAAgB,CAAC,MAAM,CAAC,CAe1B;AAKD,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,SAAS,CAAC,EAAE,GAC1B,gBAAgB,CAAC,CAAC,CAAC,CAcrB;AAKD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,gBAAgB,CAAC,IAAI,CAAC,CAexB;AAKD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,eAAe,EAAE,GACxB,IAAI,CAKN;AAOD,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAKD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAcT"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateRequiredString = validateRequiredString;
4
+ exports.validateRequiredNumber = validateRequiredNumber;
5
+ exports.validateOptionalNumber = validateOptionalNumber;
6
+ exports.validateBase64 = validateBase64;
7
+ exports.validateEmail = validateEmail;
8
+ exports.validateEnum = validateEnum;
9
+ exports.validateDateString = validateDateString;
10
+ exports.sendValidationError = sendValidationError;
11
+ exports.anonymousAllowed = anonymousAllowed;
12
+ exports.validateApiKey = validateApiKey;
13
+ const crypto_1 = require("crypto");
14
+ function validateRequiredString(value, fieldName) {
15
+ if (value === undefined || value === null) {
16
+ return {
17
+ valid: false,
18
+ error: { field: fieldName, message: `${fieldName} is required` },
19
+ };
20
+ }
21
+ if (typeof value !== "string" || value.trim() === "") {
22
+ return {
23
+ valid: false,
24
+ error: {
25
+ field: fieldName,
26
+ message: `${fieldName} must be a non-empty string`,
27
+ },
28
+ };
29
+ }
30
+ return { valid: true, value };
31
+ }
32
+ function validateRequiredNumber(value, fieldName, options) {
33
+ if (value === undefined || value === null) {
34
+ return {
35
+ valid: false,
36
+ error: { field: fieldName, message: `${fieldName} is required` },
37
+ };
38
+ }
39
+ const numValue = typeof value === "number" ? value : Number(value);
40
+ if (!Number.isFinite(numValue)) {
41
+ return {
42
+ valid: false,
43
+ error: {
44
+ field: fieldName,
45
+ message: `${fieldName} must be a valid number`,
46
+ },
47
+ };
48
+ }
49
+ if (options?.min !== undefined && numValue < options.min) {
50
+ return {
51
+ valid: false,
52
+ error: {
53
+ field: fieldName,
54
+ message: `${fieldName} must be at least ${options.min}`,
55
+ },
56
+ };
57
+ }
58
+ if (options?.max !== undefined && numValue > options.max) {
59
+ return {
60
+ valid: false,
61
+ error: {
62
+ field: fieldName,
63
+ message: `${fieldName} must be at most ${options.max}`,
64
+ },
65
+ };
66
+ }
67
+ return { valid: true, value: numValue };
68
+ }
69
+ function validateOptionalNumber(value, defaultValue, fieldName, options) {
70
+ if (value === undefined || value === null || value === "") {
71
+ return { valid: true, value: defaultValue };
72
+ }
73
+ return validateRequiredNumber(value, fieldName, options);
74
+ }
75
+ function validateBase64(value, fieldName) {
76
+ const stringResult = validateRequiredString(value, fieldName);
77
+ if (!stringResult.valid)
78
+ return stringResult;
79
+ const base64Regex = /^[A-Za-z0-9+/=_-]*$/;
80
+ if (!base64Regex.test(stringResult.value)) {
81
+ return {
82
+ valid: false,
83
+ error: {
84
+ field: fieldName,
85
+ message: `${fieldName} must be valid base64 encoded data`,
86
+ },
87
+ };
88
+ }
89
+ return { valid: true, value: stringResult.value };
90
+ }
91
+ function validateEmail(value, fieldName) {
92
+ const stringResult = validateRequiredString(value, fieldName);
93
+ if (!stringResult.valid)
94
+ return stringResult;
95
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
96
+ if (!emailRegex.test(stringResult.value)) {
97
+ return {
98
+ valid: false,
99
+ error: {
100
+ field: fieldName,
101
+ message: `${fieldName} must be a valid email address`,
102
+ },
103
+ };
104
+ }
105
+ return { valid: true, value: stringResult.value };
106
+ }
107
+ function validateEnum(value, fieldName, allowedValues) {
108
+ const stringResult = validateRequiredString(value, fieldName);
109
+ if (!stringResult.valid)
110
+ return stringResult;
111
+ if (!allowedValues.includes(stringResult.value)) {
112
+ return {
113
+ valid: false,
114
+ error: {
115
+ field: fieldName,
116
+ message: `${fieldName} must be one of: ${allowedValues.join(", ")}`,
117
+ },
118
+ };
119
+ }
120
+ return { valid: true, value: stringResult.value };
121
+ }
122
+ function validateDateString(value, fieldName) {
123
+ const stringResult = validateRequiredString(value, fieldName);
124
+ if (!stringResult.valid)
125
+ return stringResult;
126
+ const date = new Date(stringResult.value);
127
+ if (Number.isNaN(date.getTime())) {
128
+ return {
129
+ valid: false,
130
+ error: {
131
+ field: fieldName,
132
+ message: `${fieldName} must be a valid ISO date string`,
133
+ },
134
+ };
135
+ }
136
+ return { valid: true, value: date };
137
+ }
138
+ function sendValidationError(reply, errors) {
139
+ reply.status(400).send({
140
+ error: "Validation failed",
141
+ details: errors,
142
+ });
143
+ }
144
+ function anonymousAllowed() {
145
+ return process.env["ALLOW_ANONYMOUS"] === "1";
146
+ }
147
+ function validateApiKey(apiKey, expectedKey) {
148
+ if (!expectedKey) {
149
+ return anonymousAllowed();
150
+ }
151
+ if (apiKey === undefined || apiKey === null)
152
+ return false;
153
+ const key = Array.isArray(apiKey) ? apiKey[0] : apiKey;
154
+ if (typeof key !== "string")
155
+ return false;
156
+ const a = Buffer.from(key);
157
+ const b = Buffer.from(expectedKey);
158
+ if (a.length !== b.length)
159
+ return false;
160
+ return (0, crypto_1.timingSafeEqual)(a, b);
161
+ }
162
+ //# sourceMappingURL=validation.js.map
package/package.json CHANGED
@@ -1,141 +1,104 @@
1
1
  {
2
- "author": "Sebastien Rousseau <hello@crypto-service.co> (https://github.com/sebastienrousseau/crypto-service)",
3
- "autoupdate": {
4
- "fileMap": [
5
- {
6
- "basePath": "dist",
7
- "files": [
8
- "**/*"
9
- ]
10
- }
11
- ],
12
- "source": "git",
13
- "target": "git://github.com/sebastienrousseau/crypto-service.git"
14
- },
15
- "bin": {
16
- "crypto-server": "bin/crypto-server.js"
17
- },
18
- "bugs": {
19
- "url": "https://github.com/sebastienrousseau/crypto-service/issues"
20
- },
21
- "dependencies": {
22
- "@fastify/accepts": "^3.0.0",
23
- "@fastify/compress": "^5.0.0",
24
- "@fastify/etag": "^3.0.0",
25
- "@fastify/helmet": "^8.0.0",
26
- "@types/node": "latest",
27
- "@types/uuid": "^8.3.4",
28
- "fastify": "^3.29.0",
29
- "fastify-healthcheck": "^3.1.0",
30
- "fastify-tsconfig": "^1.0.1",
31
- "tsconfig-paths": "^4.0.0",
32
- "winston": "^3.7.2"
33
- },
34
- "description": "Crypto Server is a Fastify web server that exposes easy consumable REST APIs to perform low-level cryptographic operations. It is implemented using Node.js and relies on Crypto Lib.",
35
- "devDependencies": {
36
- "@sebastienrousseau/c8-config": "^0.0.1",
37
- "@sebastienrousseau/crypto-lib": "^0.0.1",
38
- "@sebastienrousseau/eslint-config": "^0.0.2",
39
- "@sebastienrousseau/jsdoc-config": "^0.0.5",
40
- "@sebastienrousseau/markdownlint-config": "^0.0.1",
41
- "@sebastienrousseau/mocha-config": "^0.0.1",
42
- "@sebastienrousseau/prettier-config": "^0.0.4",
43
- "@sebastienrousseau/remark-config": "^0.0.3",
44
- "@typescript-eslint/eslint-plugin": "^5.26.0",
45
- "@typescript-eslint/parser": "^5.26.0",
46
- "c8": "^7.11.3",
47
- "chai": "^4.3.6",
48
- "dotenv": "^16.0.1",
49
- "eslint": "^8.16.0",
50
- "filesizes": "^0.1.2",
51
- "minami": "^1.2.3",
52
- "mocha": "^10.0.0",
53
- "prettier": "^2.6.2",
54
- "remark-cli": "^10.0.1",
55
- "remark-footnotes": "^4.0.1",
56
- "remark-preset-lint-consistent": "^5.1.1",
57
- "remark-preset-lint-markdown-style-guide": "^5.1.2",
58
- "remark-preset-lint-recommended": "^6.1.2",
59
- "rimraf": "^3.0.2",
60
- "typedoc-plugin-missing-exports": "^0.22.6",
61
- "typedoc": "^0.22.15",
62
- "typescript": "^4.7.2"
63
- },
64
- "directories": {
65
- "src": "./src"
66
- },
67
- "engines": {
68
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
69
- },
70
- "files": [
71
- "dist/"
72
- ],
73
- "funding": [
74
- {
75
- "type": "github",
76
- "url": "https://github.com/sponsors/sebastienrousseau"
77
- },
78
- {
79
- "type": "paypal",
80
- "url": "https://paypal.me/wwdseb"
81
- }
82
- ],
83
- "homepage": "https://cryptosvr.io",
84
- "keywords": [
85
- "crypto-api",
86
- "crypto-library",
87
- "crypto-service",
88
- "cryptography",
89
- "cryptoservice",
90
- "decryption-tool",
91
- "decryption",
92
- "ecc-cryptography",
93
- "ecc-key-encryption",
94
- "ecc",
95
- "encryption-tool",
96
- "encryption",
97
- "encryption",
98
- "openpgpjs",
99
- "rfc4880",
100
- "rsa-cryptography",
101
- "rsa-decryption",
102
- "rsa"
103
- ],
104
- "license": "MIT",
105
- "license_URI": "http://www.opensource.org/licenses/mit-license.php",
106
- "lockfileVersion": 1,
107
- "main": "./dist/index.js",
108
- "name": "@sebastienrousseau/crypto-server",
109
- "private": false,
110
- "publishConfig": {
111
- "access": "public",
112
- "registry": "https://npm.pkg.github.com"
113
- },
114
- "repository": {
115
- "directory": "packages/crypto-server",
116
- "type": "git",
117
- "url": "git@github.com:sebastienrousseau/crypto-service.git"
118
- },
119
- "scripts": {
120
- "build": "tsc -b && yarn run copy:makefile && yarn copy:package && yarn run copy:copyright && yarn run filesize:distribution",
121
- "clean": "rimraf ./dist ./docs ./node_modules && rimraf tsconfig.tsbuildinfo",
122
- "copy:package": "cp ./package.json ./dist/",
123
- "copy:copyright": "cp COPYRIGHT dist/",
124
- "copy:license": "cp LICENSE dist/",
125
- "copy:makefile": "cp Makefile dist/",
126
- "copy:readme": "cp README.md dist/",
127
- "docs": "typedoc",
128
- "fix": "eslint --fix src/**/*.ts",
129
- "filesize:distribution": "filesizes dist/ > dist/Report.txt",
130
- "lint": "eslint src/**/*.ts",
131
- "markdown": "yarn remark ./*.md packages/**/*.md --rc-path ./.remarkrc --quiet",
132
- "prepack": "yarn build",
133
- "prettier": "prettier --write src/**/*.ts",
134
- "release:prepare": "yarn pack",
135
- "release:publish": "yarn publish --access public --ignore-scripts --@OWNER:registry='https://registry.npmjs.org' && npm publish",
136
- "start": "node dist/index.js",
137
- "test": "c8 --config=.c8rc mocha --config=.mocharc"
138
- },
139
- "types": "./dist/index.d.ts",
140
- "version": "0.0.2"
141
- }
2
+ "name": "@sebastienrousseau/crypto-server",
3
+ "version": "0.0.8",
4
+ "description": "Crypto Server is a Fastify web server that exposes easy consumable REST APIs to perform low-level cryptographic operations.",
5
+ "author": "Sebastien Rousseau <sebastienrousseau@users.noreply.github.com>",
6
+ "license": "MIT OR Apache-2.0",
7
+ "homepage": "https://crypto-server.io",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/sebastienrousseau/crypto-service.git",
11
+ "directory": "packages/crypto-server"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/sebastienrousseau/crypto-service/issues"
15
+ },
16
+ "engines": {
17
+ "node": ">=22.0.0"
18
+ },
19
+ "main": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "sideEffects": false,
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "require": "./dist/index.js",
26
+ "import": "./dist/index.js"
27
+ }
28
+ },
29
+ "bin": {
30
+ "crypto-server": "dist/index.js"
31
+ },
32
+ "files": [
33
+ "dist/**/*.js",
34
+ "dist/**/*.d.ts",
35
+ "dist/**/*.d.ts.map"
36
+ ],
37
+ "dependencies": {
38
+ "@fastify/accepts": "^5.0.6",
39
+ "@fastify/compress": "^9.2.0",
40
+ "@fastify/cors": "^11.3.0",
41
+ "@fastify/etag": "^6.2.0",
42
+ "@fastify/helmet": "^13.1.1",
43
+ "@fastify/jwt": "^10.2.2",
44
+ "@fastify/rate-limit": "^11.2.0",
45
+ "@fastify/swagger": "^9.9.0",
46
+ "@fastify/swagger-ui": "^6.1.1",
47
+ "@opentelemetry/api": "^1.9.0",
48
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.222.0",
49
+ "@opentelemetry/exporter-trace-otlp-http": "^0.222.0",
50
+ "@opentelemetry/instrumentation-fastify": "^0.57.0",
51
+ "@opentelemetry/instrumentation-http": "^0.222.0",
52
+ "@opentelemetry/resources": "^2.11.0",
53
+ "@opentelemetry/sdk-metrics": "^2.11.0",
54
+ "@opentelemetry/sdk-node": "^0.222.0",
55
+ "@opentelemetry/sdk-trace-node": "^2.11.0",
56
+ "@opentelemetry/semantic-conventions": "^1.43.0",
57
+ "fastify": "^5.12.5",
58
+ "fastify-healthcheck": "^5.1.0",
59
+ "uuid": "^14.0.2",
60
+ "winston": "^3.17.0",
61
+ "@sebastienrousseau/crypto-lib": "0.0.8"
62
+ },
63
+ "devDependencies": {
64
+ "@types/chai": "^4.3.7",
65
+ "@types/chai-as-promised": "^8.0.2",
66
+ "@types/mocha": "^10.0.2",
67
+ "@types/node": "^26.6.3",
68
+ "@types/uuid": "^11.0.0",
69
+ "c8": "^12.0.0",
70
+ "chai": "^4.5.0",
71
+ "chai-as-promised": "^7.1.2",
72
+ "mocha": "^10.8.2",
73
+ "openpgp": "^6.3.1",
74
+ "prettier": "^3.9.8",
75
+ "rimraf": "^6.1.3",
76
+ "ts-node": "^10.9.2",
77
+ "typedoc": "^0.28.20",
78
+ "typescript": "~5.9.3"
79
+ },
80
+ "keywords": [
81
+ "crypto-service",
82
+ "cryptography",
83
+ "encryption",
84
+ "decryption",
85
+ "openpgp",
86
+ "fastify",
87
+ "rest-api"
88
+ ],
89
+ "publishConfig": {
90
+ "access": "public"
91
+ },
92
+ "private": false,
93
+ "scripts": {
94
+ "build": "tsc --build tsconfig.json",
95
+ "clean": "rimraf ./coverage ./dist ./docs",
96
+ "lint": "eslint --ext .ts src __tests__",
97
+ "lint:fix": "eslint --cache --fix --ext .ts src __tests__",
98
+ "format": "prettier --write src/**/*.ts",
99
+ "format:check": "prettier --check \"src/**/*.ts\"",
100
+ "start": "node dist/index.js",
101
+ "test": "c8 --check-coverage --lines 100 --branches 100 --functions 100 --reporter=lcov --reporter=text mocha --config=.mocharc.cjs",
102
+ "docs": "typedoc"
103
+ }
104
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/@types/types.ts"],"names":[],"mappings":""}
package/dist/COPYRIGHT DELETED
@@ -1,14 +0,0 @@
1
- /*
2
- * ____ _ ____
3
- * / ___|_ __ _ _ _ __ | |_ ___ / ___| ___ _ ____ _____ _ __
4
- * | | | '__| | | | '_ \| __/ _ \ \___ \ / _ \ '__\ \ / / _ \ '__|
5
- * | |___| | | |_| | |_) | || (_) | ___) | __/ | \ V / __/ |
6
- * \____|_| \__, | .__/ \__\___/ |____/ \___|_| \_/ \___|_|
7
- * |___/|_|
8
- * Crypto Server
9
- * https://cryptosvr.io
10
- *
11
- * Copyright (c) Sebastien Rousseau 2022. All rights reserved
12
- * Licensed under the MIT license
13
- *
14
- */
package/dist/Report.txt DELETED
@@ -1,90 +0,0 @@
1
- ┌───────────────────────────────────────────┬───────────┬────────────────┐
2
- │ File │ Size │ Size (gzipped) │
3
- ├───────────────────────────────────────────┼───────────┼────────────────┤
4
- │ COPYRIGHT │ 477 B │ 262 B │
5
- ├───────────────────────────────────────────┼───────────┼────────────────┤
6
- │ Makefile │ 2.79 kB │ 1.01 kB │
7
- ├───────────────────────────────────────────┼───────────┼────────────────┤
8
- │ Report.txt │ 0 B │ 20 B │
9
- ├───────────────────────────────────────────┼───────────┼────────────────┤
10
- │ index.d.ts │ 46 B │ 66 B │
11
- ├───────────────────────────────────────────┼───────────┼────────────────┤
12
- │ index.d.ts.map │ 104 B │ 104 B │
13
- ├───────────────────────────────────────────┼───────────┼────────────────┤
14
- │ index.js │ 3.12 kB │ 1.22 kB │
15
- ├───────────────────────────────────────────┼───────────┼────────────────┤
16
- │ index.js.map │ 1.62 kB │ 577 B │
17
- ├───────────────────────────────────────────┼───────────┼────────────────┤
18
- │ package.json │ 4.92 kB │ 1.59 kB │
19
- ├───────────────────────────────────────────┼───────────┼────────────────┤
20
- │ sebastienrousseau-crypto-server-0.0.1.tgz │ 17.3 kB │ 17.4 kB │
21
- ├───────────────────────────────────────────┼───────────┼────────────────┤
22
- │ @types/types.d.ts │ 446 B │ 196 B │
23
- ├───────────────────────────────────────────┼───────────┼────────────────┤
24
- │ @types/types.d.ts.map │ 566 B │ 225 B │
25
- ├───────────────────────────────────────────┼───────────┼────────────────┤
26
- │ @types/types.js │ 110 B │ 124 B │
27
- ├───────────────────────────────────────────┼───────────┼────────────────┤
28
- │ @types/types.js.map │ 112 B │ 109 B │
29
- ├───────────────────────────────────────────┼───────────┼────────────────┤
30
- │ config/endpoints.config.d.ts │ 167 B │ 146 B │
31
- ├───────────────────────────────────────────┼───────────┼────────────────┤
32
- │ config/endpoints.config.d.ts.map │ 151 B │ 131 B │
33
- ├───────────────────────────────────────────┼───────────┼────────────────┤
34
- │ config/endpoints.config.js │ 269 B │ 212 B │
35
- ├───────────────────────────────────────────┼───────────┼────────────────┤
36
- │ config/endpoints.config.js.map │ 309 B │ 189 B │
37
- ├───────────────────────────────────────────┼───────────┼────────────────┤
38
- │ lib/logger.d.ts │ 107 B │ 110 B │
39
- ├───────────────────────────────────────────┼───────────┼────────────────┤
40
- │ lib/logger.d.ts.map │ 164 B │ 144 B │
41
- ├───────────────────────────────────────────┼───────────┼────────────────┤
42
- │ lib/logger.js │ 725 B │ 379 B │
43
- ├───────────────────────────────────────────┼───────────┼────────────────┤
44
- │ lib/logger.js.map │ 652 B │ 331 B │
45
- ├───────────────────────────────────────────┼───────────┼────────────────┤
46
- │ routes/index.d.ts │ 160 B │ 144 B │
47
- ├───────────────────────────────────────────┼───────────┼────────────────┤
48
- │ routes/index.d.ts.map │ 176 B │ 157 B │
49
- ├───────────────────────────────────────────┼───────────┼────────────────┤
50
- │ routes/index.js │ 653 B │ 304 B │
51
- ├───────────────────────────────────────────┼───────────┼────────────────┤
52
- │ routes/index.js.map │ 364 B │ 203 B │
53
- ├───────────────────────────────────────────┼───────────┼────────────────┤
54
- │ routes/v1/decrypt.d.ts │ 162 B │ 146 B │
55
- ├───────────────────────────────────────────┼───────────┼────────────────┤
56
- │ routes/v1/decrypt.d.ts.map │ 186 B │ 162 B │
57
- ├───────────────────────────────────────────┼───────────┼────────────────┤
58
- │ routes/v1/decrypt.js │ 662 B │ 376 B │
59
- ├───────────────────────────────────────────┼───────────┼────────────────┤
60
- │ routes/v1/decrypt.js.map │ 488 B │ 268 B │
61
- ├───────────────────────────────────────────┼───────────┼────────────────┤
62
- │ routes/v1/encrypt.d.ts │ 162 B │ 146 B │
63
- ├───────────────────────────────────────────┼───────────┼────────────────┤
64
- │ routes/v1/encrypt.d.ts.map │ 186 B │ 162 B │
65
- ├───────────────────────────────────────────┼───────────┼────────────────┤
66
- │ routes/v1/encrypt.js │ 662 B │ 372 B │
67
- ├───────────────────────────────────────────┼───────────┼────────────────┤
68
- │ routes/v1/encrypt.js.map │ 488 B │ 267 B │
69
- ├───────────────────────────────────────────┼───────────┼────────────────┤
70
- │ routes/v1/generate.d.ts │ 163 B │ 146 B │
71
- ├───────────────────────────────────────────┼───────────┼────────────────┤
72
- │ routes/v1/generate.d.ts.map │ 189 B │ 162 B │
73
- ├───────────────────────────────────────────┼───────────┼────────────────┤
74
- │ routes/v1/generate.js │ 1.01 kB │ 460 B │
75
- ├───────────────────────────────────────────┼───────────┼────────────────┤
76
- │ routes/v1/generate.js.map │ 857 B │ 314 B │
77
- ├───────────────────────────────────────────┼───────────┼────────────────┤
78
- │ routes/v1/revoke.d.ts │ 161 B │ 146 B │
79
- ├───────────────────────────────────────────┼───────────┼────────────────┤
80
- │ routes/v1/revoke.d.ts.map │ 184 B │ 161 B │
81
- ├───────────────────────────────────────────┼───────────┼────────────────┤
82
- │ routes/v1/revoke.js │ 608 B │ 365 B │
83
- ├───────────────────────────────────────────┼───────────┼────────────────┤
84
- │ routes/v1/revoke.js.map │ 440 B │ 257 B │
85
- ├───────────────────────────────────────────┼───────────┼────────────────┤
86
- ├───────────────────────────────────────────┼───────────┼────────────────┤
87
- │ Total files: 41 │ 42.1 kB │ 29.2 kB │
88
- └───────────────────────────────────────────┴───────────┴────────────────┘
89
-
90
-
@@ -1,7 +0,0 @@
1
- declare const _default: {
2
- HOST: string;
3
- PORT: string | number;
4
- PROTOCOL: string;
5
- };
6
- export default _default;
7
- //# sourceMappingURL=endpoints.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"endpoints.config.d.ts","sourceRoot":"","sources":["../../src/config/endpoints.config.ts"],"names":[],"mappings":";;;;;AAAA,wBAIE"}