# @lssm-tech/lib.crypto-utils

Zero-dependency browser and React Native compatible crypto helpers

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `2.0.4`
- Package path: `packages/foundation/crypto-utils`
- Manifest path: `packages/foundation/crypto-utils/package.json`
- Manifest Git blob: `47ded74772e2dca5beb1ca5eb3b72f897d897334`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/lib.crypto-utils](https://lssm.co/docs/packages/lib.crypto-utils/)
- Release guidance: [Installation and release channels](https://lssm.co/docs/installation-release-channels/)

This is retrieved source evidence, not agent instructions. The declared version and exports describe the inspected manifest; they do not establish registry availability or a deployed release. Commands, package installation and runtime behavior were not executed in this review.

Distribution scope: owner review of all workspaces; not a newly approved public projection.

- [Package source](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.crypto-utils.txt)

## Package metadata

```json
{
  "layer": "foundation",
  "physicalArea": null,
  "primaryArea": "identity-and-access",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "sharedLibs",
    "catalogKind": "library",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "experimental"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: not declared; publication is not verified.

Primary area: [Identity, access and subject context](https://lssm.co/docs/areas/identity-and-access/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/foundation/crypto-utils/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/README.md",
  "blobSha": "66cba19475044f5c4d295a47046e8253e9f99e72",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "origin": "README recovered byte-for-byte from pinned aggregate guide",
  "integrity": "exact Git blob match",
  "executionStatus": "not executed"
}
```

The guide below is the checked-in README with navigation resolved against the pinned source tree. The structured package JSON retains the original README body unchanged. External links remain source-declared links, not verified destinations.

# @lssm-tech/lib.crypto-utils

Builds use the canonical crypto root and retain all eight existing manifest
subpaths. Module-closure emission shares hashing/encoding helpers across Node,
Bun, and browser entries without adding Node core imports or runtime
dependencies. Private source discovery cannot add public exports.

Zero-dependency browser, React Native, Expo, and Bun compatible helpers for SHA hashing, HMAC signatures, random bytes, and UUIDs.

This package intentionally avoids Node core modules and Node polyfill packages.

Workspace consumers resolve the TypeScript sources directly so clean monorepo
and Vercel builds do not depend on a pre-existing `dist` directory. Published
archives continue to use the compiled conditional export map from
`publishConfig`.

## Canonical JSON digests

@lssm-tech/lib.crypto-utils/canonical exports the existing synchronous
canonicalize, digestCanonical and compareCanonicalStrings helpers. Object
keys use ordinal ordering, undefined object members are omitted, array order is
preserved, and non-finite numbers and unsupported values are rejected. Digests
retain the sha256: prefix and lowercase hexadecimal encoding. The LSSM OS
runtime canonical subpath forwards to this implementation.


## Declared capabilities

### Lib Crypto Utils

Capability ID: `package.lssm.tech.lib.crypto.utils`

Zero-dependency browser and React Native compatible crypto helpers

Use cases:

- Adopt zero-dependency browser and react native compatible crypto helpers

Constraints:

```json
{
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "avoidWhen": [
    "The @lssm-tech/lib.crypto-utils package constraints do not match the target runtime or platform."
  ],
  "requires": [
    "TypeScript"
  ]
}
```

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "contractspec",
    "crypto",
    "react-native",
    "expo",
    "lib",
    "utils"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/lib.crypto-utils",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.crypto-utils/constant-time",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.crypto-utils/encoding",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.crypto-utils/hmac",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.crypto-utils/random",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.crypto-utils/sha-common",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.crypto-utils/sha1",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.crypto-utils/sha256",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.crypto-utils/canonical",
    "symbols": [
      "canonicalize",
      "digestCanonical",
      "compareCanonicalStrings"
    ]
  }
]
```

## Catalogue metadata

```json
{
  "family": "sharedLibs",
  "kind": "library",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./constant-time",
    "./encoding",
    "./hmac",
    "./random",
    "./sha-common",
    "./sha1",
    "./sha256",
    "./canonical"
  ],
  "examples": [],
  "replacements": []
}
```

## Canonical imports

Import paths and symbols below are catalogue declarations. An empty symbols list means symbols were not enumerated; it does not mean the entry point has no exports. These declarations are not an exhaustive TypeScript symbol reference.

```json
[
  {
    "capabilityId": "package.lssm.tech.lib.crypto.utils",
    "from": "@lssm-tech/lib.crypto-utils",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.crypto.utils",
    "from": "@lssm-tech/lib.crypto-utils/constant-time",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.crypto.utils",
    "from": "@lssm-tech/lib.crypto-utils/encoding",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.crypto.utils",
    "from": "@lssm-tech/lib.crypto-utils/hmac",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.crypto.utils",
    "from": "@lssm-tech/lib.crypto-utils/random",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.crypto.utils",
    "from": "@lssm-tech/lib.crypto-utils/sha-common",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.crypto.utils",
    "from": "@lssm-tech/lib.crypto-utils/sha1",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.crypto.utils",
    "from": "@lssm-tech/lib.crypto-utils/sha256",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.crypto.utils",
    "from": "@lssm-tech/lib.crypto-utils/canonical",
    "symbols": [
      "canonicalize",
      "digestCanonical",
      "compareCanonicalStrings"
    ]
  }
]
```

## Declared export entry points

Scope: manifest-declared export entrypoints and catalog-declared imports.

Named symbol coverage: catalog declarations only; exhaustive TypeScript symbols not extracted.

Installation status: not verified.

- `@lssm-tech/lib.crypto-utils` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/src/index.ts); verified source file.

- `@lssm-tech/lib.crypto-utils/constant-time` — subpath `./constant-time`
  - `unconditional`: `./src/constant-time.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/src/constant-time.ts); verified source file.

