Skip to main content

Crate instapi360_cloud

Crate instapi360_cloud 

Source
Expand description

§instapi360-cloud

Async, platform-agnostic client for the Insta360 cloud: authenticate, list cloud media, and download original camera files (Ace Pro 2 .insv/ .mp4, X5 dual-lens .insv) for local editing.

Design constraints (this crate is meant to cross-compile to Android):

  • TLS via rustls only (no OpenSSL/native-tls in the dependency graph).
  • No filesystem assumptions in the core: downloads write to a caller-owned AsyncWrite; session persistence is a caller-provided SessionStore.

§Status

Authentication is the session token alone — no request signing for list/download. Import a token once and the session renews itself via Client::refresh (the API mints a fresh token from the current one, so no separate refresh token is needed). Credential login is reCAPTCHA-gated and not implemented here.

§Quick start

use instapi360_cloud::{Client, ClientConfig, Region, Session, PageCursor};
let client = Client::new(ClientConfig::windows(Region::Global))?;
let session = Session::from_token("<captured X-User-Token>");
let page = client.list_media(&session, PageCursor::first(50)).await?;
for m in &page.items {
    println!("{} ({} bytes, {} parts)", m.name, m.size_original, m.parts.len());
}

Structs§

Client
Async client for the Insta360 cloud API.
ClientConfig
Static client identity + request-signing material.
Envelope
Standard response envelope. Insta360 has used both code and errCode across versions, and both errInfo/msg for the message; accept all.
FilePart
One downloadable file belonging to a Media. For dual-lens 360 clips there are two of these.
Media
A logical cloud media asset (may span multiple FileParts).
MediaId
Opaque identifier for a cloud media item.
MediaPage
One page of a media listing plus the cursor to fetch the next page.
PageCursor
Pagination request cursor.
Profile
Authenticated account profile (subset we need).
Session
The bearer material for authenticated requests.
Signature
A computed signature plus the nonce/timestamp that produced it, so the caller can attach all three to the request consistently.
Signer
Builds request signatures from the static ClientConfig material.

Enums§

Error
All failures the client can surface.
MediaKind
Kind of media, derived from the API’s mediaType.
Platform
The platform value sent in x-insta360-platform and used to pick the client-identity constants. The desktop app sends windows; a future Android build sends android.
Region
Cloud environment / region. The base host is region-selected; this user’s desktop startup.ini reported current_area=OverSea → HOST_OPENAPI_INSTA360=openapi-g.insta360.com.

Traits§

ProgressSink
Progress callback: (bytes_done, total_bytes_if_known).
SessionStore
Persistence for a Session. Implementations decide where (file, keyring, Android secure storage). All methods are synchronous and cheap.

Functions§

jwt_exp
Decode a JWT’s exp (unix seconds) without verifying the signature.
session_token_exp
If token looks like an Insta360 session token (a JWT whose payload carries openId), return its exp (unix seconds). Used to pick the real session token out of arbitrary strings scraped from a browser session.

Type Aliases§

Result
Result alias used throughout the crate.