@byok-sdk/core 0.30.1 → 0.31.0
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/dist/index.js +8 -3163
- package/dist/index.js.map +1 -1
- package/dist/sealed-payload/index.d.ts +1 -1
- package/dist/sealed-payload/index.js +2 -1586
- package/dist/sealed-payload/index.js.map +1 -1
- package/dist/sealed-payload/scope-key.d.ts +19 -5
- package/dist/sealed-payload/sealed-content.d.ts +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,9 @@ export declare const SCOPE_KEY_PACKAGE_VERSION = 1;
|
|
|
10
10
|
export declare const SCOPE_KEY_HPKE_INFO = "byok-sdk.scope-key.v1";
|
|
11
11
|
/** Prepended to the canonical package bytes the sender signs. */
|
|
12
12
|
export declare const SCOPE_KEY_PACKAGE_DOMAIN_PREFIX = "byok-scope-key-package-v1\n";
|
|
13
|
+
export declare const SCOPE_KEY_PACKAGE_V2 = 2;
|
|
14
|
+
export declare const SCOPE_KEY_HPKE_INFO_V2 = "byok-sdk.scope-key.v2";
|
|
15
|
+
export declare const SCOPE_KEY_PACKAGE_V2_DOMAIN_PREFIX = "byok-scope-key-package-v2\n";
|
|
13
16
|
/** A fresh scope key from the platform CSPRNG. */
|
|
14
17
|
export declare function generateScopeKey(): Bytes;
|
|
15
18
|
export declare function deriveScopeKeyId(scopeKey: Uint8Array): Promise<string>;
|
|
@@ -38,14 +41,22 @@ export interface ScopeKeyPackageV1 {
|
|
|
38
41
|
/** Sender's ECDSA P-256 / SHA-256 signature, base64url of the 64-byte P1363 form. */
|
|
39
42
|
readonly sig: string;
|
|
40
43
|
}
|
|
44
|
+
export interface ScopeKeyPackageV2 extends Omit<ScopeKeyPackageV1, 'v'> {
|
|
45
|
+
readonly v: typeof SCOPE_KEY_PACKAGE_V2;
|
|
46
|
+
/** The KEM epoch of the recipient key the package is wrapped to. */
|
|
47
|
+
readonly recipientKemEpoch: number;
|
|
48
|
+
}
|
|
49
|
+
export type ScopeKeyPackage = ScopeKeyPackageV1 | ScopeKeyPackageV2;
|
|
41
50
|
export interface SealScopeKeyPackageInput {
|
|
42
51
|
readonly scopeKey: Uint8Array;
|
|
43
52
|
readonly tenantId: string;
|
|
44
53
|
readonly scopeId: string;
|
|
45
54
|
readonly epoch: number;
|
|
55
|
+
/** The recipient's current KEM key, with its epoch from the verified member chain. */
|
|
46
56
|
readonly recipient: {
|
|
47
57
|
readonly memberId: string;
|
|
48
58
|
readonly kemPublicJwk: P256PublicJwk;
|
|
59
|
+
readonly kemEpoch: number;
|
|
49
60
|
};
|
|
50
61
|
readonly sender: {
|
|
51
62
|
readonly signingPublicJwk: P256PublicJwk;
|
|
@@ -53,11 +64,11 @@ export interface SealScopeKeyPackageInput {
|
|
|
53
64
|
};
|
|
54
65
|
}
|
|
55
66
|
/**
|
|
56
|
-
* Wrap one scope key to one member
|
|
57
|
-
* that does not pair with
|
|
58
|
-
* `sealed_secret_invalid`.
|
|
67
|
+
* Wrap one scope key to one member's KEM key of `recipient.kemEpoch` and sign
|
|
68
|
+
* the version 2 package. A signing private key that does not pair with
|
|
69
|
+
* `sender.signingPublicJwk` throws `sealed_secret_invalid`.
|
|
59
70
|
*/
|
|
60
|
-
export declare function sealScopeKeyPackage(input: SealScopeKeyPackageInput): Promise<
|
|
71
|
+
export declare function sealScopeKeyPackage(input: SealScopeKeyPackageInput): Promise<ScopeKeyPackageV2>;
|
|
61
72
|
export interface OpenScopeKeyPackageInput {
|
|
62
73
|
readonly package: unknown;
|
|
63
74
|
/** What the caller asked the Host for. A package for anything else is refused. */
|
|
@@ -70,6 +81,8 @@ export interface OpenScopeKeyPackageInput {
|
|
|
70
81
|
readonly memberId: string;
|
|
71
82
|
readonly kemPublicJwk: P256PublicJwk;
|
|
72
83
|
readonly kemPrivateKey: WebCryptoKey;
|
|
84
|
+
/** The KEM epoch of this key pair. A version 2 package must name it. */
|
|
85
|
+
readonly kemEpoch: number;
|
|
73
86
|
};
|
|
74
87
|
/** The signing key the caller's verified chain holds for `package.sender`. */
|
|
75
88
|
readonly senderSigningPublicJwk: P256PublicJwk;
|
|
@@ -84,7 +97,8 @@ export type ScopeKeyPackageOpenResult = {
|
|
|
84
97
|
};
|
|
85
98
|
/**
|
|
86
99
|
* Verify and open one key package, in this order: shape; addressed to this
|
|
87
|
-
* recipient for
|
|
100
|
+
* recipient (and, for version 2, its KEM epoch) for the expected tenant,
|
|
101
|
+
* scope and epoch; sender key matches the
|
|
88
102
|
* sender id; sender signature; HPKE open; key length; and `keyId` equal to
|
|
89
103
|
* the opened key's own id. Nothing here throws for hostile input.
|
|
90
104
|
*/
|
|
@@ -86,7 +86,7 @@ export type SealedContentHeaderV1 = z.infer<typeof SealedContentHeaderV1Schema>;
|
|
|
86
86
|
*/
|
|
87
87
|
export interface SealedBinding {
|
|
88
88
|
readonly tenantId: string;
|
|
89
|
-
/** Message family, e.g. `task.
|
|
89
|
+
/** Message family, e.g. `task.offer`, or `routine.template`. */
|
|
90
90
|
readonly family: string;
|
|
91
91
|
readonly direction: SealedDirection;
|
|
92
92
|
/** The write's identity: `{ taskId }`, `{ messageId }`, … or `{ routineId, definitionVersion }`. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byok-sdk/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "BYOK SDK platform contracts: branded tenant identity, tenant-first store ports, device proof canonicalization, and the composition conformance reference",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|