Created
November 1, 2023 20:18
-
-
Save pkoch/980b056b65643b28199021af40189cb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/apps/idos-enclave/package.json b/apps/idos-enclave/package.json | |
index 788cd6c..8889842 100644 | |
--- a/apps/idos-enclave/package.json | |
+++ b/apps/idos-enclave/package.json | |
@@ -9,6 +9,7 @@ | |
"dev": "vite", | |
"build": "vite build", | |
"preview": "vite preview", | |
+ "test": "vitest run", | |
"format": "prettier --write ." | |
}, | |
"devDependencies": { | |
@@ -19,7 +20,8 @@ | |
"typescript": "^5.0.2", | |
"vite": "^4.4.5", | |
"vite-plugin-html": "^3.2.0", | |
- "vite-plugin-mkcert": "^1.16.0" | |
+ "vite-plugin-mkcert": "^1.16.0", | |
+ "vitest": "^0.31.4" | |
}, | |
"dependencies": { | |
"@stablelib/base64": "^1.0.1", | |
diff --git a/apps/idos-enclave/src/__tests__/idOSKeyDerivation.test.js b/apps/idos-enclave/src/__tests__/idOSKeyDerivation.test.js | |
new file mode 100644 | |
index 0000000..9068f9d | |
--- /dev/null | |
+++ b/apps/idos-enclave/src/__tests__/idOSKeyDerivation.test.js | |
@@ -0,0 +1,14 @@ | |
+import { describe, expect, test } from "vitest"; | |
+import { idOSKeyDerivation } from "../idOSKeyDerivation"; | |
+import * as Base64 from "@stablelib/base64" | |
+ | |
+describe("idOSKeyDerivation", () => { | |
+ test("trivial example", async () => { | |
+ const password = "password"; | |
+ const salt = "0202dd48-de1d-4e93-a65c-5a6677faf6f1"; | |
+ | |
+ expect( | |
+ await(idOSKeyDerivation({password, salt})) | |
+ ).toStrictEqual(Base64.decode("+KX/ySxPOVVvhbyJEyWER+B2CvpmY6bZJtfzvt4Y1IQ=")); | |
+ }); | |
+}); | |
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml | |
index a0f5ffb..95b6ae6 100644 | |
--- a/pnpm-lock.yaml | |
+++ b/pnpm-lock.yaml | |
@@ -214,6 +214,9 @@ importers: | |
vite-plugin-mkcert: | |
specifier: ^1.16.0 | |
version: 1.16.0([email protected]) | |
+ vitest: | |
+ specifier: ^0.31.4 | |
+ version: 0.31.4(@vitest/[email protected])([email protected]) | |
apps/idos-example-dapp: | |
dependencies: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment