Skip to content

Commit

Permalink
fix: linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladivo committed Aug 23, 2024
1 parent a02ad87 commit d867e0a
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 52 deletions.
18 changes: 12 additions & 6 deletions apps/account-deletion-website/app/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import {Schema} from '@effect/schema'
import {ecdsa} from '@vexl-next/cryptography'
import {
PrivateKeyHolder,
type PublicKeyPemBase64,
} from '@vexl-next/cryptography/src/KeyHolder'
import {SemverStringE} from '@vexl-next/domain/src/utility/SmeverString.brand'
import {VersionCode} from '@vexl-next/domain/src/utility/VersionCode.brand'
import {
parseJson,
safeParse,
Expand All @@ -21,6 +24,12 @@ import type z from 'zod'

const STORAGE_KEYPAIR_KEY = 'keypair'

const apiMeta = {
clientVersion: Schema.decodeSync(VersionCode)(0),
clientSemver: Schema.decodeSync(SemverStringE)('0.0.1'),
platform: 'WEB' as const,
}

export function saveKeypair(keypair: PrivateKeyHolder): void {
sessionStorage.setItem(STORAGE_KEYPAIR_KEY, JSON.stringify(keypair))
}
Expand Down Expand Up @@ -113,8 +122,7 @@ export function parseFormData<T extends z.ZodType>(
export function createUserPublicApi(): userApi.UserPublicApi {
return userApi.publicApi({
url: getEnvPreset().userMs,
clientVersion: 130,
platform: 'WEB',
...apiMeta,
})
}

Expand All @@ -128,14 +136,13 @@ export function createContactsPrivateApi({
signature: string
}): contactsApi.ContactPrivateApi {
return contactsApi.privateApi({
clientVersion: 130,
getUserSessionCredentials: () => ({
hash,
publicKey,
signature,
}),
platform: 'WEB',
url: getEnvPreset().contactMs,
...apiMeta,
})
}

Expand All @@ -149,13 +156,12 @@ export function createUserPrivateApi({
signature: string
}): userApi.UserPrivateApi {
return userApi.privateApi({
clientVersion: 130,
getUserSessionCredentials: () => ({
hash,
publicKey,
signature,
}),
platform: 'WEB',
url: getEnvPreset().userMs,
...apiMeta,
})
}
2 changes: 2 additions & 0 deletions apps/account-deletion-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@effect/schema": "^0.70.4",
"@remix-run/css-bundle": "^2.8.1",
"@remix-run/express": "^2.8.1",
"@remix-run/node": "^2.8.1",
Expand All @@ -26,6 +27,7 @@
"buffer": "^6.0.3",
"cross-env": "^7.0.3",
"crypto-browserify": "^3.12.0",
"effect": "^3.6.3",
"events": "^3.3.0",
"express": "^4.19.2",
"fp-ts": "^2.13.1",
Expand Down
20 changes: 10 additions & 10 deletions apps/btc-exchange-rate-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
]
},
"dependencies": {
"@effect/experimental": "^0.22.1",
"@effect/opentelemetry": "^0.35.1",
"@effect/platform": "^0.61.4",
"@effect/platform-node": "^0.56.4",
"@effect/schema": "^0.70.2",
"@effect/sql": "^0.8.3",
"@effect/sql-pg": "^0.8.3",
"@effect/experimental": "^0.22.6",
"@effect/opentelemetry": "^0.35.3",
"@effect/platform": "^0.61.8",
"@effect/platform-node": "^0.56.9",
"@effect/schema": "^0.70.4",
"@effect/sql": "^0.8.7",
"@effect/sql-pg": "^0.8.7",
"@opentelemetry/exporter-trace-otlp-http": "^0.52.1",
"@opentelemetry/sdk-trace-node": "^1.23.0",
"@opentelemetry/sdk-trace-web": "^1.23.0",
Expand All @@ -39,9 +39,9 @@
"@vexl-next/rest-api": "0.0.0",
"@vexl-next/server-utils": "0.0.0",
"dotenv": "^16.4.5",
"effect": "^3.6.1",
"effect-http": "^0.77.3",
"effect-http-node": "^0.17.6",
"effect": "^3.6.3",
"effect-http": "^0.77.4",
"effect-http-node": "^0.17.7",
"fast-check": "^3.20.0",
"ioredis": "^5.4.1",
"node-fetch": "^3.3.2"
Expand Down
8 changes: 4 additions & 4 deletions apps/user-service/src/routes/login/domain.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Schema} from '@effect/schema'
import {PublicKeyPemBase64E} from '@vexl-next/cryptography/src/KeyHolder/brands'
import {CountryPrefixE} from '@vexl-next/domain/src/general/CountryPrefix.brand'
import {HashedPhoneNumberE} from '@vexl-next/domain/src/general/HashedPhoneNumber.brand'
import {UnixMillisecondsE} from '@vexl-next/domain/src/utility/UnixMilliseconds.brand'
import {HmacHash} from '@vexl-next/generic-utils/src/effect-helpers/crypto'
import {
PhoneNumberVerificationId,
VerificationChallenge,
Expand All @@ -12,7 +12,7 @@ import {TwilioVerificationSid} from '../../utils/twilio'
export const ChallengeVerificationState = Schema.Struct({
publicKey: PublicKeyPemBase64E,
countryPrefix: CountryPrefixE,
phoneNumber: HmacHash,
phoneNumber: HashedPhoneNumberE,
expiresAt: UnixMillisecondsE,
challenge: VerificationChallenge,
})
Expand All @@ -26,15 +26,15 @@ export const PhoneVerificationState = Schema.Union(
id: PhoneNumberVerificationId,
type: Schema.Literal('twilioSmsVerification'),
sid: TwilioVerificationSid,
phoneNumber: HmacHash,
phoneNumber: HashedPhoneNumberE,
countryPrefix: CountryPrefixE,
expiresAt: UnixMillisecondsE,
}),
Schema.Struct({
id: PhoneNumberVerificationId,
type: Schema.Literal('staticCodeVerification'),
code: Schema.String,
phoneNumber: HmacHash,
phoneNumber: HashedPhoneNumberE,
countryPrefix: CountryPrefixE,
expiresAt: UnixMillisecondsE,
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {type PublicKeyPemBase64} from '@vexl-next/cryptography/src/KeyHolder'
import {
ConnectionLevel,
type ConnectionLevel,
type IntendedConnectionLevel,
} from '@vexl-next/domain/src/general/offers'
import {type ContactPrivateApi} from '@vexl-next/rest-api/src/services/contact'
Expand Down
4 changes: 2 additions & 2 deletions packages/rest-api/src/services/location/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {SemverString} from '@vexl-next/domain/src/utility/SmeverString.brand'
import {VersionCode} from '@vexl-next/domain/src/utility/VersionCode.brand'
import {type SemverString} from '@vexl-next/domain/src/utility/SmeverString.brand'
import {type VersionCode} from '@vexl-next/domain/src/utility/VersionCode.brand'
import {type CreateAxiosDefaults, type GenericAbortSignal} from 'axios'
import * as TE from 'fp-ts/TaskEither'
import {pipe} from 'fp-ts/function'
Expand Down
4 changes: 2 additions & 2 deletions packages/rest-api/src/services/user/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {SemverString} from '@vexl-next/domain/src/utility/SmeverString.brand'
import {VersionCode} from '@vexl-next/domain/src/utility/VersionCode.brand'
import {type SemverString} from '@vexl-next/domain/src/utility/SmeverString.brand'
import {type VersionCode} from '@vexl-next/domain/src/utility/VersionCode.brand'
import {type CreateAxiosDefaults} from 'axios'
import * as TE from 'fp-ts/TaskEither'
import {pipe} from 'fp-ts/function'
Expand Down
8 changes: 3 additions & 5 deletions packages/rest-api/src/services/user/specification.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {Schema} from '@effect/schema'
import {PublicKeyPemBase64E} from '@vexl-next/cryptography/src/KeyHolder/brands'
import {E164PhoneNumberE} from '@vexl-next/domain/src/general/E164PhoneNumber.brand'
import {HashedPhoneNumberE} from '@vexl-next/domain/src/general/HashedPhoneNumber.brand'
import {IsoDatetimeStringE} from '@vexl-next/domain/src/utility/IsoDatetimeString.brand'
import {
EcdsaSignature,
HmacHash,
} from '@vexl-next/generic-utils/src/effect-helpers/crypto'
import {EcdsaSignature} from '@vexl-next/generic-utils/src/effect-helpers/crypto'
import {Api, ApiGroup} from 'effect-http'
import {ServerSecurity} from '../../apiSecurity'
import {SubmitFeedbackRequest} from '../feedback/specification'
Expand Down Expand Up @@ -129,7 +127,7 @@ export class VerifyChallengeRequest extends Schema.Class<VerifyChallengeRequest>
export class VerifyChallengeResponse extends Schema.Class<VerifyChallengeResponse>(
'VerifyChallengeResponse'
)({
hash: HmacHash,
hash: HashedPhoneNumberE,
signature: EcdsaSignature,
challengeVerified: Schema.Literal(true),
}) {}
Expand Down
4 changes: 2 additions & 2 deletions packages/rest-api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"rootDir": "./src",
"rootDir": ".",
"outDir": "./dist",
"lib": ["ESNext"],
"module": "ESNext",
Expand All @@ -23,5 +23,5 @@
"noUncheckedIndexedAccess": true
},
"exclude": ["./dist/**", "./tests/**", "node_modules"],
"include": ["./src"]
"include": ["./src", "./jest.config.ts"]
}
42 changes: 22 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4623,7 +4623,7 @@ __metadata:
languageName: node
linkType: hard

