Skip to content

Commit b25471e

Browse files
committed
More conversion fixes
1 parent c19dbd1 commit b25471e

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

remix-auth-rfd/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

remix-auth-rfd/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@oxide/remix-auth-rfd",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"engines": {
55
"node": ">=18"
66
},

remix-auth-rfd/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type RfdScope =
1919
| 'rfd:discussion:r'
2020
| 'search'
2121

22-
export type RfdApiProvider = 'email' | 'google'
22+
export type RfdApiProvider = 'email' | 'google' | 'github'
2323

2424
export type RfdAccessToken = {
2525
iss: string

remix-auth-rfd/src/magic-link.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class InvalidMethod extends Error {}
1818
export class MissingRequiredField extends Error {}
1919
export class RemoteError extends Error {}
2020

21-
export type TurnstileMagicLinkStrategyOptions = {
21+
export type RfdMagicLinkStrategyOptions = {
2222
storage: SessionStorage
2323
host: string
2424
clientSecret: string
@@ -32,21 +32,21 @@ export type TurnstileMagicLinkStrategyOptions = {
3232
scope?: RfdScope[]
3333
}
3434

35-
export type TurnstileMagicLinkVerifyParams = {
35+
export type RfdMagicLinkVerifyParams = {
3636
attemptId: string
3737
email: string
3838
user: GetUserResponse_for_RfdPermission
3939
token: string
4040
}
4141

42-
export class TurnstileMagicLinkStrategy<User> extends Strategy<User, TurnstileMagicLinkVerifyParams> {
42+
export class RfdMagicLinkStrategy<User> extends Strategy<User, RfdMagicLinkVerifyParams> {
4343
public name = 'rfd-magic-link'
4444

4545
// Session based storage to use for storing the client side authentication materials
4646
// for tracking the authentication flow
4747
private readonly storage: SessionStorage
4848

49-
// Turnstile server to perform authentication against
49+
// Rfd server to perform authentication against
5050
private readonly host: string
5151

5252
// Client secret that will be used to exchange magic link codes for user information
@@ -73,11 +73,11 @@ export class TurnstileMagicLinkStrategy<User> extends Strategy<User, TurnstileMa
7373
private readonly sessionAttemptKey: string = 'auth:v-ml:attempt'
7474
private readonly sessionEmailKey: string = 'auth:v-ml:email'
7575

76-
protected verify: Strategy.VerifyFunction<User, TurnstileMagicLinkVerifyParams>
76+
protected verify: Strategy.VerifyFunction<User, RfdMagicLinkVerifyParams>
7777

7878
constructor(
79-
options: TurnstileMagicLinkStrategyOptions,
80-
verify: Strategy.VerifyFunction<User, TurnstileMagicLinkVerifyParams>,
79+
options: RfdMagicLinkStrategyOptions,
80+
verify: Strategy.VerifyFunction<User, RfdMagicLinkVerifyParams>,
8181
) {
8282
super(verify)
8383
this.verify = verify
@@ -151,7 +151,7 @@ export class TurnstileMagicLinkStrategy<User> extends Strategy<User, TurnstileMa
151151
session.set(this.sessionAttemptKey, attemptId)
152152
session.set(this.sessionEmailKey, email)
153153
} catch (err) {
154-
console.error('Turnstile server failed to send magic link email', err)
154+
console.error('RFD server failed to send magic link email', err)
155155
throw new RemoteError('Failed to send magic link email')
156156
}
157157

remix-auth-rfd/src/oauth.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Strategy } from 'remix-auth/strategy'
1313
import { RfdApiProvider, RfdScope } from '.'
1414
import { client, handleApiResponse } from './util'
1515

16-
export type TurnstileOAuthStrategyOptions = {
16+
export type RfdOAuthStrategyOptions = {
1717
host: string
1818
clientId: string
1919
clientSecret: string
@@ -29,12 +29,12 @@ export type ExpiringUser = {
2929
expiresAt: Date
3030
}
3131

32-
export type TurnstileVerifyCallback<T> = Strategy.VerifyFunction<T, OAuth2Strategy.VerifyOptions>
32+
export type RfdVerifyCallback<T> = Strategy.VerifyFunction<T, OAuth2Strategy.VerifyOptions>
3333

34-
export class TurnstileOAuthStrategy<User extends ExpiringUser> extends OAuth2Strategy<
34+
export class RfdOAuthStrategy<User extends ExpiringUser> extends OAuth2Strategy<
3535
User
3636
> {
37-
public name = `turnstile`
37+
public name = `rfd`
3838
protected readonly userInfoUrl
3939
protected readonly host
4040

@@ -46,8 +46,8 @@ export class TurnstileOAuthStrategy<User extends ExpiringUser> extends OAuth2Str
4646
redirectURI,
4747
remoteProvider,
4848
scopes,
49-
}: TurnstileOAuthStrategyOptions,
50-
verify: TurnstileVerifyCallback<User>,
49+
}: RfdOAuthStrategyOptions,
50+
verify: RfdVerifyCallback<User>,
5151
) {
5252
super(
5353
{

remix-auth-rfd/src/util.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Api, { ApiResult } from '@oxide/turnstile.ts/client'
2-
import { ApiWithRetry } from '@oxide/turnstile.ts/client-retry'
1+
import Api, { ApiResult } from '@oxide/rfd.ts/client'
2+
import { ApiWithRetry } from '@oxide/rfd.ts/client-retry'
33

44
const retryOnReset = () => {
55
const limit = 1
@@ -22,10 +22,10 @@ export function handleApiResponse<T>(response: ApiResult<T>): T {
2222
if (response.type === 'success') {
2323
return response.data
2424
} else if (response.type === 'client_error') {
25-
console.error('Failed attempting to send request to turnstile server', response)
25+
console.error('Failed attempting to send request to RFD server', response)
2626
throw response.error as Error
2727
} else {
28-
console.error('Failed attempting to send request to turnstile server', response)
28+
console.error('Failed attempting to send request to RFD server', response)
2929
throw new Error(response.data.message)
3030
}
3131
}

0 commit comments

Comments
 (0)