Skip to content

Commit

Permalink
Enable Ios autofill (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyrat authored Nov 20, 2022
1 parent 10873ac commit e824de2
Show file tree
Hide file tree
Showing 105 changed files with 20,945 additions and 148 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flutter_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
BuildAndTestIos:
name: Build ios prod

runs-on: macos-latest
runs-on: macos-12

steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flutter_release_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
DeployIosBetaAdhoc:
name: Build and release beta adhoc

runs-on: macos-latest
runs-on: macos-12

steps:
- name: Checkout
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
DeployIosProdTestflight:
name: Build and release prod testflight

runs-on: macos-latest
runs-on: macos-12

steps:
- name: Checkout
Expand Down
14 changes: 14 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@
"problemMatcher": [],
"label": "flutter: flutter build apk prod play"
},
{
"type": "flutter",
"command": "flutter",
"args": [
"build",
"ios",
"--config-only",
"--debug",
"--no-codesign"
],
"group": "build",
"problemMatcher": [],
"label": "flutter prep: flutter build ios"
},
{
"type": "flutter",
"command": "flutter",
Expand Down
4 changes: 4 additions & 0 deletions ios/Flutter/Debug-autofill.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#include "Generated.xcconfig"
#include "KeeVault-defaults.xcconfig"

CODE_SIGN_ENTITLEMENTS=./KeeVaultAutofill/KeeVaultAutofill$(KEEVAULT_ID_SUFFIX).entitlements
KEE_VAULT_SHARED_DEFAULT_ACCESS_GROUP=$(AppIdentifierPrefix)com.keevault.keevault.shared.default$(KEEVAULT_ID_SUFFIX)
KEE_VAULT_SHARED_DEFAULT_GROUP_NAME=group.com.keevault.keevault$(KEEVAULT_ID_SUFFIX)
4 changes: 4 additions & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
#include "KeeVault-defaults.xcconfig"

CODE_SIGN_ENTITLEMENTS=./Runner/Runner$(KEEVAULT_ID_SUFFIX).entitlements
KEE_VAULT_SHARED_DEFAULT_ACCESS_GROUP=$(AppIdentifierPrefix)com.keevault.keevault.shared.default$(KEEVAULT_ID_SUFFIX)
KEE_VAULT_SHARED_DEFAULT_GROUP_NAME=group.com.keevault.keevault$(KEEVAULT_ID_SUFFIX)
4 changes: 4 additions & 0 deletions ios/Flutter/Release-autofill.xcconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#include "Generated.xcconfig"
#include "KeeVault-defaults.xcconfig"
#include "KeeVault-generated.xcconfig"

CODE_SIGN_ENTITLEMENTS=./KeeVaultAutofill/KeeVaultAutofill$(KEEVAULT_ID_SUFFIX).entitlements
KEE_VAULT_SHARED_DEFAULT_ACCESS_GROUP=$(AppIdentifierPrefix)com.keevault.keevault.shared.default$(KEEVAULT_ID_SUFFIX)
KEE_VAULT_SHARED_DEFAULT_GROUP_NAME=group.com.keevault.keevault$(KEEVAULT_ID_SUFFIX)
4 changes: 4 additions & 0 deletions ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
#include "Generated.xcconfig"
#include "KeeVault-defaults.xcconfig"
#include "KeeVault-generated.xcconfig"

CODE_SIGN_ENTITLEMENTS=./Runner/Runner$(KEEVAULT_ID_SUFFIX).entitlements
KEE_VAULT_SHARED_DEFAULT_ACCESS_GROUP=$(AppIdentifierPrefix)com.keevault.keevault.shared.default$(KEEVAULT_ID_SUFFIX)
KEE_VAULT_SHARED_DEFAULT_GROUP_NAME=group.com.keevault.keevault$(KEEVAULT_ID_SUFFIX)
9 changes: 9 additions & 0 deletions ios/KdbxSwift/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
731 changes: 731 additions & 0 deletions ios/KdbxSwift/LICENSE

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions ios/KdbxSwift/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "KdbxSwift",
// defaultLocalization: "en",
platforms: [.iOS("12.4")],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "KdbxSwift",
targets: ["KdbxSwift"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "KdbxSwift",
dependencies: [],
resources: [
.copy("resources")]),
.testTarget(
name: "KdbxSwiftTests",
dependencies: ["KdbxSwift"]),
]
)
19 changes: 19 additions & 0 deletions ios/KdbxSwift/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# KdbxSwift

