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
3
import { Client } from '@atcute/client';
4
import type { Did } from '@atcute/lexicons';
0
5
import {
6
AuthMethodUnsatisfiableError,
7
TokenInvalidError,
···
48
return locals.auth;
49
}
50
51
-
const did = getSignedCookie(cookies, SESSION_COOKIE) as Did | null;
52
if (!did) {
0
0
0
0
0
53
error(401, `not signed in`);
54
}
55
···
2
3
import { Client } from '@atcute/client';
4
import type { Did } from '@atcute/lexicons';
5
+
import { isDid } from '@atcute/lexicons/syntax';
6
import {
7
AuthMethodUnsatisfiableError,
8
TokenInvalidError,
···
49
return locals.auth;
50
}
51
52
+
const did = getSignedCookie(cookies, SESSION_COOKIE);
53
if (!did) {
54
+
error(401, `not signed in`);
55
+
}
56
+
57
+
if (!isDid(did)) {
58
+
cookies.delete(SESSION_COOKIE, { path: '/' });
59
error(401, `not signed in`);
60
}
61