Skip to content

Commit a008c80

Browse files
committed
adding rust napi bindings
1 parent 1513275 commit a008c80

File tree

17 files changed

+98
-235
lines changed

17 files changed

+98
-235
lines changed

Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "cas-typescript-sdk-napi"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[lib]
7+
path = "src/lib.rs"
8+
crate-type = ["cdylib"]
9+
10+
[dependencies]
11+
argon2 = "0.5.2"
12+
napi = "2"
13+
napi-derive = "2"
14+
rand = "0.8.5"
15+
16+
[build-dependencies]
17+
napi-build = "1"

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extern crate napi_build;
2+
3+
fn main() {
4+
napi_build::setup();
5+
}

cas_core_lib.dll

-3.22 MB
Binary file not shown.

index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
4+
/* auto-generated by NAPI-RS */
5+
6+
export function argon2Hash(password: string): string
7+
export function argon2Verify(hashedPassword: string, passwordToVerify: string): boolean

index.node

305 KB
Binary file not shown.

libcas_core_lib.so

-8.17 MB
Binary file not shown.

package-lock.json

Lines changed: 17 additions & 189 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"types": "lib/index.d.ts",
77
"scripts": {
88
"test": "mocha -r ts-node/register ./test/**/*.ts --timeout 20000 --recursive",
9-
"build": "tsc && copyfiles \"./cas_core_lib.dll\" \"lib\" && copyfiles \"./libcas_core_lib.so\" \"lib\"",
9+
"build": "napi build --release && tsc",
1010
"prepare": "npm run build"
1111
},
1212
"repository": {
@@ -25,16 +25,15 @@
2525
"registry": "https://registry.npmjs.org/"
2626
},
2727
"devDependencies": {
28+
"@napi-rs/cli": "^2.17.0",
2829
"@types/chai": "^4.3.5",
2930
"@types/mocha": "^10.0.1",
3031
"@types/node-fetch": "^2.6.3",
3132
"chai": "^4.3.7",
32-
"copyfiles": "^2.4.1",
3333
"mocha": "^10.2.0",
3434
"ts-node": "^10.9.1",
3535
"typescript": "^5.0.3"
3636
},
3737
"dependencies": {
38-
"koffi": "^2.7.1"
3938
}
4039
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)