diff --git a/YubiKit/YubiKit/Connections/Shared/Requests/FIDO2/YKFFIDO2GetInfoResponse.h b/YubiKit/YubiKit/Connections/Shared/Requests/FIDO2/YKFFIDO2GetInfoResponse.h index 1fa02edb..dcccca15 100644 --- a/YubiKit/YubiKit/Connections/Shared/Requests/FIDO2/YKFFIDO2GetInfoResponse.h +++ b/YubiKit/YubiKit/Connections/Shared/Requests/FIDO2/YKFFIDO2GetInfoResponse.h @@ -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. */ diff --git a/YubiKit/YubiKit/Connections/Shared/Requests/FIDO2/YKFFIDO2GetInfoResponse.m b/YubiKit/YubiKit/Connections/Shared/Requests/FIDO2/YKFFIDO2GetInfoResponse.m index bcbc052c..f095100c 100644 --- a/YubiKit/YubiKit/Connections/Shared/Requests/FIDO2/YKFFIDO2GetInfoResponse.m +++ b/YubiKit/YubiKit/Connections/Shared/Requests/FIDO2/YKFFIDO2GetInfoResponse.m @@ -29,7 +29,9 @@ typedef NS_ENUM(NSUInteger, YKFFIDO2GetInfoResponseKey) { YKFFIDO2GetInfoResponseKeyAAGUID = 0x03, YKFFIDO2GetInfoResponseKeyOptions = 0x04, YKFFIDO2GetInfoResponseKeyMaxMsgSize = 0x05, - YKFFIDO2GetInfoResponseKeyPinProtocols = 0x06 + YKFFIDO2GetInfoResponseKeyPinProtocols = 0x06, + YKFFIDO2GetInfoResponseKeyMinPinLength = 0x0d + }; @interface YKFFIDO2GetInfoResponse() @@ -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 @@ -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)];