fastbcrypt 0.0.0-stage → 1.0.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.
package/.dockerignore ADDED
@@ -0,0 +1,6 @@
1
+ .git/
2
+ .vscode/
3
+ Dockerfile*
4
+ prebuilds/
5
+ node_modules/
6
+ build*/
package/.editorconfig ADDED
@@ -0,0 +1,19 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+
11
+ [{package.json,*.yml}]
12
+ indent_style = space
13
+ indent_size = 2
14
+
15
+ [appveyor.yml]
16
+ end_of_line = crlf
17
+
18
+ [*.md]
19
+ trim_trailing_whitespace = false
@@ -0,0 +1,110 @@
1
+ name: Build and package Fastbcrypt
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+ release:
9
+ types: [ prereleased, released ]
10
+
11
+ jobs:
12
+ build-linux:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ # This is unsafe, but we really don't use any other native dependencies
17
+ - run: npm ci
18
+ - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/almalinux-devtoolset11 npx prebuildify --napi --tag-libc --strip --target=node@18.0.0
19
+ - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/alpine npx prebuildify --napi --tag-libc --strip --target=node@18.0.0
20
+ - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-armv7 npx prebuildify --napi --tag-libc --strip --target=node@18.0.0
21
+ - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-armv7l-musl npx prebuildify --napi --tag-libc --strip --target=node@18.0.0
22
+ - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-arm64 npx prebuildify --napi --tag-libc --strip --target=node@18.0.0
23
+ - run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-arm64-musl npx prebuildify --napi --tag-libc --strip --target=node@18.0.0
24
+ - run: find prebuilds
25
+ - uses: actions/upload-artifact@v4
26
+ with:
27
+ name: prebuild-linux
28
+ path: ./prebuilds/
29
+
30
+ build-windows:
31
+ runs-on: windows-latest
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: actions/setup-node@v4
35
+ with:
36
+ node-version: 20
37
+ registry-url: 'https://registry.npmjs.org'
38
+ - run: npm ci
39
+ - run: npx prebuildify --napi --strip --arch=x64 --target=node@18.0.0
40
+ - run: npx prebuildify --napi --strip --arch=arm64 --target=node@20.0.0
41
+ - run: dir prebuilds
42
+ - uses: actions/upload-artifact@v4
43
+ with:
44
+ name: prebuild-windows
45
+ path: ./prebuilds/
46
+
47
+ build-macos:
48
+ runs-on: macos-latest
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+ - uses: actions/setup-node@v4
52
+ with:
53
+ node-version: 18
54
+ registry-url: 'https://registry.npmjs.org'
55
+ - run: npm ci
56
+ - run: npx prebuildify --napi --strip --arch=arm64 --target=node@18.0.0
57
+ - run: npx prebuildify --napi --strip --arch=x64 --target=node@18.0.0
58
+ - run: find prebuilds
59
+ - uses: actions/upload-artifact@v4
60
+ with:
61
+ name: prebuild-macos
62
+ path: ./prebuilds/
63
+
64
+ pack:
65
+ needs:
66
+ - build-linux
67
+ - build-windows
68
+ - build-macos
69
+ runs-on: ubuntu-latest
70
+ outputs:
71
+ PACK_FILE: ${{ steps.pack.outputs.PACK_FILE }}
72
+ steps:
73
+ - uses: actions/checkout@v4
74
+ - uses: actions/download-artifact@v4
75
+ with:
76
+ path: /tmp/prebuilds/
77
+ - name: Coalesce prebuilds from build matrix
78
+ run: |
79
+ mkdir prebuilds
80
+ for d in /tmp/prebuilds/*; do
81
+ cp -Rav $d/* prebuilds/
82
+ done
83
+ - run: chmod a+x prebuilds/*/*.node && find prebuilds -executable -type f
84
+ - id: pack
85
+ name: Prepare NPM package
86
+ run: |
87
+ echo "PACK_FILE=$(npm pack)" >> "$GITHUB_OUTPUT"
88
+ - uses: actions/upload-artifact@v4
89
+ with:
90
+ name: package-tgz
91
+ path: ${{ steps.pack.outputs.PACK_FILE }}
92
+ if-no-files-found: 'error'
93
+
94
+ test-package:
95
+ needs: pack
96
+ strategy:
97
+ matrix:
98
+ node-version: [ 18, 20, 22, 23 ]
99
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
100
+ runs-on: ${{ matrix.os }}
101
+ steps:
102
+ - uses: actions/setup-node@v4
103
+ with:
104
+ node-version: ${{ matrix.node-version }}
105
+ registry-url: 'https://registry.npmjs.org'
106
+ - uses: actions/download-artifact@v4
107
+ with:
108
+ name: package-tgz
109
+ - run: npm install ${{ needs.pack.outputs.PACK_FILE }}
110
+ - run: node -e "const fastbcrypt = require('fastbcrypt'); const hash = fastbcrypt.hashSync('hello', 10); require('node:assert/strict').ok(fastbcrypt.compareSync('hello', hash))"
@@ -0,0 +1,42 @@
1
+ name: Fastbcrypt CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ node-version: [18, 20, 22]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Use Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+ - run: npm ci
24
+ - name: Test
25
+ run: npm test
26
+
27
+ build-alpine:
28
+ runs-on: ubuntu-latest
29
+ strategy:
30
+ matrix:
31
+ node-version: [18, 20, 22]
32
+ container:
33
+ image: node:${{ matrix.node-version }}-alpine
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - name: Install dependencies
37
+ run: |
38
+ apk add make g++ python3
39
+ - run: npm ci
40
+ - name: Test
41
+ run: |
42
+ npm test --unsafe-perm
package/CHANGELOG.md ADDED
@@ -0,0 +1,191 @@
1
+ # Fastbcrypt 1.0.0
2
+
3
+ * Initial Fastbcrypt release, based on `bcrypt@6.0.0`.
4
+ * Includes prebuilt native addons for password hashing and verification.
5
+
6
+ Upstream bcrypt release history follows.
7
+
8
+ # 6.0.0 (2025-02-28)
9
+ * Drop support for NodeJS <= 16
10
+ * Remove `node-pre-gyp` in favor of `prebuildify`, prebuilt binaries are now shipped with the package
11
+ * Update `node-addon-api` to 8.3.0
12
+ * Update JS code to newer ES syntax
13
+
14
+ # 5.1.0 (2022-10-06)
15
+ * Update `node-pre-gyp` to 1.0.11
16
+
17
+ # 5.1.0 (2022-10-06)
18
+ * Update `node-pre-gyp` to 1.0.10
19
+ * Replace `nodeunit` with `jest` as the testing library
20
+
21
+ # 5.0.1 (2021-02-22)
22
+
23
+ * Update `node-pre-gyp` to 1.0.0
24
+
25
+ # 5.0.0 (2020-06-02)
26
+
27
+ * Fix the bcrypt "wrap-around" bug. It affects passwords with lengths >= 255.
28
+ It is uncommon but it's a bug nevertheless. Previous attempts to fix the bug
29
+ was unsuccessful.
30
+ * Experimental support for z/OS
31
+ * Fix a bug related to NUL in password input
32
+ * Update `node-pre-gyp` to 0.15.0
33
+
34
+ # 4.0.1 (2020-02-27)
35
+
36
+ * Fix compilation errors in Alpine linux
37
+
38
+ # 4.0.0 (2020-02-17)
39
+
40
+ * Switch to NAPI bcrypt
41
+ * Drop support for NodeJS 8
42
+
43
+ # 3.0.8 (2019-12-31)
44
+
45
+ * Update `node-pre-gyp` to 0.14
46
+ * Pre-built binaries for NodeJS 13
47
+
48
+ # 3.0.7 (2019-10-18)
49
+
50
+ * Update `nan` to 2.14.0
51
+ * Update `node-pre-gyp` to 0.13
52
+
53
+ # 3.0.6 (2019-04-11)
54
+
55
+ * Update `nan` to 2.13.2
56
+
57
+ # 3.0.5 (2019-03-19)
58
+
59
+ * Update `nan` to 2.13.1
60
+ * NodeJS 12 compatibility
61
+ * Remove `node-pre-gyp` from bundled dependencies
62
+
63
+ # 3.0.4-napi (2019-03-08)
64
+
65
+ * Sync N-API bcrypt with NAN bcrypt
66
+
67
+ # 3.0.4 (2019-02-07)
68
+
69
+ * Fix GCC, NAN and V8 deprecation warnings
70
+
71
+ # 3.0.3 (2018-12-19)
72
+
73
+ * Update `nan` to 2.12.1
74
+
75
+ # 3.0.2 (2018-10-18)
76
+
77
+ * Update `nan` to 2.11.1
78
+
79
+ # 3.0.1 (2018-09-20)
80
+
81
+ * Update `nan` to 2.11.0
82
+
83
+ # 3.0.0 (2018-07-06)
84
+
85
+ * Drop support for NodeJS <= 4
86
+
87
+ # 2.0.1 (2018-04-20)
88
+
89
+ * Update `node-pre-gyp` to allow downloading prebuilt modules
90
+
91
+ # 2.0.0 (2018-04-07)
92
+
93
+ * Make `2b` the default bcrypt version
94
+
95
+ # 1.1.0-napi (2018-01-21)
96
+
97
+ * Initial support for [N-API](https://nodejs.org/api/n-api.html)
98
+
99
+ # 1.0.3 (2016-08-23)
100
+
101
+ * update to nan v2.6.2 for NodeJS 8 support
102
+ * Fix: use npm scripts instead of node-gyp directly.
103
+
104
+ # 1.0.2 (2016-12-31)
105
+
106
+ * Fix `compare` promise rejection with invalid arguments
107
+
108
+ # 1.0.1 (2016-12-07)
109
+
110
+ * Fix destructuring imports with promises
111
+
112
+ # 1.0.0 (2016-12-04)
113
+
114
+ * add Promise support (commit 2488473)
115
+
116
+ # 0.8.7 (2016-06-09)
117
+
118
+ * update nan to 2.3.5 for improved node v6 support
119
+
120
+ # 0.8.6 (2016-04-20)
121
+
122
+ * update nan for node v6 support
123
+
124
+ # 0.8.5 (2015-08-12)
125
+
126
+ * update to nan v2 (adds support for iojs 3)
127
+
128
+ # 0.8.4 (2015-07-24)
129
+
130
+ * fix deprecation warning for the Encode API
131
+
132
+ # 0.8.3 (2015-05-06)
133
+
134
+ * update nan to 1.8.4 for iojs 2.x support
135
+
136
+ # 0.8.2 (2015-03-28)
137
+
138
+ * always use callback for generating random bytes to avoid blocking
139
+
140
+ # 0.8.1 (2015-01-18)
141
+ * update NaN to 1.5.0 for iojs support
142
+
143
+ # 0.8.0 (2014-08-03)
144
+ * migrate to NAN for bindings
145
+
146
+ # v0.5.0
147
+ * Fix for issue around empty string params throwing Errors.
148
+ * Method deprecation.
149
+ * Upgrade from libeio/ev to libuv. (shtylman)
150
+ ** --- NOTE --- Breaks 0.4.x compatability
151
+ * EV_MULTIPLICITY compile flag.
152
+
153
+ # v0.4.1
154
+ * Thread safety fix around OpenSSL (GH-32). (bnoordhuis - through node)
155
+ * C++ code changes using delete and new instead of malloc and free. (shtylman)
156
+ * Compile options for speed, zoom. (shtylman)
157
+ * Move much of the type and variable checking to the JS. (shtylman)
158
+
159
+ # v0.4.0
160
+ * Added getRounds function that will tell you the number of rounds within a hash/salt
161
+
162
+ # v0.3.2
163
+ * Fix api issue with async salt gen first param
164
+
165
+ # v0.3.1
166
+ * Compile under node 0.5.x
167
+
168
+ # v0.3.0
169
+ * Internal Refactoring
170
+ * Remove pthread dependencies and locking
171
+ * Fix compiler warnings and a memory bug
172
+
173
+ # v0.2.4
174
+ * Use threadsafe functions instead of pthread mutexes
175
+ * salt validation to make sure the salt is of the correct size and format
176
+
177
+ # v0.2.3
178
+ * cygwin support
179
+
180
+ # v0.2.2
181
+ * Remove dependency on libbsd, use libssl instead
182
+
183
+ # v0.2.0
184
+ * Added async functionality
185
+ * API changes
186
+ * hashpw -> encrypt
187
+ * all old sync methods now end with _sync
188
+ * Removed libbsd(arc4random) dependency...now uses openssl which is more widely spread
189
+
190
+ # v0.1.2
191
+ * Security fix. Wasn't reading rounds in properly and was always only using 4 rounds
package/Dockerfile ADDED
@@ -0,0 +1,57 @@
1
+ # Usage:
2
+ #
3
+ # docker build -t fastbcrypt-builder .
4
+ # CONTAINER=$(docker create fastbcrypt-builder)
5
+ # # Then copy the artifact to your host:
6
+ # docker cp "$CONTAINER:/usr/local/opt/fastbcrypt/prebuilds" .
7
+ # docker rm "$CONTAINER"
8
+ #
9
+ # Use --platform to build cross-platform i.e. for ARM:
10
+ #
11
+ # docker build -t fastbcrypt-builder --platform "linux/arm64/v8" .
12
+ # CONTAINER=$(docker create --platform "linux/arm64/v8" fastbcrypt-builder)
13
+ # # this copies the prebuilds/linux-arm64 artifacts
14
+ # docker cp "$CONTAINER:/usr/local/opt/fastbcrypt/prebuilds" .
15
+ # docker rm "$CONTAINER"
16
+
17
+
18
+ ARG FROM_IMAGE=node:18-bullseye
19
+ #ARG FROM_IMAGE=arm32v7/node:16-bullseye
20
+ #ARG FROM_IMAGE=arm64v8/node:16-bullseye
21
+ FROM ${FROM_IMAGE}
22
+
23
+ ENV project fastbcrypt
24
+ ENV DEBIAN_FRONTEND noninteractive
25
+ ENV LC_ALL en_US.UTF-8
26
+ ENV LANG ${LC_ALL}
27
+
28
+ RUN echo "#log: ${project}: Setup system" \
29
+ && set -x \
30
+ && apt-get update -y \
31
+ && apt-get install -y \
32
+ build-essential \
33
+ python3 \
34
+ && apt-get clean \
35
+ && update-alternatives --install /usr/local/bin/python python /usr/bin/python3 20 \
36
+ && npm i -g prebuildify@5 node-gyp@9 \
37
+ && sync
38
+
39
+ ADD . /usr/local/opt/${project}
40
+ WORKDIR /usr/local/opt/${project}
41
+
42
+ RUN echo "#log: ${project}: Running build" \
43
+ && set -x \
44
+ && npm ci \
45
+ && npm run build
46
+
47
+ ARG RUN_TESTS=true
48
+ ARG TEST_TIMEOUT_SECONDS=
49
+
50
+ RUN if "${RUN_TESTS}"; then \
51
+ echo "#log ${project}: Running tests" \
52
+ && npm test; \
53
+ else \
54
+ echo "#log ${project}: Tests were skipped!"; \
55
+ fi
56
+
57
+ CMD /bin/bash -l
@@ -0,0 +1,41 @@
1
+ # Usage:
2
+ #
3
+ # docker build -t fastbcrypt-linux-alpine-builder -f Dockerfile-alpine .
4
+ # CONTAINER=$(docker create fastbcrypt-linux-alpine-builder)
5
+ # # Then copy the artifact to your host:
6
+ # docker cp "$CONTAINER:/usr/local/opt/fastbcrypt/prebuilds" .
7
+ # docker rm "$CONTAINER"
8
+
9
+ ARG FROM_IMAGE=node:18-alpine
10
+ FROM ${FROM_IMAGE}
11
+
12
+ ENV project fastbcrypt
13
+ ENV DEBIAN_FRONTEND noninteractive
14
+ ENV LC_ALL en_US.UTF-8
15
+ ENV LANG ${LC_ALL}
16
+
17
+ RUN echo "#log: ${project}: Setup system" \
18
+ && set -x \
19
+ && apk add --update build-base python3 \
20
+ && npm i -g prebuildify@5 node-gyp@9 \
21
+ && sync
22
+
23
+ ADD . /usr/local/opt/${project}
24
+ WORKDIR /usr/local/opt/${project}
25
+
26
+ RUN echo "#log: ${project}: Running build" \
27
+ && set -x \
28
+ && npm ci \
29
+ && npm run build
30
+
31
+ ARG RUN_TESTS=true
32
+ ARG TEST_TIMEOUT_SECONDS=
33
+
34
+ RUN if "${RUN_TESTS}"; then \
35
+ echo "#log ${project}: Running tests" \
36
+ && npm test; \
37
+ else \
38
+ echo "#log ${project}: Tests were skipped!"; \
39
+ fi
40
+
41
+ CMD /bin/bash -l
@@ -0,0 +1,18 @@
1
+ Thanks for reporting an issue with Fastbcrypt.
2
+
3
+ To help you resolve your issue faster please make sure you have done the following:
4
+
5
+ * Searched existing issues (even closed ones) for your same problem
6
+ * Make sure you have installed the required dependencies listed on the readme
7
+ * Read your npm error log for lines telling you what failed, usually it is a problem with not having the correct dependencies installed to build the native module
8
+
9
+ Once you have done the above and are still confident that the issue is with the module, please describe it below. Some things that really help get your issue resolved faster are:
10
+
11
+ * What went wrong?
12
+ * What did you expect to happen?
13
+ * Which versions of Fastbcrypt and Node.js are you using, and on which OS and architecture?
14
+ * If you find a bug, please write a failing test.
15
+
16
+ Thanks!
17
+
18
+ P.S. If it doesn't look like you read the above then your issue will likely be closed without further explanation. Sorry, but there are just too many issues opened with no useful information or questions which have been previously addressed.
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Nicholas Campbell
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
package/Makefile ADDED
@@ -0,0 +1,19 @@
1
+ TESTS = test/*.js
2
+
3
+ all: test
4
+
5
+ build: clean compile
6
+
7
+ compile:
8
+ npm install .
9
+ npm run install
10
+
11
+ test: build
12
+ @./node_modules/.bin/jest \
13
+ $(TESTS)
14
+
15
+ clean:
16
+ rm -Rf lib/bindings/
17
+
18
+
19
+ .PHONY: clean test build