43 lines
908 B
TypeScript
43 lines
908 B
TypeScript
export interface PollProps {
|
|
userid: string | undefined,
|
|
activePollId: string,
|
|
pollData: PollData,
|
|
addOption: (name: string) => void,
|
|
vote: (optionName: string) => void
|
|
}
|
|
|
|
export interface PollListProps {
|
|
userid: string | undefined,
|
|
}
|
|
|
|
export interface PollMetadata {
|
|
createdAt: number; // Unix timestamp in milliseconds
|
|
duration: number; // Duration in milliseconds
|
|
createdBy: string;
|
|
}
|
|
|
|
export interface PollData {
|
|
[key: string]: SignedData<VoteData>[] | SignedData<PollMetadata> | undefined;
|
|
}
|
|
|
|
export interface SignedData<T> {
|
|
data: T,
|
|
signature: string
|
|
}
|
|
|
|
export interface VoteData {
|
|
userid: string,
|
|
timestamp: string
|
|
}
|
|
|
|
export interface OptionData {
|
|
userid: string,
|
|
timestamp: string,
|
|
optionName: string
|
|
}
|
|
|
|
export interface UserData {
|
|
userid: string,
|
|
private_key: CryptoKey | undefined,
|
|
public_key: CryptoKey | undefined
|
|
} |