"@effect/experimental@npm:^0.22.1, @effect/experimental@npm:^0.22.6":
"@effect/experimental@npm:^0.22.6":
version: 0.22.6
resolution: "@effect/experimental@npm:0.22.6"
dependencies:
Expand All @@ -4649,7 +4649,7 @@ __metadata:
languageName: node
linkType: hard

"@effect/opentelemetry@npm:^0.35.1, @effect/opentelemetry@npm:^0.35.3":
"@effect/opentelemetry@npm:^0.35.3":
version: 0.35.3
resolution: "@effect/opentelemetry@npm:0.35.3"
peerDependencies:
Expand Down Expand Up @@ -4687,7 +4687,7 @@ __metadata:
languageName: node
linkType: hard

"@effect/platform-node@npm:^0.56.4, @effect/platform-node@npm:^0.56.9":
"@effect/platform-node@npm:^0.56.9":
version: 0.56.9
resolution: "@effect/platform-node@npm:0.56.9"
dependencies:
Expand All @@ -4702,7 +4702,7 @@ __metadata:
languageName: node
linkType: hard

"@effect/platform@npm:^0.61.4, @effect/platform@npm:^0.61.8":
"@effect/platform@npm:^0.61.8":
version: 0.61.8
resolution: "@effect/platform@npm:0.61.8"
dependencies:
Expand All @@ -4715,7 +4715,7 @@ __metadata:
languageName: node
linkType: hard

