Skip to main content

restore_encrypted_link

Function restore_encrypted_link 

Source
pub async fn restore_encrypted_link(
    session: PubkySession,
    secret_key: [u8; 32],
    remote_identity_public_key: &PublicKey,
    outbox_client: Pubky,
    snapshot: EncryptedLinkSnapshot,
) -> Result<EncryptedLink>
Expand description

Restores an EncryptedLink from a previously saved snapshot.

Use this after an app restart when the original Noise configuration is no longer available. The caller supplies a fresh authenticated Pubky session, the same local secret key used for the original link, the counterparty public key, and the saved snapshot.

Restored links reset max_send_retries to DEFAULT_MAX_SEND_RETRIES. remote_identity_public_key must match snapshot.recipient(). Download failures return PaykitError::Transport; retain the snapshot to retry. Missing or invalid handshake transcripts return PaykitError::InvalidData.