-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] make keychain #183
[Feat] make keychain #183
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
κ³ μνμ ¨μ΅λλ€! μμ μλκ° μμ² λΉ λ₯΄μλ€μ ,,,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM π
private struct Key { | ||
static let accessToken = "accessToken" | ||
static let refreshToken = "refreshToken" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
structλ μμ±μ΄ κ°λ₯νκΈ° λλ¬Έμ, μΌλ°μ μΌλ‘ enumμΌλ‘ μ μΈνκ³€ νλ΅λλ€.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ν μ°Έκ³ νκ²μ΅λλ€!
print("Keychain initialized with service name: \(serviceName)") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ΄ λΆλΆμ μμ ν΄λ μ’μ κ² κ°μ΅λλ€.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ°μμ
if let newValue = newValue { | ||
let success = keychain.set(newValue, forKey: Key.accessToken) | ||
print("Setting Access Token: \(newValue)") | ||
if success { | ||
print("Access Token saved successfully") | ||
// μ μ₯ ν μ¦μ μ½μ΄ νμΈ | ||
if let savedToken = keychain.string(forKey: Key.accessToken) { | ||
print("Verified Access Token: \(savedToken)") | ||
} else { | ||
print("Failed to verify Access Token after saving") | ||
} | ||
} else { | ||
print("Failed to save Access Token") | ||
printKeychainError(forKey: Key.accessToken) | ||
} | ||
} else { | ||
let success = keychain.removeObject(forKey: Key.accessToken) | ||
print(success ? "Access Token removed successfully" : "Failed to remove Access Token") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λμ€ μ’ μ€μ¬μ£ΌμΈμ!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ°μμ
if let newValue = newValue { | ||
let success = keychain.set(newValue, forKey: Key.refreshToken) | ||
print("Setting Refresh Token: \(newValue)") | ||
if success { | ||
print("Refresh Token saved successfully") | ||
// μ μ₯ ν μ¦μ μ½μ΄ νμΈ | ||
if let savedToken = keychain.string(forKey: Key.refreshToken) { | ||
print("Verified Refresh Token: \(savedToken)") | ||
} else { | ||
print("Failed to verify Refresh Token after saving") | ||
} | ||
} else { | ||
print("Failed to save Refresh Token") | ||
printKeychainError(forKey: Key.refreshToken) | ||
} | ||
} else { | ||
let success = keychain.removeObject(forKey: Key.refreshToken) | ||
print(success ? "Refresh Token removed successfully" : "Failed to remove Refresh Token") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ¬κΈ°λ λμ€ μ€μ¬μ£ΌμΈμ!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ°μμ
π μ°κ²°λ μ΄μ
π μμ λ΄μ©