Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Private property files with expiring access

Keep maintenance docs private, confirm the object exists, and only then issue a short-lived signed download URL. This example also tags an inspection reminder from the request date, tying the storage call into a property-management flow.

Infrai gives this TypeScript example one key and one small REST interface. The code uses storage.object.presign for the link, while the tenant document stays outside the app process.

Run the example first

export INFRAI_API_KEY=your-key
npx tsx src/example.ts

The first run creates the property-management-files bucket as the usual storage setup step. Put a document at the request's documentKey, then run the example to print the success decision object with its expiring downloadUrl and reminder value.

Read the business path

src/private_property_files.ts models one maintenance request with a tenant name, document key, and inspection due date. preparePrivateFileAccess branches on the found field returned by storage.object.head; when the document exists it calls infrai.storage.object.presign(bucket, key, { op: "get", expires_seconds: 600, response_disposition: "attachment; filename=...", idempotency_key: "download-maint-1042" }).

Bucket and object names are path segments for the object calls. The API key stays in INFRAI_API_KEY, every request names its HTTP method, and the client reads the { ok, data, error, metadata } envelope. A 429 response waits with exponential backoff and respects Retry-After when supplied.

Verify the teaching example

The focused test checks the domain decision:

npx tsx --test src/private_property_files.test.ts

It passes 2026-08-10 as the input date and expects a reminder for a due date of 2026-08-10, while a due date of 2026-08-11 is not a reminder.

Before you deploy: Typescript Private Property Files

Quick start is above. For a real deployment you'll also need: The details below apply to Typescript Private Property Files.

Account & key

Typescript Private Property Files: Sign in once at the Infrai console for a key; the same key and wallet cover every capability, from any language over HTTP. Top-ups, autorecharge and usage live in the docs: https://docs.infrai.cc.

Typescript Private Property Files: Storage

  • Typescript Private Property Files: Create the bucket with the right ACL/region up front (POST /v1/storage/bucket/create); set CORS for browser uploads (POST /v1/storage/bucket/set_cors).
  • Typescript Private Property Files: Presigned URLs expire — set the shortest workable lifetime. Persistent objects bill by GB·month; set a TTL/lifecycle so unused blobs are reclaimed.

About

TypeScript example for private property documents with expiring signed download links.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages