UNPKG

yc-types

Version:

TypeScript types and interfaces for YellowCard protobuf definitions

150 lines (149 loc) 5.5 kB
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export declare const protobufPackage = "pb"; /** OTP Management Messages */ export interface GenerateOTPRequest { /** OTP expiration in minutes (default: 10) */ expiryMinutes?: number | undefined; /** Maximum uses per OTP (default: 5) */ maxUses?: number | undefined; } export interface GenerateOTPResponse { status: number; message: string; /** Plain OTP code for distribution */ otpCode: string; expiresInMinutes: number; maxUses: number; } export interface ValidateOTPRequest { otpCode: string; } export interface ValidateOTPResponse { status: number; message: string; valid: boolean; } /** Sync Queue Management Messages */ export interface SyncQueueStatusRequest { } export interface SyncQueueStatusResponse { status: number; message: string; pendingCount: number; failedCount: number; inProgressCount: number; isOnline: boolean; isOfflineMode: boolean; connectivity: { [key: string]: ServiceConnectivityStatus; }; } export interface SyncQueueStatusResponse_ConnectivityEntry { key: string; value: ServiceConnectivityStatus | undefined; } export interface ServiceConnectivityStatus { service: string; isConnected: boolean; responseTime: string; error: string; } export interface ProcessSyncQueueRequest { /** Maximum number of operations to process */ limit?: number | undefined; } export interface ProcessSyncQueueResponse { status: number; message: string; processedCount: number; failedCount: number; } export interface GetCardPDFRequest { cardId: string; /** Get provisional PDF if true */ provisional?: boolean | undefined; } export interface GetCardPDFResponse { status: number; message: string; /** PDF file content */ pdfData: Uint8Array; contentType: string; } /** Offline OTP Pool Management */ export interface GenerateOTPBatchRequest { /** Number of OTPs to generate (default: 50) */ count: number; /** Expiry time in minutes (default: 1440 = 24 hours) */ expiryMinutes: number; /** Max uses per OTP (default: 1) */ maxUsesPerOtp: number; /** Client-provided symmetric key (>=32 chars) for encrypting this pool */ deviceEncryptionKey: string; } export interface GenerateOTPBatchResponse { status: number; message: string; /** Encrypted OTP pool JSON for client storage */ otpPoolEncrypted: Uint8Array; otpCount: number; expiryMinutes: number; /** Unique identifier for this pool */ poolId: string; } export interface SyncOTPUsageRequest { /** OTPs that were used offline */ usedOtps: OTPUsageEntry[]; } export interface OTPUsageEntry { /** Plain OTP code that was used */ code: string; /** ISO 8601 timestamp when OTP was used */ usedAt: string; /** Operation ID from the issuance */ operationId: string; } export interface SyncOTPUsageResponse { status: number; message: string; /** Number of OTPs successfully validated */ validatedCount: number; /** Number of invalid/duplicate OTPs */ invalidCount: number; } export declare const GenerateOTPRequest: MessageFns<GenerateOTPRequest>; export declare const GenerateOTPResponse: MessageFns<GenerateOTPResponse>; export declare const ValidateOTPRequest: MessageFns<ValidateOTPRequest>; export declare const ValidateOTPResponse: MessageFns<ValidateOTPResponse>; export declare const SyncQueueStatusRequest: MessageFns<SyncQueueStatusRequest>; export declare const SyncQueueStatusResponse: MessageFns<SyncQueueStatusResponse>; export declare const SyncQueueStatusResponse_ConnectivityEntry: MessageFns<SyncQueueStatusResponse_ConnectivityEntry>; export declare const ServiceConnectivityStatus: MessageFns<ServiceConnectivityStatus>; export declare const ProcessSyncQueueRequest: MessageFns<ProcessSyncQueueRequest>; export declare const ProcessSyncQueueResponse: MessageFns<ProcessSyncQueueResponse>; export declare const GetCardPDFRequest: MessageFns<GetCardPDFRequest>; export declare const GetCardPDFResponse: MessageFns<GetCardPDFResponse>; export declare const GenerateOTPBatchRequest: MessageFns<GenerateOTPBatchRequest>; export declare const GenerateOTPBatchResponse: MessageFns<GenerateOTPBatchResponse>; export declare const SyncOTPUsageRequest: MessageFns<SyncOTPUsageRequest>; export declare const OTPUsageEntry: MessageFns<OTPUsageEntry>; export declare const SyncOTPUsageResponse: MessageFns<SyncOTPUsageResponse>; type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]>; } : Partial<T>; type KeysOfUnion<T> = T extends T ? keyof T : never; export type Exact<P, I extends P> = P extends Builtin ? P : P & { [K in keyof P]: Exact<P[K], I[K]>; } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never; }; export interface MessageFns<T> { encode(message: T, writer?: BinaryWriter): BinaryWriter; decode(input: BinaryReader | Uint8Array, length?: number): T; fromJSON(object: any): T; toJSON(message: T): unknown; create<I extends Exact<DeepPartial<T>, I>>(base?: I): T; fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T; } export {};