Skip to content

Commit

Permalink
fix: remove dependency on identity module
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Dec 28, 2024
1 parent 810aff3 commit 7a2a933
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mods/common/src/identity/createAuthInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { Access, TokenUseEnum } from "./types";
import { tokenHasAccessKeyId } from "./tokenHasAccessKeyId";
import { permissionDeniedError, unauthenticatedError } from "./errors";

const logger = getLogger({ service: "identity", filePath: __filename });
const logger = getLogger({ service: "common", filePath: __filename });

/**
* This function is a gRPC interceptor that checks if the request is valid
Expand Down
6 changes: 4 additions & 2 deletions mods/common/src/identity/getPublicKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ const IdentityServiceClient = grpc.makeGenericClientConstructor(
{}
);

function getPublicKey(endpoint: string) {
function getPublicKey(endpoint: string, allowInsecure: boolean = false) {
return new Promise<GetPublicKeyResponse>((resolve, reject) => {
const client = new IdentityServiceClient(
endpoint,
grpc.credentials.createInsecure()
allowInsecure
? grpc.credentials.createInsecure()
: grpc.credentials.createSsl()
);

client.getPublicKey(
Expand Down
6 changes: 3 additions & 3 deletions mods/sdk/src/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import { TrunksClient } from "../generated/node/trunks_grpc_pb";
const DEFAULT_ENDPOINT = "api.fonoster.io:50051";

export class Client extends AbstractClient {
private endpoint: string;
private tokenRefresherInterceptor: Interceptor;
private channelCredentials: ChannelCredentials;
private readonly endpoint: string;
private readonly tokenRefresherInterceptor: Interceptor;
private readonly channelCredentials: ChannelCredentials;

constructor(config: {
endpoint?: string;
Expand Down
4 changes: 3 additions & 1 deletion mods/voice/src/VoiceServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ export default class VoiceServer {
} catch (err) {
if (err.code === grpc.status.UNAVAILABLE) {
logger.error("failed to connect to identity service");
process.exit(1);
} else {
logger.error("failed to start voice server", err);
}
process.exit(1);
}
}
}
2 changes: 1 addition & 1 deletion mods/voice/src/defaultServerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ServerConfig } from "./types";
const defaultServerConfig: ServerConfig = {
port: 50061,
bind: "0.0.0.0",
identityAddress: "api.fonoster.io:50051",
identityAddress: "api.fonoster.dev",
skipIdentity: false
};

Expand Down

0 comments on commit 7a2a933

Please sign in to comment.