A cut-down KDBX file handling library. This can't be used for general purpose KDBX file reading and writing but it offers the essentials that Kee Vault Ltd requires in order for us to integrate our KDBX file with an iOS autofill app extension.

## License

Much of the code within is copyright KeePassium and used under GPL3 license (see below). Otherwise, the code is copyright Kee Vault Ltd unless a file-specific comment indicates an alternative source with compatible license. As with all Kee Vault Ltd open source software, all code in this library is released under our AGPL3 license, as described in the LICENSE file.


### KeePassium license statement

// KeePassium Password Manager
// Copyright © 2018–2022 Andrei Popleteev <[email protected]>
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License version 3 as published
// by the Free Software Foundation: https://www.gnu.org/licenses/).
// For commercial licensing, please contact the author.

107 changes: 107 additions & 0 deletions ios/KdbxSwift/Sources/KdbxSwift/AEXML/Document.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/**
* https://github.com/tadija/AEXML
* Copyright (c) Marko Tadić 2014-2018
* Licensed under the MIT license. See LICENSE file.
*/

import Foundation

/**
This class is inherited from `AEXMLElement` and has a few addons to represent **XML Document**.

XML Parsing is also done with this object.
*/
open class AEXMLDocument: AEXMLElement {

// MARK: - Properties

/// Root (the first child element) element of XML Document **(Empty element with error if not exists)**.
open var root: AEXMLElement {
guard let rootElement = children.first else {
let errorElement = AEXMLElement(name: "Error")
errorElement.error = AEXMLError.rootElementMissing
return errorElement
}
return rootElement
}

public let options: AEXMLOptions

// MARK: - Lifecycle

/**
Designated initializer - Creates and returns new XML Document object.

- parameter root: Root XML element for XML Document (defaults to `nil`).
- parameter options: Options for XML Document header and parser settings (defaults to `AEXMLOptions()`).

- returns: Initialized XML Document object.
*/
public init(root: AEXMLElement? = nil, options: AEXMLOptions = AEXMLOptions()) {
self.options = options

let documentName = String(describing: AEXMLDocument.self)
super.init(name: documentName)

// document has no parent element
parent = nil

// add root element to document (if any)
if let rootElement = root {
_ = addChild(rootElement)
}
}

/**
Convenience initializer - used for parsing XML data (by calling `loadXMLData:` internally).

- parameter xmlData: XML data to parse.
- parameter options: Options for XML Document header and parser settings (defaults to `AEXMLOptions()`).

- returns: Initialized XML Document object containing parsed data. Throws error if data could not be parsed.
*/
public convenience init(xml: Data, options: AEXMLOptions = AEXMLOptions()) throws {
self.init(options: options)
try loadXML(xml)
}

/**
Convenience initializer - used for parsing XML string (by calling `init(xmlData:options:)` internally).

- parameter xmlString: XML string to parse.
- parameter encoding: String encoding for creating `Data` from `xmlString` (defaults to `String.Encoding.utf8`)
- parameter options: Options for XML Document header and parser settings (defaults to `AEXMLOptions()`).

- returns: Initialized XML Document object containing parsed data. Throws error if data could not be parsed.
*/
public convenience init(xml: String,
encoding: String.Encoding = String.Encoding.utf8,
options: AEXMLOptions = AEXMLOptions()) throws {
guard let data = xml.data(using: encoding) else { throw AEXMLError.parsingFailed }
try self.init(xml: data, options: options)
}

// MARK: - Parse XML

/**
Creates instance of `AEXMLParser` (private class which is simple wrapper around `XMLParser`)
and starts parsing the given XML data. Throws error if data could not be parsed.

- parameter data: XML which should be parsed.
*/
open func loadXML(_ data: Data) throws {
children.removeAll(keepingCapacity: false)
let xmlParser = AEXMLParser(document: self, data: data)
try xmlParser.parse()
}

// MARK: - Override

/// Override of `xml` property of `AEXMLElement` - it just inserts XML Document header at the beginning.
open override var xml: String {
var xml = "\(options.documentHeader.xmlString)\n"
xml += root.xml
return xml
}

}
Loading

0 comments on commit e824de2

Please sign in to comment.