Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Basic Envelope

ASecurity

How to use @owlmeans/basic-envelope — makeEnvelopeModel for wrapping a payload with a type tag, timestamp and TTL, signing and verifying it with a basic-keys key pair, and serializing it as a wrap or a token. Auto-invoked when importing envelope types, or building a signed challenge or token payload.

3 stars
0 votes
0 copies
0 views
Added 9/22/2026
devopstypescriptexpress

Security Analysis

A100/100

Scanned 9/22/2026

Install to Claude Code

$npx -y skills add owlmeans/common --skill basic-envelope --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Basic Envelope?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Basic Envelope
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/owlmeans-basic-envelope-common/badge)](https://www.skillsdirectory.com/skills/owlmeans-basic-envelope-common)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: basic-envelope
description: How to use @owlmeans/basic-envelope — makeEnvelopeModel for wrapping a payload with a type tag, timestamp and TTL, signing and verifying it with a basic-keys key pair, and serializing it as a wrap or a token. Auto-invoked when importing envelope types, or building a signed challenge or token payload.
user-invocable: false
---
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->

# @owlmeans/basic-envelope

**Layer:** Core
**Install:** `"@owlmeans/basic-envelope": "^0.1.18-rc.29"` in `dependencies`

An envelope is a signed, self-expiring container: a type tag, an encoded message, a timestamp and a
TTL, plus the signature over all of it. It is what carries auth challenges and tokens between
services, because a receiver can check the type, the age and the signature without knowing what the
message means.

## Key Exports

| Export | Description |
|--------|-------------|
| `makeEnvelopeModel<T>(type, kind?)` | Build a new envelope, or parse an existing one |
| `EnvelopeModel<T>` | `envelope` / `send` / `message` / `type` / `wrap` / `tokenize` / `sign` / `verify` |
| `EnvelopeModel.envelope` | The `Envelope` itself — read `dt`/`ttl` from it, e.g. to size a cache entry |
| `Envelope` | The wire shape: `{ t, msg, sig?, dt, ttl }` |
| `EnvelopeKind` | `Wrap` (base64) and `Token` (base64url, no padding) |
| `DEFAULT_TTL` | 5 minutes, in milliseconds |

## Creating, signing, sending

Called with a type tag alone, `makeEnvelopeModel` starts a fresh envelope stamped with the current
time and `DEFAULT_TTL`. `send()` sets the payload — a string is stored as is, anything else is
JSON-encoded and base64'd — takes an optional TTL where `null` means never expires, and **returns
the model**, so the chained form is the idiomatic one.

```typescript
import { makeEnvelopeModel, EnvelopeKind } from '@owlmeans/basic-envelope'
import { RELY_3RD, type RelyToken } from '@owlmeans/auth'
import { fromPubKey, makeKeyPairModel } from '@owlmeans/basic-keys'

const key = makeKeyPairModel(privateKey)

// unsigned, serialized in one expression
const plain = makeEnvelopeModel<RelyToken>(RELY_3RD).send(rely).tokenize()

// signed
const envelope = makeEnvelopeModel<RelyToken>(RELY_3RD)
envelope.send(rely)
const token = await envelope.sign(key, EnvelopeKind.Token)
```

`sign(key, kind?)` stores the signature on the envelope and returns it; pass `EnvelopeKind.Wrap` or
`EnvelopeKind.Token` to get the whole serialized envelope back instead. `wrap()` and `tokenize()`
serialize without signing — a token is URL-safe, a wrap is not.

The type tag and the payload type are the caller's — the example borrows `RELY_3RD` and `RelyToken`
from `@owlmeans/auth`, which this package does not depend on. Any string works as a tag.

The envelope itself is public as `model.envelope`, which is how a caller reaches `dt` and `ttl` —
a server that caches a received envelope for exactly as long as it is valid reads
`envelope.envelope.ttl` and derives the entry's lifetime from it.

## Parsing and verifying

Pass the serialized string as the first argument together with the kind it was produced in:

```typescript
const received = makeEnvelopeModel<RelyToken>(token, EnvelopeKind.Token)

if (received.type() !== RELY_3RD) { /* wrong kind of message */ }
if (!await received.verify(fromPubKey(publicKey))) { /* forged or expired */ }

const rely = received.message()               // decoded payload
const raw = received.message(true)            // the encoded string, untouched
```

`verify` answers `false` — it does not throw — when the envelope carries no signature, when
`dt + ttl` is already in the past, or when the signature does not match. The signature covers the
envelope with `sig` removed, so re-serializing a verified envelope keeps it verifiable. `message()`
falls back to returning the raw string when the payload was not JSON.

## Depends On

- `@owlmeans/basic-keys` — the `KeyPairModel` that signs and verifies
- `@scure/base`, `@noble/curves`, `@noble/hashes` — encoding and the underlying primitives

Attribution

owlmeansowlmeans
View sourceMore from owlmeans →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Terraform Module Library

Build reusable Terraform modules for AWS, Azure, and GCP infrastructure following infrastructure-as-code best practices. Use when creating infrastructure modules, standardizing cloud provisioning, or implementing reusable IaC components.

397921 votes

sematext-otel

Wire a service's OpenTelemetry output to Sematext Cloud. Walks through region, App-type, instrumentation flow (managed OTLP endpoint vs Sematext Agent), and signal selection (traces/metrics/logs), then produces the exact env-var block and points at a runnable reference example in this repo. Invoke when instrumenting a new app for Sematext.

01 votes

Deployment Patterns

Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications. Use when setting up deployment infrastructure or planning releases.

2459130 votes

Babysit

Watch a pull request or review cycle until it is ready to merge. Use when asked to babysit, monitor, or keep checking PR comments, reviews, and CI until all actionable issues are resolved.

942310 votes

V7 Roster

Interact with the Paperclip control plane API for task coordination and governance. Use when checking assignments, updating issue status, posting comments, delegating work, managing routines, or calling Paperclip API endpoints.

805540 votes
View all in devops →