@open-norantec/utilities 2.0.5 → 2.1.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.
@@ -2,4 +2,5 @@ export declare class CryptoUtil {
2
2
  static importRsaPrivatePemKey(pemString: string, algorithm: AlgorithmIdentifier, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
3
3
  static importRsaPublicPemKey(pemString: string, algorithm: AlgorithmIdentifier, keyUsages: Iterable<KeyUsage>): Promise<CryptoKey>;
4
4
  static sha256Hex(input: string): Promise<string>;
5
+ static convertHexToUint8Array(hexString: string): Uint8Array;
5
6
  }
@@ -31,5 +31,10 @@ class CryptoUtil {
31
31
  const hashArray = Array.from(new Uint8Array(hashBuffer));
32
32
  return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
33
33
  }
34
+ static convertHexToUint8Array(hexString) {
35
+ return new Uint8Array(new Array(hexString.length / 2).fill(0).map((value, index) => {
36
+ return parseInt(hexString.slice(index * 2, index * 2 + 2), 16);
37
+ }));
38
+ }
34
39
  }
35
40
  exports.CryptoUtil = CryptoUtil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-norantec/utilities",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "NoranTec Utilities",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {