-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding sdk and example project * Logged in page is now user credential list * Unit tests + DocC * UI Tweaks and README * Point project to BW account * Add testing workflow * Added requirements section in README
- Loading branch information
1 parent
8004075
commit 94eb8c5
Showing
75 changed files
with
3,983 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer | ||
SIMULATOR_DESTINATION: platform=iOS Simulator,name=iPhone 15 Pro,OS=17.2 | ||
|
||
jobs: | ||
check-run: | ||
name: Check PR run | ||
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main | ||
|
||
test: | ||
name: Test | ||
runs-on: macos-14 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: Test | ||
run: | | ||
set -o pipefail && \ | ||
xcodebuild test \ | ||
-scheme Passwordless \ | ||
-destination "${{ env.SIMULATOR_DESTINATION }}" \ | ||
-derivedDataPath build/DerivedData \ | ||
| xcbeautify --renderer github-actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# macOS | ||
.DS_Store | ||
|
||
## User settings | ||
xcuserdata/ | ||
|
||
.swiftpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# How to Contribute | ||
|
||
Our [Contributing Guidelines](https://contributing.bitwarden.com/contributing/) are located in our [Contributing Documentation](https://contributing.bitwarden.com/). The documentation also includes recommended tooling, code style tips, and lots of other great information to get you started. |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
Example/DemoPasswordless.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
Example/DemoPasswordless.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
77 changes: 77 additions & 0 deletions
77
Example/DemoPasswordless.xcodeproj/xcshareddata/xcschemes/DemoPasswordless.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1510" | ||
version = "1.7"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "578159A82C29EF41006F3C20" | ||
BuildableName = "DemoPasswordless.app" | ||
BlueprintName = "DemoPasswordless" | ||
ReferencedContainer = "container:DemoPasswordless.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
shouldAutocreateTestPlan = "YES"> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "578159A82C29EF41006F3C20" | ||
BuildableName = "DemoPasswordless.app" | ||
BlueprintName = "DemoPasswordless" | ||
ReferencedContainer = "container:DemoPasswordless.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "578159A82C29EF41006F3C20" | ||
BuildableName = "DemoPasswordless.app" | ||
BlueprintName = "DemoPasswordless" | ||
ReferencedContainer = "container:DemoPasswordless.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
20 changes: 20 additions & 0 deletions
20
Example/DemoPasswordless/Assets.xcassets/AccentColor.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
Example/DemoPasswordless/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "1024.png", | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Example/DemoPasswordless/Assets.xcassets/logo.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "logo.png", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions
38
Example/DemoPasswordless/Assets.xcassets/primaryBitwarden.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0xDC", | ||
"green" : "0x5D", | ||
"red" : "0x17" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0xFF", | ||
"green" : "0xC5", | ||
"red" : "0xB2" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
Example/DemoPasswordless/Assets.xcassets/textPrimaryInverted.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0xFF", | ||
"green" : "0xFF", | ||
"red" : "0xFF" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0x00", | ||
"green" : "0x00", | ||
"red" : "0x00" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.developer.associated-domains</key> | ||
<array> | ||
<string>webcredentials:demo.passwordless.dev</string> | ||
</array> | ||
</dict> | ||
</plist> |
52 changes: 52 additions & 0 deletions
52
Example/DemoPasswordless/DemoApp/DemoNetworking/DemoAppAPIService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import Foundation | ||
|
||
class DemoAppAPIService { | ||
let demoApiUrl: String | ||
|
||
init(demoApiUrl: String) { | ||
self.demoApiUrl = demoApiUrl | ||
} | ||
|
||
private func make<T: Decodable>(request: URLRequest, authToken: String? = nil) async -> T { | ||
var updatedRequest = request | ||
updatedRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") | ||
if let authToken { | ||
updatedRequest.setValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization") | ||
} | ||
|
||
let response = try! await URLSession.shared.data(for: updatedRequest) | ||
let data = response.0 | ||
let dataString = String(data: data, encoding: .utf8) ?? "Empty response" | ||
let httpResponse = response.1 as! HTTPURLResponse | ||
|
||
print("Status Code: \(httpResponse.statusCode), Body: \(dataString)") | ||
return try! JSONDecoder().decode(T.self, from: data) | ||
} | ||
|
||
func register(username: String, firstName: String, lastName: String) async -> DemoRegisterResponse { | ||
let url = URL(string: "\(demoApiUrl)/auth/register")! | ||
var request = URLRequest(url: url) | ||
request.httpMethod = "POST" | ||
request.httpBody = try? JSONEncoder().encode( | ||
DemoRegisterRequest( | ||
username: username, | ||
firstName: firstName, | ||
lastName: lastName | ||
) | ||
) | ||
return await make(request: request) | ||
} | ||
|
||
func login(verifyToken: String) async -> DemoLoginResponse { | ||
let url = URL(string: "\(demoApiUrl)/auth/login")! | ||
var request = URLRequest(url: url) | ||
request.httpMethod = "POST" | ||
request.httpBody = try? JSONEncoder().encode(DemoLoginRequest(token: verifyToken)) | ||
return await make(request: request) | ||
} | ||
|
||
func fetchCredentials(userId: String, authToken: String) async -> [DemoCredentialsResponse] { | ||
let url = URL(string: "\(demoApiUrl)/users/\(userId)/credentials")! | ||
return await make(request: URLRequest(url: url), authToken: authToken) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Example/DemoPasswordless/DemoApp/DemoNetworking/DemoModels/DemoCredentialsResponse.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Foundation | ||
|
||
struct DemoCredentialsResponse: Decodable, Identifiable { | ||
var id: String { publicKey } | ||
|
||
let publicKey: String | ||
let userHandle: String | ||
let signatureCounter: Int | ||
let attestationFmt: String | ||
let createdAt: String | ||
let aaGuid: String | ||
let lastUsedAt: String | ||
let rpId: String? | ||
let origin: String | ||
let country: String | ||
let device: String | ||
let nickname: String? | ||
let userId: String | ||
} |
5 changes: 5 additions & 0 deletions
5
Example/DemoPasswordless/DemoApp/DemoNetworking/DemoModels/DemoLoginRequest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Foundation | ||
|
||
struct DemoLoginRequest: Encodable { | ||
let token: String | ||
} |
5 changes: 5 additions & 0 deletions
5
Example/DemoPasswordless/DemoApp/DemoNetworking/DemoModels/DemoLoginResponse.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Foundation | ||
|
||
struct DemoLoginResponse: Decodable { | ||
let jwtToken: String | ||
} |
7 changes: 7 additions & 0 deletions
7
Example/DemoPasswordless/DemoApp/DemoNetworking/DemoModels/DemoRegisterRequest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Foundation | ||
|
||
struct DemoRegisterRequest: Encodable { | ||
let username: String | ||
let firstName: String | ||
let lastName: String | ||
} |
5 changes: 5 additions & 0 deletions
5
Example/DemoPasswordless/DemoApp/DemoNetworking/DemoModels/DemoRegisterResponse.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Foundation | ||
|
||
struct DemoRegisterResponse: Decodable { | ||
let token: String | ||
} |
Oops, something went wrong.