New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@socialgouv/e2esdk-client

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@socialgouv/e2esdk-client - npm Package Compare versions

Comparing version

to
1.0.0-beta.19

4

dist/index.d.ts

@@ -148,4 +148,4 @@ import { PermissionFlags } from '@socialgouv/e2esdk-api';

banUser(userId: string, nameFingerprint: string): Promise<void>;
encrypt<DataType>(input: DataType, nameFingerprint: string): string;
decrypt(ciphertext: string, nameFingerpint: string): unknown;
encrypt<DataType>(input: DataType, nameFingerprint: string, additionalData?: string | Uint8Array): string;
decrypt(ciphertext: string, nameFingerpint: string, additionalData?: string | Uint8Array): unknown;
unsealFormData<FormData extends object>(submission: EncryptedFormSubmission<FormData>, nameFingerpint: string): Record<keyof FormData, unknown>;

@@ -152,0 +152,0 @@ sign(...items: string[]): string;

@@ -7,2 +7,3 @@ import initOpaqueClient, { Registration, Login } from '@47ng/opaque-client';

import mitt from 'mitt';
import secureJSON from 'secure-json-parse';
import { z } from 'zod';

@@ -30,3 +31,3 @@

payloadFingerprint: fingerprintSchema,
cipher: z.string().transform((input) => cipherParser.parse(JSON.parse(input.trim()))),
cipher: z.string().transform((input) => cipherParser.parse(secureJSON.parse(input.trim()))),
createdAt: timestampSchema.transform((value) => new Date(value)),

@@ -247,10 +248,3 @@ expiresAt: timestampSchema.transform((value) => new Date(value)).nullable(),

const mainKeyWrappingCipher = getOpaqueExportCipher(this.sodium, exportKey);
const mainKey = z.instanceof(Uint8Array).parse(
decrypt(
this.sodium,
wrappedMainKey,
mainKeyWrappingCipher,
"application/e2esdk.ciphertext.v1"
)
);
const mainKey = z.instanceof(Uint8Array).parse(decrypt(this.sodium, wrappedMainKey, mainKeyWrappingCipher));
const identity = deriveClientIdentity(this.sodium, userId, mainKey);

@@ -289,8 +283,3 @@ this.sodium.memzero(mainKey);

const mainKey = z.instanceof(Uint8Array).parse(
decrypt(
this.sodium,
device.wrappedMainKey,
mainKeyUnwrappingCipher,
"application/e2esdk.ciphertext.v1"
)
decrypt(this.sodium, device.wrappedMainKey, mainKeyUnwrappingCipher)
);

@@ -336,2 +325,3 @@ this.sodium.memzero(mainKeyUnwrappingCipher.key);

mainKeyRewrappingCipher,
null,
"application/e2esdk.ciphertext.v1"

@@ -350,2 +340,3 @@ );

labelCipher,
null,
"application/e2esdk.ciphertext.v1"

@@ -485,3 +476,9 @@ ) : void 0;

subkeyIndex,
name: encrypt(this.sodium, name, nameCipher, encodedCiphertextFormatV1),
name: encrypt(
this.sodium,
name,
nameCipher,
null,
encodedCiphertextFormatV1
),
payload: encrypt(

@@ -491,2 +488,3 @@ this.sodium,

payloadCipher,
null,
encodedCiphertextFormatV1

@@ -616,2 +614,3 @@ ),

sendTo,
null,
encodedCiphertextFormatV1

@@ -623,2 +622,3 @@ ),

sendTo,
null,
encodedCiphertextFormatV1

