feat(android): implement Phase 1 TimeSafari integration infrastructure

- Extend ConfigureOptions interface with activeDid integration options
- Add ActiveDid management methods to DailyNotificationPlugin interface
- Create DailyNotificationJWTManager for Android JWT authentication
- Extend DailyNotificationFetcher with Endorser.ch API support
- Enhance Android plugin with TimeSafari integration components
- Implement Phase 1 ActiveDid methods for web platform
- Update all test mocks to include new interface methods
- Add comprehensive error handling and logging

Phase 1 delivers:
 Extended TypeScript interfaces
 Android JWT authentication manager
 Enhanced Android fetcher with Endorser.ch APIs
 Integrated activeDid management methods
 Cross-platform interface compliance
 All tests passing

Ready for Phase 2: ActiveDid Integration & TimeSafari API Enhancement
This commit is contained in:
Matthew Raymer
2025-10-03 06:59:07 +00:00
parent 5c247f3ed2
commit ee772f136a
10 changed files with 1588 additions and 2 deletions

View File

@@ -160,6 +160,13 @@ export interface ConfigureOptions {
prefetchLeadMinutes?: number;
maxNotificationsPerDay?: number;
retentionDays?: number;
// Phase 1: ActiveDid Integration Enhancement
activeDidIntegration?: {
platform: 'android' | 'ios' | 'web' | 'electron';
storageType: 'plugin-managed' | 'host-managed';
jwtExpirationSeconds?: number;
apiServer?: string;
};
}
// Dual Scheduling System Interfaces
@@ -318,4 +325,87 @@ export interface DailyNotificationPlugin {
registerCallback(name: string, callback: Function): Promise<void>;
unregisterCallback(name: string): Promise<void>;
getRegisteredCallbacks(): Promise<string[]>;
}
// Phase 1: ActiveDid Management Methods (Option A Implementation)
setActiveDidFromHost(activeDid: string): Promise<void>;
onActiveDidChange(callback: (newActiveDid: string) => Promise<void>): void;
refreshAuthenticationForNewIdentity(activeDid: string): Promise<void>;
clearCacheForNewIdentity(): Promise<void>;
updateBackgroundTaskIdentity(activeDid: string): Promise<void>;
}
// Phase 1: TimeSafari Endorser.ch API Interfaces
export interface OffersResponse {
data: OfferSummaryRecord[];
hitLimit: boolean;
}
export interface OfferSummaryRecord {
jwtId: string;
handleId: string;
issuedAt: string;
offeredByDid: string;
recipientDid: string;
unit: string;
amount: number;
amountGiven: number;
amountGivenConfirmed: number;
objectDescription: string;
validThrough?: string;
fullClaim?: Record<string, any>;
}
export interface OffersToPlansResponse {
data: OfferToPlanSummaryRecord[];
hitLimit: boolean;
}
export interface OfferToPlanSummaryRecord {
jwtId: string;
planId: string;
handleId: string;
issuedAt: string;
offeredByDid: string;
unit: string;
amount: number;
amountGiven: number;
objectDescription: string;
validThrough?: string;
}
export interface PlansLastUpdatedResponse {
data: PlanSummaryWithPreviousClaim[];
hitLimit: boolean;
}
export interface PlanSummaryWithPreviousClaim {
plan: PlanSummary;
wrappedClaimBefore?: Record<string, any>;
}
export interface PlanSummary {
jwtId: string;
handleId: string;
name: string;
description: string;
issuerDid: string;
agentDid: string;
startTime: string;
endTime: string;
locLat?: number;
locLon?: number;
url?: string;
};
export interface ActiveDidIntegrationConfig {
platform: 'android' | 'ios' | 'web' | 'electron';
storageType: 'plugin-managed' | 'host-managed';
jwtExpirationSeconds?: number;
apiServer?: string;
};
export interface ActiveDidChangeEvent {
activeDid: string;
timestamp: number;
source: 'host' | 'plugin';
};