|
|
|
| 1 | # seedmark | | 2 | | | 3 | Dependency-free ESM library for small, deterministic SVG avatars. Give it opaque text; get a mask, strange creature, plant, orbital composition, landscape, geometric glyph, weave, or machine. No initials, fonts, external assets, or DOM required. | | 4 | | | 5 | `` `js | | 6 | import { avatar, recipe, createRng, FAMILIES, VERSION } from './src/index.js' ; | | 7 | | | 8 | const svg = avatar('any opaque seed — or a full Nostr pubkey' , { size: 32 }); | | 9 | const visual = recipe('any opaque seed — or a full Nostr pubkey' ); | | 10 | // visual.family, visual.palette, visual.layout, visual.silhouette, | | 11 | // visual.features, visual.texture | | 12 | `` ` | | 13 | | | 14 | [Open the playground](https://4mzigytzhwbe0sgupjebmx449xjgutyhw8hgjevqpgzxyidk6eseedmark.012.run/) | | 15 | | | 16 | The playground has a contact sheet, family filters, chat-size previews, square/circle crops, light/dark backgrounds, SVG export and shareable seeds. It does not change tinyrelay's current avatars. | | 17 | | | 18 | ## API | | 19 | | | 20 | - **`avatar(seed, {size = 64, version = 1} = {})` ** returns a standalone SVG string with a fixed `0 0 64 64` viewBox. `size` must be an integer from 1 through 4096; only root width/height change, never geometry. Designed for 24–48 px chat avatars. | | 21 | - **`recipe(seed, {version = 1} = {})` ** returns deeply frozen, plain JSON-serializable data. Palette is an array of four hex colors: background, light, warm/accent, cool/accent. Some compositions use fewer colors. Recipes never include the seed. | | 22 | - **`createRng(seed, namespace = 'default')` ** returns a fresh independent object with `next()` in `[0, 1)` , `int(min, max)` with inclusive safe-integer bounds and a safe span, and `pick(nonemptyArray)` . Namespace must be a string. Helpers are noncryptographic and not intended for statistically exact sampling over enormous ranges. | | 23 | - **`FAMILIES` ** is a frozen, ordered array: `masks` , `creatures` , `botanical` , `orbital` , `landscapes` , `glyphs` , `woven` , `machines` . | | 24 | - **`VERSION` ** is `1` . Unsupported versions and invalid sizes/ranges throw `RangeError` ; nonstring seeds/namespaces throw `TypeError` . | | 25 | | | 26 | All seeds must be primitive strings. Empty strings, Unicode, case, whitespace, embedded nulls, and arbitrarily long input are accepted as-is. There is no hex validation, trimming, Unicode normalization, or truncation. Runtime is linear in seed length. | | 27 | | | 28 | ## Determinism and versioning | | 29 | | | 30 | Version 1 length-frames the full JavaScript UTF-16 seed, version, and namespace into a four-word cyrb128-derived hash state, then uses sfc32. No randomness, clock, persistent shared state, or runtime-specific APIs are used. Same exact seed and namespace produce the same sequence regardless of calls or draws elsewhere. | | 31 | | | 32 | The visual layers use separate public namespaces: `family` , `layout` , `palette` , `silhouette` , `features` , and `texture` . In v1, `createRng(seed, 'family').pick(FAMILIES)` reproduces family selection. Consuming texture draws cannot perturb palette, silhouette, or family selection. Geometry is pure recipe data rendered with bounded internal primitives, never seed interpolation. SVGs have no IDs, definitions, scripts, links, or external references, so inline grids do not collide. | | 33 | | | 34 | Visual version covers hashing, stream usage, family ordering, palette choices, recipe interpretation, and rendering. Preserve v1 when adding future visual versions: do not silently change existing identities. The tests pin PRNG values, a complete recipe, and SVG hashes for all families. Package releases and visual versions are separate concepts. | | 35 | | | 36 | **Not cryptographic. Not an authentication, public-key verification, or fingerprint scheme.** Different seeds can produce the same or similar avatar; a matching picture proves nothing about identity. Do not use secret seeds if their derived appearance would expose sensitive information. Sampled variety tests measure different geometry strings, not perceptual uniqueness. | | 37 | | | 38 | ## Development | | 39 | | | 40 | Requires Node.js 18+ for the native test runner; the library itself is browser-compatible ESM. | | 41 | | | 42 | `` `sh | | 43 | npm test | | 44 | npm start | | 45 | `` ` | | 46 | | | 47 | No installation or build step is needed. `npm start` uses the repository's separately supplied `server.js` playground; the distributed library includes only source, README, and license. Browser visual QA is separate from the dependency-free tests, which check deterministic streams, validation, SVG structure/safety, layer axes, fixtures, and sampled geometry variety. | | 48 | | | 49 | MIT — Hermes contributors. |
|
|
About| owner | ba1b5beed5b5 |
|---|
| visibility | public |
|---|
| head | c808a940bc19 |
|---|
Clonehttps://012.run/npub1hgd4hmk4kkukjx7yf402adl7msw0ssnmqmt0y6sgz0j8yjjcj9nqh9znde/seedmark.git
|