Skip to content

Commit

Permalink
Fixed some typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
svenhofman committed Nov 22, 2024
1 parent cef4fe6 commit cef67fd
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions extensions/hidemyemail/src/api/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { getNestedHeader, hashPassword } from "./utils";

interface ErrorData {
error?: string;
reason?: string;
[key: string]: unknown;
}

Expand Down Expand Up @@ -194,9 +195,14 @@ export class iCloudService {
private clientID: string;
private session: iCloudSession;

private webservices!: unknown;
private webservices!: Record<string, unknown>;
private sessionData: Record<string, unknown> = {};
private data!: Record<string, unknown>;
private data!: {
dsInfo: Record<string, unknown>,
webservices: Record<string, unknown>,
hsaChallengeRequired?: string,
hsaTrustedBrowser?: string,
};

constructor(appleID: string) {
this.appleID = appleID;
Expand Down Expand Up @@ -249,6 +255,7 @@ export class iCloudService {
}

this.webservices = this.data?.webservices;
console.log(this.webservices);
}

async srpAuthenticate(password: string) {
Expand Down Expand Up @@ -429,18 +436,19 @@ export class iCloudService {

if (addSessionData) {
if (this.sessionData?.scnt) {
headers.set("scnt", this.sessionData.scnt);
headers.set("scnt", this.sessionData.scnt as string);
}
if (this.sessionData?.sessionID) {
headers.set("X-Apple-ID-Session-Id", this.sessionData.sessionID);
headers.set("X-Apple-ID-Session-Id", this.sessionData.sessionID as string);
}
}

return headers;
}

getWebserviceUrl(wsKey: string): string {
return this.webservices?.[wsKey]?.url || "";
const hmeService = (this.webservices?.[wsKey] as { url: string });
return hmeService?.url ?? "";
}

get cookieJarKey() {
Expand Down

0 comments on commit cef67fd

Please sign in to comment.