"@effect/schema@npm:^0.70.2, @effect/schema@npm:^0.70.4":
"@effect/schema@npm:^0.70.4":
version: 0.70.4
resolution: "@effect/schema@npm:0.70.4"
dependencies:
Expand All @@ -4726,7 +4726,7 @@ __metadata:
languageName: node
linkType: hard

"@effect/sql-pg@npm:^0.8.3, @effect/sql-pg@npm:^0.8.7":
"@effect/sql-pg@npm:^0.8.7":
version: 0.8.7
resolution: "@effect/sql-pg@npm:0.8.7"
dependencies:
Expand All @@ -4740,7 +4740,7 @@ __metadata:
languageName: node
linkType: hard

"@effect/sql@npm:^0.8.3, @effect/sql@npm:^0.8.7":
"@effect/sql@npm:^0.8.7":
version: 0.8.7
resolution: "@effect/sql@npm:0.8.7"
dependencies:
Expand Down Expand Up @@ -12327,13 +12327,13 @@ __metadata:
version: 0.0.0-use.local
resolution: "@vexl-next/btc-exchange-rate-service@workspace:apps/btc-exchange-rate-service"
dependencies:
"@effect/experimental": ^0.22.1
"@effect/opentelemetry": ^0.35.1
"@effect/platform": ^0.61.4
"@effect/platform-node": ^0.56.4
"@effect/schema": ^0.70.2
"@effect/sql": ^0.8.3
"@effect/sql-pg": ^0.8.3
"@effect/experimental": ^0.22.6
"@effect/opentelemetry": ^0.35.3
"@effect/platform": ^0.61.8
"@effect/platform-node": ^0.56.9
"@effect/schema": ^0.70.4
"@effect/sql": ^0.8.7
"@effect/sql-pg": ^0.8.7
"@opentelemetry/exporter-trace-otlp-http": ^0.52.1
"@opentelemetry/sdk-trace-node": ^1.23.0
"@opentelemetry/sdk-trace-web": ^1.23.0
Expand All @@ -12351,9 +12351,9 @@ __metadata:
"@vexl-next/server-utils": 0.0.0
"@vexl-next/tsconfig": 0.0.0
dotenv: ^16.4.5
effect: ^3.6.1
effect-http: ^0.77.3
effect-http-node: ^0.17.6
effect: ^3.6.3
effect-http: ^0.77.4
effect-http-node: ^0.17.7
esbuild: ^0.17.16
eslint: ^8.50.0
fast-check: ^3.20.0
Expand Down Expand Up @@ -13301,6 +13301,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "account-deletion-website@workspace:apps/account-deletion-website"
dependencies:
"@effect/schema": ^0.70.4
"@remix-run/css-bundle": ^2.8.1
"@remix-run/dev": ^2.8.1
"@remix-run/express": ^2.8.1
Expand All @@ -13325,6 +13326,7 @@ __metadata:
buffer: ^6.0.3
cross-env: ^7.0.3
crypto-browserify: ^3.12.0
effect: ^3.6.3
eslint: ^8.50.0
events: ^3.3.0
express: ^4.19.2
Expand Down Expand Up @@ -17133,7 +17135,7 @@ __metadata:
languageName: node
linkType: hard

"effect-http-node@npm:^0.17.6, effect-http-node@npm:^0.17.7":
"effect-http-node@npm:^0.17.7":
version: 0.17.7
resolution: "effect-http-node@npm:0.17.7"
dependencies:
Expand All @@ -17148,7 +17150,7 @@ __metadata:
languageName: node
linkType: hard

"effect-http@npm:^0.77.3, effect-http@npm:^0.77.4":
"effect-http@npm:^0.77.4":
version: 0.77.4
resolution: "effect-http@npm:0.77.4"
peerDependencies:
Expand All @@ -17159,7 +17161,7 @@ __metadata:
languageName: node
linkType: hard

"effect@npm:^3.6.1, effect@npm:^3.6.3":
"effect@npm:^3.6.3":
version: 3.6.3
resolution: "effect@npm:3.6.3"
checksum: 7d3498f5f4aab752a55d73ada475a38f8d18d4fa0a379673c25a14add2fab66a72ba88070a876ced7d4160366b0c9efb02c6cf6e761a8a0850e975927ea14164
Expand Down

0 comments on commit d867e0a

Please sign in to comment.