FRAMechanism.h revision 78c07714ec1113f7f21c75b818f2bf6a7021618a
2beebed98b4fc7f018fb224a1e4a3ab6103a4c0bCraig McDonnell * The contents of this file are subject to the terms of the Common Development and
2beebed98b4fc7f018fb224a1e4a3ab6103a4c0bCraig McDonnell * Distribution License (the License). You may not use this file except in compliance with the
2beebed98b4fc7f018fb224a1e4a3ab6103a4c0bCraig McDonnell * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
2beebed98b4fc7f018fb224a1e4a3ab6103a4c0bCraig McDonnell * specific language governing permission and limitations under the License.
2beebed98b4fc7f018fb224a1e4a3ab6103a4c0bCraig McDonnell * When distributing Covered Software, include this CDDL Header Notice in each file and include
2beebed98b4fc7f018fb224a1e4a3ab6103a4c0bCraig McDonnell * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
2beebed98b4fc7f018fb224a1e4a3ab6103a4c0bCraig McDonnell * Header, with the fields enclosed by brackets [] replaced by your own identifying
2beebed98b4fc7f018fb224a1e4a3ab6103a4c0bCraig McDonnell * information: "Portions copyright [year] [name of copyright owner]".
2beebed98b4fc7f018fb224a1e4a3ab6103a4c0bCraig McDonnell * Copyright 2016 ForgeRock AS.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * A mechanism used for authentication within the Authenticator Application.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * Encapsulates the related settings, as well as an owning Identity.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * The parent Identity object which this mechanism belongs to.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell// NB. FRAIdentity and FRAMechanism hold a strong reference to each other - Necessary as FRAMechanismFactory
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell// returns FRAMechanism which may reference a new FRAIdentity.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * A list of the current Notficiations that are assigned to this Mechanism.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell@property (getter=notifications, nonatomic, readonly) NSArray<FRANotification *> *notifications;
78c07714ec1113f7f21c75b818f2bf6a7021618aDiego Colantoni * The type of this mechanism (totp, hotp or push).
78c07714ec1113f7f21c75b818f2bf6a7021618aDiego Colantoni@property (nonatomic, readonly) NSString *type;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Init method.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @param database The database to which this mechanism can be persisted.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param identityModel The identity model which contains the list of identities.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @return The initialized mechanism or nil if initialization failed.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni- (instancetype)initWithDatabase:(FRAIdentityDatabase *)database identityModel:(FRAIdentityModel *)identityModel;
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * When a new notification is received by the App, it will be appended to
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * the owning Mechanism using this method.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @param notification The notification to add to this Mechanism.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * @param error If there was an error, this value will be populated.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * @return BOOL NO if there was an error adding the Notification, in which case the error value will be populated.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott- (BOOL)addNotification:(FRANotification *)notification error:(NSError *__autoreleasing*)error;
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * Once a Notification has been marked as deleted, it will be removed from
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * the Mechanism by this method.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @param notification The notification to remove from the Mechanism.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * @param error If there was an error, this value will be populated.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * @return BOOL NO if there was an error adding the Notification, in which case the error value will be populated.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott- (BOOL)removeNotification:(FRANotification *)notification error:(NSError *__autoreleasing*)error;
a3970d0ea62388e4ede01470a6436eb5c6c92353Craig McDonnell * Count of notifications that have not yet been dealt with.
a3970d0ea62388e4ede01470a6436eb5c6c92353Craig McDonnell * @return The number of pending notifications.
916ef74523ecddc8140815c084ab6971ee366bcfCraig McDonnell * Gets the notification identified uniquely by the provided messageID.
916ef74523ecddc8140815c084ab6971ee366bcfCraig McDonnell * @param messageId The message id of the notification to get.
916ef74523ecddc8140815c084ab6971ee366bcfCraig McDonnell * @return The notification with the specified messageId or nil if no match is found.