File
Blob: src/workerd/server/tests/extensions/binding.js
| 1 | // Copyright (c) 2023 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | |
| 5 | export function wrap(env) { |
| 6 | if (!env.secret) { |
| 7 | throw new Error('secret internal binding is not specified'); |
| 8 | } |
| 9 | |
| 10 | return { |
| 11 | tryOpen(key) { |
| 12 | return key === env.secret; |
| 13 | }, |
| 14 | }; |
| 15 | } |
| 16 | |
| 17 | export default wrap; |