{"id":23174355,"url":"https://github.com/dracoon/dracoon-javascript-crypto-sdk","last_synced_at":"2026-01-27T10:35:36.499Z","repository":{"id":57109586,"uuid":"348758762","full_name":"dracoon/dracoon-javascript-crypto-sdk","owner":"dracoon","description":"Official DRACOON SDK for JavaScript","archived":false,"fork":false,"pushed_at":"2025-12-03T15:08:10.000Z","size":903,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-06T18:50:48.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dracoon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-03-17T15:26:16.000Z","updated_at":"2025-12-03T15:08:13.000Z","dependencies_parsed_at":"2022-08-20T17:40:46.722Z","dependency_job_id":"41536779-1baf-4304-b8a4-c8356989e2de","html_url":"https://github.com/dracoon/dracoon-javascript-crypto-sdk","commit_stats":{"total_commits":31,"total_committers":3,"mean_commits":"10.333333333333334","dds":"0.19354838709677424","last_synced_commit":"9b52d0ccb28c96fd0a43cf74933b5a2c659ceecc"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/dracoon/dracoon-javascript-crypto-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dracoon%2Fdracoon-javascript-crypto-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dracoon%2Fdracoon-javascript-crypto-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dracoon%2Fdracoon-javascript-crypto-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dracoon%2Fdracoon-javascript-crypto-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dracoon","download_url":"https://codeload.github.com/dracoon/dracoon-javascript-crypto-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dracoon%2Fdracoon-javascript-crypto-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28812142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T07:41:26.337Z","status":"ssl_error","status_checked_at":"2026-01-27T07:41:08.776Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-18T05:19:56.164Z","updated_at":"2026-01-27T10:35:36.477Z","avatar_url":"https://github.com/dracoon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/dracoon/dracoon-javascript-crypto-sdk/actions/workflows/main.yml/badge.svg)](https://github.com/dracoon/dracoon-javascript-crypto-sdk/actions)\n[![Node version](https://img.shields.io/npm/v/@dracoon-official/crypto-sdk)](https://npmjs.com/package/@dracoon-official/crypto-sdk)\n\n# Dracoon JavaScript Crypto SDK\n\nA library which implements the client-side encryption of Dracoon.\n\n# Introduction\n\nA document which describes the client-side encryption in detail can be found here:\n\nhttps://support.dracoon.com/hc/en-us/articles/360000986345\n\n# System Requirements\n\nThe following Browser versions are officially supported:\n\n-   Chrome v89+\n-   Edge v89+\n-   Firefox v87+\n-   Safari v14+\n\nThe following Node versions are officially supported:\n\n-   Node v16+\n\nOlder Browser/Node versions might still work, but have not been tested.\n\n# Setup\n\n#### Download \u0026 Installation\n\nThe package is available on the [npm Registry](https://npmjs.com/package/@dracoon-official/crypto-sdk) and can be installed using `npm`.\n\n```shell\nnpm install --save @dracoon-official/crypto-sdk\n```\n\n##### Import\n\nCommonJS\n\n```javascript\nconst { Crypto } = require('@dracoon-official/crypto-sdk');\n```\n\nES Modules\n\n```javascript\nimport { Crypto } from '@dracoon-official/crypto-sdk';\n```\n\n# Example\n\nAn example can be found here: `example/program.js`\n\nThe example shows the complete encryption/decryption workflow, including key generation and key operations.\n\nIMPORTANT: please create a new file key for every file you encrypt!\nIMPORTANT: please call doFinal() to complete decryption BEFORE using the decrypted data!\n\n```javascript\nimport { Crypto, EncryptedDataContainer, PlainDataContainer, PlainFileKeyVersion, UserKeyPairVersion } from '@dracoon-official/crypto-sdk';\n\n/**\n * This file shows how to use the Dracoon JavaScript Crypto SDK.\n * For the sake of simplicity, error handling is ignored.\n *\n * IMPORTANT: please create a new file key for every file you encrypt!\n * IMPORTANT: please call doFinal() to complete decryption BEFORE using the decrypted data!\n */\n\nconst CHUNK_SIZE_BYTES = 16;\nconst DATA = new Uint8Array(CHUNK_SIZE_BYTES ** 2);\nconst USER_PASSWORD = 'Password1234!';\n\n/**\n * Shows a complete encryption/decryption workflow.\n */\nconst performEncryptionDecryptionWorkflow = async () =\u003e {\n    // Get plain data\n    const plainData = new Uint8Array([...DATA]);\n    console.log('plainData', plainData);\n\n    // --- KEY GENERATION ---\n    // Generate key pair\n    const userKeyPair = await Crypto.generateUserKeyPair(UserKeyPairVersion.RSA4096, USER_PASSWORD);\n    // Generate plain file key\n    const plainFileKey = Crypto.generateFileKey(PlainFileKeyVersion.AES256GCM);\n\n    // --- ENCRYPTION ---\n    // Perform Encryption\n    const encryptedData = performEncryption(plainFileKey, plainData);\n    console.log('encryptedData', encryptedData);\n\n    // --- KEY OPERATIONS ---\n    // Encrypt file key\n    const encryptedFileKey = Crypto.encryptFileKey(plainFileKey, userKeyPair.publicKeyContainer);\n    // Check password\n    const success = await Crypto.checkUserKeyPairAsync(userKeyPair, USER_PASSWORD);\n    if (!success) {\n        console.log('wrong password');\n        return;\n    }\n    // Decrypt private key\n    const plainUserKeyPair = await Crypto.decryptPrivateKeyAsync(userKeyPair, USER_PASSWORD);\n    // Decrypt file key\n    const decryptedFileKey = Crypto.decryptFileKey(encryptedFileKey, plainUserKeyPair.privateKeyContainer);\n\n    // --- DECRYPTION ---\n    // Perform Decryption\n    const decryptedData = performDecryption(decryptedFileKey, encryptedData);\n    console.log('decryptedData', decryptedData);\n};\n\n/**\n * Shows the encryption workflow.\n */\nconst performEncryption = (plainFileKey, plainData) =\u003e {\n    // Generate file encryption cipher\n    const fileEncryptionCipher = Crypto.createFileEncryptionCipher(plainFileKey);\n\n    // Split up data into chunks\n    const plainChunks = [];\n    for (let startIndex = 0; startIndex \u003c plainData.length; startIndex += CHUNK_SIZE_BYTES) {\n        const endIndex = startIndex + CHUNK_SIZE_BYTES;\n        plainChunks.push(plainData.slice(startIndex, endIndex));\n    }\n\n    // Encrypt chunks\n    const encryptedChunks = [];\n    plainChunks.forEach((chunk) =\u003e {\n        const encryptedDataContainer = fileEncryptionCipher.processBytes(new PlainDataContainer(chunk));\n        encryptedChunks.push(encryptedDataContainer.getContent());\n    });\n\n    // Complete encryption and get authentication tag\n    plainFileKey.tag = fileEncryptionCipher.doFinal().getTag();\n\n    // Concatenate encrypted chunks\n    const concatenatedChunks = [];\n    encryptedChunks.forEach((chunk) =\u003e {\n        concatenatedChunks.push(...chunk);\n    });\n    const encryptedData = new Uint8Array(concatenatedChunks);\n\n    return encryptedData;\n};\n\n/**\n * Shows the decryption workflow.\n */\nconst performDecryption = (plainFileKey, encryptedData) =\u003e {\n    // Create file decryption cipher\n    const fileDecryptionCipher = Crypto.createFileDecryptionCipher(plainFileKey);\n\n    // Split up data into chunks\n    const encryptedChunks = [];\n    for (let startIndex = 0; startIndex \u003c encryptedData.length; startIndex += CHUNK_SIZE_BYTES) {\n        const endIndex = startIndex + CHUNK_SIZE_BYTES;\n        encryptedChunks.push(encryptedData.slice(startIndex, endIndex));\n    }\n\n    // Decrypt chunks\n    const decryptedChunks = [];\n    encryptedChunks.forEach((chunk) =\u003e {\n        const plainDataContainer = fileDecryptionCipher.processBytes(new EncryptedDataContainer(chunk));\n        decryptedChunks.push(plainDataContainer.getContent());\n    });\n\n    // Complete decryption and get final chunk\n    const plainDataContainer = fileDecryptionCipher.doFinal();\n    decryptedChunks.push(plainDataContainer.getContent());\n\n    // Concatenate decrypted chunks\n    const concatenatedChunks = [];\n    decryptedChunks.forEach((chunk) =\u003e {\n        concatenatedChunks.push(...chunk);\n    });\n    const decryptedData = new Uint8Array(concatenatedChunks);\n\n    return decryptedData;\n};\n\nperformEncryptionDecryptionWorkflow();\n```\n\n# Copyright and License\n\nCopyright 2021 Dracoon GmbH. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the\nLicense. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an\n\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific\nlanguage governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdracoon%2Fdracoon-javascript-crypto-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdracoon%2Fdracoon-javascript-crypto-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdracoon%2Fdracoon-javascript-crypto-sdk/lists"}