Skip to content

Commit

Permalink
chore: upgrade toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Oct 26, 2023
1 parent 8b0be16 commit 48c7f3a
Show file tree
Hide file tree
Showing 15 changed files with 3,982 additions and 3,924 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
target: 'aarch64-pc-windows-msvc'
build: |
npm i -g @napi-rs/cli
yarn workspaces foreach --no-private -j 1 --exclude @node-rs/jsonwebtoken run build --target aarch64-pc-windows-msvc
yarn build --target aarch64-pc-windows-msvc
name: stable - ${{ matrix.settings.target }} - node@18
runs-on: ${{ matrix.settings.host }}
Expand All @@ -115,7 +115,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
with:
toolchain: nightly-2023-07-19
toolchain: nightly-2023-10-25
targets: ${{ matrix.settings.target }}

- name: Cache cargo registry
Expand Down Expand Up @@ -184,19 +184,21 @@ jobs:
- uses: actions/checkout@v3
- name: Build
id: build
uses: vmactions/freebsd-vm@v0
uses: cross-platform-actions/action@v0.20.0
env:
DEBUG: 'napi:*'
RUSTUP_HOME: /usr/local/rustup
CARGO_HOME: /usr/local/cargo
RUSTUP_IO_THREADS: 1
with:
envs: 'DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS'
usesh: true
mem: 3000
prepare: |
pkg install -y -f curl node libnghttp2 npm
npm install -g yarn --ignore-scripts
operating_system: freebsd
version: '13.2'
memory: 13G
cpu_count: 3
environment_variables: 'DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS'
run: |
sudo pkg install -y -f curl node libnghttp2 npm
sudo npm install -g yarn --ignore-scripts
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain stable
export PATH="/usr/local/cargo/bin:$PATH"
Expand All @@ -206,7 +208,6 @@ jobs:
node -v
echo "~~~~ yarn --version ~~~~"
yarn --version
run: |
export PATH="/usr/local/cargo/bin:$PATH"
pwd
ls -lah
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2023-07-19
toolchain: nightly-2023-10-25
components: rustfmt, clippy

- name: 'Install dependencies'
Expand Down
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.4.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.0.cjs

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@ nodeLinker: node-modules

npmRegistryServer: 'https://registry.npmjs.org/'

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.6.4.cjs
yarnPath: .yarn/releases/yarn-4.0.0.cjs
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-rs",
"packageManager": "yarn@3.6.4",
"packageManager": "yarn@4.0.0",
"version": "0.0.0",
"description": "Node & Rust bindings monorepo",
"author": "LongYinan <lynweklm@gmail.com>",
Expand All @@ -10,9 +10,9 @@
"packages/*"
],
"scripts": {
"artifacts": "yarn workspaces foreach --no-private run artifacts",
"artifacts": "yarn workspaces foreach -A --no-private run artifacts",
"bench": "lerna run bench --concurrency 1 --stream --no-prefix",
"build": "yarn workspaces foreach --no-private -j 1 run build",
"build": "yarn workspaces foreach -A --no-private -j 1 run build",
"build:ts": "tsc -b tsconfig.project.json -verbose",
"lint": "eslint . -c ./.eslintrc.yml \"packages/**/*.{ts,js}\"",
"test": "ava",
Expand Down
4 changes: 2 additions & 2 deletions packages/argon2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ version = "0.0.0"
crate-type = ["cdylib"]

[dependencies]
argon2 = "0.5"
argon2 = { version = "0.5", features = ["rand"] }
global_alloc = { path = "../../crates/alloc" }
napi = { version = "2", default-features = false, features = ["napi3"] }
napi-derive = { version = "2", default-features = false, features = [
"type-def",
] }
rand = { version = "0.8", features = ["nightly", "simd_support", "getrandom"] }
rand_core = { version = "0.6", features = ["getrandom"] }

[build-dependencies]
napi-build = "2"
3 changes: 2 additions & 1 deletion packages/argon2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ use napi::bindgen_prelude::*;
use napi_derive::napi;

use argon2::{
password_hash::{rand_core::OsRng, PasswordHasher, PasswordVerifier, SaltString},
password_hash::{PasswordHasher, PasswordVerifier, SaltString},
Argon2, Params,
};
use rand_core::OsRng;

#[napi]
pub enum Algorithm {
Expand Down
2 changes: 1 addition & 1 deletion packages/jsonwebtoken/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ napi = { version = "2", default-features = false, features = [
"serde-json",
] }
napi-derive = { version = "2" }
rand = "0.8"
rand_core = { version = "0.6", features = ["std"] }
serde = "1.0"
serde_json = "1.0"

Expand Down
1 change: 1 addition & 0 deletions packages/jsonwebtoken/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
Expand Down
4 changes: 1 addition & 3 deletions packages/jsonwebtoken/src/sign.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use jsonwebtoken::{self};
use napi::{bindgen_prelude::*, JsBuffer, JsBufferValue, Ref};
use napi_derive::napi;
use std::borrow::Borrow;

use crate::{claims::Claims, header::Header};

Expand Down Expand Up @@ -68,7 +66,7 @@ pub struct SignTask {
impl SignTask {
#[inline]
pub fn sign(claims: &Claims, header: &Header, key: &[u8]) -> Result<String> {
let header: &jsonwebtoken::Header = &header.borrow().into();
let header: &jsonwebtoken::Header = &header.into();
let claims = &claims;
let sign_key = &into_encoding_key(key, &header.alg)?;

Expand Down
7 changes: 3 additions & 4 deletions packages/jsonwebtoken/src/verify.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use napi::{bindgen_prelude::*, JsBuffer, JsBufferValue, Ref};
use napi_derive::napi;
use std::borrow::Borrow;

use crate::{claims::Claims, validation::Validation};

Expand Down Expand Up @@ -66,7 +65,7 @@ pub struct VerifyTask {

impl VerifyTask {
pub fn verify(token: &str, key: &[u8], validation: &Validation) -> Result<Claims> {
let validation: &jsonwebtoken::Validation = &validation.borrow().into();
let validation: &jsonwebtoken::Validation = &validation.into();

let first_alg = validation.algorithms.first().ok_or(Error::new(
Status::InvalidArg,
Expand Down Expand Up @@ -112,7 +111,7 @@ pub fn verify(
VerifyTask {
token,
key: AsyncKeyInput::from_either(key)?,
validation: validation.unwrap_or(Validation::default()),
validation: validation.unwrap_or_default(),
},
abort_signal,
))
Expand All @@ -124,6 +123,6 @@ pub fn verify_sync(
key: Either<String, Buffer>,
validation: Option<Validation>,
) -> Result<Claims> {
let validation = validation.unwrap_or(Validation::default());
let validation = validation.unwrap_or_default();
VerifyTask::verify(&token, key.as_ref(), &validation)
}
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-07-19
nightly-2023-10-25
Loading

0 comments on commit 48c7f3a

Please sign in to comment.