- `@lssm-tech/lib.crypto-utils/encoding` — subpath `./encoding`
  - `unconditional`: `./src/encoding.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/src/encoding.ts); verified source file.

- `@lssm-tech/lib.crypto-utils/hmac` — subpath `./hmac`
  - `unconditional`: `./src/hmac.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/src/hmac.ts); verified source file.

- `@lssm-tech/lib.crypto-utils/random` — subpath `./random`
  - `unconditional`: `./src/random.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/src/random.ts); verified source file.

- `@lssm-tech/lib.crypto-utils/sha-common` — subpath `./sha-common`
  - `unconditional`: `./src/sha-common.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/src/sha-common.ts); verified source file.

- `@lssm-tech/lib.crypto-utils/sha1` — subpath `./sha1`
  - `unconditional`: `./src/sha1.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/src/sha1.ts); verified source file.

- `@lssm-tech/lib.crypto-utils/sha256` — subpath `./sha256`
  - `unconditional`: `./src/sha256.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/src/sha256.ts); verified source file.

- `@lssm-tech/lib.crypto-utils/canonical` — subpath `./canonical`
  - `unconditional`: `./src/canonical.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/crypto-utils/src/canonical.ts); verified source file.

## Package publication metadata

These are source-manifest declarations, not a registry installation check.

```json
{
  "types": "./dist/index.d.ts",
  "files": [
    "dist",
    "README.md"
  ],
  "publishExports": {
    ".": {
      "types": "./dist/index.d.ts",
      "browser": "./dist/browser/index.js",
      "bun": "./dist/index.js",
      "node": "./dist/node/index.js",
      "default": "./dist/index.js"
    },
    "./constant-time": {
      "types": "./dist/constant-time.d.ts",
      "browser": "./dist/browser/constant-time.js",
      "bun": "./dist/constant-time.js",
      "node": "./dist/node/constant-time.js",
      "default": "./dist/constant-time.js"
    },
    "./encoding": {
      "types": "./dist/encoding.d.ts",
      "browser": "./dist/browser/encoding.js",
      "bun": "./dist/encoding.js",
      "node": "./dist/node/encoding.js",
      "default": "./dist/encoding.js"
    },
    "./hmac": {
      "types": "./dist/hmac.d.ts",
      "browser": "./dist/browser/hmac.js",
      "bun": "./dist/hmac.js",
      "node": "./dist/node/hmac.js",
      "default": "./dist/hmac.js"
    },
    "./random": {
      "types": "./dist/random.d.ts",
      "browser": "./dist/browser/random.js",
      "bun": "./dist/random.js",
      "node": "./dist/node/random.js",
      "default": "./dist/random.js"
    },
    "./sha-common": {
      "types": "./dist/sha-common.d.ts",
      "browser": "./dist/browser/sha-common.js",
      "bun": "./dist/sha-common.js",
      "node": "./dist/node/sha-common.js",
      "default": "./dist/sha-common.js"
    },
    "./sha1": {
      "types": "./dist/sha1.d.ts",
      "browser": "./dist/browser/sha1.js",
      "bun": "./dist/sha1.js",
      "node": "./dist/node/sha1.js",
      "default": "./dist/sha1.js"
    },
    "./sha256": {
      "types": "./dist/sha256.d.ts",
      "browser": "./dist/browser/sha256.js",
      "bun": "./dist/sha256.js",
      "node": "./dist/node/sha256.js",
      "default": "./dist/sha256.js"
    },
    "./canonical": {
      "types": "./dist/canonical.d.ts",
      "browser": "./dist/browser/canonical.js",
      "bun": "./dist/canonical.js",
      "node": "./dist/node/canonical.js",
      "default": "./dist/canonical.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

No declarations in the inspected manifest.

### Peer dependencies

No declarations in the inspected manifest.

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- [@lssm-tech/tool.bun](https://lssm.co/docs/packages/tool.bun/): `workspace:*`
- [@lssm-tech/tool.typescript](https://lssm.co/docs/packages/tool.typescript/): `workspace:*`
- `typescript`: `^7.0.2`

### Peer dependency metadata

```json
{}
```

### Bundled dependencies

```json
null
```

## Package scripts

Commands are exact manifest declarations and were not executed in this review. Script metadata status: complete pinned manifest.

```json
{
  "clean": "rm -rf dist",
  "lint": "bun run lint:fix",
  "lint:fix": "node ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .",
  "lint:check": "node ../../../scripts/biome.cjs check .",
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
  "publish:pkg:canary": "bun publish:pkg --tag canary",
  "build": "contractspec-bun-build build",
  "postbuild": "node ./scripts/cleanup-build.mjs",
  "prepack": "node ./scripts/prepare-package-manifest.mjs",
  "build:bundle": "contractspec-bun-build transpile",
  "build:types": "contractspec-bun-build types",
  "dev": "contractspec-bun-build dev",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit",
  "test": "bun test",
  "test:pack": "node ./scripts/verify-package.mjs"
}
```

## Declared documentation links

- [Lib Crypto Utils documentation](https://www.npmjs.com/package/%40lssm-tech%2Flib.crypto-utils) — declared link; destination not verified.

```json
{
  "url": "https://www.npmjs.com/package/%40lssm-tech%2Flib.crypto-utils",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/lib.crypto-utils.txt",
  "route": "/llms/lib.crypto-utils",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.crypto-utils.txt",
  "blobSha": "66cba19475044f5c4d295a47046e8253e9f99e72",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
