diff --git a/package-lock.json b/package-lock.json
index ef2da3f0..53aa7ba6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -94,6 +94,7 @@
"ua-parser-js": "^1.0.38",
"unorm": "^1.6.0",
"utf8": "^3.0.0",
+ "uuid": "^11.1.0",
"vkbeautify": "^0.99.3",
"xpath": "0.0.34",
"xregexp": "^5.1.1",
@@ -13876,6 +13877,15 @@
"node": ">=8"
}
},
+ "node_modules/nightwatch/node_modules/uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
+ "dev": true,
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/nightwatch/node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
@@ -16819,6 +16829,15 @@
"node": ">=0.8.0"
}
},
+ "node_modules/sockjs/node_modules/uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
+ "dev": true,
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/socks": {
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
@@ -18106,13 +18125,15 @@
}
},
"node_modules/uuid": {
- "version": "8.3.2",
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
- "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
- "dev": true,
- "license": "MIT",
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
+ "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
"bin": {
- "uuid": "dist/bin/uuid"
+ "uuid": "dist/esm/bin/uuid"
}
},
"node_modules/v8flags": {
diff --git a/package.json b/package.json
index b3492a8e..847ace80 100644
--- a/package.json
+++ b/package.json
@@ -180,6 +180,7 @@
"ua-parser-js": "^1.0.38",
"unorm": "^1.6.0",
"utf8": "^3.0.0",
+ "uuid": "^11.1.0",
"vkbeautify": "^0.99.3",
"xpath": "0.0.34",
"xregexp": "^5.1.1",
diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json
index 71b311e6..0b3aa90a 100644
--- a/src/core/config/Categories.json
+++ b/src/core/config/Categories.json
@@ -545,6 +545,7 @@
"Pseudo-Random Number Generator",
"Generate De Bruijn Sequence",
"Generate UUID",
+ "Analyse UUID",
"Generate TOTP",
"Generate HOTP",
"Generate QR Code",
diff --git a/src/core/operations/AnalyseUUID.mjs b/src/core/operations/AnalyseUUID.mjs
new file mode 100644
index 00000000..b3506017
--- /dev/null
+++ b/src/core/operations/AnalyseUUID.mjs
@@ -0,0 +1,48 @@
+/**
+ * @author n1474335 [n1474335@gmail.com]
+ * @copyright Crown Copyright 2023
+ * @license Apache-2.0
+ */
+
+import * as uuid from "uuid";
+
+import Operation from "../Operation.mjs";
+import OperationError from "../errors/OperationError.mjs";
+
+/**
+ * Analyse UUID operation
+ */
+class AnalyseUUID extends Operation {
+
+ /**
+ * AnalyseUUID constructor
+ */
+ constructor() {
+ super();
+
+ this.name = "Analyse UUID";
+ this.module = "Crypto";
+ this.description = "Tries to determine information about a given UUID and suggests which version may have been used to generate it";
+ this.infoURL = "https://wikipedia.org/wiki/Universally_unique_identifier";
+ this.inputType = "string";
+ this.outputType = "string";
+ this.args = [];
+ }
+
+ /**
+ * @param {string} input
+ * @param {Object[]} args
+ * @returns {string}
+ */
+ run(input, args) {
+ try {
+ const uuidVersion = uuid.version(input);
+ return "UUID version: " + uuidVersion;
+ } catch (error) {
+ throw new OperationError("Invalid UUID");
+ }
+ }
+
+}
+
+export default AnalyseUUID;
diff --git a/src/core/operations/GenerateUUID.mjs b/src/core/operations/GenerateUUID.mjs
index 1ee0faba..21d063e3 100644
--- a/src/core/operations/GenerateUUID.mjs
+++ b/src/core/operations/GenerateUUID.mjs
@@ -5,8 +5,8 @@
*/
import Operation from "../Operation.mjs";
-import crypto from "crypto";
-
+import * as uuid from "uuid";
+import OperationError from "../errors/OperationError.mjs";
/**
* Generate UUID operation
*/
@@ -20,11 +20,38 @@ class GenerateUUID extends Operation {
this.name = "Generate UUID";
this.module = "Crypto";
- this.description = "Generates an RFC 4122 version 4 compliant Universally Unique Identifier (UUID), also known as a Globally Unique Identifier (GUID).
A version 4 UUID relies on random numbers, in this case generated using window.crypto
if available and falling back to Math.random
if not.";
+ this.description =
+ "Generates an RFC 9562 (formerly RFC 4122) compliant Universally Unique Identifier (UUID), " +
+ "also known as a Globally Unique Identifier (GUID).
" +
+ "
" +
+ "We currently support generating the following UUID versions:
" +
+ "
uuid
package.