Skip to content
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

Add min pin length to FIDO2 session #161

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ extern NSString* const YKFFIDO2GetInfoResponseOptionUserVerification;
*/
@property (nonatomic, readonly, nullable) NSArray *pinProtocols;

/*!
@abstract
The current minimum PIN length, in Unicode code points, the authenticator enforces for ClientPIN.
*/
@property (nonatomic, readonly) NSUInteger minPinLength;

/*
Not available: the response will be created by the library.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ typedef NS_ENUM(NSUInteger, YKFFIDO2GetInfoResponseKey) {
YKFFIDO2GetInfoResponseKeyAAGUID = 0x03,
YKFFIDO2GetInfoResponseKeyOptions = 0x04,
YKFFIDO2GetInfoResponseKeyMaxMsgSize = 0x05,
YKFFIDO2GetInfoResponseKeyPinProtocols = 0x06
YKFFIDO2GetInfoResponseKeyPinProtocols = 0x06,
YKFFIDO2GetInfoResponseKeyMinPinLength = 0x0d

};

@interface YKFFIDO2GetInfoResponse()
Expand All @@ -39,6 +41,7 @@ @interface YKFFIDO2GetInfoResponse()
@property (nonatomic, readwrite) NSData *aaguid;
@property (nonatomic, readwrite) NSDictionary *options;
@property (nonatomic, assign, readwrite) NSUInteger maxMsgSize;
@property (nonatomic, readwrite) NSUInteger minPinLength;
@property (nonatomic, readwrite) NSArray *pinProtocols;

@end
Expand Down Expand Up @@ -95,6 +98,14 @@ - (BOOL)parseResponseMap:(YKFCBORMap *)map {
self.maxMsgSize = maxMsgSize.integerValue;
}

// minPinLength
NSNumber *minPinLength = response[@(YKFFIDO2GetInfoResponseKeyMinPinLength)];
if (minPinLength != nil) {
self.minPinLength = minPinLength.integerValue;
} else {
self.minPinLength = 4;
}

// pin protocols
self.pinProtocols = response[@(YKFFIDO2GetInfoResponseKeyPinProtocols)];

Expand Down
Loading