(encryptedBundle: Uint8Array, recipientSecretKey: Uint8Array)
| 128 | } |
| 129 | |
| 130 | function decryptWithEphemeralKey(encryptedBundle: Uint8Array, recipientSecretKey: Uint8Array): Uint8Array | null { |
| 131 | const ephemeralPublicKey = encryptedBundle.slice(0, 32); |
| 132 | const nonce = encryptedBundle.slice(32, 32 + tweetnacl.box.nonceLength); |
| 133 | const encrypted = encryptedBundle.slice(32 + tweetnacl.box.nonceLength); |
| 134 | |
| 135 | const decrypted = tweetnacl.box.open(encrypted, nonce, ephemeralPublicKey, recipientSecretKey); |
| 136 | if (!decrypted) return null; |
| 137 | return decrypted; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Ensure authentication and machine setup |
no outgoing calls
no test coverage detected