Save a recovery key first
#Use newVaultKey() once for your vault and save the result in a password manager or encrypted key file. Supply that key to upload and download. Never log it or send it to the storage backend.
import { newVaultKey } from '@ozvault/sdk';
const vaultKey = newVaultKey(); // Save securely before uploadingUpload through the SDK
#The SDK computes a local file digest, derives an object key, encrypts chunks, reserves ciphertext bytes, and reports progress. The default maximum is 256 MB of ciphertext. Upload tickets contain encryption parameters and a plaintext digest, but no recovery key.
let resumeTicket;
const object = await vault.upload(bucket.id, file, 'docs/readme.txt', vaultKey, {
onTicket: ticket => { resumeTicket = ticket; },
onProgress: (sent, total) => console.log(sent, total),
signal: abortController.signal
});Resume the original file
#Pass the saved resume ticket, the exact same file and the same recovery key to upload. The SDK rejects changed file contents before reusing a nonce. It queries the authoritative offset and retries interrupted chunks. Reservations expire after 24 hours.
await vault.upload(bucket.id, file, 'docs/readme.txt', vaultKey, {
resume: resumeTicket
});Understand the wire protocol
#POST /v1/uploads accepts bucketId, name, encrypted size, encryption metadata and a UUID idempotencyKey. PATCH sends application/octet-stream with Upload-Offset. Complete with {"sha256":"<64 lowercase hex characters>"}. The upload-specific capability allows transfer without third-party browser cookies.
Clear documentation is part of the product.