tangled
alpha
login
or
join now
mary.my.id
/
atcute-statusphere-example
19
fork
atom
Statusphere, but in atcute and SvelteKit
atproto
svelte
sveltekit
drizzle
atcute
typescript
19
fork
atom
overview
issues
pulls
pipelines
refactor: ensure cookie value is a DID
mary.my.id
2 months ago
62e82381
7aad04c5
verified
This commit was signed with the committer's
known signature
.
mary.my.id
SSH Key Fingerprint:
SHA256:ZlTP/auFSGpGnaoDg4mCTG1g9OZvXp62jWR4c6H4O3c=
+7
-1
1 changed file
expand all
collapse all
unified
split
src
lib
server
auth
index.ts
+7
-1
src/lib/server/auth/index.ts
···
2
2
3
3
import { Client } from '@atcute/client';
4
4
import type { Did } from '@atcute/lexicons';
5
5
+
import { isDid } from '@atcute/lexicons/syntax';
5
6
import {
6
7
AuthMethodUnsatisfiableError,
7
8
TokenInvalidError,
···
48
49
return locals.auth;
49
50
}
50
51
51
51
-
const did = getSignedCookie(cookies, SESSION_COOKIE) as Did | null;
52
52
+
const did = getSignedCookie(cookies, SESSION_COOKIE);
52
53
if (!did) {
54
54
+
error(401, `not signed in`);
55
55
+
}
56
56
+
57
57
+
if (!isDid(did)) {
58
58
+
cookies.delete(SESSION_COOKIE, { path: '/' });
53
59
error(401, `not signed in`);
54
60
}
55
61