This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * An http client to use until ktor works with multithreaded coroutines. | |
| * This goes in a common module that ios and android clients depend on. | |
| * We just return a string as shared components can use kotlinx serialization | |
| * thereafter to handle response parsing. | |
| */ | |
| interface IPlainClient { | |
| fun get( | |
| baseUrl: String, | |
| path: String, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open class BaseViewModel<T : Any, R : Any>( | |
| initialState: T | |
| ) : CoroutineScope { | |
| private val job = Job() | |
| override val coroutineContext: CoroutineContext = Dispatchers.Main + job | |
| protected val _state = ConflatedBroadcastChannel<T>(initialState) | |
| val state = _state.asFlow() | |
| val cState = state.wrap() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Function to generate AccountSalt | |
| import { buildPoseidon } from 'circomlibjs'; | |
| /** | |
| * Attempt at reproducing the account salt generation that zkemail does on the backend at -> | |
| * https://github.com/zkemail/relayer-utils/blob/aefb00fdcfbfde7fced50e5a0b086e5cc2ff64cd/src/cryptos.rs#L198 | |
| * @param email | |
| * @param accountCode | |
| */ | |
| export async function generateAccountSalt(email: string, accountCode: bigint): Promise<string> { |
OlderNewer