mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
17 lines
351 B
TypeScript
17 lines
351 B
TypeScript
import { Context, getPublicKey } from '@/deps.ts';
|
|
|
|
function getKeys(c: Context) {
|
|
const auth = c.req.headers.get('Authorization') || '';
|
|
|
|
if (auth.startsWith('Bearer ')) {
|
|
const privatekey = auth.split('Bearer ')[1];
|
|
const pubkey = getPublicKey(privatekey);
|
|
|
|
return {
|
|
privatekey,
|
|
pubkey,
|
|
};
|
|
}
|
|
}
|
|
|
|
export { getKeys };
|