mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-20 06:54:20 +01:00
Allow posting a status to Nostr
This commit is contained in:
17
src/utils.ts
Normal file
17
src/utils.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user