Skip to content

Commit

Permalink
set service id for keychain
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshihorie committed Feb 12, 2022
1 parent cc2f0bb commit ea3cdd9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
26 changes: 13 additions & 13 deletions LiveKitExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
isa = PBXGroup;
children = (
6865EA2527513B4500FFAFC3 /* Info.plist */,
683F05F6273F96B20080C7AC /* BroadcastExt */,
683F0603273FAD690080C7AC /* iOS.entitlements */,
);
path = iOS;
Expand All @@ -191,7 +192,6 @@
68B3853B271E780600711D5F /* Shared */,
6865EA2427513B4500FFAFC3 /* iOS */,
68B3854A271E780700711D5F /* macOS */,
683F05F6273F96B20080C7AC /* BroadcastExt */,
68B38544271E780700711D5F /* Products */,
681E3F47271FCB40007BB547 /* Frameworks */,
);
Expand Down Expand Up @@ -436,11 +436,11 @@
683F05FE273F96B20080C7AC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = BroadcastExt/BroadcastExt.entitlements;
CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOS/BroadcastExt/BroadcastExt.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = J48VV6BZV9;
INFOPLIST_FILE = BroadcastExt/Info.plist;
INFOPLIST_FILE = "$(SRCROOT)/iOS/BroadcastExt/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = BroadcastExt;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -461,11 +461,11 @@
683F05FF273F96B20080C7AC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = BroadcastExt/BroadcastExt.entitlements;
CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOS/BroadcastExt/BroadcastExt.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = J48VV6BZV9;
INFOPLIST_FILE = BroadcastExt/Info.plist;
INFOPLIST_FILE = "$(SRCROOT)/iOS/BroadcastExt/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = BroadcastExt;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -606,7 +606,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = iOS/iOS.entitlements;
CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOS/iOS.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
Expand Down Expand Up @@ -640,7 +640,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = iOS/iOS.entitlements;
CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/iOS/iOS.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
Expand Down Expand Up @@ -674,11 +674,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = MacAppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements;
CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/macOS/macOS.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = J48VV6BZV9;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
Expand All @@ -691,7 +691,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = "io.livekit.example.Multiplatform-SwiftUI";
PRODUCT_NAME = LiveKitExample;
SDKROOT = macosx;
Expand All @@ -704,11 +704,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = MacAppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "LiveKitExample (macOS)Release.entitlements";
CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/macOS/macOS.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = J48VV6BZV9;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
Expand All @@ -721,7 +721,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.0.0;
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = "io.livekit.example.Multiplatform-SwiftUI";
PRODUCT_NAME = LiveKitExample;
SDKROOT = macosx;
Expand Down
2 changes: 1 addition & 1 deletion Shared/Controllers/AppContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ final class AppContext: ObservableObject {
self.preferMetal = store.get(.preferMetal) ?? true
self.videoViewMode = store.get(.videoViewMode) ?? .fit
self.videoViewMirrored = store.get(.videoViewMirrored) ?? false
self.connectionHistory = store.get(.connectionHistory) ?? []
self.connectionHistory = store.get(.connectionHistory) ?? Set<ConnectionHistory>()
}
}
2 changes: 1 addition & 1 deletion Shared/LiveKitExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SwiftUI
import Logging
import LiveKit

let store = SecureStore<SecureStoreKeys>()
let store = SecureStore<SecureStoreKeys>(service: "io.livekit.example")

struct RoomContextView: View {

Expand Down
6 changes: 5 additions & 1 deletion Shared/Support/SecureStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ enum SecureStoreKeys: String {

class SecureStore<K: RawRepresentable> where K.RawValue == String {

let keychain = Keychain()
let keychain: Keychain
let encoder = JSONEncoder()
let decoder = JSONDecoder()

init(service: String) {
self.keychain = Keychain(service: service)
}

func get<T: Decodable>(_ key: K) -> T? {
guard let data = try? keychain.getData(key.rawValue) else { return nil }
return try? decoder.decode(T.self, from: data)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ea3cdd9

Please sign in to comment.