feat(ios,p0): iOS P0 platform, audio fixes, channel UX
This commit is contained in:
@@ -218,7 +218,12 @@ impl IdentityFileStore {
|
||||
if keyring_disabled() {
|
||||
return Ok(None);
|
||||
}
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "ios"))]
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "macos",
|
||||
target_os = "windows",
|
||||
target_os = "ios"
|
||||
))]
|
||||
{
|
||||
use base64::Engine;
|
||||
let entry = match keyring::Entry::new(Self::KEYRING_SERVICE, &self.keyring_account) {
|
||||
@@ -252,7 +257,12 @@ impl IdentityFileStore {
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "ios")))]
|
||||
#[cfg(not(any(
|
||||
target_os = "linux",
|
||||
target_os = "macos",
|
||||
target_os = "windows",
|
||||
target_os = "ios"
|
||||
)))]
|
||||
{
|
||||
Ok(None)
|
||||
}
|
||||
@@ -268,7 +278,12 @@ impl IdentityFileStore {
|
||||
if keyring_disabled() {
|
||||
return false;
|
||||
}
|
||||
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "ios"))]
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "macos",
|
||||
target_os = "windows",
|
||||
target_os = "ios"
|
||||
))]
|
||||
{
|
||||
use base64::Engine;
|
||||
let entry = match keyring::Entry::new(Self::KEYRING_SERVICE, &self.keyring_account) {
|
||||
@@ -287,7 +302,12 @@ impl IdentityFileStore {
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows", target_os = "ios")))]
|
||||
#[cfg(not(any(
|
||||
target_os = "linux",
|
||||
target_os = "macos",
|
||||
target_os = "windows",
|
||||
target_os = "ios"
|
||||
)))]
|
||||
{
|
||||
false
|
||||
}
|
||||
@@ -389,12 +409,10 @@ impl IdentityFileStore {
|
||||
let cipher = ChaCha20Poly1305::new(key);
|
||||
let nonce_bytes = &buf[..12];
|
||||
let nonce = Nonce::from_slice(nonce_bytes);
|
||||
let pt = cipher
|
||||
.decrypt(nonce, &buf[12..])
|
||||
.map_err(|e| {
|
||||
key_bytes.zeroize();
|
||||
StorageError::Crypto(format!("decrypt: {e}"))
|
||||
})?;
|
||||
let pt = cipher.decrypt(nonce, &buf[12..]).map_err(|e| {
|
||||
key_bytes.zeroize();
|
||||
StorageError::Crypto(format!("decrypt: {e}"))
|
||||
})?;
|
||||
key_bytes.zeroize();
|
||||
let s = String::from_utf8(pt)
|
||||
.map_err(|e| StorageError::Crypto(format!("plaintext not utf8: {e}")))?;
|
||||
@@ -560,10 +578,7 @@ impl IdentityFileStore {
|
||||
Ok(())
|
||||
}
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
|
||||
Err(e) => Err(StorageError::Io(format!(
|
||||
"remove {:?}: {e}",
|
||||
self.path
|
||||
))),
|
||||
Err(e) => Err(StorageError::Io(format!("remove {:?}: {e}", self.path))),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -596,8 +611,8 @@ fn is_plausibly_legacy_plaintext(buf: &[u8]) -> bool {
|
||||
/// Read a 32-byte DEK from `path`. Used by the file-fallback path
|
||||
/// and the legacy migration path inside `ensure_dek`.
|
||||
fn read_file_dek(path: &Path) -> Result<[u8; 32], StorageError> {
|
||||
let mut f = fs::File::open(path)
|
||||
.map_err(|e| StorageError::Io(format!("open dek {:?}: {e}", path)))?;
|
||||
let mut f =
|
||||
fs::File::open(path).map_err(|e| StorageError::Io(format!("open dek {:?}: {e}", path)))?;
|
||||
let mut key = [0u8; 32];
|
||||
f.read_exact(&mut key)
|
||||
.map_err(|e| StorageError::Io(format!("read dek: {e}")))?;
|
||||
@@ -1093,7 +1108,10 @@ mod tests {
|
||||
store.save("9999VabcdefghIJKLmnop=").unwrap();
|
||||
let raw = fs::read(store.path()).unwrap();
|
||||
assert!(!raw.starts_with(b"9999"));
|
||||
assert_eq!(store.load().unwrap().as_deref(), Some("9999VabcdefghIJKLmnop="));
|
||||
assert_eq!(
|
||||
store.load().unwrap().as_deref(),
|
||||
Some("9999VabcdefghIJKLmnop=")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user