@hackthedev/dsync-sign 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 (2) hide show
  1. package/index.mjs +10 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -19,10 +19,18 @@ export class dSyncSign {
19
19
  return JSON.stringify(this.canonicalize(obj));
20
20
  }
21
21
 
22
- clearWhiteSpaces(string) {
23
- return string.replace(/\s/g,'')
22
+ normalizePublicKey(key) {
23
+ return key
24
+ .replace(/\r|\n|\s+/g, '')
25
+ .replace('-----BEGINPUBLICKEY-----', '-----BEGIN PUBLIC KEY-----')
26
+ .replace('-----ENDPUBLICKEY-----', '-----END PUBLIC KEY-----')
27
+ .replace(/-----BEGIN PUBLIC KEY-----/, '-----BEGIN PUBLIC KEY-----\n')
28
+ .replace(/-----END PUBLIC KEY-----/, '\n-----END PUBLIC KEY-----')
29
+ .replace(/(.{64})/g, '$1\n')
30
+ .trim();
24
31
  }
25
32
 
33
+
26
34
  async ensureKeyPair() {
27
35
  try {
28
36
  const raw = await fs.readFile(this.KEY_FILE, "utf8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackthedev/dsync-sign",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "type": "module",