File tree Expand file tree Collapse file tree 5 files changed +56
-48
lines changed
Expand file tree Collapse file tree 5 files changed +56
-48
lines changed Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 11import { thirtyTwoBytesBase64Schema } from '@socialgouv/e2esdk-api'
2- import type { KeyPair } from 'libsodium-wrappers'
32import { base64UrlDecode , base64UrlEncode } from '../shared/codec'
43import { 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
6769const storageKey = ( namespace : string ) => `e2esdk:forms:localState:${ namespace } `
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change 1- import type { KeyPair } from 'libsodium-wrappers'
21import {
32 multipartSignature ,
43 verifyMultipartSignature ,
@@ -14,8 +13,14 @@ export function generateMainKey(sodium: Sodium) {
1413type 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
You can’t perform that action at this time.
0 commit comments