-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated Pawskey app to handle automated constants baed on devtunnel e…
…ndpoints
- Loading branch information
Showing
10 changed files
with
95 additions
and
31 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
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 @@ | ||
// | ||
// Constants.xcconfig | ||
// PawsKey | ||
// | ||
// Created by Yubico Developer Program on 5/17/24. | ||
// Copyright © 2024 Yubico. All rights reserved. | ||
// | ||
|
||
API_BASE_URI = replace-with-your-api-hostname | ||
RP_ID = replace-with-your-RPID-domain |
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
2 changes: 1 addition & 1 deletion
2
...ples/clients/mobile/iOS/PawsKey/PawsKey.xcodeproj/xcshareddata/xcschemes/PawsKey.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
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
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
45 changes: 45 additions & 0 deletions
45
examples/clients/mobile/iOS/PawsKey/Shared/Constants.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,45 @@ | ||
// | ||
// Constants.swift | ||
// PawsKey | ||
// | ||
// Created by Dennis Hills on 5/17/24. | ||
// Copyright © 2024 Yubico. All rights reserved. | ||
// | ||
// See Configuration/Constants.xcconfig for API_BASE_URI/RP_ID values | ||
// | ||
|
||
import Foundation | ||
|
||
enum Constants { | ||
enum Error: Swift.Error { | ||
case missingKey, invalidValue | ||
} | ||
|
||
static func value<T>(for key: String) throws -> T where T: LosslessStringConvertible { | ||
guard let object = Bundle.main.object(forInfoDictionaryKey:key) else { | ||
throw Error.missingKey | ||
} | ||
|
||
switch object { | ||
case let value as T: | ||
return value | ||
case let string as String: | ||
guard let value = T(string) else { fallthrough } | ||
return value | ||
default: | ||
throw Error.invalidValue | ||
} | ||
} | ||
} | ||
|
||
enum APIBASEURI { | ||
static var domain: String { | ||
return try! Constants.value(for: "API_BASE_URI") | ||
} | ||
} | ||
|
||
enum RPID { | ||
static var domain: String { | ||
return try! Constants.value(for: "RP_ID") | ||
} | ||
} |
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
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
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