Skip to content

Commit d629614

Browse files
committed
fu
1 parent aea2a08 commit d629614

File tree

5 files changed

+56
-48
lines changed

5 files changed

+56
-48
lines changed

config/tsconfig/tsconfig.base.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
"compilerOptions": {
44
// Type checking
55
"strict": true,
6+
"baseUrl": ".",
7+
"paths": {
8+
"@socialgouv/e2esdk-api": ["../../packages/api/src"],
9+
"@socialgouv/e2esdk-api/*": ["../../packages/api/src/*"],
10+
"@socialgouv/e2esdk-client": ["../../packages/client/src"],
11+
"@socialgouv/e2esdk-client/*": ["../../packages/client/src/*"],
12+
"@socialgouv/e2esdk-crypto": ["../../packages/crypto/src"],
13+
"@socialgouv/e2esdk-crypto/*": ["../../packages/crypto/src/*"],
14+
"@socialgouv/e2esdk-devtools": ["../../packages/devtools/src"],
15+
"@socialgouv/e2esdk-devtools/*": ["../../packages/devtools/src/*"],
16+
"@socialgouv/e2esdk-generator": ["../../packages/generator/src"],
17+
"@socialgouv/e2esdk-generator/*": ["../../packages/generator/src/*"],
18+
"@socialgouv/e2esdk-react": ["../../packages/react/src"],
19+
"@socialgouv/e2esdk-react/*": ["../../packages/react/src/*"],
20+
"@socialgouv/e2esdk-server": ["../../packages/server/src"],
21+
"@socialgouv/e2esdk-server/*": ["../../packages/server/src/*"]
22+
},
623

724
// Modules
825
"module": "ESNext",

packages/crypto/src/form/state.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { thirtyTwoBytesBase64Schema } from '@socialgouv/e2esdk-api'
2-
import type { KeyPair } from 'libsodium-wrappers'
32
import { base64UrlDecode, base64UrlEncode } from '../shared/codec'
43
import { Sodium, sodium } from '../sodium/sodium'
54

@@ -61,7 +60,10 @@ export type EncryptedFormLocalState = {
6160
/**
6261
* Signature key pair to authenticate response submissions
6362
*/
64-
identity: Omit<KeyPair, 'keyType'>
63+
identity: {
64+
publicKey: Uint8Array
65+
privateKey: Uint8Array
66+
}
6567
}
6668

6769
const storageKey = (namespace: string) => `e2esdk:forms:localState:${namespace}`

packages/crypto/src/sodium/files.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ export function decryptFileContents(
111111
const ciphertextSlice = ciphertext.slice(start, end)
112112
const clearText = sodium.crypto_secretstream_xchacha20poly1305_pull(
113113
state,
114-
ciphertextSlice
114+
ciphertextSlice,
115+
null
115116
)
116-
if (!clearText.message) {
117+
if (!clearText || !clearText.message) {
117118
throw new Error('Failed to decrypt file')
118119
}
119120
clearTextBuffer.set(clearText.message, chunkIndex * chunkSize)

packages/crypto/src/sodium/identity.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { KeyPair } from 'libsodium-wrappers'
21
import {
32
multipartSignature,
43
verifyMultipartSignature,
@@ -14,8 +13,14 @@ export function generateMainKey(sodium: Sodium) {
1413
type ClientIdentity = {
1514
userId: string
1615
keychainBaseKey: Uint8Array
17-
sharing: Omit<KeyPair, 'keyType'>
18-
signature: Omit<KeyPair, 'keyType'>
16+
sharing: {
17+
publicKey: Uint8Array
18+
privateKey: Uint8Array
19+
}
20+
signature: {
21+
publicKey: Uint8Array
22+
privateKey: Uint8Array
23+
}
1924
proof: string
2025
}
2126

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)