chore: commit to move to laptop
This commit is contained in:
@@ -290,9 +290,9 @@ public class DailyNotificationFetchWorker extends Worker {
|
||||
|
||||
// Save content to storage
|
||||
storage.saveNotificationContent(content);
|
||||
|
||||
// Schedule notification if not already scheduled
|
||||
scheduleNotificationIfNeeded(content);
|
||||
|
||||
// Schedule notification if not already scheduled
|
||||
scheduleNotificationIfNeeded(content);
|
||||
scheduledCount++;
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -389,7 +389,7 @@ public class DailyNotificationFetchWorker extends Worker {
|
||||
long baseDelay = backoff.minMs;
|
||||
double exponentialMultiplier = Math.pow(backoff.factor, retryCount - 1);
|
||||
long exponentialDelay = (long) (baseDelay * exponentialMultiplier);
|
||||
|
||||
|
||||
// Cap at maxMs
|
||||
long cappedDelay = Math.min(exponentialDelay, backoff.maxMs);
|
||||
|
||||
|
||||
@@ -182,10 +182,15 @@ public class DailyNotificationPlugin extends Plugin {
|
||||
* await DailyNotification.configureNativeFetcher({
|
||||
* apiBaseUrl: 'http://10.0.2.2:3000',
|
||||
* activeDid: 'did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F',
|
||||
* jwtSecret: 'test-jwt-secret-for-development'
|
||||
* jwtToken: 'eyJhbGciOiJFUzI1Nksi...' // Pre-generated JWT token
|
||||
* });
|
||||
* }</pre>
|
||||
*
|
||||
* <p><b>Architecture Note:</b> JWT tokens should be generated in TypeScript using
|
||||
* TimeSafari's {@code createEndorserJwtForKey()} function (which uses DID-based ES256K
|
||||
* signing), then passed to this method. This avoids the complexity of implementing
|
||||
* DID-based JWT signing in Java.</p>
|
||||
*
|
||||
* @param call Plugin call containing configuration parameters:
|
||||
* <ul>
|
||||
* <li>{@code apiBaseUrl} (required): Base URL for API server.
|
||||
@@ -194,8 +199,9 @@ public class DailyNotificationPlugin extends Plugin {
|
||||
* Production: "https://api.timesafari.com"</li>
|
||||
* <li>{@code activeDid} (required): Active DID for authentication.
|
||||
* Format: "did:ethr:0x..."</li>
|
||||
* <li>{@code jwtSecret} (required): JWT secret for signing tokens.
|
||||
* Keep secure in production.</li>
|
||||
* <li>{@code jwtToken} (required): Pre-generated JWT token (ES256K signed).
|
||||
* Generated in TypeScript using TimeSafari's {@code createEndorserJwtForKey()}
|
||||
* function. Token format: "Bearer {token}" will be added automatically.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @throws PluginException if configuration fails (rejected via call.reject())
|
||||
@@ -207,10 +213,10 @@ public class DailyNotificationPlugin extends Plugin {
|
||||
try {
|
||||
String apiBaseUrl = call.getString("apiBaseUrl");
|
||||
String activeDid = call.getString("activeDid");
|
||||
String jwtSecret = call.getString("jwtSecret");
|
||||
String jwtToken = call.getString("jwtToken");
|
||||
|
||||
if (apiBaseUrl == null || activeDid == null || jwtSecret == null) {
|
||||
call.reject("Missing required parameters: apiBaseUrl, activeDid, and jwtSecret are required");
|
||||
if (apiBaseUrl == null || activeDid == null || jwtToken == null) {
|
||||
call.reject("Missing required parameters: apiBaseUrl, activeDid, and jwtToken are required");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -225,7 +231,7 @@ public class DailyNotificationPlugin extends Plugin {
|
||||
"... activeDid: " + activeDid.substring(0, Math.min(30, activeDid.length())) + "...");
|
||||
|
||||
// Call configure on the native fetcher (defaults to no-op if not implemented)
|
||||
fetcher.configure(apiBaseUrl, activeDid, jwtSecret);
|
||||
fetcher.configure(apiBaseUrl, activeDid, jwtToken);
|
||||
|
||||
Log.i(TAG, "SPI: Native fetcher configured successfully");
|
||||
call.resolve();
|
||||
|
||||
@@ -129,12 +129,15 @@ public interface NativeNotificationContentFetcher {
|
||||
* - Production: "https://api.timesafari.com"
|
||||
* @param activeDid Active DID (Decentralized Identifier) for authentication.
|
||||
* Used as the JWT issuer/subject. Format: "did:ethr:0x..."
|
||||
* @param jwtSecret JWT secret key for signing authentication tokens.
|
||||
* Keep this secure - consider using secure storage for production.
|
||||
* @param jwtToken Pre-generated JWT token (ES256K signed) from TypeScript.
|
||||
* This token is generated in the host app using TimeSafari's
|
||||
* {@code createEndorserJwtForKey()} function. The native fetcher
|
||||
* should use this token directly in the Authorization header as
|
||||
* "Bearer {jwtToken}". No JWT generation or signing is needed in Java.
|
||||
*
|
||||
* @see DailyNotificationPlugin#configureNativeFetcher(PluginCall)
|
||||
*/
|
||||
default void configure(String apiBaseUrl, String activeDid, String jwtSecret) {
|
||||
default void configure(String apiBaseUrl, String activeDid, String jwtToken) {
|
||||
// Default no-op implementation - fetchers that need config can override
|
||||
// This allows fetchers that don't need TypeScript-provided configuration
|
||||
// to ignore this method without implementing an empty body.
|
||||
|
||||
Reference in New Issue
Block a user