Skip to content

Commit

Permalink
CryptographicKey now can contain PEM-PKCS#1 key
Browse files Browse the repository at this point in the history
Close #209
  • Loading branch information
dahlia committed Feb 18, 2025
1 parent 5609c37 commit b516691
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ To be released.
- Fedify now accepts PEM-PKCS#1 besides PEM-SPKI for RSA public keys.
[[#209]]

- `CryptographicKey` now can contain a `publicKey` with a PEM-PKCS#1
format (in addition to PEM-SPKI).
- Added `importPkcs1()` function.
- Added `importPem()` function.

Expand Down
4 changes: 2 additions & 2 deletions src/codegen/__snapshots__/class.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { decode as decodeMultibase, encode as encodeMultibase }
import {
exportSpki,
exportMultibaseKey,
importSpki,
importPem,
importMultibaseKey,
} from \\"../runtime/key.ts\\";
import { LanguageString } from \\"../runtime/langstr.ts\\";
Expand Down Expand Up @@ -15371,7 +15371,7 @@ owner?: Application | Group | Organization | Person | Service | URL | null;publi
: _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem__array
) {
if (v == null) continue;
_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.push(await importSpki(v[\\"@value\\"]))
_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem.push(await importPem(v[\\"@value\\"]))
}
instance.#_2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem = _2fE2QMDdg6KFGqa4NEC3TmjApSAD_publicKeyPem;

Expand Down
2 changes: 1 addition & 1 deletion src/codegen/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export async function* generateClasses(
yield `import {
exportSpki,
exportMultibaseKey,
importSpki,
importPem,
importMultibaseKey,
} from "${runtimePath}/key.ts";\n`;
yield `import { LanguageString } from "${runtimePath}/langstr.ts";\n`;
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ const scalarTypes: Record<string, ScalarType> = {
&& typeof ${v}["@value"] === "string"`;
},
decoder(v) {
return `await importSpki(${v}["@value"])`;
return `await importPem(${v}["@value"])`;
},
},
"fedify:multibaseKey": {
Expand Down

0 comments on commit b516691

Please sign in to comment.