[{"data":1,"prerenderedAt":549},["ShallowReactive",2],{"navigation_docs":3,"-guide-armor":140,"-guide-armor-surround":544},[4,52],{"title":5,"path":6,"stem":7,"children":8,"icon":51},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31,35,39,43,47],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Encoding and Decoding","\u002Fguide\u002Fencoding","1.guide\u002F02.encoding",{"title":16,"path":17,"stem":18},"Checksums","\u002Fguide\u002Fchecksums","1.guide\u002F03.checksums",{"title":20,"path":21,"stem":22},"Identify","\u002Fguide\u002Fidentify","1.guide\u002F04.identify",{"title":24,"path":25,"stem":26},"CLI","\u002Fguide\u002Fcli","1.guide\u002F05.cli",{"title":28,"path":29,"stem":30},"Agents","\u002Fguide\u002Fagents","1.guide\u002F06.agents",{"title":32,"path":33,"stem":34},"Code pages","\u002Fguide\u002Fcode-pages","1.guide\u002F07.code-pages",{"title":36,"path":37,"stem":38},"RLP","\u002Fguide\u002Frlp","1.guide\u002F08.rlp",{"title":40,"path":41,"stem":42},"OpenPGP armor","\u002Fguide\u002Farmor","1.guide\u002F09.armor",{"title":44,"path":45,"stem":46},"Custom Encodings","\u002Fguide\u002Fcustom","1.guide\u002F10.custom",{"title":48,"path":49,"stem":50},"Playground","\u002Fguide\u002Fplayground","1.guide\u002F11.playground","i-lucide-book-open",{"title":53,"path":54,"stem":55,"children":56,"icon":139},"Encodings","\u002Fencodings","2.encodings\u002F00.index",[57,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131,135],{"title":58,"path":54,"stem":55},"Every encoding",{"title":60,"path":61,"stem":62},"Binary","\u002Fencodings\u002Fbinary","2.encodings\u002F01.binary",{"title":64,"path":65,"stem":66},"Octal","\u002Fencodings\u002Foctal","2.encodings\u002F02.octal",{"title":68,"path":69,"stem":70},"Decimal","\u002Fencodings\u002Fdecimal","2.encodings\u002F03.decimal",{"title":72,"path":73,"stem":74},"Integer","\u002Fencodings\u002Finteger","2.encodings\u002F03.integer",{"title":76,"path":77,"stem":78},"Hex","\u002Fencodings\u002Fhex","2.encodings\u002F04.hex",{"title":80,"path":81,"stem":82},"Base32","\u002Fencodings\u002Fbase32","2.encodings\u002F05.base32",{"title":84,"path":85,"stem":86},"Base45","\u002Fencodings\u002Fbase45","2.encodings\u002F09.base45",{"title":88,"path":89,"stem":90},"Base58","\u002Fencodings\u002Fbase58","2.encodings\u002F10.base58",{"title":92,"path":93,"stem":94},"Base64","\u002Fencodings\u002Fbase64","2.encodings\u002F14.base64",{"title":96,"path":97,"stem":98},"Base85","\u002Fencodings\u002Fbase85","2.encodings\u002F18.base85",{"title":100,"path":101,"stem":102},"basE91","\u002Fencodings\u002Fbase91","2.encodings\u002F19.base91",{"title":104,"path":105,"stem":106},"Base256","\u002Fencodings\u002Fbase256","2.encodings\u002F20.base256",{"title":108,"path":109,"stem":110},"Bech32","\u002Fencodings\u002Fbech32","2.encodings\u002F21.bech32",{"title":112,"path":113,"stem":114},"uuencode","\u002Fencodings\u002Fuuencode","2.encodings\u002F22.uuencode",{"title":116,"path":117,"stem":118},"Quoted-Printable","\u002Fencodings\u002Fquoted-printable","2.encodings\u002F23.quoted-printable",{"title":120,"path":121,"stem":122},"HTML","\u002Fencodings\u002Fhtml","2.encodings\u002F24.html",{"title":124,"path":125,"stem":126},"ITA2","\u002Fencodings\u002Fita2","2.encodings\u002F25.ita2",{"title":128,"path":129,"stem":130},"Prefix codes","\u002Fencodings\u002Fprefix","2.encodings\u002F26.prefix",{"title":132,"path":133,"stem":134},"Chess squares","\u002Fencodings\u002Fsquare","2.encodings\u002F27.square",{"title":136,"path":137,"stem":138},"FEN","\u002Fencodings\u002Ffen","2.encodings\u002F28.fen","i-lucide-library",{"id":141,"title":40,"body":142,"description":538,"extension":539,"links":540,"meta":541,"navigation":200,"path":41,"seo":542,"stem":42,"__hash__":543},"docs\u002F1.guide\u002F09.armor.md",{"type":143,"value":144,"toc":531},"minimark",[145,150,163,339,360,367,373,427,437,441,447,463,488,503,507,527],[146,147,149],"h2",{"id":148},"base64-in-a-nice-suit","Base64 in a nice suit",[151,152,153,154,158,159,162],"p",{},"That PGP key you once pasted into a form? Armor. It's base64 with a ",[155,156,157],"code",{},"-----BEGIN PGP MESSAGE-----"," line on top, an END line below and a few ",[155,160,161],{},"Name: value"," headers if somebody felt chatty. Nothing is encrypted by the armor itself. It just keeps binary packets alive in an email.",[164,165,170],"pre",{"className":166,"code":167,"language":168,"meta":169,"style":169},"language-ts shiki shiki-themes encodings encodings encodings","import { armor } from \"@agntn\u002Fencodings\";\n\nconst block = armor.encode(new TextEncoder().encode(\"Hello, armor\"), {\n  label: \"MESSAGE\",\n  headers: [[\"Comment\", \"not encrypted, just wrapped\"]],\n});\n\u002F\u002F -----BEGIN PGP MESSAGE-----\n\u002F\u002F Comment: not encrypted, just wrapped\n\u002F\u002F\n\u002F\u002F SGVsbG8sIGFybW9y\n\u002F\u002F -----END PGP MESSAGE-----\n\narmor.decode(block);\n\u002F\u002F { label: \"MESSAGE\", headers: [[\"Comment\", \"not encrypted, just wrapped\"]],\n\u002F\u002F   bytes: Uint8Array(12), checksum: \"absent\" }\n","ts","",[155,171,172,195,202,243,255,273,279,286,292,298,304,310,315,327,333],{"__ignoreMap":169},[173,174,177,181,185,188,192],"span",{"class":175,"line":176},"line",1,[173,178,180],{"class":179},"skH_V","import",[173,182,184],{"class":183},"s38Sx"," { armor } ",[173,186,187],{"class":179},"from",[173,189,191],{"class":190},"shU9J"," \"@agntn\u002Fencodings\"",[173,193,194],{"class":183},";\n",[173,196,198],{"class":175,"line":197},2,[173,199,201],{"emptyLinePlaceholder":200},true,"\n",[173,203,205,208,211,214,217,221,224,227,230,233,235,237,240],{"class":175,"line":204},3,[173,206,207],{"class":179},"const",[173,209,210],{"class":183}," block ",[173,212,213],{"class":179},"=",[173,215,216],{"class":183}," armor.",[173,218,220],{"class":219},"sK71F","encode",[173,222,223],{"class":183},"(",[173,225,226],{"class":179},"new",[173,228,229],{"class":219}," TextEncoder",[173,231,232],{"class":183},"().",[173,234,220],{"class":219},[173,236,223],{"class":183},[173,238,239],{"class":190},"\"Hello, armor\"",[173,241,242],{"class":183},"), {\n",[173,244,246,249,252],{"class":175,"line":245},4,[173,247,248],{"class":183},"  label: ",[173,250,251],{"class":190},"\"MESSAGE\"",[173,253,254],{"class":183},",\n",[173,256,258,261,264,267,270],{"class":175,"line":257},5,[173,259,260],{"class":183},"  headers: [[",[173,262,263],{"class":190},"\"Comment\"",[173,265,266],{"class":183},", ",[173,268,269],{"class":190},"\"not encrypted, just wrapped\"",[173,271,272],{"class":183},"]],\n",[173,274,276],{"class":175,"line":275},6,[173,277,278],{"class":183},"});\n",[173,280,282],{"class":175,"line":281},7,[173,283,285],{"class":284},"scIB-","\u002F\u002F -----BEGIN PGP MESSAGE-----\n",[173,287,289],{"class":175,"line":288},8,[173,290,291],{"class":284},"\u002F\u002F Comment: not encrypted, just wrapped\n",[173,293,295],{"class":175,"line":294},9,[173,296,297],{"class":284},"\u002F\u002F\n",[173,299,301],{"class":175,"line":300},10,[173,302,303],{"class":284},"\u002F\u002F SGVsbG8sIGFybW9y\n",[173,305,307],{"class":175,"line":306},11,[173,308,309],{"class":284},"\u002F\u002F -----END PGP MESSAGE-----\n",[173,311,313],{"class":175,"line":312},12,[173,314,201],{"emptyLinePlaceholder":200},[173,316,318,321,324],{"class":175,"line":317},13,[173,319,320],{"class":183},"armor.",[173,322,323],{"class":219},"decode",[173,325,326],{"class":183},"(block);\n",[173,328,330],{"class":175,"line":329},14,[173,331,332],{"class":284},"\u002F\u002F { label: \"MESSAGE\", headers: [[\"Comment\", \"not encrypted, just wrapped\"]],\n",[173,334,336],{"class":175,"line":335},15,[173,337,338],{"class":284},"\u002F\u002F   bytes: Uint8Array(12), checksum: \"absent\" }\n",[151,340,341,342,345,346,266,349,266,352,355,356,359],{},"The label is whatever follows ",[155,343,344],{},"BEGIN PGP ",". ",[155,347,348],{},"MESSAGE",[155,350,351],{},"PUBLIC KEY BLOCK",[155,353,354],{},"SIGNATURE",", or your own. Headers are pairs, in order, so a repeated ",[155,357,358],{},"Comment"," stays repeated. Lines come out at 64 characters, the way GnuPG writes them.",[146,361,363,364,366],{"id":362},"whats-that-line-above-end","What's that ",[155,365,213],{}," line above END?",[151,368,369,370,372],{},"Older blocks carry a CRC24 there, a 24-bit checksum of the bytes. RFC 9580 says to stop writing it, and never to reject a block over it. So ",[155,371,220],{}," leaves it out unless you ask.",[164,374,376],{"className":166,"code":375,"language":168,"meta":169,"style":169},"armor.encode(new TextEncoder().encode(\"Hello, armor\"), { label: \"MESSAGE\", checksum: true });\n\u002F\u002F -----BEGIN PGP MESSAGE-----\n\u002F\u002F\n\u002F\u002F SGVsbG8sIGFybW9y\n\u002F\u002F =o0JO\n\u002F\u002F -----END PGP MESSAGE-----\n",[155,377,378,406,410,414,418,423],{"__ignoreMap":169},[173,379,380,382,384,386,388,390,392,394,396,398,401,403],{"class":175,"line":176},[173,381,320],{"class":183},[173,383,220],{"class":219},[173,385,223],{"class":183},[173,387,226],{"class":179},[173,389,229],{"class":219},[173,391,232],{"class":183},[173,393,220],{"class":219},[173,395,223],{"class":183},[173,397,239],{"class":190},[173,399,400],{"class":183},"), { label: ",[173,402,251],{"class":190},[173,404,405],{"class":183},", checksum: true });\n",[173,407,408],{"class":175,"line":197},[173,409,285],{"class":284},[173,411,412],{"class":175,"line":204},[173,413,297],{"class":284},[173,415,416],{"class":175,"line":245},[173,417,303],{"class":284},[173,419,420],{"class":175,"line":257},[173,421,422],{"class":284},"\u002F\u002F =o0JO\n",[173,424,425],{"class":175,"line":275},[173,426,309],{"class":284},[151,428,429,430,432,433,436],{},"And ",[155,431,323],{}," never throws on it. A wrong one shows up as ",[155,434,435],{},"checksum: \"mismatch\""," next to perfectly good bytes. Want to warn somebody that the text got changed or cut? Go ahead. The bytes are still yours to use.",[146,438,440],{"id":439},"armor-from-the-wild","Armor from the wild",[151,442,443,444,446],{},"Real armor arrives pasted, forwarded and a bit mangled. ",[155,445,323],{}," takes it the way it comes:",[448,449,450,454,457,460],"ul",{},[451,452,453],"li",{},"text around the block, like the rest of an email,",[451,455,456],{},"CRLF line ends and indented lines,",[451,458,459],{},"a lost blank line under the headers,",[451,461,462],{},"spaces and blank lines inside the base64.",[151,464,465,466,469,470,472,473,476,477,479,480,487],{},"Two blocks in one text? You get the first one. Pass ",[155,467,468],{},"label: \"SIGNATURE\""," and it skips to the one you want. A cleartext signed message isn't armor at all, only its signature block is. So ",[155,471,323],{}," steps over the ",[155,474,475],{},"SIGNED MESSAGE"," frame and hands you the ",[155,478,354],{},". Checking that signature is a job for ",[481,482,486],"a",{"href":483,"rel":484},"https:\u002F\u002Fgithub.com\u002Fagntn\u002Fkeys",[485],"nofollow","@agntn\u002Fkeys",".",[151,489,490,491,494,495,498,499,502],{},"What it won't take is a block with no END line, a checksum line with data under it, or data that isn't base64. Each one is a ",[155,492,493],{},"DecodeError",". A label in lowercase, or one with ",[155,496,497],{},"PGP"," already in it, is an ",[155,500,501],{},"InvalidOptionError"," that tells you what to pass instead.",[146,504,506],{"id":505},"where-it-lives","Where it lives",[151,508,509,511,512,515,516,518,519,522,523,526],{},[155,510,323],{}," hands back a label and headers along with the bytes, and nothing in the registry does that. So ",[155,513,514],{},"armor"," sits outside it, like ",[481,517,36],{"href":37}," and the ",[481,520,521],{"href":33},"code pages",". The subpath is ",[155,524,525],{},"@agntn\u002Fencodings\u002Farmor",". No CLI command and no agent tool yet, just the two functions.",[528,529,530],"style",{},"html pre.shiki code .skH_V, html code.shiki .skH_V{--shiki-light:var(--shiki-token-keyword);--shiki-default:var(--shiki-token-keyword);--shiki-dark:var(--shiki-token-keyword)}html pre.shiki code .s38Sx, html code.shiki .s38Sx{--shiki-light:var(--ui-text-highlighted);--shiki-default:var(--ui-text-highlighted);--shiki-dark:var(--ui-text-highlighted)}html pre.shiki code .shU9J, html code.shiki .shU9J{--shiki-light:var(--shiki-token-string);--shiki-default:var(--shiki-token-string);--shiki-dark:var(--shiki-token-string)}html pre.shiki code .sK71F, html code.shiki .sK71F{--shiki-light:var(--shiki-token-function);--shiki-default:var(--shiki-token-function);--shiki-dark:var(--shiki-token-function)}html pre.shiki code .scIB-, html code.shiki .scIB-{--shiki-light:var(--shiki-token-comment);--shiki-default:var(--shiki-token-comment);--shiki-dark:var(--shiki-token-comment)}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":169,"searchDepth":197,"depth":197,"links":532},[533,534,536,537],{"id":148,"depth":197,"text":149},{"id":362,"depth":197,"text":535},"What's that = line above END?",{"id":439,"depth":197,"text":440},{"id":505,"depth":197,"text":506},"The -----BEGIN PGP----- blocks from RFC 9580. Wrap bytes in armor or pull them back out with the label and headers intact","md",null,{},{"title":40,"description":538},"aCnhr0eEeJiexDh0mV0xvO0E_DiBA14qfd2i6WzAyxo",[545,547],{"title":36,"path":37,"stem":38,"description":546,"children":-1},"Ethereum's Recursive Length Prefix. Bytes and nested lists in and out and decoded as strictly as geth does it",{"title":44,"path":45,"stem":46,"description":548,"children":-1},"An encoding is one object with a name and info and encode and decode. Register it and everything sees it",1794584248256]