mirror of
https://github.com/bitwarden/browser
synced 2025-12-22 11:13:46 +00:00
[deps] Platform: Update napi to v3 (major) (#16053)
* [deps] Platform: Update napi to v3 * fix: upgrade required dependencies * fix: deprecated syntax in package.json * fix: TS code after napi changes * fix: lint * fix: floating promise * fix: libsqlite musl compilation * feat: remove support for musl * fix: sorting lint * fix: logging not working * fix: pre-emptive fix for passkey autofill * fix: rust lint * fix: package-lock * fix: linux type error * fix: windows type error --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com> Co-authored-by: Andreas Coroiu <acoroiu@bitwarden.com>
This commit is contained in:
12
.github/workflows/build-desktop.yml
vendored
12
.github/workflows/build-desktop.yml
vendored
@@ -209,7 +209,7 @@ jobs:
|
|||||||
- name: Set up environment
|
- name: Set up environment
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install pkg-config libxss-dev rpm musl-dev musl-tools flatpak flatpak-builder
|
sudo apt-get -y install pkg-config libxss-dev rpm flatpak flatpak-builder
|
||||||
|
|
||||||
- name: Set up Snap
|
- name: Set up Snap
|
||||||
run: sudo snap install snapcraft --classic
|
run: sudo snap install snapcraft --classic
|
||||||
@@ -262,12 +262,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PKG_CONFIG_ALLOW_CROSS: true
|
PKG_CONFIG_ALLOW_CROSS: true
|
||||||
PKG_CONFIG_ALL_STATIC: true
|
PKG_CONFIG_ALL_STATIC: true
|
||||||
TARGET: musl
|
|
||||||
# Note: It is important that we use the release build because some compute heavy
|
# Note: It is important that we use the release build because some compute heavy
|
||||||
# operations such as key derivation for oo7 on linux are too slow in debug mode
|
# operations such as key derivation for oo7 on linux are too slow in debug mode
|
||||||
run: |
|
run: |
|
||||||
rustup target add x86_64-unknown-linux-musl
|
node build.js --release
|
||||||
node build.js --target=x86_64-unknown-linux-musl --release
|
|
||||||
|
|
||||||
- name: Build application
|
- name: Build application
|
||||||
run: npm run dist:lin
|
run: npm run dist:lin
|
||||||
@@ -367,7 +365,7 @@ jobs:
|
|||||||
- name: Set up environment
|
- name: Set up environment
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install pkg-config libxss-dev rpm musl-dev musl-tools flatpak flatpak-builder squashfs-tools ruby ruby-dev rubygems build-essential
|
sudo apt-get -y install pkg-config libxss-dev rpm flatpak flatpak-builder squashfs-tools ruby ruby-dev rubygems build-essential
|
||||||
sudo gem install --no-document fpm
|
sudo gem install --no-document fpm
|
||||||
|
|
||||||
- name: Set up Snap
|
- name: Set up Snap
|
||||||
@@ -427,12 +425,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PKG_CONFIG_ALLOW_CROSS: true
|
PKG_CONFIG_ALLOW_CROSS: true
|
||||||
PKG_CONFIG_ALL_STATIC: true
|
PKG_CONFIG_ALL_STATIC: true
|
||||||
TARGET: musl
|
|
||||||
# Note: It is important that we use the release build because some compute heavy
|
# Note: It is important that we use the release build because some compute heavy
|
||||||
# operations such as key derivation for oo7 on linux are too slow in debug mode
|
# operations such as key derivation for oo7 on linux are too slow in debug mode
|
||||||
run: |
|
run: |
|
||||||
rustup target add aarch64-unknown-linux-musl
|
node build.js --release
|
||||||
node build.js --target=aarch64-unknown-linux-musl --release
|
|
||||||
|
|
||||||
- name: Check index.d.ts generated
|
- name: Check index.d.ts generated
|
||||||
if: github.event_name == 'pull_request' && steps.cache.outputs.cache-hit != 'true'
|
if: github.event_name == 'pull_request' && steps.cache.outputs.cache-hit != 'true'
|
||||||
|
|||||||
71
apps/desktop/desktop_native/Cargo.lock
generated
71
apps/desktop/desktop_native/Cargo.lock
generated
@@ -685,9 +685,9 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
version = "0.6.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
|
checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
]
|
]
|
||||||
@@ -746,16 +746,6 @@ dependencies = [
|
|||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ctor"
|
|
||||||
version = "0.2.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501"
|
|
||||||
dependencies = [
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctor"
|
name = "ctor"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
@@ -1860,32 +1850,33 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "napi"
|
name = "napi"
|
||||||
version = "2.16.17"
|
version = "3.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "55740c4ae1d8696773c78fdafd5d0e5fe9bc9f1b071c7ba493ba5c413a9184f3"
|
checksum = "f1b74e3dce5230795bb4d2821b941706dee733c7308752507254b0497f39cad7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"ctor 0.2.9",
|
"ctor",
|
||||||
"napi-derive",
|
"napi-build",
|
||||||
"napi-sys",
|
"napi-sys",
|
||||||
"once_cell",
|
"nohash-hasher",
|
||||||
|
"rustc-hash",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "napi-build"
|
name = "napi-build"
|
||||||
version = "2.2.0"
|
version = "2.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "03acbfa4f156a32188bfa09b86dc11a431b5725253fc1fc6f6df5bed273382c4"
|
checksum = "dcae8ad5609d14afb3a3b91dee88c757016261b151e9dcecabf1b2a31a6cab14"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "napi-derive"
|
name = "napi-derive"
|
||||||
version = "2.16.13"
|
version = "3.2.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7cbe2585d8ac223f7d34f13701434b9d5f4eb9c332cccce8dee57ea18ab8ab0c"
|
checksum = "7552d5a579b834614bbd496db5109f1b9f1c758f08224b0dee1e408333adf0d0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
|
||||||
"convert_case",
|
"convert_case",
|
||||||
|
"ctor",
|
||||||
"napi-derive-backend",
|
"napi-derive-backend",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -1894,24 +1885,22 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "napi-derive-backend"
|
name = "napi-derive-backend"
|
||||||
version = "1.0.75"
|
version = "2.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1639aaa9eeb76e91c6ae66da8ce3e89e921cd3885e99ec85f4abacae72fc91bf"
|
checksum = "5f6a81ac7486b70f2532a289603340862c06eea5a1e650c1ffeda2ce1238516a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case",
|
||||||
"once_cell",
|
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"regex",
|
|
||||||
"semver",
|
"semver",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "napi-sys"
|
name = "napi-sys"
|
||||||
version = "2.4.0"
|
version = "3.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3"
|
checksum = "3e4e7135a8f97aa0f1509cce21a8a1f9dcec1b50d8dee006b48a5adb69a9d64d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading",
|
"libloading",
|
||||||
]
|
]
|
||||||
@@ -1929,6 +1918,12 @@ dependencies = [
|
|||||||
"memoffset",
|
"memoffset",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nohash-hasher"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nom"
|
name = "nom"
|
||||||
version = "7.1.3"
|
version = "7.1.3"
|
||||||
@@ -2498,7 +2493,7 @@ dependencies = [
|
|||||||
name = "process_isolation"
|
name = "process_isolation"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ctor 0.5.0",
|
"ctor",
|
||||||
"desktop_core",
|
"desktop_core",
|
||||||
"libc",
|
"libc",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -2613,18 +2608,6 @@ dependencies = [
|
|||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex"
|
|
||||||
version = "1.11.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
|
||||||
dependencies = [
|
|
||||||
"aho-corasick",
|
|
||||||
"memchr",
|
|
||||||
"regex-automata",
|
|
||||||
"regex-syntax",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-automata"
|
name = "regex-automata"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
@@ -2697,6 +2680,12 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc-hash"
|
||||||
|
version = "2.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rustc_version"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ interprocess = "=2.2.1"
|
|||||||
libc = "=0.2.178"
|
libc = "=0.2.178"
|
||||||
linux-keyutils = "=0.2.4"
|
linux-keyutils = "=0.2.4"
|
||||||
memsec = "=0.7.0"
|
memsec = "=0.7.0"
|
||||||
napi = "=2.16.17"
|
napi = "=3.3.0"
|
||||||
napi-build = "=2.2.0"
|
napi-build = "=2.2.3"
|
||||||
napi-derive = "=2.16.13"
|
napi-derive = "=3.2.5"
|
||||||
oo7 = "=0.4.3"
|
oo7 = "=0.4.3"
|
||||||
pin-project = "=1.1.10"
|
pin-project = "=1.1.10"
|
||||||
pkcs8 = "=0.10.2"
|
pkcs8 = "=0.10.2"
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ const rustTargetsMap = {
|
|||||||
"aarch64-pc-windows-msvc": { nodeArch: 'arm64', platform: 'win32' },
|
"aarch64-pc-windows-msvc": { nodeArch: 'arm64', platform: 'win32' },
|
||||||
"x86_64-apple-darwin": { nodeArch: 'x64', platform: 'darwin' },
|
"x86_64-apple-darwin": { nodeArch: 'x64', platform: 'darwin' },
|
||||||
"aarch64-apple-darwin": { nodeArch: 'arm64', platform: 'darwin' },
|
"aarch64-apple-darwin": { nodeArch: 'arm64', platform: 'darwin' },
|
||||||
'x86_64-unknown-linux-musl': { nodeArch: 'x64', platform: 'linux' },
|
'x86_64-unknown-linux-gnu': { nodeArch: 'x64', platform: 'linux' },
|
||||||
'aarch64-unknown-linux-musl': { nodeArch: 'arm64', platform: 'linux' },
|
'aarch64-unknown-linux-gnu': { nodeArch: 'arm64', platform: 'linux' },
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the dist directory exists
|
// Ensure the dist directory exists
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ pub struct NativeImporterMetadata {
|
|||||||
/// Identifies the importer
|
/// Identifies the importer
|
||||||
pub id: String,
|
pub id: String,
|
||||||
/// Describes the strategies used to obtain imported data
|
/// Describes the strategies used to obtain imported data
|
||||||
pub loaders: Vec<&'static str>,
|
pub loaders: Vec<String>,
|
||||||
/// Identifies the instructions for the importer
|
/// Identifies the instructions for the importer
|
||||||
pub instructions: &'static str,
|
pub instructions: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a map of supported importers based on the current platform.
|
/// Returns a map of supported importers based on the current platform.
|
||||||
@@ -36,9 +36,9 @@ pub fn get_supported_importers<T: InstalledBrowserRetriever>(
|
|||||||
PLATFORM_SUPPORTED_BROWSERS.iter().map(|b| b.name).collect();
|
PLATFORM_SUPPORTED_BROWSERS.iter().map(|b| b.name).collect();
|
||||||
|
|
||||||
for (id, browser_name) in IMPORTERS {
|
for (id, browser_name) in IMPORTERS {
|
||||||
let mut loaders: Vec<&'static str> = vec!["file"];
|
let mut loaders: Vec<String> = vec!["file".to_string()];
|
||||||
if supported.contains(browser_name) {
|
if supported.contains(browser_name) {
|
||||||
loaders.push("chromium");
|
loaders.push("chromium".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
if installed_browsers.contains(&browser_name.to_string()) {
|
if installed_browsers.contains(&browser_name.to_string()) {
|
||||||
@@ -47,7 +47,7 @@ pub fn get_supported_importers<T: InstalledBrowserRetriever>(
|
|||||||
NativeImporterMetadata {
|
NativeImporterMetadata {
|
||||||
id: id.to_string(),
|
id: id.to_string(),
|
||||||
loaders,
|
loaders,
|
||||||
instructions: "chromium",
|
instructions: "chromium".to_string(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -79,12 +79,9 @@ mod tests {
|
|||||||
map.keys().cloned().collect()
|
map.keys().cloned().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_loaders(
|
fn get_loaders(map: &HashMap<String, NativeImporterMetadata>, id: &str) -> HashSet<String> {
|
||||||
map: &HashMap<String, NativeImporterMetadata>,
|
|
||||||
id: &str,
|
|
||||||
) -> HashSet<&'static str> {
|
|
||||||
map.get(id)
|
map.get(id)
|
||||||
.map(|m| m.loaders.iter().copied().collect::<HashSet<_>>())
|
.map(|m| m.loaders.iter().cloned().collect::<HashSet<_>>())
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +104,7 @@ mod tests {
|
|||||||
for (key, meta) in map.iter() {
|
for (key, meta) in map.iter() {
|
||||||
assert_eq!(&meta.id, key);
|
assert_eq!(&meta.id, key);
|
||||||
assert_eq!(meta.instructions, "chromium");
|
assert_eq!(meta.instructions, "chromium");
|
||||||
assert!(meta.loaders.contains(&"file"));
|
assert!(meta.loaders.contains(&"file".to_owned()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +144,7 @@ mod tests {
|
|||||||
for (key, meta) in map.iter() {
|
for (key, meta) in map.iter() {
|
||||||
assert_eq!(&meta.id, key);
|
assert_eq!(&meta.id, key);
|
||||||
assert_eq!(meta.instructions, "chromium");
|
assert_eq!(meta.instructions, "chromium");
|
||||||
assert!(meta.loaders.contains(&"file"));
|
assert!(meta.loaders.contains(&"file".to_owned()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +180,7 @@ mod tests {
|
|||||||
for (key, meta) in map.iter() {
|
for (key, meta) in map.iter() {
|
||||||
assert_eq!(&meta.id, key);
|
assert_eq!(&meta.id, key);
|
||||||
assert_eq!(meta.instructions, "chromium");
|
assert_eq!(meta.instructions, "chromium");
|
||||||
assert!(meta.loaders.contains(&"file"));
|
assert!(meta.loaders.contains(&"file".to_owned()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
431
apps/desktop/desktop_native/napi/index.d.ts
vendored
431
apps/desktop/desktop_native/napi/index.d.ts
vendored
@@ -1,125 +1,7 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
/* auto-generated by NAPI-RS */
|
/* auto-generated by NAPI-RS */
|
||||||
|
/* eslint-disable */
|
||||||
export declare namespace passwords {
|
export declare namespace autofill {
|
||||||
/** The error message returned when a password is not found during retrieval or deletion. */
|
export class AutofillIpcServer {
|
||||||
export const PASSWORD_NOT_FOUND: string
|
|
||||||
/**
|
|
||||||
* Fetch the stored password from the keychain.
|
|
||||||
* Throws {@link Error} with message {@link PASSWORD_NOT_FOUND} if the password does not exist.
|
|
||||||
*/
|
|
||||||
export function getPassword(service: string, account: string): Promise<string>
|
|
||||||
/**
|
|
||||||
* Save the password to the keychain. Adds an entry if none exists otherwise updates the
|
|
||||||
* existing entry.
|
|
||||||
*/
|
|
||||||
export function setPassword(service: string, account: string, password: string): Promise<void>
|
|
||||||
/**
|
|
||||||
* Delete the stored password from the keychain.
|
|
||||||
* Throws {@link Error} with message {@link PASSWORD_NOT_FOUND} if the password does not exist.
|
|
||||||
*/
|
|
||||||
export function deletePassword(service: string, account: string): Promise<void>
|
|
||||||
/** Checks if the os secure storage is available */
|
|
||||||
export function isAvailable(): Promise<boolean>
|
|
||||||
}
|
|
||||||
export declare namespace biometrics {
|
|
||||||
export function prompt(hwnd: Buffer, message: string): Promise<boolean>
|
|
||||||
export function available(): Promise<boolean>
|
|
||||||
export function setBiometricSecret(service: string, account: string, secret: string, keyMaterial: KeyMaterial | undefined | null, ivB64: string): Promise<string>
|
|
||||||
/**
|
|
||||||
* Retrieves the biometric secret for the given service and account.
|
|
||||||
* Throws Error with message [`passwords::PASSWORD_NOT_FOUND`] if the secret does not exist.
|
|
||||||
*/
|
|
||||||
export function getBiometricSecret(service: string, account: string, keyMaterial?: KeyMaterial | undefined | null): Promise<string>
|
|
||||||
/**
|
|
||||||
* Derives key material from biometric data. Returns a string encoded with a
|
|
||||||
* base64 encoded key and the base64 encoded challenge used to create it
|
|
||||||
* separated by a `|` character.
|
|
||||||
*
|
|
||||||
* If the iv is provided, it will be used as the challenge. Otherwise a random challenge will
|
|
||||||
* be generated.
|
|
||||||
*
|
|
||||||
* `format!("<key_base64>|<iv_base64>")`
|
|
||||||
*/
|
|
||||||
export function deriveKeyMaterial(iv?: string | undefined | null): Promise<OsDerivedKey>
|
|
||||||
export interface KeyMaterial {
|
|
||||||
osKeyPartB64: string
|
|
||||||
clientKeyPartB64?: string
|
|
||||||
}
|
|
||||||
export interface OsDerivedKey {
|
|
||||||
keyB64: string
|
|
||||||
ivB64: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export declare namespace biometrics_v2 {
|
|
||||||
export function initBiometricSystem(): BiometricLockSystem
|
|
||||||
export function authenticate(biometricLockSystem: BiometricLockSystem, hwnd: Buffer, message: string): Promise<boolean>
|
|
||||||
export function authenticateAvailable(biometricLockSystem: BiometricLockSystem): Promise<boolean>
|
|
||||||
export function enrollPersistent(biometricLockSystem: BiometricLockSystem, userId: string, key: Buffer): Promise<void>
|
|
||||||
export function provideKey(biometricLockSystem: BiometricLockSystem, userId: string, key: Buffer): Promise<void>
|
|
||||||
export function unlock(biometricLockSystem: BiometricLockSystem, userId: string, hwnd: Buffer): Promise<Buffer>
|
|
||||||
export function unlockAvailable(biometricLockSystem: BiometricLockSystem, userId: string): Promise<boolean>
|
|
||||||
export function hasPersistent(biometricLockSystem: BiometricLockSystem, userId: string): Promise<boolean>
|
|
||||||
export function unenroll(biometricLockSystem: BiometricLockSystem, userId: string): Promise<void>
|
|
||||||
export class BiometricLockSystem { }
|
|
||||||
}
|
|
||||||
export declare namespace clipboards {
|
|
||||||
export function read(): Promise<string>
|
|
||||||
export function write(text: string, password: boolean): Promise<void>
|
|
||||||
}
|
|
||||||
export declare namespace sshagent {
|
|
||||||
export interface PrivateKey {
|
|
||||||
privateKey: string
|
|
||||||
name: string
|
|
||||||
cipherId: string
|
|
||||||
}
|
|
||||||
export interface SshKey {
|
|
||||||
privateKey: string
|
|
||||||
publicKey: string
|
|
||||||
keyFingerprint: string
|
|
||||||
}
|
|
||||||
export interface SshUiRequest {
|
|
||||||
cipherId?: string
|
|
||||||
isList: boolean
|
|
||||||
processName: string
|
|
||||||
isForwarding: boolean
|
|
||||||
namespace?: string
|
|
||||||
}
|
|
||||||
export function serve(callback: (err: Error | null, arg: SshUiRequest) => any): Promise<SshAgentState>
|
|
||||||
export function stop(agentState: SshAgentState): void
|
|
||||||
export function isRunning(agentState: SshAgentState): boolean
|
|
||||||
export function setKeys(agentState: SshAgentState, newKeys: Array<PrivateKey>): void
|
|
||||||
export function lock(agentState: SshAgentState): void
|
|
||||||
export function clearKeys(agentState: SshAgentState): void
|
|
||||||
export class SshAgentState { }
|
|
||||||
}
|
|
||||||
export declare namespace processisolations {
|
|
||||||
export function disableCoredumps(): Promise<void>
|
|
||||||
export function isCoreDumpingDisabled(): Promise<boolean>
|
|
||||||
export function isolateProcess(): Promise<void>
|
|
||||||
}
|
|
||||||
export declare namespace powermonitors {
|
|
||||||
export function onLock(callback: (err: Error | null, ) => any): Promise<void>
|
|
||||||
export function isLockMonitorAvailable(): Promise<boolean>
|
|
||||||
}
|
|
||||||
export declare namespace windows_registry {
|
|
||||||
export function createKey(key: string, subkey: string, value: string): Promise<void>
|
|
||||||
export function deleteKey(key: string, subkey: string): Promise<void>
|
|
||||||
}
|
|
||||||
export declare namespace ipc {
|
|
||||||
export interface IpcMessage {
|
|
||||||
clientId: number
|
|
||||||
kind: IpcMessageType
|
|
||||||
message?: string
|
|
||||||
}
|
|
||||||
export const enum IpcMessageType {
|
|
||||||
Connected = 0,
|
|
||||||
Disconnected = 1,
|
|
||||||
Message = 2
|
|
||||||
}
|
|
||||||
export class IpcServer {
|
|
||||||
/**
|
/**
|
||||||
* Create and start the IPC server without blocking.
|
* Create and start the IPC server without blocking.
|
||||||
*
|
*
|
||||||
@@ -127,34 +9,43 @@ export declare namespace ipc {
|
|||||||
* connection and must be the same for both the server and client. @param callback
|
* connection and must be the same for both the server and client. @param callback
|
||||||
* This function will be called whenever a message is received from a client.
|
* This function will be called whenever a message is received from a client.
|
||||||
*/
|
*/
|
||||||
static listen(name: string, callback: (error: null | Error, message: IpcMessage) => void): Promise<IpcServer>
|
static listen(name: string, registrationCallback: (error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyRegistrationRequest) => void, assertionCallback: (error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyAssertionRequest) => void, assertionWithoutUserInterfaceCallback: (error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyAssertionWithoutUserInterfaceRequest) => void, nativeStatusCallback: (error: null | Error, clientId: number, sequenceNumber: number, message: NativeStatus) => void): Promise<AutofillIpcServer>
|
||||||
/** Return the path to the IPC server. */
|
/** Return the path to the IPC server. */
|
||||||
getPath(): string
|
getPath(): string
|
||||||
/** Stop the IPC server. */
|
/** Stop the IPC server. */
|
||||||
stop(): void
|
stop(): void
|
||||||
/**
|
completeRegistration(clientId: number, sequenceNumber: number, response: PasskeyRegistrationResponse): number
|
||||||
* Send a message over the IPC server to all the connected clients
|
completeAssertion(clientId: number, sequenceNumber: number, response: PasskeyAssertionResponse): number
|
||||||
*
|
completeError(clientId: number, sequenceNumber: number, error: string): number
|
||||||
* @return The number of clients that the message was sent to. Note that the number of
|
|
||||||
* messages actually received may be less, as some clients could disconnect before
|
|
||||||
* receiving the message.
|
|
||||||
*/
|
|
||||||
send(message: string): number
|
|
||||||
}
|
}
|
||||||
}
|
export interface NativeStatus {
|
||||||
export declare namespace autostart {
|
key: string
|
||||||
export function setAutostart(autostart: boolean, params: Array<string>): Promise<void>
|
value: string
|
||||||
}
|
|
||||||
export declare namespace autofill {
|
|
||||||
export function runCommand(value: string): Promise<string>
|
|
||||||
export const enum UserVerification {
|
|
||||||
Preferred = 'preferred',
|
|
||||||
Required = 'required',
|
|
||||||
Discouraged = 'discouraged'
|
|
||||||
}
|
}
|
||||||
export interface Position {
|
export interface PasskeyAssertionRequest {
|
||||||
x: number
|
rpId: string
|
||||||
y: number
|
clientDataHash: Array<number>
|
||||||
|
userVerification: UserVerification
|
||||||
|
allowedCredentials: Array<Array<number>>
|
||||||
|
windowXy: Position
|
||||||
|
}
|
||||||
|
export interface PasskeyAssertionResponse {
|
||||||
|
rpId: string
|
||||||
|
userHandle: Array<number>
|
||||||
|
signature: Array<number>
|
||||||
|
clientDataHash: Array<number>
|
||||||
|
authenticatorData: Array<number>
|
||||||
|
credentialId: Array<number>
|
||||||
|
}
|
||||||
|
export interface PasskeyAssertionWithoutUserInterfaceRequest {
|
||||||
|
rpId: string
|
||||||
|
credentialId: Array<number>
|
||||||
|
userName: string
|
||||||
|
userHandle: Array<number>
|
||||||
|
recordIdentifier?: string
|
||||||
|
clientDataHash: Array<number>
|
||||||
|
userVerification: UserVerification
|
||||||
|
windowXy: Position
|
||||||
}
|
}
|
||||||
export interface PasskeyRegistrationRequest {
|
export interface PasskeyRegistrationRequest {
|
||||||
rpId: string
|
rpId: string
|
||||||
@@ -172,71 +63,77 @@ export declare namespace autofill {
|
|||||||
credentialId: Array<number>
|
credentialId: Array<number>
|
||||||
attestationObject: Array<number>
|
attestationObject: Array<number>
|
||||||
}
|
}
|
||||||
export interface PasskeyAssertionRequest {
|
export interface Position {
|
||||||
rpId: string
|
x: number
|
||||||
clientDataHash: Array<number>
|
y: number
|
||||||
userVerification: UserVerification
|
|
||||||
allowedCredentials: Array<Array<number>>
|
|
||||||
windowXy: Position
|
|
||||||
}
|
}
|
||||||
export interface PasskeyAssertionWithoutUserInterfaceRequest {
|
export function runCommand(value: string): Promise<string>
|
||||||
rpId: string
|
export const enum UserVerification {
|
||||||
credentialId: Array<number>
|
Preferred = 'preferred',
|
||||||
userName: string
|
Required = 'required',
|
||||||
userHandle: Array<number>
|
Discouraged = 'discouraged'
|
||||||
recordIdentifier?: string
|
|
||||||
clientDataHash: Array<number>
|
|
||||||
userVerification: UserVerification
|
|
||||||
windowXy: Position
|
|
||||||
}
|
|
||||||
export interface NativeStatus {
|
|
||||||
key: string
|
|
||||||
value: string
|
|
||||||
}
|
|
||||||
export interface PasskeyAssertionResponse {
|
|
||||||
rpId: string
|
|
||||||
userHandle: Array<number>
|
|
||||||
signature: Array<number>
|
|
||||||
clientDataHash: Array<number>
|
|
||||||
authenticatorData: Array<number>
|
|
||||||
credentialId: Array<number>
|
|
||||||
}
|
|
||||||
export class IpcServer {
|
|
||||||
/**
|
|
||||||
* Create and start the IPC server without blocking.
|
|
||||||
*
|
|
||||||
* @param name The endpoint name to listen on. This name uniquely identifies the IPC
|
|
||||||
* connection and must be the same for both the server and client. @param callback
|
|
||||||
* This function will be called whenever a message is received from a client.
|
|
||||||
*/
|
|
||||||
static listen(name: string, registrationCallback: (error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyRegistrationRequest) => void, assertionCallback: (error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyAssertionRequest) => void, assertionWithoutUserInterfaceCallback: (error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyAssertionWithoutUserInterfaceRequest) => void, nativeStatusCallback: (error: null | Error, clientId: number, sequenceNumber: number, message: NativeStatus) => void): Promise<IpcServer>
|
|
||||||
/** Return the path to the IPC server. */
|
|
||||||
getPath(): string
|
|
||||||
/** Stop the IPC server. */
|
|
||||||
stop(): void
|
|
||||||
completeRegistration(clientId: number, sequenceNumber: number, response: PasskeyRegistrationResponse): number
|
|
||||||
completeAssertion(clientId: number, sequenceNumber: number, response: PasskeyAssertionResponse): number
|
|
||||||
completeError(clientId: number, sequenceNumber: number, error: string): number
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export declare namespace passkey_authenticator {
|
|
||||||
export function register(): void
|
export declare namespace autostart {
|
||||||
|
export function setAutostart(autostart: boolean, params: Array<string>): Promise<void>
|
||||||
}
|
}
|
||||||
export declare namespace logging {
|
|
||||||
export const enum LogLevel {
|
export declare namespace autotype {
|
||||||
Trace = 0,
|
export function getForegroundWindowTitle(): string
|
||||||
Debug = 1,
|
export function typeInput(input: Array<number>, keyboardShortcut: Array<string>): void
|
||||||
Info = 2,
|
}
|
||||||
Warn = 3,
|
|
||||||
Error = 4
|
export declare namespace biometrics {
|
||||||
|
export function available(): Promise<boolean>
|
||||||
|
/**
|
||||||
|
* Derives key material from biometric data. Returns a string encoded with a
|
||||||
|
* base64 encoded key and the base64 encoded challenge used to create it
|
||||||
|
* separated by a `|` character.
|
||||||
|
*
|
||||||
|
* If the iv is provided, it will be used as the challenge. Otherwise a random challenge will
|
||||||
|
* be generated.
|
||||||
|
*
|
||||||
|
* `format!("<key_base64>|<iv_base64>")`
|
||||||
|
*/
|
||||||
|
export function deriveKeyMaterial(iv?: string | undefined | null): Promise<OsDerivedKey>
|
||||||
|
/**
|
||||||
|
* Retrieves the biometric secret for the given service and account.
|
||||||
|
* Throws Error with message [`passwords::PASSWORD_NOT_FOUND`] if the secret does not exist.
|
||||||
|
*/
|
||||||
|
export function getBiometricSecret(service: string, account: string, keyMaterial?: KeyMaterial | undefined | null): Promise<string>
|
||||||
|
export interface KeyMaterial {
|
||||||
|
osKeyPartB64: string
|
||||||
|
clientKeyPartB64?: string
|
||||||
}
|
}
|
||||||
export function initNapiLog(jsLogFn: (err: Error | null, arg0: LogLevel, arg1: string) => any): void
|
export interface OsDerivedKey {
|
||||||
|
keyB64: string
|
||||||
|
ivB64: string
|
||||||
|
}
|
||||||
|
export function prompt(hwnd: Buffer, message: string): Promise<boolean>
|
||||||
|
export function setBiometricSecret(service: string, account: string, secret: string, keyMaterial: KeyMaterial | undefined | null, ivB64: string): Promise<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export declare namespace biometrics_v2 {
|
||||||
|
export class BiometricLockSystem {
|
||||||
|
|
||||||
|
}
|
||||||
|
export function authenticate(biometricLockSystem: BiometricLockSystem, hwnd: Buffer, message: string): Promise<boolean>
|
||||||
|
export function authenticateAvailable(biometricLockSystem: BiometricLockSystem): Promise<boolean>
|
||||||
|
export function enrollPersistent(biometricLockSystem: BiometricLockSystem, userId: string, key: Buffer): Promise<void>
|
||||||
|
export function hasPersistent(biometricLockSystem: BiometricLockSystem, userId: string): Promise<boolean>
|
||||||
|
export function initBiometricSystem(): BiometricLockSystem
|
||||||
|
export function provideKey(biometricLockSystem: BiometricLockSystem, userId: string, key: Buffer): Promise<void>
|
||||||
|
export function unenroll(biometricLockSystem: BiometricLockSystem, userId: string): Promise<void>
|
||||||
|
export function unlock(biometricLockSystem: BiometricLockSystem, userId: string, hwnd: Buffer): Promise<Buffer>
|
||||||
|
export function unlockAvailable(biometricLockSystem: BiometricLockSystem, userId: string): Promise<boolean>
|
||||||
|
}
|
||||||
|
|
||||||
export declare namespace chromium_importer {
|
export declare namespace chromium_importer {
|
||||||
export interface ProfileInfo {
|
export function getAvailableProfiles(browser: string): Array<ProfileInfo>
|
||||||
id: string
|
/** Returns OS aware metadata describing supported Chromium based importers as a JSON string. */
|
||||||
name: string
|
export function getMetadata(): Record<string, NativeImporterMetadata>
|
||||||
}
|
export function importLogins(browser: string, profileId: string): Promise<Array<LoginImportResult>>
|
||||||
export interface Login {
|
export interface Login {
|
||||||
url: string
|
url: string
|
||||||
username: string
|
username: string
|
||||||
@@ -257,12 +154,130 @@ export declare namespace chromium_importer {
|
|||||||
loaders: Array<string>
|
loaders: Array<string>
|
||||||
instructions: string
|
instructions: string
|
||||||
}
|
}
|
||||||
/** Returns OS aware metadata describing supported Chromium based importers as a JSON string. */
|
export interface ProfileInfo {
|
||||||
export function getMetadata(): Record<string, NativeImporterMetadata>
|
id: string
|
||||||
export function getAvailableProfiles(browser: string): Array<ProfileInfo>
|
name: string
|
||||||
export function importLogins(browser: string, profileId: string): Promise<Array<LoginImportResult>>
|
}
|
||||||
}
|
}
|
||||||
export declare namespace autotype {
|
|
||||||
export function getForegroundWindowTitle(): string
|
export declare namespace clipboards {
|
||||||
export function typeInput(input: Array<number>, keyboardShortcut: Array<string>): void
|
export function read(): Promise<string>
|
||||||
|
export function write(text: string, password: boolean): Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare namespace ipc {
|
||||||
|
export class NativeIpcServer {
|
||||||
|
/**
|
||||||
|
* Create and start the IPC server without blocking.
|
||||||
|
*
|
||||||
|
* @param name The endpoint name to listen on. This name uniquely identifies the IPC
|
||||||
|
* connection and must be the same for both the server and client. @param callback
|
||||||
|
* This function will be called whenever a message is received from a client.
|
||||||
|
*/
|
||||||
|
static listen(name: string, callback: (error: null | Error, message: IpcMessage) => void): Promise<NativeIpcServer>
|
||||||
|
/** Return the path to the IPC server. */
|
||||||
|
getPath(): string
|
||||||
|
/** Stop the IPC server. */
|
||||||
|
stop(): void
|
||||||
|
/**
|
||||||
|
* Send a message over the IPC server to all the connected clients
|
||||||
|
*
|
||||||
|
* @return The number of clients that the message was sent to. Note that the number of
|
||||||
|
* messages actually received may be less, as some clients could disconnect before
|
||||||
|
* receiving the message.
|
||||||
|
*/
|
||||||
|
send(message: string): number
|
||||||
|
}
|
||||||
|
export interface IpcMessage {
|
||||||
|
clientId: number
|
||||||
|
kind: IpcMessageType
|
||||||
|
message?: string
|
||||||
|
}
|
||||||
|
export const enum IpcMessageType {
|
||||||
|
Connected = 0,
|
||||||
|
Disconnected = 1,
|
||||||
|
Message = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare namespace logging {
|
||||||
|
export function initNapiLog(jsLogFn: ((err: Error | null, arg0: LogLevel, arg1: string) => any)): void
|
||||||
|
export const enum LogLevel {
|
||||||
|
Trace = 0,
|
||||||
|
Debug = 1,
|
||||||
|
Info = 2,
|
||||||
|
Warn = 3,
|
||||||
|
Error = 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare namespace passkey_authenticator {
|
||||||
|
export function register(): void
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare namespace passwords {
|
||||||
|
/**
|
||||||
|
* Delete the stored password from the keychain.
|
||||||
|
* Throws {@link Error} with message {@link PASSWORD_NOT_FOUND} if the password does not exist.
|
||||||
|
*/
|
||||||
|
export function deletePassword(service: string, account: string): Promise<void>
|
||||||
|
/**
|
||||||
|
* Fetch the stored password from the keychain.
|
||||||
|
* Throws {@link Error} with message {@link PASSWORD_NOT_FOUND} if the password does not exist.
|
||||||
|
*/
|
||||||
|
export function getPassword(service: string, account: string): Promise<string>
|
||||||
|
/** Checks if the os secure storage is available */
|
||||||
|
export function isAvailable(): Promise<boolean>
|
||||||
|
/** The error message returned when a password is not found during retrieval or deletion. */
|
||||||
|
export const PASSWORD_NOT_FOUND: string
|
||||||
|
/**
|
||||||
|
* Save the password to the keychain. Adds an entry if none exists otherwise updates the
|
||||||
|
* existing entry.
|
||||||
|
*/
|
||||||
|
export function setPassword(service: string, account: string, password: string): Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare namespace powermonitors {
|
||||||
|
export function isLockMonitorAvailable(): Promise<boolean>
|
||||||
|
export function onLock(callback: ((err: Error | null, ) => any)): Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare namespace processisolations {
|
||||||
|
export function disableCoredumps(): Promise<void>
|
||||||
|
export function isCoreDumpingDisabled(): Promise<boolean>
|
||||||
|
export function isolateProcess(): Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare namespace sshagent {
|
||||||
|
export class SshAgentState {
|
||||||
|
|
||||||
|
}
|
||||||
|
export function clearKeys(agentState: SshAgentState): void
|
||||||
|
export function isRunning(agentState: SshAgentState): boolean
|
||||||
|
export function lock(agentState: SshAgentState): void
|
||||||
|
export interface PrivateKey {
|
||||||
|
privateKey: string
|
||||||
|
name: string
|
||||||
|
cipherId: string
|
||||||
|
}
|
||||||
|
export function serve(callback: ((err: Error | null, arg: SshUiRequest) => Promise<boolean>)): Promise<SshAgentState>
|
||||||
|
export function setKeys(agentState: SshAgentState, newKeys: Array<PrivateKey>): void
|
||||||
|
export interface SshKey {
|
||||||
|
privateKey: string
|
||||||
|
publicKey: string
|
||||||
|
keyFingerprint: string
|
||||||
|
}
|
||||||
|
export interface SshUiRequest {
|
||||||
|
cipherId?: string
|
||||||
|
isList: boolean
|
||||||
|
processName: string
|
||||||
|
isForwarding: boolean
|
||||||
|
namespace?: string
|
||||||
|
}
|
||||||
|
export function stop(agentState: SshAgentState): void
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare namespace windows_registry {
|
||||||
|
export function createKey(key: string, subkey: string, value: string): Promise<void>
|
||||||
|
export function deleteKey(key: string, subkey: string): Promise<void>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,20 +82,20 @@ switch (platform) {
|
|||||||
switch (arch) {
|
switch (arch) {
|
||||||
case "x64":
|
case "x64":
|
||||||
nativeBinding = loadFirstAvailable(
|
nativeBinding = loadFirstAvailable(
|
||||||
["desktop_napi.linux-x64-musl.node", "desktop_napi.linux-x64-gnu.node"],
|
["desktop_napi.linux-x64-gnu.node"],
|
||||||
"@bitwarden/desktop-napi-linux-x64-musl",
|
"@bitwarden/desktop-napi-linux-x64-gnu",
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "arm64":
|
case "arm64":
|
||||||
nativeBinding = loadFirstAvailable(
|
nativeBinding = loadFirstAvailable(
|
||||||
["desktop_napi.linux-arm64-musl.node", "desktop_napi.linux-arm64-gnu.node"],
|
["desktop_napi.linux-arm64-gnu.node"],
|
||||||
"@bitwarden/desktop-napi-linux-arm64-musl",
|
"@bitwarden/desktop-napi-linux-arm64-gnu",
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "arm":
|
case "arm":
|
||||||
nativeBinding = loadFirstAvailable(
|
nativeBinding = loadFirstAvailable(
|
||||||
["desktop_napi.linux-arm-musl.node", "desktop_napi.linux-arm-gnu.node"],
|
["desktop_napi.linux-arm-gnu.node"],
|
||||||
"@bitwarden/desktop-napi-linux-arm-musl",
|
"@bitwarden/desktop-napi-linux-arm-gnu",
|
||||||
);
|
);
|
||||||
localFileExisted = existsSync(join(__dirname, "desktop_napi.linux-arm-gnueabihf.node"));
|
localFileExisted = existsSync(join(__dirname, "desktop_napi.linux-arm-gnueabihf.node"));
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -3,27 +3,23 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "napi build --platform --js false",
|
"build": "napi build --platform --no-js",
|
||||||
"test": "cargo test"
|
"test": "cargo test"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@napi-rs/cli": "2.18.4"
|
"@napi-rs/cli": "3.2.0"
|
||||||
},
|
},
|
||||||
"napi": {
|
"napi": {
|
||||||
"name": "desktop_napi",
|
"binaryName": "desktop_napi",
|
||||||
"triples": {
|
"targets": [
|
||||||
"defaults": true,
|
"aarch64-apple-darwin",
|
||||||
"additional": [
|
"aarch64-pc-windows-msvc",
|
||||||
"x86_64-unknown-linux-musl",
|
"aarch64-unknown-linux-gnu",
|
||||||
"aarch64-unknown-linux-gnu",
|
"armv7-unknown-linux-gnueabihf",
|
||||||
"i686-pc-windows-msvc",
|
"i686-pc-windows-msvc",
|
||||||
"armv7-unknown-linux-gnueabihf",
|
"x86_64-unknown-linux-gnu"
|
||||||
"aarch64-apple-darwin",
|
]
|
||||||
"aarch64-unknown-linux-musl",
|
|
||||||
"aarch64-pc-windows-msvc"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ pub mod sshagent {
|
|||||||
|
|
||||||
use napi::{
|
use napi::{
|
||||||
bindgen_prelude::Promise,
|
bindgen_prelude::Promise,
|
||||||
threadsafe_function::{ErrorStrategy::CalleeHandled, ThreadsafeFunction},
|
threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode},
|
||||||
};
|
};
|
||||||
use tokio::{self, sync::Mutex};
|
use tokio::{self, sync::Mutex};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
@@ -326,13 +326,15 @@ pub mod sshagent {
|
|||||||
#[allow(clippy::unused_async)] // FIXME: Remove unused async!
|
#[allow(clippy::unused_async)] // FIXME: Remove unused async!
|
||||||
#[napi]
|
#[napi]
|
||||||
pub async fn serve(
|
pub async fn serve(
|
||||||
callback: ThreadsafeFunction<SshUIRequest, CalleeHandled>,
|
callback: ThreadsafeFunction<SshUIRequest, Promise<bool>>,
|
||||||
) -> napi::Result<SshAgentState> {
|
) -> napi::Result<SshAgentState> {
|
||||||
let (auth_request_tx, mut auth_request_rx) =
|
let (auth_request_tx, mut auth_request_rx) =
|
||||||
tokio::sync::mpsc::channel::<desktop_core::ssh_agent::SshAgentUIRequest>(32);
|
tokio::sync::mpsc::channel::<desktop_core::ssh_agent::SshAgentUIRequest>(32);
|
||||||
let (auth_response_tx, auth_response_rx) =
|
let (auth_response_tx, auth_response_rx) =
|
||||||
tokio::sync::broadcast::channel::<(u32, bool)>(32);
|
tokio::sync::broadcast::channel::<(u32, bool)>(32);
|
||||||
let auth_response_tx_arc = Arc::new(Mutex::new(auth_response_tx));
|
let auth_response_tx_arc = Arc::new(Mutex::new(auth_response_tx));
|
||||||
|
// Wrap callback in Arc so it can be shared across spawned tasks
|
||||||
|
let callback = Arc::new(callback);
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let _ = auth_response_rx;
|
let _ = auth_response_rx;
|
||||||
|
|
||||||
@@ -342,42 +344,50 @@ pub mod sshagent {
|
|||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let auth_response_tx_arc = cloned_response_tx_arc;
|
let auth_response_tx_arc = cloned_response_tx_arc;
|
||||||
let callback = cloned_callback;
|
let callback = cloned_callback;
|
||||||
let promise_result: Result<Promise<bool>, napi::Error> = callback
|
// In NAPI v3, obtain the JS callback return as a Promise<boolean> and await it
|
||||||
.call_async(Ok(SshUIRequest {
|
// in Rust
|
||||||
|
let (tx, rx) = std::sync::mpsc::channel::<Promise<bool>>();
|
||||||
|
let status = callback.call_with_return_value(
|
||||||
|
Ok(SshUIRequest {
|
||||||
cipher_id: request.cipher_id,
|
cipher_id: request.cipher_id,
|
||||||
is_list: request.is_list,
|
is_list: request.is_list,
|
||||||
process_name: request.process_name,
|
process_name: request.process_name,
|
||||||
is_forwarding: request.is_forwarding,
|
is_forwarding: request.is_forwarding,
|
||||||
namespace: request.namespace,
|
namespace: request.namespace,
|
||||||
}))
|
}),
|
||||||
.await;
|
ThreadsafeFunctionCallMode::Blocking,
|
||||||
match promise_result {
|
move |ret: Result<Promise<bool>, napi::Error>, _env| {
|
||||||
Ok(promise_result) => match promise_result.await {
|
if let Ok(p) = ret {
|
||||||
Ok(result) => {
|
let _ = tx.send(p);
|
||||||
let _ = auth_response_tx_arc
|
|
||||||
.lock()
|
|
||||||
.await
|
|
||||||
.send((request.request_id, result))
|
|
||||||
.expect("should be able to send auth response to agent");
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
error!(error = %e, "Calling UI callback promise was rejected");
|
|
||||||
let _ = auth_response_tx_arc
|
|
||||||
.lock()
|
|
||||||
.await
|
|
||||||
.send((request.request_id, false))
|
|
||||||
.expect("should be able to send auth response to agent");
|
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
},
|
},
|
||||||
Err(e) => {
|
);
|
||||||
error!(error = %e, "Calling UI callback could not create promise");
|
|
||||||
let _ = auth_response_tx_arc
|
let result = if status == napi::Status::Ok {
|
||||||
.lock()
|
match rx.recv() {
|
||||||
.await
|
Ok(promise) => match promise.await {
|
||||||
.send((request.request_id, false))
|
Ok(v) => v,
|
||||||
.expect("should be able to send auth response to agent");
|
Err(e) => {
|
||||||
|
error!(error = %e, "UI callback promise rejected");
|
||||||
|
false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
|
error!(error = %e, "Failed to receive UI callback promise");
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
error!(error = ?status, "Calling UI callback failed");
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
let _ = auth_response_tx_arc
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.send((request.request_id, result))
|
||||||
|
.expect("should be able to send auth response to agent");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -465,14 +475,12 @@ pub mod processisolations {
|
|||||||
#[napi]
|
#[napi]
|
||||||
pub mod powermonitors {
|
pub mod powermonitors {
|
||||||
use napi::{
|
use napi::{
|
||||||
threadsafe_function::{
|
threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode},
|
||||||
ErrorStrategy::CalleeHandled, ThreadsafeFunction, ThreadsafeFunctionCallMode,
|
|
||||||
},
|
|
||||||
tokio,
|
tokio,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
pub async fn on_lock(callback: ThreadsafeFunction<(), CalleeHandled>) -> napi::Result<()> {
|
pub async fn on_lock(callback: ThreadsafeFunction<()>) -> napi::Result<()> {
|
||||||
let (tx, mut rx) = tokio::sync::mpsc::channel::<()>(32);
|
let (tx, mut rx) = tokio::sync::mpsc::channel::<()>(32);
|
||||||
desktop_core::powermonitor::on_lock(tx)
|
desktop_core::powermonitor::on_lock(tx)
|
||||||
.await
|
.await
|
||||||
@@ -511,9 +519,7 @@ pub mod windows_registry {
|
|||||||
#[napi]
|
#[napi]
|
||||||
pub mod ipc {
|
pub mod ipc {
|
||||||
use desktop_core::ipc::server::{Message, MessageType};
|
use desktop_core::ipc::server::{Message, MessageType};
|
||||||
use napi::threadsafe_function::{
|
use napi::threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode};
|
||||||
ErrorStrategy, ThreadsafeFunction, ThreadsafeFunctionCallMode,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[napi(object)]
|
#[napi(object)]
|
||||||
pub struct IpcMessage {
|
pub struct IpcMessage {
|
||||||
@@ -550,12 +556,12 @@ pub mod ipc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
pub struct IpcServer {
|
pub struct NativeIpcServer {
|
||||||
server: desktop_core::ipc::server::Server,
|
server: desktop_core::ipc::server::Server,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
impl IpcServer {
|
impl NativeIpcServer {
|
||||||
/// Create and start the IPC server without blocking.
|
/// Create and start the IPC server without blocking.
|
||||||
///
|
///
|
||||||
/// @param name The endpoint name to listen on. This name uniquely identifies the IPC
|
/// @param name The endpoint name to listen on. This name uniquely identifies the IPC
|
||||||
@@ -566,7 +572,7 @@ pub mod ipc {
|
|||||||
pub async fn listen(
|
pub async fn listen(
|
||||||
name: String,
|
name: String,
|
||||||
#[napi(ts_arg_type = "(error: null | Error, message: IpcMessage) => void")]
|
#[napi(ts_arg_type = "(error: null | Error, message: IpcMessage) => void")]
|
||||||
callback: ThreadsafeFunction<IpcMessage, ErrorStrategy::CalleeHandled>,
|
callback: ThreadsafeFunction<IpcMessage>,
|
||||||
) -> napi::Result<Self> {
|
) -> napi::Result<Self> {
|
||||||
let (send, mut recv) = tokio::sync::mpsc::channel::<Message>(32);
|
let (send, mut recv) = tokio::sync::mpsc::channel::<Message>(32);
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
@@ -583,7 +589,7 @@ pub mod ipc {
|
|||||||
))
|
))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(IpcServer { server })
|
Ok(NativeIpcServer { server })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the path to the IPC server.
|
/// Return the path to the IPC server.
|
||||||
@@ -630,8 +636,9 @@ pub mod autostart {
|
|||||||
#[napi]
|
#[napi]
|
||||||
pub mod autofill {
|
pub mod autofill {
|
||||||
use desktop_core::ipc::server::{Message, MessageType};
|
use desktop_core::ipc::server::{Message, MessageType};
|
||||||
use napi::threadsafe_function::{
|
use napi::{
|
||||||
ErrorStrategy, ThreadsafeFunction, ThreadsafeFunctionCallMode,
|
bindgen_prelude::FnArgs,
|
||||||
|
threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode},
|
||||||
};
|
};
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
@@ -746,14 +753,14 @@ pub mod autofill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
pub struct IpcServer {
|
pub struct AutofillIpcServer {
|
||||||
server: desktop_core::ipc::server::Server,
|
server: desktop_core::ipc::server::Server,
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Remove unwraps! They panic and terminate the whole application.
|
// FIXME: Remove unwraps! They panic and terminate the whole application.
|
||||||
#[allow(clippy::unwrap_used)]
|
#[allow(clippy::unwrap_used)]
|
||||||
#[napi]
|
#[napi]
|
||||||
impl IpcServer {
|
impl AutofillIpcServer {
|
||||||
/// Create and start the IPC server without blocking.
|
/// Create and start the IPC server without blocking.
|
||||||
///
|
///
|
||||||
/// @param name The endpoint name to listen on. This name uniquely identifies the IPC
|
/// @param name The endpoint name to listen on. This name uniquely identifies the IPC
|
||||||
@@ -769,30 +776,24 @@ pub mod autofill {
|
|||||||
ts_arg_type = "(error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyRegistrationRequest) => void"
|
ts_arg_type = "(error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyRegistrationRequest) => void"
|
||||||
)]
|
)]
|
||||||
registration_callback: ThreadsafeFunction<
|
registration_callback: ThreadsafeFunction<
|
||||||
(u32, u32, PasskeyRegistrationRequest),
|
FnArgs<(u32, u32, PasskeyRegistrationRequest)>,
|
||||||
ErrorStrategy::CalleeHandled,
|
|
||||||
>,
|
>,
|
||||||
#[napi(
|
#[napi(
|
||||||
ts_arg_type = "(error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyAssertionRequest) => void"
|
ts_arg_type = "(error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyAssertionRequest) => void"
|
||||||
)]
|
)]
|
||||||
assertion_callback: ThreadsafeFunction<
|
assertion_callback: ThreadsafeFunction<
|
||||||
(u32, u32, PasskeyAssertionRequest),
|
FnArgs<(u32, u32, PasskeyAssertionRequest)>,
|
||||||
ErrorStrategy::CalleeHandled,
|
|
||||||
>,
|
>,
|
||||||
#[napi(
|
#[napi(
|
||||||
ts_arg_type = "(error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyAssertionWithoutUserInterfaceRequest) => void"
|
ts_arg_type = "(error: null | Error, clientId: number, sequenceNumber: number, message: PasskeyAssertionWithoutUserInterfaceRequest) => void"
|
||||||
)]
|
)]
|
||||||
assertion_without_user_interface_callback: ThreadsafeFunction<
|
assertion_without_user_interface_callback: ThreadsafeFunction<
|
||||||
(u32, u32, PasskeyAssertionWithoutUserInterfaceRequest),
|
FnArgs<(u32, u32, PasskeyAssertionWithoutUserInterfaceRequest)>,
|
||||||
ErrorStrategy::CalleeHandled,
|
|
||||||
>,
|
>,
|
||||||
#[napi(
|
#[napi(
|
||||||
ts_arg_type = "(error: null | Error, clientId: number, sequenceNumber: number, message: NativeStatus) => void"
|
ts_arg_type = "(error: null | Error, clientId: number, sequenceNumber: number, message: NativeStatus) => void"
|
||||||
)]
|
)]
|
||||||
native_status_callback: ThreadsafeFunction<
|
native_status_callback: ThreadsafeFunction<(u32, u32, NativeStatus)>,
|
||||||
(u32, u32, NativeStatus),
|
|
||||||
ErrorStrategy::CalleeHandled,
|
|
||||||
>,
|
|
||||||
) -> napi::Result<Self> {
|
) -> napi::Result<Self> {
|
||||||
let (send, mut recv) = tokio::sync::mpsc::channel::<Message>(32);
|
let (send, mut recv) = tokio::sync::mpsc::channel::<Message>(32);
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
@@ -817,7 +818,7 @@ pub mod autofill {
|
|||||||
Ok(msg) => {
|
Ok(msg) => {
|
||||||
let value = msg
|
let value = msg
|
||||||
.value
|
.value
|
||||||
.map(|value| (client_id, msg.sequence_number, value))
|
.map(|value| (client_id, msg.sequence_number, value).into())
|
||||||
.map_err(|e| napi::Error::from_reason(format!("{e:?}")));
|
.map_err(|e| napi::Error::from_reason(format!("{e:?}")));
|
||||||
|
|
||||||
assertion_callback
|
assertion_callback
|
||||||
@@ -836,7 +837,7 @@ pub mod autofill {
|
|||||||
Ok(msg) => {
|
Ok(msg) => {
|
||||||
let value = msg
|
let value = msg
|
||||||
.value
|
.value
|
||||||
.map(|value| (client_id, msg.sequence_number, value))
|
.map(|value| (client_id, msg.sequence_number, value).into())
|
||||||
.map_err(|e| napi::Error::from_reason(format!("{e:?}")));
|
.map_err(|e| napi::Error::from_reason(format!("{e:?}")));
|
||||||
|
|
||||||
assertion_without_user_interface_callback
|
assertion_without_user_interface_callback
|
||||||
@@ -854,7 +855,7 @@ pub mod autofill {
|
|||||||
Ok(msg) => {
|
Ok(msg) => {
|
||||||
let value = msg
|
let value = msg
|
||||||
.value
|
.value
|
||||||
.map(|value| (client_id, msg.sequence_number, value))
|
.map(|value| (client_id, msg.sequence_number, value).into())
|
||||||
.map_err(|e| napi::Error::from_reason(format!("{e:?}")));
|
.map_err(|e| napi::Error::from_reason(format!("{e:?}")));
|
||||||
registration_callback
|
registration_callback
|
||||||
.call(value, ThreadsafeFunctionCallMode::NonBlocking);
|
.call(value, ThreadsafeFunctionCallMode::NonBlocking);
|
||||||
@@ -894,7 +895,7 @@ pub mod autofill {
|
|||||||
))
|
))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(IpcServer { server })
|
Ok(AutofillIpcServer { server })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the path to the IPC server.
|
/// Return the path to the IPC server.
|
||||||
@@ -987,8 +988,9 @@ pub mod logging {
|
|||||||
|
|
||||||
use std::{fmt::Write, sync::OnceLock};
|
use std::{fmt::Write, sync::OnceLock};
|
||||||
|
|
||||||
use napi::threadsafe_function::{
|
use napi::{
|
||||||
ErrorStrategy::CalleeHandled, ThreadsafeFunction, ThreadsafeFunctionCallMode,
|
bindgen_prelude::FnArgs,
|
||||||
|
threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode},
|
||||||
};
|
};
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
use tracing_subscriber::{
|
use tracing_subscriber::{
|
||||||
@@ -999,7 +1001,7 @@ pub mod logging {
|
|||||||
Layer,
|
Layer,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JsLogger(OnceLock<ThreadsafeFunction<(LogLevel, String), CalleeHandled>>);
|
struct JsLogger(OnceLock<ThreadsafeFunction<FnArgs<(LogLevel, String)>>>);
|
||||||
static JS_LOGGER: JsLogger = JsLogger(OnceLock::new());
|
static JS_LOGGER: JsLogger = JsLogger(OnceLock::new());
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
@@ -1071,13 +1073,13 @@ pub mod logging {
|
|||||||
let msg = (event.metadata().level().into(), buffer);
|
let msg = (event.metadata().level().into(), buffer);
|
||||||
|
|
||||||
if let Some(logger) = JS_LOGGER.0.get() {
|
if let Some(logger) = JS_LOGGER.0.get() {
|
||||||
let _ = logger.call(Ok(msg), ThreadsafeFunctionCallMode::NonBlocking);
|
let _ = logger.call(Ok(msg.into()), ThreadsafeFunctionCallMode::NonBlocking);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
pub fn init_napi_log(js_log_fn: ThreadsafeFunction<(LogLevel, String), CalleeHandled>) {
|
pub fn init_napi_log(js_log_fn: ThreadsafeFunction<FnArgs<(LogLevel, String)>>) {
|
||||||
let _ = JS_LOGGER.0.set(js_log_fn);
|
let _ = JS_LOGGER.0.set(js_log_fn);
|
||||||
|
|
||||||
let filter = EnvFilter::builder()
|
let filter = EnvFilter::builder()
|
||||||
@@ -1140,8 +1142,8 @@ pub mod chromium_importer {
|
|||||||
#[napi(object)]
|
#[napi(object)]
|
||||||
pub struct NativeImporterMetadata {
|
pub struct NativeImporterMetadata {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub loaders: Vec<&'static str>,
|
pub loaders: Vec<String>,
|
||||||
pub instructions: &'static str,
|
pub instructions: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<_LoginImportResult> for LoginImportResult {
|
impl From<_LoginImportResult> for LoginImportResult {
|
||||||
@@ -1218,7 +1220,7 @@ pub mod chromium_importer {
|
|||||||
#[napi]
|
#[napi]
|
||||||
pub mod autotype {
|
pub mod autotype {
|
||||||
#[napi]
|
#[napi]
|
||||||
pub fn get_foreground_window_title() -> napi::Result<String, napi::Status> {
|
pub fn get_foreground_window_title() -> napi::Result<String> {
|
||||||
autotype::get_foreground_window_title().map_err(|_| {
|
autotype::get_foreground_window_title().map_err(|_| {
|
||||||
napi::Error::from_reason(
|
napi::Error::from_reason(
|
||||||
"Autotype Error: failed to get foreground window title".to_string(),
|
"Autotype Error: failed to get foreground window title".to_string(),
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export class MainSshAgentService {
|
|||||||
init() {
|
init() {
|
||||||
// handle sign request passing to UI
|
// handle sign request passing to UI
|
||||||
sshagent
|
sshagent
|
||||||
.serve(async (err: Error, sshUiRequest: sshagent.SshUiRequest) => {
|
.serve(async (err: Error | null, sshUiRequest: sshagent.SshUiRequest): Promise<boolean> => {
|
||||||
// clear all old (> SIGN_TIMEOUT) requests
|
// clear all old (> SIGN_TIMEOUT) requests
|
||||||
this.requestResponses = this.requestResponses.filter(
|
this.requestResponses = this.requestResponses.filter(
|
||||||
(response) => response.timestamp > new Date(Date.now() - this.SIGN_TIMEOUT),
|
(response) => response.timestamp > new Date(Date.now() - this.SIGN_TIMEOUT),
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { isDev } from "../utils";
|
|||||||
import { WindowMain } from "./window.main";
|
import { WindowMain } from "./window.main";
|
||||||
|
|
||||||
export class NativeMessagingMain {
|
export class NativeMessagingMain {
|
||||||
private ipcServer: ipc.IpcServer | null;
|
private ipcServer: ipc.NativeIpcServer | null;
|
||||||
private connected: number[] = [];
|
private connected: number[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -78,7 +78,7 @@ export class NativeMessagingMain {
|
|||||||
this.ipcServer.stop();
|
this.ipcServer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ipcServer = await ipc.IpcServer.listen("bw", (error, msg) => {
|
this.ipcServer = await ipc.NativeIpcServer.listen("bw", (error, msg) => {
|
||||||
switch (msg.kind) {
|
switch (msg.kind) {
|
||||||
case ipc.IpcMessageType.Connected: {
|
case ipc.IpcMessageType.Connected: {
|
||||||
this.connected.push(msg.clientId);
|
this.connected.push(msg.clientId);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export type RunCommandParams<C extends CommandDefinition> = {
|
|||||||
export type RunCommandResult<C extends CommandDefinition> = C["output"];
|
export type RunCommandResult<C extends CommandDefinition> = C["output"];
|
||||||
|
|
||||||
export class NativeAutofillMain {
|
export class NativeAutofillMain {
|
||||||
private ipcServer: autofill.IpcServer | null;
|
private ipcServer?: autofill.AutofillIpcServer;
|
||||||
private messageBuffer: BufferedMessage[] = [];
|
private messageBuffer: BufferedMessage[] = [];
|
||||||
private listenerReady = false;
|
private listenerReady = false;
|
||||||
|
|
||||||
@@ -70,13 +70,13 @@ export class NativeAutofillMain {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
this.ipcServer = await autofill.IpcServer.listen(
|
this.ipcServer = await autofill.AutofillIpcServer.listen(
|
||||||
"af",
|
"af",
|
||||||
// RegistrationCallback
|
// RegistrationCallback
|
||||||
(error, clientId, sequenceNumber, request) => {
|
(error, clientId, sequenceNumber, request) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
this.logService.error("autofill.IpcServer.registration", error);
|
this.logService.error("autofill.IpcServer.registration", error);
|
||||||
this.ipcServer.completeError(clientId, sequenceNumber, String(error));
|
this.ipcServer?.completeError(clientId, sequenceNumber, String(error));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.safeSend("autofill.passkeyRegistration", {
|
this.safeSend("autofill.passkeyRegistration", {
|
||||||
@@ -89,7 +89,7 @@ export class NativeAutofillMain {
|
|||||||
(error, clientId, sequenceNumber, request) => {
|
(error, clientId, sequenceNumber, request) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
this.logService.error("autofill.IpcServer.assertion", error);
|
this.logService.error("autofill.IpcServer.assertion", error);
|
||||||
this.ipcServer.completeError(clientId, sequenceNumber, String(error));
|
this.ipcServer?.completeError(clientId, sequenceNumber, String(error));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.safeSend("autofill.passkeyAssertion", {
|
this.safeSend("autofill.passkeyAssertion", {
|
||||||
@@ -102,7 +102,7 @@ export class NativeAutofillMain {
|
|||||||
(error, clientId, sequenceNumber, request) => {
|
(error, clientId, sequenceNumber, request) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
this.logService.error("autofill.IpcServer.assertion", error);
|
this.logService.error("autofill.IpcServer.assertion", error);
|
||||||
this.ipcServer.completeError(clientId, sequenceNumber, String(error));
|
this.ipcServer?.completeError(clientId, sequenceNumber, String(error));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.safeSend("autofill.passkeyAssertionWithoutUserInterface", {
|
this.safeSend("autofill.passkeyAssertionWithoutUserInterface", {
|
||||||
@@ -115,7 +115,7 @@ export class NativeAutofillMain {
|
|||||||
(error, clientId, sequenceNumber, status) => {
|
(error, clientId, sequenceNumber, status) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
this.logService.error("autofill.IpcServer.nativeStatus", error);
|
this.logService.error("autofill.IpcServer.nativeStatus", error);
|
||||||
this.ipcServer.completeError(clientId, sequenceNumber, String(error));
|
this.ipcServer?.completeError(clientId, sequenceNumber, String(error));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.safeSend("autofill.nativeStatus", {
|
this.safeSend("autofill.nativeStatus", {
|
||||||
@@ -137,19 +137,19 @@ export class NativeAutofillMain {
|
|||||||
ipcMain.on("autofill.completePasskeyRegistration", (event, data) => {
|
ipcMain.on("autofill.completePasskeyRegistration", (event, data) => {
|
||||||
this.logService.debug("autofill.completePasskeyRegistration", data);
|
this.logService.debug("autofill.completePasskeyRegistration", data);
|
||||||
const { clientId, sequenceNumber, response } = data;
|
const { clientId, sequenceNumber, response } = data;
|
||||||
this.ipcServer.completeRegistration(clientId, sequenceNumber, response);
|
this.ipcServer?.completeRegistration(clientId, sequenceNumber, response);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on("autofill.completePasskeyAssertion", (event, data) => {
|
ipcMain.on("autofill.completePasskeyAssertion", (event, data) => {
|
||||||
this.logService.debug("autofill.completePasskeyAssertion", data);
|
this.logService.debug("autofill.completePasskeyAssertion", data);
|
||||||
const { clientId, sequenceNumber, response } = data;
|
const { clientId, sequenceNumber, response } = data;
|
||||||
this.ipcServer.completeAssertion(clientId, sequenceNumber, response);
|
this.ipcServer?.completeAssertion(clientId, sequenceNumber, response);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on("autofill.completeError", (event, data) => {
|
ipcMain.on("autofill.completeError", (event, data) => {
|
||||||
this.logService.debug("autofill.completeError", data);
|
this.logService.debug("autofill.completeError", data);
|
||||||
const { clientId, sequenceNumber, error } = data;
|
const { clientId, sequenceNumber, error } = data;
|
||||||
this.ipcServer.completeError(clientId, sequenceNumber, String(error));
|
this.ipcServer?.completeError(clientId, sequenceNumber, String(error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1479
package-lock.json
generated
1479
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user