Skip to content

Commit

Permalink
Add min pin length to fido2 session.
Browse files Browse the repository at this point in the history
  • Loading branch information
jensutbult committed Sep 2, 2024
1 parent 1ea9c97 commit d3fa8f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
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

0 comments on commit d3fa8f3

Please sign in to comment.