android-components / mozilla.components.service.fxa.sharing / AccountSharing

AccountSharing

object AccountSharing (source)

Allows querying trusted FxA Auth provider packages on the device for instances of ShareableAccount. Once an instance of ShareableAccount is obtained, it may be used with FxaAccountManager.migrateAccountAsync directly, or with FirefoxAccount.migrateFromSessionTokenAsync via ShareableAccount.authInfo.

Functions

Name Summary
getSignaturePostAPI28 fun getSignaturePostAPI28(packageManager: <ERROR CLASS>, packageName: String): String?
Obtains package signature on devices running API>=28. Takes into consideration multiple signers and certificate rotation.
getSignaturePreAPI28 fun getSignaturePreAPI28(packageManager: <ERROR CLASS>, packageName: String): String?
Obtains package signature on devices running API<28. Takes into consideration multiple signers, but not signature rotation.
packageExistsWithSignature fun packageExistsWithSignature(packageManager: <ERROR CLASS>, suspectPackage: String, expectedSignature: String): Boolean
Checks if package exists, and that its signature matches provided value.
queryShareableAccounts fun queryShareableAccounts(context: <ERROR CLASS>): List<ShareableAccount>
Queries trusted FxA Auth providers present on the device, returning a list of accounts that can be used for signing in automatically.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.