-
Notifications
You must be signed in to change notification settings - Fork 1
アルゴリズム、OTP桁数、タイムステップ数が変更できることの確認対応 #10
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
Changes from all commits
57eb73c
977e215
ef44b2c
e00de01
105e7bb
381b8ee
f62e1e6
8605a17
f9456f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,9 @@ | |
| #import <UIKit/UIKit.h> | ||
|
|
||
| @interface ViewController : UIViewController | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| @property (nonatomic) NSString *algorithm; | ||
| @property (nonatomic) NSString *digits; | ||
| @property (nonatomic) NSString *period; | ||
|
|
||
| @end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
|
|
||
| #import "ViewController.h" | ||
| #import "OneTimePassword.h" | ||
| #import "SettingController.h" | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| #import <Base32/MF_Base32Additions.h> | ||
| #import <UAProgressView.h> | ||
|
|
||
|
|
@@ -16,20 +17,20 @@ @interface ViewController () | |
|
|
||
| @property (weak, nonatomic) IBOutlet UILabel *oneTimePasswordLabel; | ||
| @property (weak, nonatomic) IBOutlet UAProgressView *oneTimePasswordProgressView; | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| @property (nonatomic, assign) CGFloat localProgress; | ||
|
|
||
| @property (nonatomic) float scheduledTimerWithTimeInterval; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| @end | ||
|
|
||
| @implementation ViewController | ||
|
|
||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| - (void)viewDidLoad { | ||
| [super viewDidLoad]; | ||
|
|
||
| [self initOneTimePasswordToken]; | ||
| [self initOneTimePasswordView]; | ||
|
|
||
| [NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(updateOneTimePasswordView:) userInfo:nil repeats:YES]; | ||
| [NSTimer scheduledTimerWithTimeInterval:self.scheduledTimerWithTimeInterval target:self selector:@selector(updateOneTimePasswordView:) userInfo:nil repeats:YES]; | ||
| } | ||
|
|
||
| - (void)initOneTimePasswordToken { | ||
|
|
@@ -39,7 +40,21 @@ - (void)initOneTimePasswordToken { | |
|
|
||
| NSData *secretData = [NSData dataWithBase32String:secretString]; | ||
|
|
||
| self.token = [OTPToken tokenWithType:OTPTokenTypeTimer secret:secretData name:name issuer:issuer ]; | ||
| self.token = [OTPToken tokenWithType:OTPTokenTypeTimer secret:secretData name:name issuer:issuer]; | ||
| self.scheduledTimerWithTimeInterval = 0.03f; | ||
| if (_algorithm != nil) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. また |
||
| NSArray *OTPAlgorithmStrings = @[@"SHA1", @"SHA256", @"SHA512"]; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| self.token.algorithm = [OTPAlgorithmStrings indexOfObject:_algorithm]; | ||
| } | ||
| if (_digits != nil) { | ||
| self.token.digits = [_digits intValue]; | ||
| } | ||
| if (_period != nil) { | ||
| self.token.period = [_period intValue]; | ||
| if([_period isEqualToString:@"60"]) { | ||
| self.scheduledTimerWithTimeInterval = 0.06f; | ||
| } | ||
|
Comment on lines
+54
to
+56
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
|
|
||
| - (void)initOneTimePasswordView { | ||
|
|
@@ -64,6 +79,7 @@ - (void)updateOneTimePasswordView:(NSTimer *)timer { | |
|
|
||
| _localProgress = newProgress; | ||
| [self.oneTimePasswordProgressView setProgress:_localProgress animated:NO]; | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| @end | ||
Uh oh!
There was an error while loading. Please reload this page.