Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gate): skip unnecessary secret decryption step on SYNC_FORCE_REMOVE #976

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/typegate/src/sync/typegraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,23 @@ export class TypegraphStore {
return id;
}

public async download(
public async downloadTypegraph(
id: TypegraphId,
): Promise<[TypeGraphDS, SecretManager]> {
) {
const key = TypegraphStore.#getKey(id);
const data = await this.#downloadData(this.bucket, key);
const [typegraph, encryptedSecrets] = JSON.parse(data) as [
TypeGraphDS,
string,
];

return [typegraph, encryptedSecrets] satisfies [TypeGraphDS, string];
}

public async download(
id: TypegraphId,
): Promise<[TypeGraphDS, SecretManager]> {
const [typegraph, encryptedSecrets] = await this.downloadTypegraph(id);
const secrets = JSON.parse(await this.cryptoKeys.decrypt(encryptedSecrets));
const secretManager = new SecretManager(typegraph, secrets);

Expand Down
2 changes: 1 addition & 1 deletion src/typegate/src/typegate/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export class Typegate implements AsyncDisposable {
) {
logger.warn(`Dropping "${name}": started`);
const typegraphId = typegraphIdSchema.parse(JSON.parse(payload));
const [tg] = await typegraphStore.download(
const [tg] = await typegraphStore.downloadTypegraph(
typegraphId,
);
const artifacts = new Set(
Expand Down
Loading