{"_id":"@ably/encrypted-channels-react-native-polyfills","_rev":"5-18327a9886ec6b7d082cb8187fb3a534","name":"@ably/encrypted-channels-react-native-polyfills","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@ably/encrypted-channels-react-native-polyfills","version":"0.0.1","keywords":["ably","react-native","crypto","polyfills","encryption"],"author":{"name":"Ably"},"license":"Apache-2.0","_id":"@ably/encrypted-channels-react-native-polyfills@0.0.1","maintainers":[{"name":"mschristensen","email":"mike@christensen.codes"},{"name":"ably-realtime","email":"account.owners@ably.com"},{"name":"simonw_ably","email":"simon.woolf@ably.com"},{"name":"owenpearson","email":"owen.pearson@ably.com"},{"name":"hingasellu","email":"hingasellu@gmail.com"},{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},{"name":"andrii.bulat.ably","email":"andrii.bulat@ably.com"},{"name":"andytwf","email":"andyford993@gmail.com"},{"name":"splind06","email":"steven.lindsay@ably.com"},{"name":"zariel-ably","email":"chris.bannister@ably.com"},{"name":"mattheworiordan","email":"matthew.oriordan@gmail.com"},{"name":"vlad.velici.ably","email":"vlad.velici@ably.com"}],"homepage":"https://github.com/ably/ably-encrypted-channels-react-native-polyfills#readme","bugs":{"url":"https://github.com/ably/ably-encrypted-channels-react-native-polyfills/issues"},"dist":{"shasum":"f1e7c7ea8cda2465469506c5a65446cdb851c3e8","tarball":"https://registry.npmjs.org/@ably/encrypted-channels-react-native-polyfills/-/encrypted-channels-react-native-polyfills-0.0.1.tgz","fileCount":16,"integrity":"sha512-YCsiUr9el99HE0OtTbyblyn9N/rH+woHthPrkhwoaNpIebRP7qMybiaKkTB8dguQrUoVMI8UUMcbCMQ4JQeOrg==","signatures":[{"sig":"MEUCIDGi25xZ2kD9lS73g7QfhYAtkpmW66sowEpC0SBhS/SjAiEAqtkBLiPhZ/6GeZ3GQ2qcYXQMu+hPWhR+oc0tMMNtWK0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34793},"main":"./dist/cjs/index.js","types":"./dist/types/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=20.19.4"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"5a6fcd3867e7c8b4bffbd890d630d6c56af8e8a8","scripts":{"dev":"tsc -p tsconfig.esm.json --watch","lint":"eslint src --ext .ts,.tsx","test":"vitest run","build":"npm run clean && npm run build:setup && npm run build:cjs && npm run build:esm && npm run build:types","clean":"rm -rf dist","format":"prettier --write \"src/**/*.{ts,tsx,json,md}\"","lint:fix":"eslint src --ext .ts,.tsx --fix","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","typecheck":"tsc --noEmit","build:setup":"mkdir -p dist/cjs dist/esm && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json && echo '{\"type\":\"module\"}' > dist/esm/package.json","build:types":"tsc -p tsconfig.types.json","format:check":"prettier --check \"src/**/*.{ts,tsx,json,md}\"","prepublishOnly":"npm run build"},"_npmUser":{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},"repository":{"url":"git+https://github.com/ably/ably-encrypted-channels-react-native-polyfills.git","type":"git"},"_npmVersion":"11.5.1","description":"A lightweight set of polyfills that enable Ably encrypted channels to work seamlessly in React Native environments.","directories":{},"_nodeVersion":"24.7.0","dependencies":{"@bacons/text-decoder":"0.0.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","vitest":"^4.0.8","prettier":"^3.6.2","typescript":"^5.9.3","@types/node":"^20.11.19","@typescript-eslint/parser":"^8.46.4","@typescript-eslint/eslint-plugin":"^8.46.4"},"peerDependencies":{"react-native":">=0.60.0","@ably/react-native-aes":"0.0.1"},"peerDependenciesMeta":{"@ably/react-native-aes":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/encrypted-channels-react-native-polyfills_0.0.1_1763384528464_0.7490787974039717","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@ably/encrypted-channels-react-native-polyfills","version":"0.0.2","keywords":["ably","react-native","crypto","polyfills","encryption"],"author":{"name":"Ably"},"license":"Apache-2.0","_id":"@ably/encrypted-channels-react-native-polyfills@0.0.2","maintainers":[{"name":"mschristensen","email":"mike@christensen.codes"},{"name":"ably-realtime","email":"account.owners@ably.com"},{"name":"simonw_ably","email":"simon.woolf@ably.com"},{"name":"owenpearson","email":"owen.pearson@ably.com"},{"name":"hingasellu","email":"hingasellu@gmail.com"},{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},{"name":"andrii.bulat.ably","email":"andrii.bulat@ably.com"},{"name":"andytwf","email":"andyford993@gmail.com"},{"name":"splind06","email":"steven.lindsay@ably.com"},{"name":"zariel-ably","email":"chris.bannister@ably.com"},{"name":"mattheworiordan","email":"matthew.oriordan@gmail.com"},{"name":"vlad.velici.ably","email":"vlad.velici@ably.com"}],"homepage":"https://github.com/ably/ably-encrypted-channels-react-native-polyfills#readme","bugs":{"url":"https://github.com/ably/ably-encrypted-channels-react-native-polyfills/issues"},"dist":{"shasum":"fca674fbdcd4edc0c68ea7d649a132cdda1e5ab2","tarball":"https://registry.npmjs.org/@ably/encrypted-channels-react-native-polyfills/-/encrypted-channels-react-native-polyfills-0.0.2.tgz","fileCount":16,"integrity":"sha512-/Imdn+AjMsEyLqzVTdd5VDch2aX3iT0TxGrCKtOBjEa2tjw7eY5J1Lma7HhKrk1qxRSpw7JKQj8jXFu1FsM2sw==","signatures":[{"sig":"MEUCIQCyUWcgbjlFGJaARhzu5E6YfNpCFE6KKxHHtoPriRWBQAIgcbsARRp81t+VT6n+FofQHNxxtnL63oUbK/scaU+SMDY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35680},"main":"./dist/cjs/index.js","types":"./dist/types/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=20.19.4"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"0595dd4aa8e9f846f8b43ba00815d3e9921e50b2","scripts":{"dev":"tsc -p tsconfig.esm.json --watch","lint":"eslint src --ext .ts,.tsx","test":"vitest run","build":"npm run clean && npm run build:setup && npm run build:cjs && npm run build:esm && npm run build:types","clean":"rm -rf dist","format":"prettier --write \"src/**/*.{ts,tsx,json,md}\"","lint:fix":"eslint src --ext .ts,.tsx --fix","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","typecheck":"tsc --noEmit","build:setup":"mkdir -p dist/cjs dist/esm && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json && echo '{\"type\":\"module\"}' > dist/esm/package.json","build:types":"tsc -p tsconfig.types.json","format:check":"prettier --check \"src/**/*.{ts,tsx,json,md}\"","prepublishOnly":"npm run build"},"_npmUser":{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},"repository":{"url":"git+https://github.com/ably/ably-encrypted-channels-react-native-polyfills.git","type":"git"},"_npmVersion":"11.5.1","description":"A lightweight set of polyfills that enable Ably encrypted channels to work seamlessly in React Native environments.","directories":{},"_nodeVersion":"24.7.0","dependencies":{"@bacons/text-decoder":"0.0.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","vitest":"^4.0.8","prettier":"^3.6.2","typescript":"^5.9.3","@types/node":"^20.11.19","@typescript-eslint/parser":"^8.46.4","@typescript-eslint/eslint-plugin":"^8.46.4"},"peerDependencies":{"react-native":">=0.60.0","@ably/react-native-aes":"0.0.1"},"peerDependenciesMeta":{"@ably/react-native-aes":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/encrypted-channels-react-native-polyfills_0.0.2_1763399208253_0.6318828405661054","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@ably/encrypted-channels-react-native-polyfills","version":"0.0.3","keywords":["ably","react-native","crypto","polyfills","encryption"],"author":{"name":"Ably"},"license":"Apache-2.0","_id":"@ably/encrypted-channels-react-native-polyfills@0.0.3","maintainers":[{"name":"mschristensen","email":"mike@christensen.codes"},{"name":"ably-realtime","email":"account.owners@ably.com"},{"name":"simonw_ably","email":"simon.woolf@ably.com"},{"name":"owenpearson","email":"owen.pearson@ably.com"},{"name":"hingasellu","email":"hingasellu@gmail.com"},{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},{"name":"andrii.bulat.ably","email":"andrii.bulat@ably.com"},{"name":"andytwf","email":"andyford993@gmail.com"},{"name":"splind06","email":"steven.lindsay@ably.com"},{"name":"zariel-ably","email":"chris.bannister@ably.com"},{"name":"mattheworiordan","email":"matthew.oriordan@gmail.com"},{"name":"vlad.velici.ably","email":"vlad.velici@ably.com"}],"homepage":"https://github.com/ably/ably-encrypted-channels-react-native-polyfills#readme","bugs":{"url":"https://github.com/ably/ably-encrypted-channels-react-native-polyfills/issues"},"dist":{"shasum":"6b344401427c4e9d2b25a10b2aae8c44254b1f90","tarball":"https://registry.npmjs.org/@ably/encrypted-channels-react-native-polyfills/-/encrypted-channels-react-native-polyfills-0.0.3.tgz","fileCount":16,"integrity":"sha512-gic2UG2F4bwEvUFH+yInrvegjc7CdWh4T8eGTLn9Fo4NsHSog0XQxLyJXlB4ENWuDOi9CR9Az/grrGSbzwYLXA==","signatures":[{"sig":"MEQCIEtHVTWGHYlpRAchFuBwEJ1UtMrFGF7gToNSOVRXkjVkAiBuyc9TpQX1rW4fU1salsNOhAo+pMw+0VX/kPhz/B/w/g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32247},"main":"./dist/cjs/index.js","types":"./dist/types/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=20.19.4"},"exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"40ee51239cc49910ed42b50c4dbb91b60789af60","scripts":{"dev":"tsc -p tsconfig.esm.json --watch","lint":"eslint src --ext .ts,.tsx","test":"vitest run","build":"npm run clean && npm run build:setup && npm run build:cjs && npm run build:esm && npm run build:types","clean":"rm -rf dist","format":"prettier --write \"src/**/*.{ts,tsx,json,md}\"","lint:fix":"eslint src --ext .ts,.tsx --fix","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","typecheck":"tsc --noEmit","build:setup":"mkdir -p dist/cjs dist/esm && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json && echo '{\"type\":\"module\"}' > dist/esm/package.json","build:types":"tsc -p tsconfig.types.json","format:check":"prettier --check \"src/**/*.{ts,tsx,json,md}\"","prepublishOnly":"npm run build"},"_npmUser":{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},"repository":{"url":"git+https://github.com/ably/ably-encrypted-channels-react-native-polyfills.git","type":"git"},"_npmVersion":"11.5.1","description":"A lightweight set of polyfills that enable Ably encrypted channels to work seamlessly in React Native environments.","directories":{},"_nodeVersion":"24.7.0","dependencies":{"@bacons/text-decoder":"0.0.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","vitest":"^4.0.8","prettier":"^3.6.2","typescript":"^5.9.3","@types/node":"^20.11.19","@typescript-eslint/parser":"^8.46.4","@typescript-eslint/eslint-plugin":"^8.46.4"},"peerDependencies":{"react-native":">=0.60.0","@ably/react-native-aes":"0.0.3"},"peerDependenciesMeta":{"@ably/react-native-aes":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/encrypted-channels-react-native-polyfills_0.0.3_1764321498464_0.12090132044910962","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-11-17T13:02:08.325Z","modified":"2026-03-18T18:56:52.219Z","0.0.1":"2025-11-17T13:02:08.672Z","0.0.2":"2025-11-17T17:06:48.447Z","0.0.3":"2025-11-28T09:18:18.644Z"},"bugs":{"url":"https://github.com/ably/ably-encrypted-channels-react-native-polyfills/issues"},"author":{"name":"Ably"},"license":"Apache-2.0","homepage":"https://github.com/ably/ably-encrypted-channels-react-native-polyfills#readme","keywords":["ably","react-native","crypto","polyfills","encryption"],"repository":{"url":"git+https://github.com/ably/ably-encrypted-channels-react-native-polyfills.git","type":"git"},"description":"A lightweight set of polyfills that enable Ably encrypted channels to work seamlessly in React Native environments.","maintainers":[{"email":"mike@christensen.codes","name":"mschristensen"},{"email":"account.owners@ably.com","name":"ably-realtime"},{"email":"simon.woolf@ably.com","name":"simonw_ably"},{"email":"owen.pearson@ably.com","name":"owenpearson"},{"email":"khokhlov.e.n@gmail.com","name":"ttypic"},{"email":"lawrence.forooghian@ably.com","name":"lawrence.forooghian.ably"},{"email":"andrii.bulat@ably.com","name":"andrii.bulat.ably"},{"email":"andyford993@gmail.com","name":"andytwf"},{"email":"steven.lindsay@ably.com","name":"splind06"},{"email":"chris.bannister@ably.com","name":"zariel-ably"},{"email":"matthew.oriordan@gmail.com","name":"mattheworiordan"},{"email":"vlad.velici@ably.com","name":"vlad.velici.ably"}],"readme":"# Ably Encrypted Channels React Native Polyfills\n\nA lightweight set of polyfills that enable Ably encrypted channels to work seamlessly in React Native environments.\n\n## Prerequisites\n\n### Option 1: Using the default AES implementation\n\nIf you want to use the default AES encryption/decryption implementation, install:\n\n- `@ably/react-native-aes` - For AES encryption/decryption\n\n```bash\nnpm install @ably/react-native-aes\n```\n\nor\n\n```bash\nyarn add @ably/react-native-aes\n```\n\nFor React Native 0.60+, this dependency should auto-link. For older versions, you may need to link it manually.\n\n### Option 2: Using a custom implementation\n\nAlternatively, you can provide your own encryption/decryption functions. In this case, no additional dependencies are required. See the [Custom Encryption/Decryption](#custom-encryptiondecryption) section below for details.\n\n## Installation\n\nAfter installing the prerequisites, install this package:\n\n```bash\nnpm install @ably/encrypted-channels-react-native-polyfills\n```\n\nor\n\n```bash\nyarn add @ably/encrypted-channels-react-native-polyfills\n```\n\n## Usage\n\nImport and initialize the polyfills at the entry point of your React Native application:\n\n```typescript\nimport { install } from '@ably/encrypted-channels-react-native-polyfills';\n\n// Initialize polyfills before using Ably\ninstall();\n```\n\nThis will polyfill the following Web Crypto API methods:\n\n- `crypto.subtle.importKey()` - Import raw AES keys\n- `crypto.subtle.encrypt()` - Encrypt data using AES-CBC\n- `crypto.subtle.decrypt()` - Decrypt data using AES-CBC\n\n### Example with Ably\n\n```typescript\nimport { install } from '@ably/encrypted-channels-react-native-polyfills';\n\n// Install polyfills first\ninstall();\n\nfunction App() {\n    const [encrypted, setEncrypted] = useState<string>(\"\");\n    const [key, setKey] = useState<Ably.CipherKey | null>(null);\n\n    useEffect(() => {\n        if (key) return;\n        Ably.Realtime.Crypto.generateRandomKey().then(generatedKey => setKey(generatedKey))\n    }, [key]);\n\n    useEffect(() => {\n        if (!key) return;\n        const channel = client.channels.get('encrypted-channel', {\n            cipher: { key }\n        });\n        channel.subscribe(message => {\n            setEncrypted(message.data.toString())\n        });\n        channel.publish('test', \"Hello World\");\n    }, [key]);\n}\n```\n\n### Custom Encryption/Decryption\n\nIf you don't want to use `@ably/react-native-aes`, you can provide your own encryption and decryption implementations:\n\n```typescript\nimport { install, type EncryptionFunction, type DecryptionFunction } from '@ably/encrypted-channels-react-native-polyfills';\n\nconst customEncrypt: EncryptionFunction = async (algorithm, key, data) => {\n    // Your custom encryption implementation\n    // algorithm: { name: string, iv: BufferSource }\n    // key: BufferSource - the raw key data\n    // data: BufferSource - the data to encrypt\n    // Returns: Promise<ArrayBuffer> - the encrypted data\n\n    // Example using a hypothetical crypto library\n    const encrypted = await MyCryptoLib.encrypt({\n        key: keyData,\n        iv: algorithm.iv,\n        data: data,\n        algorithm: algorithm.name\n    });\n\n    return encrypted;\n};\n\nconst customDecrypt: DecryptionFunction = async (algorithm, key, data) => {\n    // Your custom decryption implementation\n    // algorithm: { name: string, iv: BufferSource }\n    // key: BufferSource - the raw key data\n    // data: BufferSource - the encrypted data to decrypt\n    // Returns: Promise<ArrayBuffer> - the decrypted data\n\n    // Example using a hypothetical crypto library\n    const decrypted = await MyCryptoLib.decrypt({\n        key: keyData,\n        iv: algorithm.iv,\n        data: data,\n        algorithm: algorithm.name\n    });\n\n    return decrypted;\n};\n\n// Install with custom functions\ninstall({\n    encryptionFunction: customEncrypt,\n    decryptionFunction: customDecrypt\n});\n```\n\n**Note:** Both `encryptionFunction` and `decryptionFunction` must be provided together. If you provide only one, an error will be thrown.","readmeFilename":"README.md"}