@socialgouv/e2esdk-client
Advanced tools
Comparing version
@@ -94,4 +94,2 @@ import { PermissionFlags } from '@socialgouv/e2esdk-api'; | ||
getEnrolledDevices(): Promise<{ | ||
enrolledFrom?: string | undefined; | ||
label?: string | undefined; | ||
id: string; | ||
@@ -103,2 +101,4 @@ createdAt: string; | ||
}[]; | ||
enrolledFrom?: string | undefined; | ||
label?: string | undefined; | ||
}[]>; | ||
@@ -105,0 +105,0 @@ createKey(label: string, algorithm: 'secretBox' | 'sealedBox', expiresAt?: Date): Promise<KeychainItemMetadata>; |
@@ -124,2 +124,3 @@ import initOpaqueClient, { Registration, Login } from '@47ng/opaque-client'; | ||
} | ||
// Event Emitter -- | ||
on(event, callback) { | ||
@@ -129,2 +130,3 @@ this.#mitt.on(event, callback); | ||
} | ||
// Auth -- | ||
async signup(userId) { | ||
@@ -269,2 +271,3 @@ await this.sodium.ready; | ||
} | ||
// Devices -- | ||
async enrollNewDevice(label) { | ||
@@ -402,2 +405,3 @@ await this.sodium.ready; | ||
} | ||
// Key Ops -- | ||
async createKey(label, algorithm, expiresAt) { | ||
@@ -414,3 +418,3 @@ await this.sodium.ready; | ||
cipher, | ||
createdAt: new Date(), | ||
createdAt: /* @__PURE__ */ new Date(), | ||
expiresAt, | ||
@@ -436,3 +440,3 @@ sharedBy: null | ||
expiresAt, | ||
createdAt: new Date(), | ||
createdAt: /* @__PURE__ */ new Date(), | ||
sharedBy: null | ||
@@ -444,3 +448,3 @@ }); | ||
cipher, | ||
createdAt = new Date(), | ||
createdAt = /* @__PURE__ */ new Date(), | ||
expiresAt = null, | ||
@@ -577,2 +581,3 @@ sharedBy = null | ||
} | ||
// Sharing -- | ||
async shareKey(nameFingerprint, to, { expiresAt } = {}) { | ||
@@ -666,2 +671,3 @@ await this.sodium.ready; | ||
} | ||
// User Ops -- | ||
get publicIdentity() { | ||
@@ -747,2 +753,3 @@ if (this.#state.state !== "loaded") { | ||
} | ||
// Permissions -- | ||
async getPermissions(nameFingerpint) { | ||
@@ -767,2 +774,3 @@ const url = `/v1/permissions/${nameFingerpint}`; | ||
} | ||
// Encryption / Decryption -- | ||
encrypt(input, nameFingerprint, additionalData) { | ||
@@ -832,2 +840,3 @@ if (this.#state.state !== "loaded") { | ||
} | ||
// Signature -- | ||
sign(...items) { | ||
@@ -856,2 +865,5 @@ if (this.#state.state !== "loaded") { | ||
} | ||
// Helpers -- | ||
// We're not using the sodium conversions because those need it | ||
// to be ready, and we want to be able to encode/decode at any time. | ||
encode(input) { | ||
@@ -863,2 +875,3 @@ return base64UrlEncode(input); | ||
} | ||
// Internal APIs -- | ||
#verifySelfIdentity() { | ||
@@ -1049,3 +1062,3 @@ if (this.#state.state !== "loaded") { | ||
} | ||
const timestamp = new Date().toISOString(); | ||
const timestamp = (/* @__PURE__ */ new Date()).toISOString(); | ||
const url = new URL("/v1/notifications", this.config.serverURL); | ||
@@ -1065,2 +1078,6 @@ url.protocol = url.protocol.replace("http", "ws"); | ||
method: "GET", | ||
// Note that we sign the URL before applying the signature | ||
// into the querystring (otherwise we'd be running in circles), | ||
// so the server will do the same thing for verification. | ||
// See packages/server/src/plugins/auth.ts | ||
url: url.toString(), | ||
@@ -1122,3 +1139,3 @@ recipientPublicKey: this.config.serverPublicKey, | ||
const json = body ? JSON.stringify(body) : void 0; | ||
const timestamp = new Date().toISOString(); | ||
const timestamp = (/* @__PURE__ */ new Date()).toISOString(); | ||
const signatureItems = { | ||
@@ -1211,2 +1228,3 @@ timestamp, | ||
} | ||
// -- | ||
#deriveKeychainKeys(subkeyIndex) { | ||
@@ -1239,2 +1257,3 @@ if (this.#state.state !== "loaded") { | ||
} | ||
// Persistance & cross-tab communication -- | ||
#clearState() { | ||
@@ -1339,2 +1358,3 @@ this.#stopWebSocket("logout"); | ||
expiresAt: item.expiresAt, | ||
// Remove the 32 bytes base64-encoded plus separator `:` | ||
label: item.name.slice(NAME_PREFIX_LENGTH_CHARS), | ||
@@ -1341,0 +1361,0 @@ nameFingerprint: item.nameFingerprint, |
{ | ||
"name": "@socialgouv/e2esdk-client", | ||
"version": "1.0.0-beta.19", | ||
"version": "1.0.0-beta.20", | ||
"license": "Apache-2.0", | ||
@@ -44,8 +44,8 @@ "description": "End-to-end encryption client", | ||
"@47ng/opaque-client": "^2.1.4", | ||
"@socialgouv/e2esdk-api": "^1.0.0-beta.10", | ||
"@socialgouv/e2esdk-crypto": "^1.0.0-beta.14", | ||
"@socialgouv/e2esdk-api": "^1.0.0-beta.11", | ||
"@socialgouv/e2esdk-crypto": "^1.0.0-beta.15", | ||
"local-state-sync": "1.0.0-beta.6", | ||
"mitt": "^3.0.0", | ||
"secure-json-parse": "^2.7.0", | ||
"zod": "^3.20.2" | ||
"zod": "^3.21.4" | ||
}, | ||
@@ -55,5 +55,5 @@ "devDependencies": { | ||
"sceau": "^1.3.0", | ||
"tsup": "^6.5.0", | ||
"typescript": "^4.9.4" | ||
"tsup": "^6.7.0", | ||
"typescript": "^4.9.5" | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
{"$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"}]} | ||
{"$schema":"https://raw.githubusercontent.com/47ng/sceau/main/src/schemas/v1.schema.json","signature":"291f27e100f3d722fecbc960191ea204c4e60a020731b2f5201919919bbf1fbf92654e3261f4c7530c2ad08c3729a5b34be84d1aa902cca9ea9ef36f1f1b3507","publicKey":"82182691aa16fb18c4ee5f502f9067fe486768391d6ad5baa95e7a68913c9ad9","timestamp":"2023-03-22T13:58:56.225Z","sourceURL":"https://github.com/SocialGouv/e2esdk/tree/574e6ef8c41e71b8db078a59565e8e631823e9b6","buildURL":"https://github.com/SocialGouv/e2esdk/actions/runs/4490605706","manifest":[{"path":"README.md","hash":"4d045827bb62a85317c226a17beb8fcced4f7464c9cd98b1a9f5454f189d6a5e41da42f1b52183dfe66f166371e9caafb80f170af967d8c7b8999fecd6751c0b","sizeBytes":184,"signature":"73db42e6419b8c7b628e73c87229c182557c258a4ec4ed8a270cb01658fbf7b8d1289288d543bf6a8ec85c9f3836ef8d70f7cba18b38604b128b3973d5bcd009"},{"path":"dist/index.cjs","hash":"4341f05178c2e9cd723c826e4f55064bac85760e3f18998b0ca20a71be4f7bb0e27d70d0fb739ebefbbb9c8972532bacad72bae0493ee677ea8259d1a27332bf","sizeBytes":47805,"signature":"b309b243c786906eb27625fb90b4bd72f854dde0421ba65680ad4bf0c9e4d0b91d08b48815a8373e03ba597b2794bcb4e3fc5ef296576fc6664da43a70914406"},{"path":"dist/index.d.ts","hash":"ef070c076de9108201e24ee54b707ded3d4c4dc59996931af65bf7aa8a30b05e54343b80cbceeaf4233c55a0c95f68c7a5a0b1e3edf4c9eedc9a1a0877496487","sizeBytes":6077,"signature":"5cb33fc35e5e02302b093c16d3c360c74a28313bf5dabd5c723b83c651e72d5eaaf9f6274db5d2fdde69141973c16ed17d01e66f2b47acca14c91e573c3b7500"},{"path":"dist/index.js","hash":"c1cace74ad18c0c4d01f7a6a6690ca2fc06f6c2606f78109e06a99b67a356d20cfdffe39e6673dccd11891dfe2d3e39b5ef50e3fad3226091132a42652ac061c","sizeBytes":46520,"signature":"46b7fd11fcfe2a58b7831c74e900dc53c7bf2a9f0ecb8803630e6d309d304f4f641e678c126c841d3dc93f06be0e9b28b71e125bf7deaa667dbac1f07fc28005"},{"path":"package.json","hash":"12887414445b6856eb965c5ca9a44ff33cdd056af318470d8922d844c8cfd03a205c2279621b69a21a1a613e56738a7b3beb890887e0b2ec6ac8dbfa4ef5a623","sizeBytes":1352,"signature":"8535364ca8d04bf7d4cca17a3fb758148f7a623dc3b1e6d06f925f970fe0fb3ac2a43740fa867d74187400924dda1237ccd7df75f67784bb768a0ed0d86ece04"}]} |
Sorry, the diff of this file is not supported yet
104087
1.96%2881
1.55%