We have implemented the SE-backed key stretching scheme RainbowSloth for iOS 15+. This folder gets synced into a designated repository to allow inclusion as a Swift package dependency.
For changes refer to the main repository here: https://github.com/lambdapioneer/sloth
Add this repository as a dependency to your Package.swift
file like so:
dependencies: [
// ...
.package(url: "https://github.com/lambdapioneer/sloth-ios.git", from: "0.3.0"),
],
targets: [
.target(
name: "YourAppTarget",
dependencies: [
// ...
.product(name: "RainbowSloth", package: "sloth-ios")
],
// ...
)
// ...
]
After adding the dependency you can import the library in the respective .swift
files and use it:
import RainbowSloth
// create a new Sloth instance
let sloth = RainbowSloth(withN: 100) // see paper on how to choose `n`
// create a new key
let (storageState, key) = try sloth.keygen(
pw: "user-passphrase",
handle: "your-identifier",
outputLength: 32
)
// re-derive the same key later
let key = try sloth.derive(
storageState: storageState,
pw: "user-passphrase",
outputLength: 32
)