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 typo: 'sempahore' -> 'semaphore' #1832

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion apps/consumer-client/src/pages/examples/group-proof.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function Page(): JSX.Element {
</p>
<p>
The underlying PCD that this example uses is{" "}
<code>SempahoreGroupPCD</code>. You can find more documentation
<code>SemaphoreGroupPCD</code>. You can find more documentation
regarding this PCD{" "}
<CodeLink file="/tree/main/packages/semaphore-group-pcd">
here on GitHub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function FrogCryptoUpdateTelegramModal({
appConfig.zupassServer,
{
pcd: await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is somewhat dangerous, have you thought through the implications?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoah, crazy that this typo made it into a PCD type name. Changing that is definitely dangerous. If anyone has any of these saved in their PCDCollection (like I do) I'm pretty sure it'll crash on load.

It may be best to just leave the typo in place in the cases where it's part of a data format. Or if we want to fix it, I think we'd need to introduce some notion of type aliases and/or conversion to the PCD framework.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context this is not a pcd type name, this is the name of something only available in the client - a type of 'credential'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, so it is. I incorrectly assumed there was a 1:1 mapping. Seems like this is a field in a type with only one value, which is sent but never read. So maybe the compatibility impact is minimal.

}),
reveal: !revealed
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function RequireAddPasswordModal(): JSX.Element {
dispatch,
update,
await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function UpgradeAccountModal(): JSX.Element | null {
dispatch,
update,
await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ function SubscribeSection({

// Check that we can actually generate the credential that the feed wants
const missingCredentialPCD = !credentialManager.canGenerateCredential({
signatureType: "sempahore-signature-pcd",
signatureType: "semaphore-signature-pcd",
pcdType: info.credentialRequest.pcdType
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function ChangePasswordScreen(): JSX.Element | null {
dispatch,
update,
await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export function useUserFeedState(subscriptions: Subscription[]): {
const refreshUserState = useCallback(async () => {
try {
const pcd = await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
});

const state = await requestFrogCryptoGetUserState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function useFeeds(): {
useEffect(() => {
const fetchPcd = async (): Promise<void> => {
const pcd = await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
});
setPcd(pcd);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function useFrogs(): {
useEffect(() => {
const fetchPcd = async (): Promise<void> => {
const pcd = await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
});
setPcd(pcd);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import { useCallback, useEffect, useState } from "react";
import { bigintToUint8Array, uint8arrayToBigint } from "../../../src/util";

export function useUsernameGenerator():
| ((sempahoreId: string, lowercase?: boolean) => string)
| ((semaphoreId: string, lowercase?: boolean) => string)
| null {
const [pcdCrypto, setPCDCrypto] = useState<PCDCrypto | null>(null);
useEffect(() => {
PCDCrypto.newInstance().then(setPCDCrypto);
}, []);

const generator = useCallback(
(sempahoreId: string, lowercase = false) => {
(semaphoreId: string, lowercase = false) => {
try {
if (!pcdCrypto) {
throw new Error("pcdCrypto is not initialized");
}

const randomBytes = pcdCrypto.randombytesDeterministic(
32,
bigintToUint8Array(BigInt(sempahoreId))
bigintToUint8Array(BigInt(semaphoreId))
);
if (randomBytes === null) {
throw new Error("Could not generate random data");
Expand Down
4 changes: 2 additions & 2 deletions apps/passport-client/src/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ async function doSync(
state.credentialCache
);
const credential = await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
});

const upRes = await uploadSerializedStorage(
Expand Down Expand Up @@ -1466,7 +1466,7 @@ async function deleteAccount(state: AppState, update: ZuUpdate): Promise<void> {
);

const pcd = await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
});

const res = await requestDeleteAccount(appConfig.zupassServer, { pcd });
Expand Down
2 changes: 1 addition & 1 deletion apps/passport-server/src/database/queries/frogcrypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ function toFeedData(dbFeedData: FrogCryptoDbFeedData): FrogCryptoFeed {
inputPCDType: undefined,
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
},
permissions: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { sqlQuery } from "../../sqlQuery";

export async function fetchTelegramUsernameFromSemaphoreId(
client: Pool,
sempahoreId: string
semaphoreId: string
): Promise<string | null> {
const result = await sqlQuery(
client,
`\
select telegram_username from telegram_bot_conversations
where semaphore_id = $1
`,
[sempahoreId]
[semaphoreId]
);
if (result.rowCount === 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ export class LemonadePipeline implements BasePipeline {

private async manualTicketToTicketData(
manualTicket: ManualTicket,
sempahoreId: string
semaphoreId: string
): Promise<ITicketData> {
const event = this.getEventById(manualTicket.eventId);
const product = this.getTicketTypeById(event, manualTicket.productId);
Expand All @@ -583,7 +583,7 @@ export class LemonadePipeline implements BasePipeline {
productId: manualTicket.productId,
attendeeEmail: manualTicket.attendeeEmail,
attendeeName: manualTicket.attendeeName,
attendeeSemaphoreId: sempahoreId,
attendeeSemaphoreId: semaphoreId,
isConsumed: checkIn ? true : false,
isRevoked: false,
timestampSigned: Date.now(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ export class PretixPipeline implements BasePipeline {

private async manualTicketToTicketData(
manualTicket: ManualTicket,
sempahoreId: string
semaphoreId: string
): Promise<ITicketData> {
const event = this.getEventById(manualTicket.eventId);
const product = this.getProductById(event, manualTicket.productId);
Expand All @@ -870,7 +870,7 @@ export class PretixPipeline implements BasePipeline {
productId: manualTicket.productId,
attendeeEmail: manualTicket.attendeeEmail,
attendeeName: manualTicket.attendeeName,
attendeeSemaphoreId: sempahoreId,
attendeeSemaphoreId: semaphoreId,
imageUrl: this.imageOptionsToImageUrl(event.imageOptions, !!checkIn),
isConsumed: checkIn ? true : false,
isRevoked: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class PipelineAPISubservice {
}
],
credentialRequest: {
signatureType: "sempahore-signature-pcd",
signatureType: "semaphore-signature-pcd",
pcdType: "email-pcd"
}
} satisfies Feed
Expand Down Expand Up @@ -467,7 +467,7 @@ export class PipelineAPISubservice {

/**
* Returns whether the given @param rootHash is a valid root hash of the given
* Sempahore group at some point in time.
* Semaphore group at some point in time.
*/
public async handleGetValidSemaphoreGroup(
pipelineId: string,
Expand Down
4 changes: 2 additions & 2 deletions apps/passport-server/src/services/issuanceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class IssuanceService {
description: "Get your Devconnect tickets here!",
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
},
permissions: [
{
Expand Down Expand Up @@ -262,7 +262,7 @@ export class IssuanceService {
inputPCDType: undefined,
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
},
permissions: [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/passport-interface/src/CredentialManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ const CACHE_TTL = ONE_HOUR_MS;
*/
export const PODBOX_CREDENTIAL_REQUEST: CredentialRequest = {
pcdType: "email-pcd",
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
};

export const ZUPASS_CREDENTIAL_REQUEST: CredentialRequest = {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
};

// Creates an in-memory cache with a TTL of one hour.
Expand Down
6 changes: 3 additions & 3 deletions packages/lib/passport-interface/src/SubscriptionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class FeedSubscriptionManager {
const pcdCredential: SerializedPCD | undefined = authKey
? await this.makeAlternateCredentialPCD(authKey)
: await credentialManager.requestCredential({
signatureType: "sempahore-signature-pcd",
signatureType: "semaphore-signature-pcd",
pcdType: subscription.feed.credentialRequest.pcdType
});

Expand Down Expand Up @@ -587,7 +587,7 @@ export class FeedSubscriptionManager {
description: sub.feed.description,
permissions: sub.feed.permissions,
credentialRequest: {
signatureType: "sempahore-signature-pcd",
signatureType: "semaphore-signature-pcd",
...(sub.feed.credentialType === "email-pcd"
? { pcdType: sub.feed.credentialType }
: {})
Expand Down Expand Up @@ -678,7 +678,7 @@ export interface SubscriptionProvider {
// The configuration of the credential required by a feed server
export interface CredentialRequest {
// Can be extended as more signature types are supported
signatureType: "sempahore-signature-pcd";
signatureType: "semaphore-signature-pcd";
// Can be extended as more PCD types are supported
// Including a PCD in the credential is optional. We might also want to
// query on more than just type of PCD in future.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const zupassDefaultSubscriptions: Record<
"used to request PCDs from other PCD feeds.",
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
},
permissions: [
{
Expand All @@ -34,7 +34,7 @@ export const zupassDefaultSubscriptions: Record<
description: "EdDSATicketPCDs representing Zuzalu Tickets.",
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
},
permissions: [
{
Expand All @@ -54,7 +54,7 @@ export const zupassDefaultSubscriptions: Record<
description: "EdDSATicketPCDs representing Zuconnect Tickets.",
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
},
permissions: [
{
Expand Down
6 changes: 3 additions & 3 deletions packages/lib/passport-interface/test/MockFeedApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class MockFeedApi implements IFeedApi {
inputPCDType: undefined,
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
}
},

Expand Down Expand Up @@ -113,7 +113,7 @@ export class MockFeedApi implements IFeedApi {
inputPCDType: undefined,
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
}
},
handleRequest: async (
Expand Down Expand Up @@ -157,7 +157,7 @@ export class MockFeedApi implements IFeedApi {
partialArgs: undefined,
credentialRequest: {
pcdType: "email-pcd",
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("Subscription Manager", async function () {
inputPCDType: undefined,
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
}
});
}
Expand Down Expand Up @@ -122,7 +122,7 @@ describe("Subscription Manager", async function () {
inputPCDType: undefined,
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
}
};

Expand Down Expand Up @@ -169,7 +169,7 @@ describe("Subscription Manager", async function () {
inputPCDType: undefined,
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
}
};

Expand Down Expand Up @@ -213,7 +213,7 @@ describe("Subscription Manager", async function () {
inputPCDType: undefined,
partialArgs: undefined,
credentialRequest: {
signatureType: "sempahore-signature-pcd"
signatureType: "semaphore-signature-pcd"
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/pcd/semaphore-group-pcd/src/SemaphoreGroupPCD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SerializedSemaphoreGroup } from "./SerializedSemaphoreGroup";

export const SemaphoreGroupPCDTypeName = "semaphore-group-signal";

export interface SempahoreGroupPCDInitArgs {
export interface SemaphoreGroupPCDInitArgs {
// TODO: how do we distribute these in-package, so that consumers
// of the package don't have to copy-paste these artifacts?
// TODO: how do we account for different versions of the same type
Expand Down
10 changes: 5 additions & 5 deletions packages/pcd/semaphore-group-pcd/src/SemaphoreGroupPCDPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import {
SemaphoreGroupPCD,
SemaphoreGroupPCDArgs,
SemaphoreGroupPCDClaim,
SemaphoreGroupPCDInitArgs,
SemaphoreGroupPCDProof,
SemaphoreGroupPCDTypeName,
SempahoreGroupPCDInitArgs
SemaphoreGroupPCDTypeName
} from "./SemaphoreGroupPCD";
import { deserializeSemaphoreGroup } from "./SerializedSemaphoreGroup";

let initArgs: SempahoreGroupPCDInitArgs | undefined = undefined;
let initArgs: SemaphoreGroupPCDInitArgs | undefined = undefined;

export async function init(args: SempahoreGroupPCDInitArgs): Promise<void> {
export async function init(args: SemaphoreGroupPCDInitArgs): Promise<void> {
initArgs = args;
}

Expand Down Expand Up @@ -144,7 +144,7 @@ export const SemaphoreGroupPCDPackage: PCDPackage<
SemaphoreGroupPCDClaim,
SemaphoreGroupPCDProof,
SemaphoreGroupPCDArgs,
SempahoreGroupPCDInitArgs
SemaphoreGroupPCDInitArgs
> = {
name: SemaphoreGroupPCDTypeName,
getDisplayOptions,
Expand Down
Loading
Loading