SEAL SDK

Send and open E2EE files, and ask a person for a file or a secret, from any website or server. Files encrypt inside your app; SEAL only ever stores ciphertext.

Install

npm install sealnet

Browsers + Node.js ≥ 20 • no account, no API key

No build step? Load the standalone build: one SRI-pinned script tag, everything inlined:

<script
  src="https://seal.net/sdk/v3.1.0/seal.js"
  integrity="sha384-cwrpNTtrwmKvOqEIX3B0BacbxDFEx2X6MfoDvNFtjLemefebcp8HZ/YyIHAw5/9h"
  crossorigin="anonymous"
></script>

Keep the integrity and crossorigin attributes, and load only from seal.net. This script performs your encryption, so pinning its digest means a tampered file fails to load instead of silently encrypting differently. Each version is an immutable URL.

Quick start

import { SealClient } from 'sealnet'

const seal = new SealClient()

const result = await seal.send({
  file: fileInput.files[0],   // File | Blob | ArrayBuffer | Uint8Array
  filename: 'contract.pdf',   // what the recipient sees
  ttl: '7d',                  // '5m' | '30m' | '1h' | '1d' | '7d'
})

result.shareUrl    // give to the recipient — opens on seal.net
result.ownerUrl    // keep — manage the seal
result.ownerToken  // keep — revoke programmatically

Access rules

await seal.send({
  file,
  filename: 'payroll.xlsx',
  ttl: '1d',
  otp: 'secret42',            // recipient must enter this password
  nda: true,                  // recipient signs an NDA first
  ownerEmail: 'me@corp.com',  // required when nda: true
  singleUse: true,            // first download destroys the file
  maxOpens: 3,                // or: cap total downloads
  geoAllowlist: ['DE', 'CH'], // or: restrict by country
  message: 'Q3 numbers, keep private.',
})

Progress & errors

await seal.send({
  file, filename, ttl: '1h',
  onProgress: ({ phase, percent }) => {
    // phase: 'encrypting' | 'uploading' | 'verifying'
    render(phase, percent)
  },
})

try {
  await seal.send({ file, filename, ttl: '7d' })
} catch (err) {
  if (err instanceof SealError) {
    console.error(err.code, err.status)   // 'RATE_LIMITED' | 'VALIDATION_ERROR' | …
    // Failed after the seal existed remotely? Never orphaned:
    if (err.details?.sealId) await seal.revoke(err.details.sealId, err.details.ownerToken)
  }
}

Files over 1 GB

A seal holds 1 GB for free. Above that, pass tier and onPaymentRequired: the person pays once by card (from $9) and send finishes the upload into the same seal.

Opening a link

// Node: every file streams to disk, 0600, named only after its header and last segment checked
const saved = await seal.open(link, { to: './downloads' })
saved.files // [{ name, mime, secret, path, sizeBytes, sha256 }]

// Or read a file as a stream
const opened = await seal.open(link)
const { stream, done } = await opened.files[0].read()

Reading a seal works in Node and on pages served from seal.net. A page on any other site sends and asks, but does not read: the receiving endpoints answer no other origin.

Asking a person for a file or a secret

const keys = await seal.keygen()
const ask = await seal.request({
  what: 'Brave API key',
  recipientBundle: keys.bundle,
  kind: 'secret',
  whereUrl: 'https://api.search.brave.com/app/keys',
})
show(ask.url, ask.words)   // the page shows the same eight words

const answer = await seal.waitFor(ask.intakeId, { keyPair: keys, to: './secrets' })
answer.files[0].path       // the value stays in the file

Sending to an address, and your inbox

// Addressed: only their seed opens it, and it lands in their inbox
const sent = await seal.send({ file, filename: 'report.pdf', ttl: '30m', to: theirAddress })
sent.delivered             // true

// Your inbox: what was sent to keys.address
const inbox = await seal.inbox({ keyPair: keys, wait: 60 })
const saved = await seal.open(inbox.items[0], { keyPair: keys, to: './downloads' })
await seal.dismiss(inbox.items[0], { keyPair: keys })