Secure storage and distribution of cryptographic keys in ATProto applications
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: update to change from pigeon to roomy.

+274 -67
+7 -1
deno.json
··· 4 4 }, 5 5 "nodeModulesDir": "auto", 6 6 "imports": { 7 - "@std/assert": "jsr:@std/assert@1" 7 + "@atproto/did": "npm:@atproto/did@^0.1.3", 8 + "@atproto/identity": "npm:@atproto/identity@^0.4.5", 9 + "@atproto/xrpc-server": "npm:@atproto/xrpc-server@^0.7.8", 10 + "@noble/ed25519": "jsr:@noble/ed25519@^2.2.3", 11 + "@earthstar/earthstar": "jsr:@muni-town-temp/earthstar@11.0.0-beta.7.patched.1", 12 + "base32-encode": "npm:base32-encode@^2.0.0", 13 + "itty-router": "npm:itty-router@^5.0.18" 8 14 } 9 15 }
+192 -42
deno.lock
··· 1 1 { 2 2 "version": "4", 3 3 "specifiers": { 4 - "jsr:@earthstar/earthstar@11.0.0-beta.7": "11.0.0-beta.7", 5 4 "jsr:@earthstar/meadowcap@~0.6.4": "0.6.4", 6 5 "jsr:@earthstar/willow-utils@2": "2.0.1", 7 - "jsr:@earthstar/willow@0.6": "0.6.1", 8 6 "jsr:@korkje/fifo@~0.2.4": "0.2.4", 9 - "jsr:@noble/ed25519@^2.1.0": "2.1.0", 10 - "jsr:@std/assert@1": "1.0.10", 7 + "jsr:@muni-town-temp/earthstar@11.0.0-beta.7.patched.1": "11.0.0-beta.7.patched.1", 8 + "jsr:@muni-town-temp/willow@~0.6.1-patched.1": "0.6.1-patched.3", 9 + "jsr:@muni-town-temp/willow@~0.6.1-patched.3": "0.6.1-patched.3", 10 + "jsr:@noble/ed25519@^2.1.0": "2.2.3", 11 + "jsr:@noble/ed25519@^2.2.3": "2.2.3", 12 + "jsr:@std/assert@0.224": "0.224.0", 13 + "jsr:@std/assert@0.226": "0.226.0", 14 + "jsr:@std/assert@~0.225.2": "0.225.3", 15 + "jsr:@std/async@0.224": "0.224.2", 11 16 "jsr:@std/bytes@0.224": "0.224.0", 17 + "jsr:@std/crypto@0.224": "0.224.0", 12 18 "jsr:@std/data-structures@0.224": "0.224.1", 13 - "jsr:@std/encoding@1.0.6": "1.0.6", 19 + "jsr:@std/encoding@0.224": "0.224.3", 14 20 "jsr:@std/encoding@~0.224.1": "0.224.3", 21 + "jsr:@std/fs@~0.229.1": "0.229.3", 22 + "jsr:@std/internal@1": "1.0.5", 15 23 "jsr:@std/internal@^1.0.5": "1.0.5", 24 + "jsr:@std/path@1.0.0-rc.1": "1.0.0-rc.1", 25 + "jsr:@std/path@~0.225.1": "0.225.2", 16 26 "npm:@atproto/did@0.1.3": "0.1.3", 27 + "npm:@atproto/did@~0.1.3": "0.1.3", 17 28 "npm:@atproto/identity@0.4.3": "0.4.3", 29 + "npm:@atproto/identity@~0.4.5": "0.4.5", 18 30 "npm:@atproto/xrpc-server@0.7.4": "0.7.4", 31 + "npm:@atproto/xrpc-server@~0.7.8": "0.7.8", 19 32 "npm:@noble/curves@^1.4.0": "1.7.0", 20 33 "npm:@types/node@*": "22.5.4", 34 + "npm:base32-encode@2": "2.0.0", 21 35 "npm:hash-wasm@^4.11.0": "4.12.0", 22 - "npm:itty-router@5.0.18": "5.0.18" 36 + "npm:itty-router@5.0.18": "5.0.18", 37 + "npm:itty-router@^5.0.18": "5.0.18" 23 38 }, 24 39 "jsr": { 25 - "@earthstar/earthstar@11.0.0-beta.7": { 26 - "integrity": "d294486e9681058ec23d4e6841c39d46ca0c4d4bf348388fb1b6f9e663fc9394", 40 + "@earthstar/meadowcap@0.6.4": { 41 + "integrity": "6697a074d9402269fd699ec51a1f5d62e8b5dee7197cb1713ad99cdc60afa638", 42 + "dependencies": [ 43 + "jsr:@earthstar/willow-utils", 44 + "jsr:@std/bytes" 45 + ] 46 + }, 47 + "@earthstar/willow-utils@2.0.1": { 48 + "integrity": "7d426c47ec8101f6f6786efd69b8ab4a1fc877514d3d0a00cbfdf6384a4c6248", 49 + "dependencies": [ 50 + "jsr:@std/bytes" 51 + ] 52 + }, 53 + "@korkje/fifo@0.2.4": { 54 + "integrity": "cd8ff3edf686dcfd0b26d4774705d6a080312afb666d93f3a90d3fc808df41ba" 55 + }, 56 + "@muni-town-temp/earthstar@11.0.0-beta.7.patched.1": { 57 + "integrity": "c3b8115e0c1c2953b3fae9a85e47bbd5112cd11d331f7d27a4ab474d11098cd3", 27 58 "dependencies": [ 28 59 "jsr:@earthstar/meadowcap", 29 - "jsr:@earthstar/willow", 30 60 "jsr:@earthstar/willow-utils", 31 - "jsr:@noble/ed25519", 61 + "jsr:@muni-town-temp/willow@~0.6.1-patched.1", 62 + "jsr:@noble/ed25519@^2.1.0", 32 63 "jsr:@std/bytes", 64 + "jsr:@std/crypto", 33 65 "jsr:@std/encoding@~0.224.1", 66 + "jsr:@std/fs", 67 + "jsr:@std/path@~0.225.1", 34 68 "npm:@noble/curves", 35 69 "npm:hash-wasm" 36 70 ] 37 71 }, 38 - "@earthstar/meadowcap@0.6.4": { 39 - "integrity": "6697a074d9402269fd699ec51a1f5d62e8b5dee7197cb1713ad99cdc60afa638", 72 + "@muni-town-temp/willow@0.6.1-patched.1": { 73 + "integrity": "6ca0c0ea8c0c0c3c0f7480757977aba70b890699a37ae3a556ffa8e0a3496bd3", 40 74 "dependencies": [ 41 75 "jsr:@earthstar/willow-utils", 42 - "jsr:@std/bytes" 76 + "jsr:@korkje/fifo", 77 + "jsr:@std/bytes", 78 + "jsr:@std/data-structures", 79 + "jsr:@std/encoding@~0.224.1", 80 + "jsr:@std/fs", 81 + "jsr:@std/path@~0.225.1" 43 82 ] 44 83 }, 45 - "@earthstar/willow@0.6.1": { 46 - "integrity": "0a3f3f55e1d547094e74533486af8f190168b2348fa36d62ae18ac3a4a33bafe", 84 + "@muni-town-temp/willow@0.6.1-patched.3": { 85 + "integrity": "59b4c0dc9d1322581aa9e32721509cc52b2ea8195929f4ef13b705d6c61800d7", 47 86 "dependencies": [ 48 87 "jsr:@earthstar/willow-utils", 49 88 "jsr:@korkje/fifo", 50 89 "jsr:@std/bytes", 51 90 "jsr:@std/data-structures", 52 - "jsr:@std/encoding@~0.224.1" 53 - ] 54 - }, 55 - "@earthstar/willow-utils@2.0.1": { 56 - "integrity": "7d426c47ec8101f6f6786efd69b8ab4a1fc877514d3d0a00cbfdf6384a4c6248", 57 - "dependencies": [ 58 - "jsr:@std/bytes" 91 + "jsr:@std/encoding@~0.224.1", 92 + "jsr:@std/fs", 93 + "jsr:@std/path@~0.225.1" 59 94 ] 60 95 }, 61 - "@korkje/fifo@0.2.4": { 62 - "integrity": "cd8ff3edf686dcfd0b26d4774705d6a080312afb666d93f3a90d3fc808df41ba" 63 - }, 64 96 "@noble/ed25519@2.1.0": { 65 97 "integrity": "59a6ad395a37a0d065f6a2771e56fe52ea4bd9070c77bdaca5c475f5184412cc" 66 98 }, 67 - "@std/assert@1.0.10": { 68 - "integrity": "59b5cbac5bd55459a19045d95cc7c2ff787b4f8527c0dd195078ff6f9481fbb3", 99 + "@noble/ed25519@2.2.3": { 100 + "integrity": "77d984ee6b823c8b1a4a36aa56105d60e696a4e7b599b821712d1251481e2f9c" 101 + }, 102 + "@std/assert@0.224.0": { 103 + "integrity": "8643233ec7aec38a940a8264a6e3eed9bfa44e7a71cc6b3c8874213ff401967f" 104 + }, 105 + "@std/assert@0.225.3": { 106 + "integrity": "b3c2847aecf6955b50644cdb9cf072004ea3d1998dd7579fc0acb99dbb23bd4f", 69 107 "dependencies": [ 70 - "jsr:@std/internal" 108 + "jsr:@std/internal@1" 71 109 ] 72 110 }, 111 + "@std/assert@0.226.0": { 112 + "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3" 113 + }, 114 + "@std/async@0.224.2": { 115 + "integrity": "4d277d6e165df43d5e061ba0ef3edfddb8e8d558f5b920e3e6b1d2614b44d074" 116 + }, 73 117 "@std/bytes@0.224.0": { 74 118 "integrity": "a2250e1d0eb7d1c5a426f21267ab9bdeac2447fa87a3d0d1a467d3f7a6058e49" 75 119 }, 120 + "@std/crypto@0.224.0": { 121 + "integrity": "154ef3ff08ef535562ef1a718718c5b2c5fc3808f0f9100daad69e829bfcdf2d", 122 + "dependencies": [ 123 + "jsr:@std/assert@0.224", 124 + "jsr:@std/encoding@0.224" 125 + ] 126 + }, 76 127 "@std/data-structures@0.224.1": { 77 128 "integrity": "266365f90014e5c52bccf1eadd65f7782a2af2c84e4052ef8316698a3572cac3" 78 129 }, 79 130 "@std/encoding@0.224.3": { 80 131 "integrity": "5e861b6d81be5359fad4155e591acf17c0207b595112d1840998bb9f476dbdaf" 81 132 }, 82 - "@std/encoding@1.0.6": { 83 - "integrity": "ca87122c196e8831737d9547acf001766618e78cd8c33920776c7f5885546069" 133 + "@std/fs@0.229.3": { 134 + "integrity": "783bca21f24da92e04c3893c9e79653227ab016c48e96b3078377ebd5222e6eb", 135 + "dependencies": [ 136 + "jsr:@std/path@1.0.0-rc.1" 137 + ] 84 138 }, 85 139 "@std/internal@1.0.5": { 86 140 "integrity": "54a546004f769c1ac9e025abd15a76b6671ddc9687e2313b67376125650dc7ba" 141 + }, 142 + "@std/path@0.225.2": { 143 + "integrity": "0f2db41d36b50ef048dcb0399aac720a5348638dd3cb5bf80685bf2a745aa506", 144 + "dependencies": [ 145 + "jsr:@std/assert@0.226" 146 + ] 147 + }, 148 + "@std/path@1.0.0-rc.1": { 149 + "integrity": "b8c00ae2f19106a6bb7cbf1ab9be52aa70de1605daeb2dbdc4f87a7cbaf10ff6" 87 150 } 88 151 }, 89 152 "npm": { ··· 96 159 "zod" 97 160 ] 98 161 }, 162 + "@atproto/common-web@0.3.2": { 163 + "integrity": "sha512-Vx0JtL1/CssJbFAb0UOdvTrkbUautsDfHNOXNTcX2vyPIxH9xOameSqLLunM1hZnOQbJwyjmQCt6TV+bhnanDg==", 164 + "dependencies": [ 165 + "graphemer", 166 + "multiformats", 167 + "uint8arrays", 168 + "zod" 169 + ] 170 + }, 99 171 "@atproto/common@0.4.5": { 100 172 "integrity": "sha512-LFAGqHcxCI5+b31Xgk+VQQtZU258iGPpHJzNeHVcdh6teIKZi4C2l6YV+m+3CEz+yYcfP7jjUmgqesx7l9Arsg==", 101 173 "dependencies": [ 102 - "@atproto/common-web", 174 + "@atproto/common-web@0.3.1", 175 + "@ipld/dag-cbor", 176 + "cbor-x", 177 + "iso-datestring-validator", 178 + "multiformats", 179 + "pino" 180 + ] 181 + }, 182 + "@atproto/common@0.4.6": { 183 + "integrity": "sha512-X33ZubLPrHLNur2Ln4tRP5TY0G0u/t9DyAeA5dgtTNGIXE3iJIlfiUSR0PW5s1iAvBbrrJK4BwaA2Pqsdl+RNw==", 184 + "dependencies": [ 185 + "@atproto/common-web@0.3.2", 103 186 "@ipld/dag-cbor", 104 187 "cbor-x", 105 188 "iso-datestring-validator", ··· 111 194 "integrity": "sha512-aeOfPQYCDbhn2hV06oBF2KXrWjf/BK4yL8lfANJKSmKl3tKWCkiW/moi643rUXXxSE72KtWtQeqvNFYnnFJ0ig==", 112 195 "dependencies": [ 113 196 "@noble/curves", 114 - "@noble/hashes", 197 + "@noble/hashes@1.6.0", 198 + "uint8arrays" 199 + ] 200 + }, 201 + "@atproto/crypto@0.4.3": { 202 + "integrity": "sha512-YSSUAvkx+ldpXw97NXZWfLx/prgh5YJ2K0BCw51JCJmXSRp6KhhwvOm4J+K/s5hwpssyuDCVTXknyS4PHwaK5g==", 203 + "dependencies": [ 204 + "@noble/curves", 205 + "@noble/hashes@1.7.1", 115 206 "uint8arrays" 116 207 ] 117 208 }, ··· 124 215 "@atproto/identity@0.4.3": { 125 216 "integrity": "sha512-DLXMWh57dHvIeBl+IvC+q20z0IdDZT1awOn84vDyxacL9DfhbiTy/zCUPFEzHyvfrilNG1tDA4zQzURubdFqNg==", 126 217 "dependencies": [ 127 - "@atproto/common-web", 128 - "@atproto/crypto", 218 + "@atproto/common-web@0.3.1", 219 + "@atproto/crypto@0.4.2", 129 220 "axios" 130 221 ] 131 222 }, 223 + "@atproto/identity@0.4.5": { 224 + "integrity": "sha512-IyW6wk+qfX+z/LmBdjatJgjSJWDTJLSCT/6yQUD/L0mkOjRdxiG7DoYIChaF3xHOPKiIuOGu/fuzhBMxVVcCcw==", 225 + "dependencies": [ 226 + "@atproto/common-web@0.3.2", 227 + "@atproto/crypto@0.4.3" 228 + ] 229 + }, 132 230 "@atproto/lexicon@0.4.4": { 133 231 "integrity": "sha512-QFEmr3rpj/RoAmfX9ALU/asBG/rsVtQZnw+9nOB1/AuIwoxXd+ZyndR6lVUc2+DL4GEjl6W2yvBru5xbQIZWyA==", 134 232 "dependencies": [ 135 - "@atproto/common-web", 233 + "@atproto/common-web@0.3.1", 234 + "@atproto/syntax", 235 + "iso-datestring-validator", 236 + "multiformats", 237 + "zod" 238 + ] 239 + }, 240 + "@atproto/lexicon@0.4.5": { 241 + "integrity": "sha512-fljWqMGKn+XWtTprBcS3F1hGBREnQYh6qYHv2sjENucc7REms1gtmZXSerB9N6pVeHVNOnXiILdukeAcic5OEw==", 242 + "dependencies": [ 243 + "@atproto/common-web@0.3.2", 136 244 "@atproto/syntax", 137 245 "iso-datestring-validator", 138 246 "multiformats", ··· 145 253 "@atproto/xrpc-server@0.7.4": { 146 254 "integrity": "sha512-MrAwxfJBQm/kCol3D8qc+vpQzBMzLqvtUbauSSfVVJ10PlGtxg4LlXqcjkAuhrjyrqp3dQH9LHuhDpgVQK+G3w==", 147 255 "dependencies": [ 148 - "@atproto/common", 149 - "@atproto/crypto", 150 - "@atproto/lexicon", 151 - "@atproto/xrpc", 256 + "@atproto/common@0.4.5", 257 + "@atproto/crypto@0.4.2", 258 + "@atproto/lexicon@0.4.4", 259 + "@atproto/xrpc@0.6.5", 260 + "cbor-x", 261 + "express", 262 + "http-errors", 263 + "mime-types", 264 + "rate-limiter-flexible", 265 + "uint8arrays", 266 + "ws", 267 + "zod" 268 + ] 269 + }, 270 + "@atproto/xrpc-server@0.7.8": { 271 + "integrity": "sha512-0QlNPYcxI37AJLL9OffQrkFI5F5SkVKf3VvNkQFVNaOe1eqdu4lty8VVVrweA57EnnOO8W4xVlc9xgVa33Gbyg==", 272 + "dependencies": [ 273 + "@atproto/common@0.4.6", 274 + "@atproto/crypto@0.4.3", 275 + "@atproto/lexicon@0.4.5", 276 + "@atproto/xrpc@0.6.6", 152 277 "cbor-x", 153 278 "express", 154 279 "http-errors", ··· 162 287 "@atproto/xrpc@0.6.5": { 163 288 "integrity": "sha512-t6u8iPEVbWge5RhzKZDahSzNDYIAxUtop6Q/X/apAZY1rgreVU0/1sSvvRoRFH19d3UIKjYdLuwFqMi9w8nY3Q==", 164 289 "dependencies": [ 165 - "@atproto/lexicon", 290 + "@atproto/lexicon@0.4.4", 291 + "zod" 292 + ] 293 + }, 294 + "@atproto/xrpc@0.6.6": { 295 + "integrity": "sha512-umXEYVMo9/pyIBoKmIAIi64RXDW9tSXY+wqztlQ6I2GZtjLfNZqmAWU+wADk3SxUe54mvjxxGyA4TtyGtDMfhA==", 296 + "dependencies": [ 297 + "@atproto/lexicon@0.4.5", 166 298 "zod" 167 299 ] 168 300 }, ··· 194 326 "@noble/curves@1.7.0": { 195 327 "integrity": "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==", 196 328 "dependencies": [ 197 - "@noble/hashes" 329 + "@noble/hashes@1.6.0" 198 330 ] 199 331 }, 200 332 "@noble/hashes@1.6.0": { 201 333 "integrity": "sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==" 334 + }, 335 + "@noble/hashes@1.7.1": { 336 + "integrity": "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==" 202 337 }, 203 338 "@types/node@22.5.4": { 204 339 "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", ··· 233 368 "dependencies": [ 234 369 "follow-redirects", 235 370 "form-data" 371 + ] 372 + }, 373 + "base32-encode@2.0.0": { 374 + "integrity": "sha512-mlmkfc2WqdDtMl/id4qm3A7RjW6jxcbAoMjdRmsPiwQP0ufD4oXItYMnPgVHe80lnAIy+1xwzhHE1s4FoIceSw==", 375 + "dependencies": [ 376 + "to-data-view" 236 377 ] 237 378 }, 238 379 "base64-js@1.5.1": { ··· 750 891 "real-require" 751 892 ] 752 893 }, 894 + "to-data-view@2.0.0": { 895 + "integrity": "sha512-RGEM5KqlPHr+WVTPmGNAXNeFEmsBnlkxXaIfEpUYV0AST2Z5W1EGq9L/MENFrMMmL2WQr1wjkmZy/M92eKhjYA==" 896 + }, 753 897 "toidentifier@1.0.1": { 754 898 "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" 755 899 }, ··· 787 931 }, 788 932 "workspace": { 789 933 "dependencies": [ 790 - "jsr:@std/assert@1" 934 + "jsr:@muni-town-temp/earthstar@11.0.0-beta.7.patched.1", 935 + "jsr:@noble/ed25519@^2.2.3", 936 + "npm:@atproto/did@~0.1.3", 937 + "npm:@atproto/identity@~0.4.5", 938 + "npm:@atproto/xrpc-server@~0.7.8", 939 + "npm:base32-encode@2", 940 + "npm:itty-router@^5.0.18" 791 941 ] 792 942 } 793 943 }
+52
lexicons.json
··· 1 + [ 2 + { 3 + "lexicon": 1, 4 + "id": "key.v0.roomy.muni.town", 5 + "defs": { 6 + "main": { 7 + "type": "query", 8 + "output": { 9 + "encoding": "application/json", 10 + "schema": { 11 + "type": "object", 12 + "required": ["publicKey", "privateKey"], 13 + "properties": { 14 + "publicKey": { 15 + "type": "string" 16 + }, 17 + "privateKey": { 18 + "type": "string" 19 + } 20 + } 21 + } 22 + } 23 + } 24 + } 25 + }, 26 + { 27 + "lexicon": 1, 28 + "id": "public.key.v0.roomy.muni.town", 29 + "defs": { 30 + "main": { 31 + "type": "query", 32 + "parameters": { 33 + "type": "params", 34 + "properties": { 35 + "did": { 36 + "type": "string" 37 + } 38 + } 39 + }, 40 + "output": { 41 + "encoding": "application/json", 42 + "schema": { 43 + "type": "object", 44 + "properties": { 45 + "publicKey": { "type": "string" } 46 + } 47 + } 48 + } 49 + } 50 + } 51 + } 52 + ]
+23 -24
main.ts
··· 1 - import { AutoRouter, cors, error } from "npm:itty-router@5.0.18"; 2 - import { verifyJwt } from "npm:@atproto/xrpc-server@0.7.4"; 3 - import { IdResolver } from "npm:@atproto/identity@0.4.3"; 4 - import * as earthstar from "jsr:@earthstar/earthstar@11.0.0-beta.7"; 5 - import { isDid, extractDidMethod } from "npm:@atproto/did@0.1.3"; 6 - import { encodeIdentityTag } from "https://jsr.io/@earthstar/earthstar/11.0.0-beta.7/src/identifiers/identity.ts"; 7 - import { encodeBase32 } from "https://jsr.io/@earthstar/earthstar/11.0.0-beta.7/src/encoding/base32.ts"; 1 + import { AutoRouter, cors, error } from "itty-router"; 2 + import { verifyJwt } from "@atproto/xrpc-server"; 3 + import { IdResolver } from "@atproto/identity"; 4 + import { isDid, extractDidMethod } from "@atproto/did"; 5 + import * as ed25519 from "@noble/ed25519"; 6 + import encodeBase32 from "base32-encode"; 8 7 9 - type Keypair = { publicKey: Uint8Array; secretKey: Uint8Array }; 8 + type Keypair = { publicKey: Uint8Array; privateKey: Uint8Array }; 9 + const encodeKey = (key: Uint8Array) => encodeBase32(key, "Crockford"); 10 10 11 11 // TODO: add a DID cache using Deno KV 12 12 const idResolver = new IdResolver(); ··· 22 22 } 23 23 24 24 const db = await Deno.openKv(); 25 - function generateKeypair(): Promise<Keypair> { 26 - return new earthstar.RuntimeDriverUniversal().ed25519.generateKeypair(); 25 + async function generateKeypair(): Promise<Keypair> { 26 + const privateKey = ed25519.utils.randomPrivateKey(); 27 + const publicKey = await ed25519.getPublicKeyAsync(privateKey); 28 + return { 29 + publicKey, 30 + privateKey, 31 + }; 27 32 } 28 33 async function getKeypair(did: string): Promise<Keypair> { 29 34 const entry = await db.get<Keypair>(["keys", did]); ··· 36 41 } 37 42 async function getPublicKey(did: string): Promise<string> { 38 43 const keypair = await getKeypair(did); 39 - return encodeIdentityTag({ 40 - shortname: "auth", 41 - underlying: keypair.publicKey, 42 - }); 44 + return encodeKey(keypair.publicKey); 43 45 } 44 46 async function getEncodedKeypair( 45 47 did: string 46 - ): Promise<{ publicKey: string; secretKey: string }> { 48 + ): Promise<{ publicKey: string; privateKey: string }> { 47 49 const keypair = await getKeypair(did); 48 50 return { 49 - publicKey: encodeIdentityTag({ 50 - shortname: "auth", 51 - underlying: keypair.publicKey, 52 - }), 53 - secretKey: encodeBase32(keypair.secretKey), 51 + publicKey: encodeKey(keypair.publicKey), 52 + privateKey: encodeKey(keypair.privateKey), 54 53 }; 55 54 } 56 55 ··· 73 72 id: serviceDid, 74 73 service: [ 75 74 { 76 - id: "#pigeon_keyserver", 77 - type: "PigeonKeyserver", 75 + id: "#roomy_keyserver", 76 + type: "RoomyKeyserver", 78 77 serviceEndpoint: (() => { 79 78 const u = new URL(url); 80 79 u.pathname = "/"; ··· 93 92 type Ctx = Request & AuthCtx; 94 93 95 94 // Get a user's public key 96 - router.get("/xrpc/public.key.pigeon.muni.town", async ({ query }) => { 95 + router.get("/xrpc/public.key.v0.roomy.muni.town", async ({ query }) => { 97 96 let { did } = query; 98 97 if (typeof did !== "string" || !did) 99 98 return error(400, "DID query parameter required"); ··· 143 142 }); 144 143 145 144 // Get the user's personal keypair 146 - router.get("/xrpc/key.pigeon.muni.town", ({ did }: Ctx) => 145 + router.get("/xrpc/key.roomy.v0.muni.town", ({ did }: Ctx) => 147 146 getEncodedKeypair(did) 148 147 ); 149 148