@@ -767,3 +767,3 @@ ),

}
encrypt(input, nameFingerprint) {
encrypt(input, nameFingerprint, additionalData) {
if (this.#state.state !== "loaded") {

@@ -785,6 +785,7 @@ throw new Error("Account is locked: cannot encrypt");

currentKey.cipher,
"application/e2esdk.ciphertext.v1"
additionalData ? typeof additionalData === "string" ? this.sodium.from_string(additionalData) : additionalData : null,
encodedCiphertextFormatV1
);
}
decrypt(ciphertext, nameFingerpint) {
decrypt(ciphertext, nameFingerpint, additionalData) {
if (this.#state.state !== "loaded") {

@@ -803,3 +804,3 @@ throw new Error("Account is locked: cannot decrypt");

key.cipher,
"application/e2esdk.ciphertext.v1"
additionalData ? typeof additionalData === "string" ? this.sodium.from_string(additionalData) : additionalData : null
);

@@ -914,8 +915,3 @@ } catch {

name: nameSchema.parse(
decrypt(
this.sodium,
lockedItem.name,
nameCipher,
encodedCiphertextFormatV1
)
decrypt(this.sodium, lockedItem.name, nameCipher)
),

@@ -925,11 +921,4 @@ nameFingerprint: lockedItem.nameFingerprint,

cipher: cipherParser.parse(
JSON.parse(
serializedCipherSchema.parse(
decrypt(
this.sodium,
lockedItem.payload,
payloadCipher,
encodedCiphertextFormatV1
)
).trim()
secureJSON.parse(
serializedCipherSchema.parse(decrypt(this.sodium, lockedItem.payload, payloadCipher)).trim()
)

@@ -1021,8 +1010,3 @@ ),

name: nameSchema.parse(
decrypt(
this.sodium,
sharedKey.name,
withSharedSecret,
encodedCiphertextFormatV1
)
decrypt(this.sodium, sharedKey.name, withSharedSecret)
),

@@ -1032,10 +1016,5 @@ nameFingerprint: sharedKey.nameFingerprint,

cipher: cipherParser.parse(
JSON.parse(
secureJSON.parse(
serializedCipherSchema.parse(
decrypt(
this.sodium,
sharedKey.payload,
withSharedSecret,
encodedCiphertextFormatV1
)
decrypt(this.sodium, sharedKey.payload, withSharedSecret)
).trim()

@@ -1230,3 +1209,3 @@ )

}
return body ? JSON.parse(body) : void 0;
return body ? secureJSON.parse(body) : void 0;
}

@@ -1325,3 +1304,3 @@ #deriveKeychainKeys(subkeyIndex) {

function stateParser(input) {
const result = stateSchema.safeParse(JSON.parse(input));
const result = stateSchema.safeParse(secureJSON.parse(input));
if (!result.success) {

@@ -1328,0 +1307,0 @@ console.error(result.error);

{
"name": "@socialgouv/e2esdk-client",
"version": "1.0.0-beta.18",
"version": "1.0.0-beta.19",
"license": "Apache-2.0",

@@ -45,5 +45,6 @@ "description": "End-to-end encryption client",

"@socialgouv/e2esdk-api": "^1.0.0-beta.10",
"@socialgouv/e2esdk-crypto": "^1.0.0-beta.13",
"@socialgouv/e2esdk-crypto": "^1.0.0-beta.14",
"local-state-sync": "1.0.0-beta.6",
"mitt": "^3.0.0",
"secure-json-parse": "^2.7.0",
"zod": "^3.20.2"

@@ -50,0 +51,0 @@ },

@@ -1,1 +0,1 @@

{"$schema":"https://raw.githubusercontent.com/47ng/sceau/main/src/schemas/v1.schema.json","signature":"247a83064b1cfa151efd0fdd2538dc47d10c3d06404f0d00b30bc43a63df358fa57edeaac2781c101ee204d2f3f1843c4459cf96a3471103c490923acc0eb107","publicKey":"82182691aa16fb18c4ee5f502f9067fe486768391d6ad5baa95e7a68913c9ad9","timestamp":"2023-03-14T13:26:33.130Z","sourceURL":"https://github.com/SocialGouv/e2esdk/tree/19f6ed0bff7074eb2bf7c1f7ff24ccbf68d2fee3","buildURL":"https://github.com/SocialGouv/e2esdk/actions/runs/4416162586","manifest":[{"path":"README.md","hash":"4d045827bb62a85317c226a17beb8fcced4f7464c9cd98b1a9f5454f189d6a5e41da42f1b52183dfe66f166371e9caafb80f170af967d8c7b8999fecd6751c0b","sizeBytes":184,"signature":"73db42e6419b8c7b628e73c87229c182557c258a4ec4ed8a270cb01658fbf7b8d1289288d543bf6a8ec85c9f3836ef8d70f7cba18b38604b128b3973d5bcd009"},{"path":"dist/index.cjs","hash":"6a79a63b3d35387f51f1630d0a3d549063e280bc7059d10c7a10c319a30329167b626de3ea36ba459c5298cac3dea928909fa1cd48d858cb6d923025d7f52adf","sizeBytes":46811,"signature":"1d25dce3b3c3f58ec6fd9e8cd48138e72aad9d13fb26f92cd307f02bd3125b0ae322bae2e04c932429ebb4c81cc35a44d931287ec82fa1cee2b638549fa5ed0f"},{"path":"dist/index.d.ts","hash":"419ef06650044956ac0a2ad1a359b62188c523c7a764d788983ea216ecfdb1c2356a1a65910a18ebc9e6531009b95146a1bccf6bdb29802a51b1d4203207e47f","sizeBytes":6001,"signature":"ff5f639caeb411b7e137440c955e8126bcde983f502e1dcc0f15a77a754cf82ec9d623dc5d7b9078e96ea3cb19bdad4354f2dd6f8aa95db50f42deb4d6c38701"},{"path":"dist/index.js","hash":"424f8dc21d69c6f76890e9aef4a0118b617bf12ab075a2a156204ca308ea520ea1087495e202836f32645ead2f79bdb82dee7ec56b6c6d73a0dfde4f085fc0c7","sizeBytes":45895,"signature":"6dee0b789ec2032b6a659c869d9848e5e8c5e888dbeb9cdd7f115966981d07907c163f3c78cc0c1b2a7be7ef49f6c766904f185150d54cc022a2790aaee79c04"},{"path":"package.json","hash":"5cc317a4d7e00807352a0b588c0c8e05ae36ff32ea0848f5ffac2cf8a7d38aee9377521a56958e3a4f3e2018747375781c340d0f3cf5d54a3176f826dead4100","sizeBytes":1317,"signature":"331ec9659552944fb953996960df9fa99e6d7de020be23869df31fb661ad912c84c566e290cd4f2d8bbd9189b8f6761d1c64ee0b95865318cf079a5016c2b704"}]}
{"$schema":"https://raw.githubusercontent.com/47ng/sceau/main/src/schemas/v1.schema.json","signature":"966dd38aa84b9db1e785145b38b4751e1ca5d27252f4f02dfb8512cfc100e7622e0b93fef4dc9df472b391be2751ebd68af470f27fbbff9c3e90b579e900df09","publicKey":"82182691aa16fb18c4ee5f502f9067fe486768391d6ad5baa95e7a68913c9ad9","timestamp":"2023-03-22T13:14:29.883Z","sourceURL":"https://github.com/SocialGouv/e2esdk/tree/abc0953492e06d4972f5d9b00597b9b1ebc8ed2c","buildURL":"https://github.com/SocialGouv/e2esdk/actions/runs/4490202048","manifest":[{"path":"README.md","hash":"4d045827bb62a85317c226a17beb8fcced4f7464c9cd98b1a9f5454f189d6a5e41da42f1b52183dfe66f166371e9caafb80f170af967d8c7b8999fecd6751c0b","sizeBytes":184,"signature":"73db42e6419b8c7b628e73c87229c182557c258a4ec4ed8a270cb01658fbf7b8d1289288d543bf6a8ec85c9f3836ef8d70f7cba18b38604b128b3973d5bcd009"},{"path":"dist/index.cjs","hash":"fa8b11d3b2994da851bb98914c5abd845218e0aae1bf50d02a81c4347b07d1b2e98d94138c2df55ede01f02381a47f3bd4aa36861f354d7df1bbc0cae047aaac","sizeBytes":46600,"signature":"53fd8afedd75f1e21a9a57cf2b3d95f2921c64433fcae2be472b5bb4e68ecfeaed4f92b714334fa9d425d0f4c5d0b923f96cbe8e94ef3248b37f884d09a49d03"},{"path":"dist/index.d.ts","hash":"7f33422f894a8ba562edbfa9478b482f6974faa17d5405d3f2db2f318f4328aeb2a7180a0d4de259e331faad9af4219c23085c8e5966f56e32efdd4672fee3be","sizeBytes":6077,"signature":"62ddba960a40361d7f50334f19804081ff0f9e4b93684bbc8db2c4b95c23768a22475dd786b8ed17217c226cc884002f38d9533260a550b002fa53b8051ae504"},{"path":"dist/index.js","hash":"65e13fcc9b1f80b498e2a9798f10e20bad9fe5f15e7f3976d37fd95b6bf32d80d54e70f11078a2c7a917d235ea4fdb72cc023a9687e982063f5f9eb5b41caea9","sizeBytes":45720,"signature":"202b5f288abc92356f76154494473e85165bb769ea70ad335709ac5dffeeeb4e098c382ea2c723a4998b3ac5514f8b334c8fb7b2bbe985009c7f025b4fb0de0e"},{"path":"package.json","hash":"df778c7e12a1e88695f59e4dcda370154b7ec129be5c7453262da491ced1f2c600f8d34add52b9183bf1794ba7e3082f72e8b8bd6e012c0fec5811129ae2d76e","sizeBytes":1352,"signature":"7ebf1286d60098c2d21b6f4dea4adb2178cdc8115f76eac24dda4c7394b85a311e7f0ee29ef0811be45fab19363189e108c0c46bc6eb7001fd05db599de08208"}]}

Sorry, the diff of this file is not supported yet