@uglyunicorn/pie 0.1.4 → 0.1.5
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 +4 -2
- package/package.json +1 -1
- package/src/crypto/hpke.ts +3 -5
- package/src/crypto/index.ts +6 -1
package/body.txt
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
* Refactor
|
|
1
|
+
* Refactor EnvelopeContext type in index.ts and clean up hpke.ts exports
|
|
2
2
|
|
|
3
|
-
* Update package version to 0.1.
|
|
3
|
+
* Update package version to 0.1.5 in package.json
|
|
4
|
+
|
|
5
|
+
* Refactor envelopeContext return type in hpke.ts to use generic CipherContext<Envelope> for improved type safety
|
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
|
|
12
|
+
import type { CipherContext, DecipherContext, RetranslateContext } from "..";
|
|
13
13
|
|
|
14
14
|
export class HpkeEnvelopeError extends Error {}
|
|
15
15
|
|
|
@@ -18,8 +18,6 @@ export interface Envelope {
|
|
|
18
18
|
enc: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export type CipherContext = CipherContextType<Envelope>;
|
|
22
|
-
|
|
23
21
|
export function createCipherSuite(): CipherSuite {
|
|
24
22
|
return new CipherSuite(KEM_DHKEM_P256_HKDF_SHA256, KDF_HKDF_SHA256, AEAD_AES_128_GCM);
|
|
25
23
|
}
|
|
@@ -91,7 +89,7 @@ export async function openEnvelope<T>(
|
|
|
91
89
|
return validated.value;
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
export function envelopeContext(opts: { out: Pick<KeyPair, "publicKey"> }): CipherContext
|
|
92
|
+
export function envelopeContext(opts: { out: Pick<KeyPair, "publicKey"> }): CipherContext<Envelope>;
|
|
95
93
|
|
|
96
94
|
export function envelopeContext(opts: {
|
|
97
95
|
in: Pick<KeyPair, "privateKey">;
|
|
@@ -121,7 +119,7 @@ export function envelopeContext(opts?: any) {
|
|
|
121
119
|
if (opts?.out) {
|
|
122
120
|
return {
|
|
123
121
|
seal: (schema, data) => sealEnvelope(schema, data, opts.out.publicKey),
|
|
124
|
-
} as CipherContext
|
|
122
|
+
} as CipherContext<Envelope>;
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
return undefined;
|
package/src/crypto/index.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { EnvelopeContext as EnvelopeContextType } from "..";
|
|
2
|
+
import type { Envelope } from "./hpke";
|
|
3
|
+
|
|
4
|
+
export { createCipherSuite, envelopeContext, type Envelope } from "./hpke";
|
|
5
|
+
|
|
6
|
+
export type EnvelopeContext = EnvelopeContextType<Envelope>;
|