Issue Description
The TokenStrategie interface's open() method has a misleading parameter name that creates confusion about what data is being passed to the authentication popup URL.
Current Problem
In redirect-strategy.ts line 94, the code uses:
.setParam("local_ledger_name", deviceId);
However, the open() method signature declares this parameter as deviceId:
open(sthis: SuperThis, logger: Logger, deviceId: string, opts: ToCloudOpts)
But when called from to-cloud.ts line 154, it actually passes the database name:
this.opts.strategy.open(ledger.sthis, logger, ledger.name, this.opts);
Impact
This works functionally but creates confusion:
- The parameter is named
deviceId but contains the database name (e.g., 'kanban-board')
- Developers reading the code may think device ID is being passed instead of database name
- This makes it unclear how the local database name gets associated with the cloud ledger
Proposed Solution
- Update TokenStrategie interface to rename the parameter from
deviceId to databaseName or ledgerName
- Update all strategy implementations:
- RedirectStrategy (
redirect-strategy.ts)
- IframeStrategy (
iframe-strategy.ts)
- SimpleTokenStrategy (
to-cloud.ts)
- Update callers in
to-cloud.ts to use the corrected parameter name
Files Affected
core/types/protocols/cloud/*.ts (TokenStrategie interface)
use-fireproof/redirect-strategy.ts
use-fireproof/iframe-strategy.ts
core/gateways/cloud/to-cloud.ts
This change would make the code much clearer about how the database name flows through the authentication process for proper cloud sync association.
Issue Description
The
TokenStrategieinterface'sopen()method has a misleading parameter name that creates confusion about what data is being passed to the authentication popup URL.Current Problem
In
redirect-strategy.tsline 94, the code uses:However, the
open()method signature declares this parameter asdeviceId:But when called from
to-cloud.tsline 154, it actually passes the database name:Impact
This works functionally but creates confusion:
deviceIdbut contains the database name (e.g., 'kanban-board')Proposed Solution
deviceIdtodatabaseNameorledgerNameredirect-strategy.ts)iframe-strategy.ts)to-cloud.ts)to-cloud.tsto use the corrected parameter nameFiles Affected
core/types/protocols/cloud/*.ts(TokenStrategie interface)use-fireproof/redirect-strategy.tsuse-fireproof/iframe-strategy.tscore/gateways/cloud/to-cloud.tsThis change would make the code much clearer about how the database name flows through the authentication process for proper cloud sync association.