Functions
The following functions are available globally.
-
Create a new, random, encryption key.
Declaration
Swift
public func createAutofillKey() throws -> String
-
Decrypt an arbitrary string -
key
must have come fromcreate_key()
andciphertext
must have come fromencrypt_string()
Declaration
Swift
public func decryptString(key: String, ciphertext: String) throws -> String
-
Encrypt an arbitrary string -
key
must have come fromcreate_key()
Declaration
Swift
public func encryptString(key: String, cleartext: String) throws -> String
-
Trigger a hard abort inside the Rust code.
This function simulates some kind of uncatchable illegal operation performed inside the Rust code. After calling this function you should expect your application to be halted with e.g. a
SIGABRT
or similar.Declaration
Swift
public func triggerRustAbort()
-
Trigger an error inside the Rust code.
This function simulates the occurrence of an expected error inside the Rust code. You should expect calling this function to throw the foreign-language representation of the [
CrashTestError
] class.Declaration
Swift
public func triggerRustError() throws
-
Trigger a panic inside the Rust code.
This function simulates the occurrence of an unexpected state inside the Rust code that causes it to panic. We build our Rust components to unwind on panic, so after calling this function through the foreign language bindings, you should expect it to intercept the panic translate it into some foreign-language-appropriate equivalent:
- In Kotlin, it will throw an exception.
- In Swift, it will fail with a
try!
runtime error.
Declaration
Swift
public func triggerRustPanic()
-
Set the global error reporter. This is typically done early in startup.
Declaration
Swift
public func setApplicationErrorReporter(errorReporter: ApplicationErrorReporter)
-
Unset the global error reporter. This is typically done at shutdown for platforms that want to cleanup references like Desktop.
Declaration
Swift
public func unsetApplicationErrorReporter()
-
Check that key is still valid using the output of
create_canary
.text
much match the text you initially passed tocreate_canary()
Declaration
Swift
public func checkCanary(canary: String, text: String, encryptionKey: String) throws -> Bool
-
Create a “canary” string, which can be used to test if the encryption key is still valid for the logins data
Declaration
Swift
public func createCanary(text: String, encryptionKey: String) throws -> String
-
We expose the crypto primitives on the namespace Create a new, random, encryption key.
Declaration
Swift
public func createKey() throws -> String
-
Decrypt an encrypted
string
toSecureLoginFields
Declaration
Swift
public func decryptFields(secFields: String, encryptionKey: String) throws -> SecureLoginFields
-
Decrypt an
EncryptedLogin
to aLogin
Declaration
Swift
public func decryptLogin(login: EncryptedLogin, encryptionKey: String) throws -> Login
-
Encrypt
SecureLoginFields
to an encryptedstring
Declaration
Swift
public func encryptFields(secFields: SecureLoginFields, encryptionKey: String) throws -> String
-
Encrypt a
Login
to anEncryptedLogin
Declaration
Swift
public func encryptLogin(login: Login, encryptionKey: String) throws -> EncryptedLogin
-
A test utility used to validate event queries against the jexl evaluator.
This method should only be used in tests.
Declaration
Swift
public func validateEventQueries(recordedContext: RecordedContext) throws
-
Declaration
Swift
public func placesApiNew(dbPath: String) throws -> PlacesApi
-
Set the logger to forward to.
Pass in null to disable logging.
Declaration
Swift
public func setLogger(logger: AppServicesLogger?)
-
Set the maximum log level filter. Records below this level will not be sent to the logger.
Declaration
Swift
public func setMaxLevel(level: Level)
-
Determines whether a “raw” sponsored suggestion URL is equivalent to a “cooked” URL. The two URLs are equivalent if they are identical except for their replaced template parameters, which can be different.
Declaration
Swift
public func rawSuggestionUrlMatches(rawUrl: String, cookedUrl: String) -> Bool