mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
chore(repo): remove dead code and useless tests (#3375)
This commit is contained in:
1 parent
7e177a1c90
commit
1cd62eb661
1391 files changed
+783
-120415
No files matched your search
@@ -25,6 +25,6 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "cargo run --locked --quiet --manifest-path ../../../tools/ci/Cargo.toml -- build-desktop-native-addon",
|
||||
"test": "cargo test --manifest-path Cargo.toml && node --test test/*.test.mjs"
|
||||
"test": "cargo test --manifest-path Cargo.toml"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
use napi::Result;
|
||||
use napi::bindgen_prelude::{Buffer, Error, Status};
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn buffer_from_bytes(bytes: &[u8]) -> Buffer {
|
||||
Buffer::from(bytes.to_vec())
|
||||
}
|
||||
use napi::bindgen_prelude::{Error, Status};
|
||||
|
||||
pub fn ceremony_error(prefix: &str, message: &str) -> Error {
|
||||
Error::new(Status::GenericFailure, format!("{prefix}: {message}"))
|
||||
@@ -33,19 +28,11 @@ pub const ATTACHMENT_CROSS_PLATFORM: u32 = 2;
|
||||
pub const USER_VERIFICATION_REQUIRED: u32 = 1;
|
||||
#[allow(dead_code)]
|
||||
pub const USER_VERIFICATION_PREFERRED: u32 = 2;
|
||||
#[allow(dead_code)]
|
||||
pub const USER_VERIFICATION_DISCOURAGED: u32 = 3;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub const ATTESTATION_NONE: u32 = 1;
|
||||
#[allow(dead_code)]
|
||||
pub const ATTESTATION_INDIRECT: u32 = 2;
|
||||
#[allow(dead_code)]
|
||||
pub const ATTESTATION_DIRECT: u32 = 3;
|
||||
|
||||
pub const ENTERPRISE_NONE: u32 = 0;
|
||||
#[allow(dead_code)]
|
||||
pub const ENTERPRISE_VENDOR_FACILITATED: u32 = 1;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[allow(dead_code)]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use std::ptr;
|
||||
use std::sync::Mutex;
|
||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
|
||||
use dispatch2::{
|
||||
DispatchQueue, DispatchRetained, DispatchSemaphore, DispatchTime, MainThreadBound, WaitError,
|
||||
@@ -45,14 +45,10 @@ use objc2_foundation::{
|
||||
};
|
||||
|
||||
use crate::common::{
|
||||
ATTACHMENT_CROSS_PLATFORM, ATTACHMENT_PLATFORM, CREATE_PREFIX, CreateInput, CreateResult,
|
||||
DescriptorInput, GET_PREFIX, GetInput, GetResult, TRANSPORT_INTERNAL, TRANSPORT_USB,
|
||||
ceremony_error,
|
||||
CREATE_PREFIX, CreateInput, CreateResult, DescriptorInput, GET_PREFIX, GetInput, GetResult,
|
||||
TRANSPORT_INTERNAL, TRANSPORT_USB, ceremony_error,
|
||||
};
|
||||
|
||||
#[allow(dead_code)]
|
||||
const _: u32 = ATTACHMENT_PLATFORM + ATTACHMENT_CROSS_PLATFORM;
|
||||
|
||||
pub fn is_supported() -> bool {
|
||||
AnyClass::get(c"ASAuthorizationPlatformPublicKeyCredentialProvider").is_some()
|
||||
&& AnyClass::get(c"ASAuthorizationSecurityKeyPublicKeyCredentialProvider").is_some()
|
||||
@@ -1105,6 +1101,3 @@ fn build_get_controller(
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
const _: Option<&Receiver<CompletionPayload>> = None;
|
||||
@@ -1,45 +0,0 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import webauthnPure from '../pure.cjs';
|
||||
|
||||
test('loader resolves supported native filenames', () => {
|
||||
assert.equal(webauthnPure.nativeFileName('darwin', 'x64'), 'webauthn.darwin-x64.node');
|
||||
assert.equal(webauthnPure.nativeFileName('darwin', 'arm64'), 'webauthn.darwin-arm64.node');
|
||||
assert.equal(webauthnPure.nativeFileName('linux', 'x64'), 'webauthn.linux-x64-gnu.node');
|
||||
assert.equal(webauthnPure.nativeFileName('linux', 'arm64'), 'webauthn.linux-arm64-gnu.node');
|
||||
assert.equal(webauthnPure.nativeFileName('win32', 'x64'), 'webauthn.win32-x64-msvc.node');
|
||||
assert.equal(webauthnPure.nativeFileName('win32', 'arm64'), 'webauthn.win32-arm64-msvc.node');
|
||||
assert.equal(webauthnPure.nativeFileName('freebsd', 'x64'), null);
|
||||
});
|
||||
|
||||
test('normalization creates spec-shaped client data and Windows transport bits', () => {
|
||||
const challenge = Buffer.from([1, 2, 3, 4]);
|
||||
const normalized = webauthnPure.normalizeCreateOptions({
|
||||
origin: 'https://web.canary.fluxer.app/channels/@me',
|
||||
challenge,
|
||||
rp: {id: 'fluxer.app', name: 'Fluxer'},
|
||||
user: {id: Buffer.from('user'), name: 'name', displayName: 'Name'},
|
||||
pubKeyCredParams: [{type: 'public-key', alg: -7}],
|
||||
authenticatorSelection: {
|
||||
authenticatorAttachment: 'platform',
|
||||
residentKey: 'preferred',
|
||||
userVerification: 'required',
|
||||
},
|
||||
excludeCredentials: [{type: 'public-key', id: Buffer.from('cred'), transports: ['internal', 'hybrid']}],
|
||||
attestation: 'none',
|
||||
});
|
||||
assert.equal(normalized.rpId, 'fluxer.app');
|
||||
assert.equal(normalized.authenticatorAttachment, 1);
|
||||
assert.equal(normalized.userVerification, 1);
|
||||
assert.equal(normalized.preferResidentKey, true);
|
||||
assert.equal(normalized.requireResidentKey, false);
|
||||
assert.equal(normalized.excludeCredentials[0].transports, 0x10 | 0x20);
|
||||
assert.deepEqual(JSON.parse(normalized.clientDataJSON.toString('utf8')), {
|
||||
type: 'webauthn.create',
|
||||
challenge: 'AQIDBA',
|
||||
origin: 'https://web.canary.fluxer.app',
|
||||
crossOrigin: false,
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user