Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ All notable changes to `@utexo/wdk-wallet-rgb` are documented here.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- Promote VSS cloud-backup to the public `WalletAccountRgb` surface:
`configureVssBackup`, `disableVssAutoBackup`, `vssBackup`, and
`vssBackupInfo` now delegate to the binding directly. Previously
these existed only on `BareRgbLibBinding`, reachable via the
`getRgbWallet()` escape hatch.

## [2.0.3] — 2026-01-28

### Changed
Expand Down
69 changes: 69 additions & 0 deletions src/wallet-account-rgb.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,75 @@ export default class WalletAccountRgb extends WalletAccountReadOnlyRgb {
return rgblib.restoreBackup(params.backupFilePath, params.password, params.dataDir)
}

/**
* VSS (Versioned Storage Service) cloud-backup config.
*
* @typedef {Object} VssBackupConfigParams
* @property {string} serverUrl - VSS server base URL.
* @property {string} storeId - Per-wallet store identifier.
* @property {string} signingKeyHex - 64-char hex (32-byte secp256k1 secret key) used to auth + sign requests.
* @property {boolean} [encryptionEnabled=true] - Client-side encrypt payloads before upload.
* @property {boolean} [autoBackup=false] - Enable automatic backup on state-changing ops.
* @property {'Async'|'Blocking'} [backupMode='Async'] - Auto-backup flush mode.
*/

/**
* VSS backup status returned by {@link vssBackupInfo}.
*
* @typedef {Object} VssBackupInfo
* @property {boolean} backupExists - Whether a backup exists on the server.
* @property {number|null} serverVersion - Latest version on the server, or null.
* @property {boolean} backupRequired - Whether local state is ahead of the server.
*/

/**
* Configures automatic VSS cloud backup. Once configured with
* `autoBackup: true`, rgb-lib flushes wallet state to the VSS server
* after state-changing operations. Encryption is client-side; the
* server never sees plaintext when `encryptionEnabled` is set.
*
* @param {VssBackupConfigParams} config - VSS backup configuration.
* @returns {void}
*/
configureVssBackup (config) {
return this._wallet.configureVssBackup(config)
}

/**
* Disables automatic VSS backup previously enabled via
* {@link configureVssBackup}. Does not delete any existing remote
* backup; only stops further automatic flushes.
*
* @returns {void}
*/
disableVssAutoBackup () {
return this._wallet.disableVssAutoBackup()
}

/**
* Uploads a VSS cloud backup of the current wallet state immediately.
* Use for app-controlled checkpoints rather than relying on the
* automatic on-write flush.
*
* @param {VssBackupConfigParams} config - VSS backup configuration.
* @returns {Promise<number>} The snapshot version persisted.
*/
vssBackup (config) {
return this._wallet.vssBackup(config)
}

/**
* Queries the VSS server for this wallet's backup status without
* mutating anything — whether a backup exists, the server's latest
* version, and whether local state is ahead of the server.
*
* @param {VssBackupConfigParams} config - VSS backup configuration.
* @returns {Promise<VssBackupInfo>} The backup status.
*/
vssBackupInfo (config) {
return this._wallet.vssBackupInfo(config)
}

/**
* Refreshes the wallet state
*
Expand Down