StorageManager

@objc(SFMCSdkStorageManager)
public class StorageManager : NSObject

This class provides helper for storing encrypted key value pairs.

  • Tag: StorageManager
  • Declaration

    Swift

    @objc
    public func getRegistrationId() -> String
  • Creates a SecurePrefs object used to store encrypted key value pairs. Using the same name references the same storage location.

    securePrefs1.setString(“first”, for: “Key”) securePrefs2.setString(“second”, for: “Key”)

    let value = securePrefs1.stringForKey(“Key”) value now equals “second”

    Declaration

    Swift

    @objc
    public func getOrCreateSecurePrefs(name: String) -> SecurePrefs

    Parameters

    name

    location name to store the secure preferences data

    Return Value

    A SecurePrefs object associated with the name provided. “` let securePrefs1 = getSecurePrefs(name: "Hello”) let securePrefs2 = getSecurePrefs(name: “Hello”)

  • Provides a generated string prefix for a given file

    Declaration

    Swift

    @objc
    public func getFilenameForModuleInstallation(fileName: String) -> String

    Parameters

    fileName

    String name of file to be given a prefix

    Return Value

    String result of the file name prefixed with module and unique installation Id

  • Provides a way to set/override the accessibility attribute for Keychain

    Declaration

    Swift

    @objc
    public static func setKeychainAccessibilityAttribute(accessibleAttribute: CFTypeRef?)

    Parameters

    accessibleAttribute

    CFTypeRef which has any one of below values kSecAttrAccessibleWhenUnlocked kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly kSecAttrAccessibleWhenUnlockedThisDeviceOnly kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly kSecAttrAccessibleAlwaysThisDeviceOnly

  • Returns accessible attribute set by the SDK or overridden value by the consuming application

    Declaration

    Swift

    @objc
    public static func keychainAccessibilityAttribute() -> CFTypeRef?
  • Sets whether or not keychain access errors cause a fatal exception.

    Declaration

    Swift

    @objc
    public static func setKeychainAccessErrorsAreFatal(errorsAreFatal: Bool)
  • Declaration

    Swift

    @objc
    public static func keychainAccessErrorsAreFatal() -> Bool
  • Provides a way to set/override the Protection level for File system

    Declaration

    Swift

    @objc
    public static func setFileSystemProtectionType(fileProtectionType: FileProtectionType?)

    Parameters

    fileProtectionType

    FileProtectionType which has any one of the below values NSFileProtectionComplete NSFileProtectionCompleteUnlessOpen NSFileProtectionCompleteUntilFirstUserAuthentication NSFileProtectionNone

  • Returns File protection type set by the SDK or overridden value by the consuming application

    Declaration

    Swift

    @objc
    public static func fileSystemProtectionType() -> FileProtectionType?