Skip to content

Commit 85606ae

Browse files
committed
paths to dll in globals
1 parent 9f2f56c commit 85606ae

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "eas-typescript-sdk",
2+
"name": "cas-typescript-sdk",
33
"version": "1.0.0",
44
"description": "",
55
"main": "lib/index.js",

src/global.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare var pathToWindowsDll: string;
2+
declare var pathToLinuxSO: string;

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
import path from "path";
2+
global.pathToLinuxSO = path.join(__dirname, "libcas_core_lib.so");
3+
global.pathToWindowsDll = path.join(__dirname, "cas_core_lib.dll");
4+
15
import { Argon2Wrapper } from "./password-hashers/argon2-wrapper";
26

7+
38
export {
49
Argon2Wrapper
510
}

src/password-hashers/argon2-wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class Argon2Wrapper {
66
private argon2_hash: Function;
77

88
constructor() {
9-
this.lib = (os.platform() === "win32") ? koffi.load('./cas_core_lib.dll') : koffi.load("./libcas_core_lib.so");
9+
this.lib = (os.platform() === "win32") ? koffi.load(global.pathToWindowsDll) : koffi.load(global.pathToLinuxSO);
1010
this.argon2_hash = this.lib.func("argon2_hash", 'string', ['string'])
1111
}
1212

0 commit comments

Comments
 (0)