mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 12:52:21 +00:00
Updated Readme to reflect new modules Added CocoaHTTPServer submodule Fixed SettingsWindow, works now with multiple tabs Added ServerSettings tab
47 lines
1.6 KiB
Objective-C
47 lines
1.6 KiB
Objective-C
//
|
|
// NSString+MPPasswordCreation.h
|
|
// MacPass
|
|
//
|
|
// Created by Michael Starke on 29.03.13.
|
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
typedef NS_OPTIONS(NSUInteger, MPPasswordCharacterFlags) {
|
|
MPPasswordCharactersUpperCase = (1<<0), // NSCharacterset lowerCaseCharacterSet
|
|
MPPasswordCharactersLowerCase = (1<<1), // NSCharacterSet upperCaseCharacterSet
|
|
MPPasswordCharactersNumbers = (1<<2), // NSCharacterSet numberCharacterSet
|
|
MPPasswordCharactersSymbols = (1<<3), // NSCharacterSet symbolCharacterSet
|
|
MPPasswordCharactersAll = MPPasswordCharactersUpperCase | MPPasswordCharactersLowerCase | MPPasswordCharactersNumbers | MPPasswordCharactersSymbols
|
|
};
|
|
|
|
@interface NSString (MPPasswordCreation)
|
|
|
|
/*
|
|
Generates a new password with the allowed charaters an the requests lenght
|
|
@param array with allowed NSChractersSets for creation
|
|
@param lenght lenght of the password to create
|
|
*/
|
|
+ (NSString *)passwordWithCharactersets:(MPPasswordCharacterFlags)allowedCharacters length:(NSUInteger)theLength;
|
|
/*
|
|
Generates a new password with the given length and allowed characters
|
|
@param Source string of allowed characters
|
|
@param lenght Lenght of the password to create
|
|
@return Password
|
|
*/
|
|
+ (NSString *)passwordFromString:(NSString *)source length:(NSUInteger)length;
|
|
|
|
/*
|
|
Creates a password containing only the characters in the string
|
|
@param Lenght of the password
|
|
*/
|
|
- (NSString *)passwordWithLength:(NSUInteger)length;
|
|
|
|
/*
|
|
Returns a random Character from the String
|
|
*/
|
|
- (NSString *)randomCharacter;
|
|
|
|
@end
|