mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-29 13:03:11 +00:00
EvenHub compatibility for iOS
This commit is contained in:
1 parent
617cdc39eb
commit
7e58c7c05f
40 files changed
+629
-176
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { Application } from "@nativescript/core";
|
||||
|
||||
export function hmacSha256Base64(secret: string, message: string): string {
|
||||
const charset = java.nio.charset.StandardCharsets.UTF_8;
|
||||
const key = new javax.crypto.spec.SecretKeySpec(new java.lang.String(secret).getBytes(charset), "HmacSHA256");
|
||||
const mac = javax.crypto.Mac.getInstance("HmacSHA256");
|
||||
mac.init(key);
|
||||
const digest = mac.doFinal(new java.lang.String(message).getBytes(charset));
|
||||
return String(android.util.Base64.encodeToString(digest, android.util.Base64.NO_WRAP));
|
||||
}
|
||||
|
||||
export function getPhoneOpenUdid(): string {
|
||||
const resolver = Application.android.context?.getContentResolver();
|
||||
const id = resolver ? String(android.provider.Settings.Secure.getString(resolver, android.provider.Settings.Secure.ANDROID_ID) ?? "") : "";
|
||||
if (!id) throw new Error("Android did not provide a device ID for EvenHub authentication.");
|
||||
return id;
|
||||
}
|
||||
Reference in new issue
Block a user