@uglyunicorn/pie 0.1.3 → 0.1.4
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/body.txt +3 -0
- package/package.json +1 -1
- package/src/crypto/hpke.ts +5 -3
- package/src/crypto/index.ts +1 -1
package/body.txt
CHANGED
package/package.json
CHANGED
package/src/crypto/hpke.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "hpke";
|
|
10
10
|
|
|
11
11
|
import { decodeBuffer, deserialize, encodeBuffer, serialize } from "../lib/utils";
|
|
12
|
-
import type { CipherContext, DecipherContext, RetranslateContext } from "..";
|
|
12
|
+
import type { CipherContext as CipherContextType, DecipherContext, RetranslateContext } from "..";
|
|
13
13
|
|
|
14
14
|
export class HpkeEnvelopeError extends Error {}
|
|
15
15
|
|
|
@@ -18,6 +18,8 @@ export interface Envelope {
|
|
|
18
18
|
enc: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export type CipherContext = CipherContextType<Envelope>;
|
|
22
|
+
|
|
21
23
|
export function createCipherSuite(): CipherSuite {
|
|
22
24
|
return new CipherSuite(KEM_DHKEM_P256_HKDF_SHA256, KDF_HKDF_SHA256, AEAD_AES_128_GCM);
|
|
23
25
|
}
|
|
@@ -89,7 +91,7 @@ export async function openEnvelope<T>(
|
|
|
89
91
|
return validated.value;
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
export function envelopeContext(opts: { out: Pick<KeyPair, "publicKey"> }): CipherContext
|
|
94
|
+
export function envelopeContext(opts: { out: Pick<KeyPair, "publicKey"> }): CipherContext;
|
|
93
95
|
|
|
94
96
|
export function envelopeContext(opts: {
|
|
95
97
|
in: Pick<KeyPair, "privateKey">;
|
|
@@ -119,7 +121,7 @@ export function envelopeContext(opts?: any) {
|
|
|
119
121
|
if (opts?.out) {
|
|
120
122
|
return {
|
|
121
123
|
seal: (schema, data) => sealEnvelope(schema, data, opts.out.publicKey),
|
|
122
|
-
} as CipherContext
|
|
124
|
+
} as CipherContext;
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
return undefined;
|
package/src/crypto/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createCipherSuite, envelopeContext } from "./hpke";
|
|
1
|
+
export { createCipherSuite, envelopeContext, type CipherContext, type Envelope } from "./hpke";
|