@suveren/gateway 0.40.0 → 0.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/guides/6-risks.md +1 -0
- package/dist/control-plane/index.mjs +182 -37
- package/dist/mcp-server/http.mjs +357 -71
- package/dist/ui/assets/{index-C-lA_7Lt.js → index-CO-dj98E.js} +27 -27
- package/dist/ui/index.html +1 -1
- package/node_modules/@hap/core/README.md +3 -3
- package/node_modules/@hap/core/dist/index.d.mts +567 -123
- package/node_modules/@hap/core/dist/index.d.ts +567 -123
- package/node_modules/@hap/core/dist/index.js +869 -23
- package/node_modules/@hap/core/dist/index.mjs +829 -22
- package/node_modules/@hap/core/node_modules/@hpke/core/LICENSE +21 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/README.md +263 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.js +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/package.json +3 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.js +167 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts +34 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.js +56 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts +145 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.js +326 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts +15 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.js +68 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts +19 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.js +62 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts +13 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts +8 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts +40 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts +7 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts +10 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts +26 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.js +112 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +214 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +214 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.js +66 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.js +66 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts +5 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.js +28 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts +236 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.js +235 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.js +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.js +45 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts +2 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.js +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/package.json +46 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.js +47 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/package.json +3 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.js +183 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts +34 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.js +70 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts +145 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.js +340 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts +15 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.js +82 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts +19 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.js +78 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts +13 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts +8 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts +40 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts +7 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts +10 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts +26 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.js +128 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +228 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +228 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.js +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.js +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts +5 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.js +42 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts +236 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.js +255 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.js +52 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.js +59 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts +2 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.js +19 -0
- package/node_modules/@hap/core/package.json +2 -1
- package/node_modules/@hap/core/src/canonicalize.ts +9 -0
- package/node_modules/@hap/core/src/commitment-modes.ts +21 -9
- package/node_modules/@hap/core/src/errors.ts +24 -8
- package/node_modules/@hap/core/src/gatekeeper.ts +52 -8
- package/node_modules/@hap/core/src/index.ts +5 -1
- package/node_modules/@hap/core/src/issuance.ts +250 -0
- package/node_modules/@hap/core/src/mandate.ts +52 -14
- package/node_modules/@hap/core/src/owner-signature.ts +86 -39
- package/node_modules/@hap/core/src/profile.ts +45 -0
- package/node_modules/@hap/core/src/proposal-content.ts +219 -0
- package/node_modules/@hap/core/src/ticket-projection.ts +167 -0
- package/node_modules/@hap/core/src/ticket.ts +254 -20
- package/node_modules/@hap/core/src/types.ts +33 -5
- package/node_modules/@hap/core/src/verifier-policy.ts +178 -0
- package/node_modules/@hap/core/src/versions.ts +50 -19
- package/node_modules/@hono/node-server/dist/index.cjs +31 -6
- package/node_modules/@hono/node-server/dist/index.mjs +31 -6
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@hpke/common/esm/package.json +5 -1
- package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts +2 -2
- package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/curve/montgomery.js +41 -26
- package/node_modules/@hpke/common/esm/src/hash/sha3.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/hash/sha3.js +0 -15
- package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts +2 -1
- package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/kdfs/hkdf.js +12 -2
- package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.js +14 -3
- package/node_modules/@hpke/common/esm/src/utils/misc.d.ts +6 -0
- package/node_modules/@hpke/common/esm/src/utils/misc.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/utils/misc.js +43 -10
- package/node_modules/@hpke/common/esm/src/utils/noble.d.ts +1 -1
- package/node_modules/@hpke/common/esm/src/utils/noble.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/utils/noble.js +21 -10
- package/node_modules/@hpke/common/package.json +5 -1
- package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts +2 -2
- package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/curve/montgomery.js +40 -25
- package/node_modules/@hpke/common/script/src/hash/sha3.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/hash/sha3.js +0 -15
- package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts +2 -1
- package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/kdfs/hkdf.js +12 -2
- package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.js +13 -2
- package/node_modules/@hpke/common/script/src/utils/misc.d.ts +6 -0
- package/node_modules/@hpke/common/script/src/utils/misc.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/utils/misc.js +43 -9
- package/node_modules/@hpke/common/script/src/utils/noble.d.ts +1 -1
- package/node_modules/@hpke/common/script/src/utils/noble.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/utils/noble.js +22 -11
- package/node_modules/@hpke/core/README.md +56 -56
- package/node_modules/@hpke/core/esm/package.json +2 -1
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +3 -201
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +3 -21
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +3 -201
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.js +216 -0
- package/node_modules/@hpke/core/package.json +6 -2
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +4 -202
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +3 -21
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +4 -202
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.js +230 -0
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +752 -0
- package/node_modules/encodeurl/README.md +14 -0
- package/node_modules/encodeurl/index.js +5 -10
- package/node_modules/encodeurl/package.json +10 -6
- package/node_modules/express-rate-limit/dist/index.cjs +7 -3
- package/node_modules/express-rate-limit/dist/index.mjs +7 -3
- package/node_modules/express-rate-limit/package.json +10 -10
- package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
- package/node_modules/hono/dist/cjs/context.js +1 -1
- package/node_modules/hono/dist/cjs/helper/css/common.js +3 -5
- package/node_modules/hono/dist/cjs/hono-base.js +4 -10
- package/node_modules/hono/dist/cjs/hono.js +0 -1
- package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/mount/index.js +4 -4
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +13 -11
- package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +4 -4
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +39 -51
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +15 -5
- package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +2 -1
- package/node_modules/hono/dist/cjs/utils/mount.js +35 -0
- package/node_modules/hono/dist/cjs/utils/url.js +10 -0
- package/node_modules/hono/dist/cjs/validator/validator.js +1 -1
- package/node_modules/hono/dist/context.js +1 -1
- package/node_modules/hono/dist/helper/css/common.js +3 -5
- package/node_modules/hono/dist/hono-base.js +4 -10
- package/node_modules/hono/dist/hono.js +0 -1
- package/node_modules/hono/dist/middleware/basic-auth/index.js +1 -1
- package/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/middleware/csrf/index.js +2 -2
- package/node_modules/hono/dist/middleware/jwk/jwk.js +2 -2
- package/node_modules/hono/dist/middleware/jwt/jwt.js +2 -2
- package/node_modules/hono/dist/middleware/language/language.js +1 -1
- package/node_modules/hono/dist/middleware/mount/index.js +4 -4
- package/node_modules/hono/dist/router/reg-exp-router/node.js +13 -11
- package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +5 -5
- package/node_modules/hono/dist/router/reg-exp-router/router.js +40 -52
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +15 -5
- package/node_modules/hono/dist/types/middleware/mount/index.d.ts +1 -0
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -3
- package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +1 -1
- package/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
- package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
- package/node_modules/hono/dist/utils/jwt/jwt.js +2 -1
- package/node_modules/hono/dist/utils/mount.js +34 -0
- package/node_modules/hono/dist/utils/url.js +10 -1
- package/node_modules/hono/dist/validator/validator.js +1 -1
- package/node_modules/hono/package.json +1 -1
- package/node_modules/ip-address/README.md +39 -39
- package/node_modules/ip-address/dist/ipv6.js +1 -1
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +3 -0
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +2 -0
- package/node_modules/jose/dist/types/jwt/verify.d.ts +3 -0
- package/node_modules/jose/dist/types/types.d.ts +8 -0
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -0
- package/node_modules/jose/dist/webapi/jwks/remote.js +3 -1
- package/node_modules/jose/dist/webapi/lib/deflate.js +2 -1
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +2 -1
- package/node_modules/jose/package.json +1 -1
- package/node_modules/qs/CHANGELOG.md +29 -22
- package/node_modules/qs/dist/qs.js +14 -14
- package/node_modules/qs/eslint.config.mjs +6 -0
- package/node_modules/qs/lib/stringify.js +1 -1
- package/node_modules/qs/package.json +5 -5
- package/node_modules/qs/test/stringify.js +74 -0
- package/package.json +2 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Ajitomi Daisuke
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<h1 align="center">@hpke/core</h1>
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="https://www.npmjs.com/package/@hpke/core"><img src="https://img.shields.io/npm/v/@hpke/core" alt="npm"/></a>
|
|
5
|
+
<a href="https://jsr.io/@hpke/core"><img src="https://jsr.io/badges/@hpke/core" alt="JSR"/></a>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div align="center">
|
|
9
|
+
A TypeScript <a href="https://datatracker.ietf.org/doc/html/rfc9180">Hybrid Public Key Encryption (HPKE)</a> core module implemented using only <a href="https://www.w3.org/TR/WebCryptoAPI/">Web Cryptography API</a>. It does not support the X448-based KEM and the ChaCha20Poly1305 AEAD, but it has no external module dependencies. It's small in size and tree-shaking friendly.</div>
|
|
10
|
+
<p></p>
|
|
11
|
+
|
|
12
|
+
<div align="center">
|
|
13
|
+
|
|
14
|
+
Documentation: [jsr.io](https://jsr.io/@hpke/core/doc) |
|
|
15
|
+
[pages (only for the latest ver.)](https://dajiaji.github.io/hpke-js/core/docs/)
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
## Index
|
|
20
|
+
|
|
21
|
+
- [Installation](#installation)
|
|
22
|
+
- [Node.js](#nodejs)
|
|
23
|
+
- [Deno](#deno)
|
|
24
|
+
- [Web Browsers](#web-browsers)
|
|
25
|
+
- [Usage](#usage)
|
|
26
|
+
- [Contributing](#contributing)
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
Where possible, it is recommended to use `@hpke/core` along with extension
|
|
31
|
+
modules (such as `@hpke/chacha20poly1305`) instead of `hpke-js`.
|
|
32
|
+
|
|
33
|
+
### Node.js
|
|
34
|
+
|
|
35
|
+
You can install the package with npm, yarn or pnpm.
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
# Using npm:
|
|
39
|
+
npm install @hpke/core
|
|
40
|
+
yarn add @hpke/core
|
|
41
|
+
pnpm install @hpke/core
|
|
42
|
+
# Using jsr:
|
|
43
|
+
npx jsr add @hpke/core
|
|
44
|
+
yarn add jsr:@hpke/core
|
|
45
|
+
pnpm add jsr:@hpke/core
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The above manner can be used with other JavaScript runtimes that support npm,
|
|
49
|
+
such as Cloudflare Workers and Bun.
|
|
50
|
+
|
|
51
|
+
Then, you can use the module from code like this:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import {
|
|
55
|
+
Aes128Gcm,
|
|
56
|
+
CipherSuite,
|
|
57
|
+
DhkemP256HkdfSha256,
|
|
58
|
+
HkdfSha256,
|
|
59
|
+
} from "@hpke/core";
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Deno
|
|
63
|
+
|
|
64
|
+
For Deno, it is recommended to use the jsr.io registry.
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
deno add jsr:@hpke/core
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Web Browsers
|
|
71
|
+
|
|
72
|
+
Followings are how to use this module with typical CDNs. Other CDNs can be used
|
|
73
|
+
as well.
|
|
74
|
+
|
|
75
|
+
Using esm.sh:
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<!-- use a specific version -->
|
|
79
|
+
<script type="module">
|
|
80
|
+
import {
|
|
81
|
+
Aes128Gcm,
|
|
82
|
+
CipherSuite,
|
|
83
|
+
DhkemP256HkdfSha256,
|
|
84
|
+
HkdfSha256,
|
|
85
|
+
} from "https://esm.sh/@hpke/core@<SEMVER>";
|
|
86
|
+
// ...
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<!-- use the latest stable version -->
|
|
90
|
+
<script type="module">
|
|
91
|
+
import {
|
|
92
|
+
Aes128Gcm,
|
|
93
|
+
CipherSuite,
|
|
94
|
+
DhkemP256HkdfSha256,
|
|
95
|
+
HkdfSha256,
|
|
96
|
+
} from "https://esm.sh/@hpke/core";
|
|
97
|
+
// ...
|
|
98
|
+
</script>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Using unpkg:
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<!-- use a specific version -->
|
|
105
|
+
<script type="module">
|
|
106
|
+
import * as hpke from "https://unpkg.com/@hpke/core@<SEMVER>/esm/mod.js";
|
|
107
|
+
// ...
|
|
108
|
+
</script>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Usage
|
|
112
|
+
|
|
113
|
+
This section shows some typical usage examples.
|
|
114
|
+
|
|
115
|
+
### Node.js
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
import {
|
|
119
|
+
Aes128Gcm,
|
|
120
|
+
CipherSuite,
|
|
121
|
+
DhkemP256HkdfSha256,
|
|
122
|
+
HkdfSha256,
|
|
123
|
+
} from "@hpke/core";
|
|
124
|
+
|
|
125
|
+
async function doHpke() {
|
|
126
|
+
// setup
|
|
127
|
+
const suite = new CipherSuite({
|
|
128
|
+
kem: new DhkemP256HkdfSha256(),
|
|
129
|
+
kdf: new HkdfSha256(),
|
|
130
|
+
aead: new Aes128Gcm(),
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const rkp = await suite.kem.generateKeyPair();
|
|
134
|
+
|
|
135
|
+
const sender = await suite.createSenderContext({
|
|
136
|
+
recipientPublicKey: rkp.publicKey,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const recipient = await suite.createRecipientContext({
|
|
140
|
+
recipientKey: rkp.privateKey,
|
|
141
|
+
enc: sender.enc,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// encrypt
|
|
145
|
+
const ct = await sender.seal(new TextEncoder().encode("Hello world!"));
|
|
146
|
+
|
|
147
|
+
// decrypt
|
|
148
|
+
const pt = await recipient.open(ct);
|
|
149
|
+
|
|
150
|
+
// Hello world!
|
|
151
|
+
console.log(new TextDecoder().decode(pt));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
doHpke();
|
|
156
|
+
} catch (err) {
|
|
157
|
+
console.log("failed:", err.message);
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Deno
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
import {
|
|
165
|
+
Aes128Gcm,
|
|
166
|
+
CipherSuite,
|
|
167
|
+
DhkemP256HkdfSha256,
|
|
168
|
+
HkdfSha256,
|
|
169
|
+
} from "@hpke/core";
|
|
170
|
+
|
|
171
|
+
async function doHpke() {
|
|
172
|
+
// setup
|
|
173
|
+
const suite = new CipherSuite({
|
|
174
|
+
kem: new DhkemP256HkdfSha256(),
|
|
175
|
+
kdf: new HkdfSha256(),
|
|
176
|
+
aead: new Aes128Gcm(),
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const rkp = await suite.kem.generateKeyPair();
|
|
180
|
+
|
|
181
|
+
const sender = await suite.createSenderContext({
|
|
182
|
+
recipientPublicKey: rkp.publicKey,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const recipient = await suite.createRecipientContext({
|
|
186
|
+
recipientKey: rkp.privateKey,
|
|
187
|
+
enc: sender.enc,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// encrypt
|
|
191
|
+
const ct = await sender.seal(new TextEncoder().encode("Hello world!"));
|
|
192
|
+
|
|
193
|
+
// decrypt
|
|
194
|
+
const pt = await recipient.open(ct);
|
|
195
|
+
|
|
196
|
+
// Hello world!
|
|
197
|
+
console.log(new TextDecoder().decode(pt));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
try {
|
|
201
|
+
doHpke();
|
|
202
|
+
} catch (_err: unknown) {
|
|
203
|
+
console.log("doHPKE() failed.");
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Web Browsers
|
|
208
|
+
|
|
209
|
+
```html
|
|
210
|
+
<html>
|
|
211
|
+
<head></head>
|
|
212
|
+
<body>
|
|
213
|
+
<script type="module">
|
|
214
|
+
import {
|
|
215
|
+
Aes128Gcm,
|
|
216
|
+
CipherSuite,
|
|
217
|
+
DhkemP256HkdfSha256,
|
|
218
|
+
HkdfSha256,
|
|
219
|
+
} from "https://esm.sh/@hpke/core";
|
|
220
|
+
|
|
221
|
+
globalThis.doHpke = async () => {
|
|
222
|
+
const suite = new CipherSuite({
|
|
223
|
+
kem: new DhkemP256HkdfSha256(),
|
|
224
|
+
kdf: new HkdfSha256(),
|
|
225
|
+
aead: new Aes128Gcm(),
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
const rkp = await suite.kem.generateKeyPair();
|
|
229
|
+
|
|
230
|
+
const sender = await suite.createSenderContext({
|
|
231
|
+
recipientPublicKey: rkp.publicKey,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
const recipient = await suite.createRecipientContext({
|
|
235
|
+
recipientKey: rkp.privateKey, // rkp (CryptoKeyPair) is also acceptable.
|
|
236
|
+
enc: sender.enc,
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// encrypt
|
|
240
|
+
const ct = await sender.seal(
|
|
241
|
+
new TextEncoder().encode("hello world!"),
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
// decrypt
|
|
245
|
+
try {
|
|
246
|
+
const pt = await recipient.open(ct);
|
|
247
|
+
|
|
248
|
+
// hello world!
|
|
249
|
+
alert(new TextDecoder().decode(pt));
|
|
250
|
+
} catch (err) {
|
|
251
|
+
alert("failed to decrypt.");
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
</script>
|
|
255
|
+
<button type="button" onclick="doHpke()">do HPKE</button>
|
|
256
|
+
</body>
|
|
257
|
+
</html>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Contributing
|
|
261
|
+
|
|
262
|
+
We welcome all kind of contributions, filing issues, suggesting new features or
|
|
263
|
+
sending PRs.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { AeadEncryptionContext, AeadInterface, JsonWebKeyExtended, KdfInterface, KemInterface, PreSharedKey, RecipientContextParams, SenderContextParams, } from "@hpke/common";
|
|
2
|
+
export type { CipherSuiteParams } from "./src/interfaces/cipherSuiteParams.js";
|
|
3
|
+
export type { EncryptionContext, RecipientContext, SenderContext, } from "./src/interfaces/encryptionContext.js";
|
|
4
|
+
export type { CipherSuiteSealResponse } from "./src/interfaces/responses.js";
|
|
5
|
+
export { AeadId, DecapError, DeriveKeyPairError, DeserializeError, EncapError, ExportError, HpkeError, InvalidParamError, KdfId, KemId, MessageLimitReachedError, NotSupportedError, OpenError, SealError, SerializeError, ValidationError, } from "@hpke/common";
|
|
6
|
+
export { Aes128Gcm, Aes256Gcm } from "./src/aeads/aesGcm.js";
|
|
7
|
+
export { ExportOnly } from "./src/aeads/exportOnly.js";
|
|
8
|
+
export { CipherSuite, DhkemP256HkdfSha256, DhkemP384HkdfSha384, DhkemP521HkdfSha512, HkdfSha256, HkdfSha384, HkdfSha512, } from "./src/native.js";
|
|
9
|
+
export { DhkemX25519HkdfSha256 } from "./src/kems/dhkemX25519.js";
|
|
10
|
+
export { DhkemX448HkdfSha512 } from "./src/kems/dhkemX448.js";
|
|
11
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EACL,MAAM,EACN,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,KAAK,EACL,KAAK,EACL,wBAAwB,EACxB,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,cAAc,EACd,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AeadId, DecapError, DeriveKeyPairError, DeserializeError, EncapError, ExportError, HpkeError, InvalidParamError, KdfId, KemId, MessageLimitReachedError, NotSupportedError, OpenError, SealError, SerializeError, ValidationError, } from "@hpke/common";
|
|
2
|
+
export { Aes128Gcm, Aes256Gcm } from "./src/aeads/aesGcm.js";
|
|
3
|
+
export { ExportOnly } from "./src/aeads/exportOnly.js";
|
|
4
|
+
export { CipherSuite, DhkemP256HkdfSha256, DhkemP384HkdfSha384, DhkemP521HkdfSha512, HkdfSha256, HkdfSha384, HkdfSha512, } from "./src/native.js";
|
|
5
|
+
export { DhkemX25519HkdfSha256 } from "./src/kems/dhkemX25519.js";
|
|
6
|
+
export { DhkemX448HkdfSha512 } from "./src/kems/dhkemX448.js";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { AeadEncryptionContext, AeadInterface } from "@hpke/common";
|
|
2
|
+
import { AeadId, NativeAlgorithm } from "@hpke/common";
|
|
3
|
+
export declare class AesGcmContext extends NativeAlgorithm implements AeadEncryptionContext {
|
|
4
|
+
private _rawKey;
|
|
5
|
+
private _key;
|
|
6
|
+
constructor(key: ArrayBufferLike | ArrayBufferView);
|
|
7
|
+
seal(iv: ArrayBufferLike | ArrayBufferView, data: ArrayBufferLike | ArrayBufferView, aad: ArrayBufferLike | ArrayBufferView): Promise<ArrayBuffer>;
|
|
8
|
+
open(iv: ArrayBufferLike | ArrayBufferView, data: ArrayBufferLike | ArrayBufferView, aad: ArrayBufferLike | ArrayBufferView): Promise<ArrayBuffer>;
|
|
9
|
+
protected _setupKey(): Promise<void>;
|
|
10
|
+
private _importKey;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The AES-128-GCM for HPKE AEAD implementing {@link AeadInterface}.
|
|
14
|
+
*
|
|
15
|
+
* When using `@hpke/core`, the instance of this class must be specified
|
|
16
|
+
* to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes128Gcm`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import {
|
|
22
|
+
* Aes128Gcm,
|
|
23
|
+
* CipherSuite,
|
|
24
|
+
* DhkemP256HkdfSha256,
|
|
25
|
+
* HkdfSha256,
|
|
26
|
+
* } from "@hpke/core";
|
|
27
|
+
*
|
|
28
|
+
* const suite = new CipherSuite({
|
|
29
|
+
* kem: new DhkemP256HkdfSha256(),
|
|
30
|
+
* kdf: new HkdfSha256(),
|
|
31
|
+
* aead: new Aes128Gcm(),
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class Aes128Gcm implements AeadInterface {
|
|
36
|
+
/** AeadId.Aes128Gcm (0x0001) */
|
|
37
|
+
readonly id: AeadId;
|
|
38
|
+
/** 16 */
|
|
39
|
+
readonly keySize: number;
|
|
40
|
+
/** 12 */
|
|
41
|
+
readonly nonceSize: number;
|
|
42
|
+
/** 16 */
|
|
43
|
+
readonly tagSize: number;
|
|
44
|
+
createEncryptionContext(key: ArrayBufferLike | ArrayBufferView): AeadEncryptionContext;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The AES-256-GCM for HPKE AEAD implementing {@link AeadInterface}.
|
|
48
|
+
*
|
|
49
|
+
* When using `@hpke/core`, the instance of this class must be specified
|
|
50
|
+
* to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes256Gcm`
|
|
51
|
+
* as follows:
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* import {
|
|
57
|
+
* Aes256Gcm,
|
|
58
|
+
* CipherSuite,
|
|
59
|
+
* DhkemP256HkdfSha256,
|
|
60
|
+
* HkdfSha256,
|
|
61
|
+
* } from "@hpke/core";
|
|
62
|
+
*
|
|
63
|
+
* const suite = new CipherSuite({
|
|
64
|
+
* kem: new DhkemP256HkdfSha256(),
|
|
65
|
+
* kdf: new HkdfSha256(),
|
|
66
|
+
* aead: new Aes256Gcm(),
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare class Aes256Gcm extends Aes128Gcm {
|
|
71
|
+
/** AeadId.Aes256Gcm (0x0002) */
|
|
72
|
+
id: AeadId;
|
|
73
|
+
/** 32 */
|
|
74
|
+
keySize: number;
|
|
75
|
+
/** 12 */
|
|
76
|
+
nonceSize: number;
|
|
77
|
+
/** 16 */
|
|
78
|
+
tagSize: number;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=aesGcm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aesGcm.d.ts","sourceRoot":"","sources":["../../../src/src/aeads/aesGcm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAEL,MAAM,EACN,eAAe,EAEhB,MAAM,cAAc,CAAC;AAEtB,qBAAa,aAAc,SAAQ,eACjC,YAAW,qBAAqB;IAChC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,IAAI,CAAoC;gBAE7B,GAAG,EAAE,eAAe,GAAG,eAAe;IAK5C,IAAI,CACf,EAAE,EAAE,eAAe,GAAG,eAAe,EACrC,IAAI,EAAE,eAAe,GAAG,eAAe,EACvC,GAAG,EAAE,eAAe,GAAG,eAAe,GACrC,OAAO,CAAC,WAAW,CAAC;IAeV,IAAI,CACf,EAAE,EAAE,eAAe,GAAG,eAAe,EACrC,IAAI,EAAE,eAAe,GAAG,eAAe,EACvC,GAAG,EAAE,eAAe,GAAG,eAAe,GACrC,OAAO,CAAC,WAAW,CAAC;cAeP,SAAS;YAWX,UAAU;CASzB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,SAAU,YAAW,aAAa;IAC7C,gCAAgC;IAChC,SAAgB,EAAE,EAAE,MAAM,CAAoB;IAC9C,SAAS;IACT,SAAgB,OAAO,EAAE,MAAM,CAAM;IACrC,SAAS;IACT,SAAgB,SAAS,EAAE,MAAM,CAAM;IACvC,SAAS;IACT,SAAgB,OAAO,EAAE,MAAM,CAAM;IAE9B,uBAAuB,CAC5B,GAAG,EAAE,eAAe,GAAG,eAAe,GACrC,qBAAqB;CAGzB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,SAAU,SAAQ,SAAS;IACtC,gCAAgC;IACvB,EAAE,EAAE,MAAM,CAAoB;IACvC,SAAS;IACA,OAAO,EAAE,MAAM,CAAM;IAC9B,SAAS;IACA,SAAS,EAAE,MAAM,CAAM;IAChC,SAAS;IACA,OAAO,EAAE,MAAM,CAAM;CAC/B"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { AEAD_USAGES, AeadId, NativeAlgorithm, toArrayBuffer, } from "@hpke/common";
|
|
2
|
+
export class AesGcmContext extends NativeAlgorithm {
|
|
3
|
+
constructor(key) {
|
|
4
|
+
super();
|
|
5
|
+
Object.defineProperty(this, "_rawKey", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true,
|
|
9
|
+
value: void 0
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(this, "_key", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
writable: true,
|
|
15
|
+
value: undefined
|
|
16
|
+
});
|
|
17
|
+
this._rawKey = toArrayBuffer(key);
|
|
18
|
+
}
|
|
19
|
+
async seal(iv, data, aad) {
|
|
20
|
+
await this._setupKey();
|
|
21
|
+
const alg = {
|
|
22
|
+
name: "AES-GCM",
|
|
23
|
+
iv: toArrayBuffer(iv),
|
|
24
|
+
additionalData: toArrayBuffer(aad),
|
|
25
|
+
};
|
|
26
|
+
const ct = await this._api.encrypt(alg, this._key, toArrayBuffer(data));
|
|
27
|
+
return ct;
|
|
28
|
+
}
|
|
29
|
+
async open(iv, data, aad) {
|
|
30
|
+
await this._setupKey();
|
|
31
|
+
const alg = {
|
|
32
|
+
name: "AES-GCM",
|
|
33
|
+
iv: toArrayBuffer(iv),
|
|
34
|
+
additionalData: toArrayBuffer(aad),
|
|
35
|
+
};
|
|
36
|
+
const pt = await this._api.decrypt(alg, this._key, toArrayBuffer(data));
|
|
37
|
+
return pt;
|
|
38
|
+
}
|
|
39
|
+
async _setupKey() {
|
|
40
|
+
if (this._key !== undefined) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
await this._setup();
|
|
44
|
+
const key = await this._importKey(this._rawKey);
|
|
45
|
+
(new Uint8Array(this._rawKey)).fill(0);
|
|
46
|
+
this._key = key;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
async _importKey(key) {
|
|
50
|
+
return await this._api.importKey("raw", key, { name: "AES-GCM" }, true, AEAD_USAGES);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The AES-128-GCM for HPKE AEAD implementing {@link AeadInterface}.
|
|
55
|
+
*
|
|
56
|
+
* When using `@hpke/core`, the instance of this class must be specified
|
|
57
|
+
* to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes128Gcm`.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* import {
|
|
63
|
+
* Aes128Gcm,
|
|
64
|
+
* CipherSuite,
|
|
65
|
+
* DhkemP256HkdfSha256,
|
|
66
|
+
* HkdfSha256,
|
|
67
|
+
* } from "@hpke/core";
|
|
68
|
+
*
|
|
69
|
+
* const suite = new CipherSuite({
|
|
70
|
+
* kem: new DhkemP256HkdfSha256(),
|
|
71
|
+
* kdf: new HkdfSha256(),
|
|
72
|
+
* aead: new Aes128Gcm(),
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export class Aes128Gcm {
|
|
77
|
+
constructor() {
|
|
78
|
+
/** AeadId.Aes128Gcm (0x0001) */
|
|
79
|
+
Object.defineProperty(this, "id", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
configurable: true,
|
|
82
|
+
writable: true,
|
|
83
|
+
value: AeadId.Aes128Gcm
|
|
84
|
+
});
|
|
85
|
+
/** 16 */
|
|
86
|
+
Object.defineProperty(this, "keySize", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true,
|
|
89
|
+
writable: true,
|
|
90
|
+
value: 16
|
|
91
|
+
});
|
|
92
|
+
/** 12 */
|
|
93
|
+
Object.defineProperty(this, "nonceSize", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
configurable: true,
|
|
96
|
+
writable: true,
|
|
97
|
+
value: 12
|
|
98
|
+
});
|
|
99
|
+
/** 16 */
|
|
100
|
+
Object.defineProperty(this, "tagSize", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
configurable: true,
|
|
103
|
+
writable: true,
|
|
104
|
+
value: 16
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
createEncryptionContext(key) {
|
|
108
|
+
return new AesGcmContext(key);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The AES-256-GCM for HPKE AEAD implementing {@link AeadInterface}.
|
|
113
|
+
*
|
|
114
|
+
* When using `@hpke/core`, the instance of this class must be specified
|
|
115
|
+
* to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes256Gcm`
|
|
116
|
+
* as follows:
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
*
|
|
120
|
+
* ```ts
|
|
121
|
+
* import {
|
|
122
|
+
* Aes256Gcm,
|
|
123
|
+
* CipherSuite,
|
|
124
|
+
* DhkemP256HkdfSha256,
|
|
125
|
+
* HkdfSha256,
|
|
126
|
+
* } from "@hpke/core";
|
|
127
|
+
*
|
|
128
|
+
* const suite = new CipherSuite({
|
|
129
|
+
* kem: new DhkemP256HkdfSha256(),
|
|
130
|
+
* kdf: new HkdfSha256(),
|
|
131
|
+
* aead: new Aes256Gcm(),
|
|
132
|
+
* });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export class Aes256Gcm extends Aes128Gcm {
|
|
136
|
+
constructor() {
|
|
137
|
+
super(...arguments);
|
|
138
|
+
/** AeadId.Aes256Gcm (0x0002) */
|
|
139
|
+
Object.defineProperty(this, "id", {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
configurable: true,
|
|
142
|
+
writable: true,
|
|
143
|
+
value: AeadId.Aes256Gcm
|
|
144
|
+
});
|
|
145
|
+
/** 32 */
|
|
146
|
+
Object.defineProperty(this, "keySize", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
configurable: true,
|
|
149
|
+
writable: true,
|
|
150
|
+
value: 32
|
|
151
|
+
});
|
|
152
|
+
/** 12 */
|
|
153
|
+
Object.defineProperty(this, "nonceSize", {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
configurable: true,
|
|
156
|
+
writable: true,
|
|
157
|
+
value: 12
|
|
158
|
+
});
|
|
159
|
+
/** 16 */
|
|
160
|
+
Object.defineProperty(this, "tagSize", {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
configurable: true,
|
|
163
|
+
writable: true,
|
|
164
|
+
value: 16
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AeadEncryptionContext, AeadInterface } from "@hpke/common";
|
|
2
|
+
import { AeadId } from "@hpke/common";
|
|
3
|
+
/**
|
|
4
|
+
* The ExportOnly mode for HPKE AEAD implementing {@link AeadInterface}.
|
|
5
|
+
*
|
|
6
|
+
* When using `@hpke/core`, the instance of this class must be specified
|
|
7
|
+
* to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.ExportOnly`
|
|
8
|
+
* as follows:
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import {
|
|
14
|
+
* CipherSuite,
|
|
15
|
+
* DhkemP256HkdfSha256,
|
|
16
|
+
* ExportOnly,
|
|
17
|
+
* HkdfSha256,
|
|
18
|
+
* } from "@hpke/core";
|
|
19
|
+
*
|
|
20
|
+
* const suite = new CipherSuite({
|
|
21
|
+
* kem: new DhkemP256HkdfSha256(),
|
|
22
|
+
* kdf: new HkdfSha256(),
|
|
23
|
+
* aead: new ExportOnly(),
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class ExportOnly implements AeadInterface {
|
|
28
|
+
readonly id: AeadId;
|
|
29
|
+
readonly keySize: number;
|
|
30
|
+
readonly nonceSize: number;
|
|
31
|
+
readonly tagSize: number;
|
|
32
|
+
createEncryptionContext(_key: ArrayBufferLike | ArrayBufferView): AeadEncryptionContext;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=exportOnly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportOnly.d.ts","sourceRoot":"","sources":["../../../src/src/aeads/exportOnly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,MAAM,EAAqB,MAAM,cAAc,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,UAAW,YAAW,aAAa;IAC9C,SAAgB,EAAE,EAAE,MAAM,CAAqB;IAC/C,SAAgB,OAAO,EAAE,MAAM,CAAK;IACpC,SAAgB,SAAS,EAAE,MAAM,CAAK;IACtC,SAAgB,OAAO,EAAE,MAAM,CAAK;IAE7B,uBAAuB,CAC5B,IAAI,EAAE,eAAe,GAAG,eAAe,GACtC,qBAAqB;CAGzB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AeadId, NotSupportedError } from "@hpke/common";
|
|
2
|
+
/**
|
|
3
|
+
* The ExportOnly mode for HPKE AEAD implementing {@link AeadInterface}.
|
|
4
|
+
*
|
|
5
|
+
* When using `@hpke/core`, the instance of this class must be specified
|
|
6
|
+
* to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.ExportOnly`
|
|
7
|
+
* as follows:
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import {
|
|
13
|
+
* CipherSuite,
|
|
14
|
+
* DhkemP256HkdfSha256,
|
|
15
|
+
* ExportOnly,
|
|
16
|
+
* HkdfSha256,
|
|
17
|
+
* } from "@hpke/core";
|
|
18
|
+
*
|
|
19
|
+
* const suite = new CipherSuite({
|
|
20
|
+
* kem: new DhkemP256HkdfSha256(),
|
|
21
|
+
* kdf: new HkdfSha256(),
|
|
22
|
+
* aead: new ExportOnly(),
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class ExportOnly {
|
|
27
|
+
constructor() {
|
|
28
|
+
Object.defineProperty(this, "id", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: AeadId.ExportOnly
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(this, "keySize", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: 0
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(this, "nonceSize", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
value: 0
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(this, "tagSize", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: 0
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
createEncryptionContext(_key) {
|
|
54
|
+
throw new NotSupportedError("Export only");
|
|
55
|
+
}
|
|
56
|
+
}
|