Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request papers/airgap/airgap-vault!282
  • Loading branch information
godenzim committed Sep 17, 2021
2 parents 5f7ace1 + 1740b71 commit 6f9b276
Show file tree
Hide file tree
Showing 120 changed files with 25,173 additions and 1,018 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ build_ios:
- echo "$IOS_BUILD_JSON" > build.json
script:
- export DEVELOPER_DIR=$XCODE_PATH
- nvm use 14
- nvm use 15
- npm install
- npm run disable-pure-getters
- npm run configure-mangle
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.5.0
FROM node:15.14.0

# See https://crbug.com/795759
RUN apt-get update && apt-get install -yq libgconf-2-4 bzip2 build-essential libxtst6
Expand All @@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y wget --no-install-recommends \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont libxss1 \
--no-install-recommends \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge --auto-remove -y curl \
&& rm -rf /src/*.deb
Expand Down
4 changes: 2 additions & 2 deletions build/android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ RUN mkdir /app
WORKDIR /app

# using npm 6.5.0 to fix installing certain cordova/ionic plugins
RUN npm install -g npm@6.5.0 [email protected] @capacitor/[email protected] @capacitor/[email protected]
RUN npm install -g npm@7.7.6 [email protected] @capacitor/[email protected] @capacitor/[email protected]
RUN npm cache clean -f
RUN npm install -g n
RUN n 10.14.1
RUN n 15.14.0

# Install app dependencies, using wildcard if package-lock exists
COPY package.json /app/package.json
Expand Down
15 changes: 10 additions & 5 deletions ios/App/App/SecurityUtils/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,21 @@ extension Keychain.Password {
return attributes
}

public static func delete(account: String, service: String? = nil) throws {
public static func delete(account: String? = nil, service: String? = nil) throws {
var query: [AnyHashable:Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrAccount as String: account
kSecClass as String: kSecClassGenericPassword
]

if let account = account {
query[kSecAttrAccount as String] = account
}

if let service = service {
query[kSecAttrService as String] = service
}

let status = SecItemDelete(query as CFDictionary)
guard status.isSuccess else {
guard status.isSuccess || status == errSecItemNotFound else {
throw VaultError.osStatus(status)
}
}
Expand Down Expand Up @@ -261,7 +266,7 @@ extension Keychain.PrivateKey {
return status.isSuccess || status == errSecInteractionNotAllowed
}

public static func delete(tag: Data) -> Bool {
public static func delete(tag: Data? = nil) -> Bool {
let query: [AnyHashable:Any] = [
kSecClass as String: kSecClassKey,
kSecAttrApplicationTag as String: tag,
Expand Down
5 changes: 5 additions & 0 deletions ios/App/App/SecurityUtils/SecureStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,9 @@ class SecureStorage {
func delete(key: String) throws {
try Keychain.Password.delete(account: key)
}

static func delete() throws {
try Keychain.Password.delete()
_ = Keychain.PrivateKey.delete()
}
}
1 change: 1 addition & 0 deletions ios/App/App/SecurityUtils/SecurityUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
CAP_PLUGIN_METHOD(isDeviceSecure, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(secureDevice, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(removeAll, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(removeItem, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(setItem, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(getItem, CAPPluginReturnPromise);
Expand Down
15 changes: 15 additions & 0 deletions ios/App/App/SecurityUtils/SecurityUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,21 @@ public class SecurityUtils: CAPPlugin {
}
}

@objc func destroy(_ call: CAPPluginCall) {
queue.addOperation {
do {
try SecureStorage.delete()
call.resolve()
} catch {
if let error = error as? VaultError {
call.reject(error.description, "\(error.code.rawValue)", error)
} else {
call.reject(error.localizedDescription, "-1", error)
}
}
}
}

@objc func removeItem(_ call: CAPPluginCall) {
queue.addOperation {
call.assertReceived(forMethod: "SecureStorage_removeItem", requiredParams: Param.ALIAS, Param.IS_PARANOIA, Param.KEY)
Expand Down
Loading

0 comments on commit 6f9b276

Please sign in to comment.