Recently, I’ve been playing with public / private keypairs for identity & signing in a networked / federated service. No username, just a public key as your proveable identity.
To more easily recognize different users, I added a word list and generated determinstic phrases (e.g. shovel_pear_lawn). This was a little boring and hard to differentiate at a glance, so then I added emoji too. You can also generate visuals, like SSH randomart, GitHub’s Identicons, or Robohashes:
My favorite was Jdenticon - they feel very visually distinctive (at least for people who see colors; I’d love to consider how these could work better for the visually-impaired!).
However, I don’t really like the 4-way rotation, and I preferred a Rust library for my projects. So, I vibe-coded my own, and decided to call it glyphatar:
Some considerations:
- Rust, so easier to use in both Rust projects and on the web (via WASM, on npm)
- Mirror symmetry (they look a little like colorful monster faces)
- A live demo so you can play with it yourself
- No dependencies (inlined SHA-256 hash function)
Development
The first versions tended to be green:
So I changed the colors to be more evenly spread, perception-wise:
If you use it and like it (or don’t), let me know!
Usage
Rust
On crates.io as glyphatar:
cargo add glyphatar
// Any bytes: a public key, a user id, an email hash…
let svg: String = glyphatar::svg(b"some public key bytes", 64);
// With a <title> for screen readers and hover tooltips:
let svg = glyphatar::Glyphatar::new(b"alice").to_svg_with_title(64, "alice");
TypeScript / JavaScript
On npm as glyphatar - the Rust crate compiled to WASM and inlined into one ES module, with types included:
npm install glyphatar
import { svg } from "glyphatar";
// Any bytes: a string (UTF-8 encoded), Uint8Array, ArrayBuffer…
const markup: string = svg("some public key", 64);
// With a <title> for screen readers and hover tooltips:
const titled = svg("alice", 64, { title: "alice" });