@byok-sdk/core 0.30.0 → 0.30.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.
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type WebCryptoKey } from '../webcrypto';
|
|
2
|
+
import { type P256PublicJwk } from './primitives';
|
|
3
|
+
export declare const MEMBER_KEY_RECORD_VERSION = 1;
|
|
4
|
+
/**
|
|
5
|
+
* Whose keys a store holds. A device member's binding names its SDK device
|
|
6
|
+
* id; a client member's has none, as in its bundle.
|
|
7
|
+
*/
|
|
8
|
+
export interface MemberKeyBinding {
|
|
9
|
+
readonly tenantId: string;
|
|
10
|
+
readonly deviceId?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MemberKeys {
|
|
13
|
+
readonly binding: MemberKeyBinding;
|
|
14
|
+
/** Signs chain entries and key packages. The private key is not extractable. */
|
|
15
|
+
readonly signing: {
|
|
16
|
+
readonly publicJwk: P256PublicJwk;
|
|
17
|
+
readonly privateKey: WebCryptoKey;
|
|
18
|
+
};
|
|
19
|
+
/** Opens key packages. The private key is not extractable. `epoch` starts at 1. */
|
|
20
|
+
readonly kem: MemberKemKey;
|
|
21
|
+
/** The KEM key of a rotation that has begun and not finished, at `kem.epoch + 1`. */
|
|
22
|
+
readonly nextKem?: MemberKemKey;
|
|
23
|
+
}
|
|
24
|
+
export interface MemberKemKey {
|
|
25
|
+
readonly epoch: number;
|
|
26
|
+
readonly publicJwk: P256PublicJwk;
|
|
27
|
+
readonly privateKey: WebCryptoKey;
|
|
28
|
+
}
|
|
29
|
+
/** The custody port of one member's keys. Each store expects one writer. */
|
|
30
|
+
export interface MemberKeyStore {
|
|
31
|
+
/** The keys bound to `binding`, or `undefined` when the store holds none for it. A malformed record throws. */
|
|
32
|
+
load(binding: MemberKeyBinding): Promise<MemberKeys | undefined>;
|
|
33
|
+
/** The keys bound to `binding`. A store that holds none for it creates new ones, which replace any other binding's keys. */
|
|
34
|
+
loadOrCreate(binding: MemberKeyBinding): Promise<MemberKeys>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A new member's record for `binding`: a fresh signing key and a fresh KEM
|
|
38
|
+
* key at epoch 1, as one canonical JSON text. The text holds both private
|
|
39
|
+
* scalars; only the member's own custody stores it.
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateMemberKeyRecord(binding: MemberKeyBinding): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* The keys of a stored record, imported non-extractable, or `undefined` when
|
|
44
|
+
* the text is not a canonical v1 record, or a private scalar does not match
|
|
45
|
+
* its public point. Never throws for hostile input.
|
|
46
|
+
*/
|
|
47
|
+
export declare function openMemberKeyRecord(text: unknown): Promise<MemberKeys | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* Begin a KEM rotation: the record with a new KEM key at `kemEpoch + 1`
|
|
50
|
+
* beside the current one. A record whose rotation has begun comes back
|
|
51
|
+
* unchanged, so a resumed rotation keeps its key. A record that is not
|
|
52
|
+
* canonical v1 text throws.
|
|
53
|
+
*/
|
|
54
|
+
export declare function beginMemberKemRotation(text: string): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Finish the KEM rotation to `epoch`: the next key becomes current, and the
|
|
57
|
+
* old private key is gone from the record. A repeat after the rotation
|
|
58
|
+
* finished comes back unchanged. Any other `epoch` returns `undefined`. A
|
|
59
|
+
* record that is not canonical v1 text throws.
|
|
60
|
+
*/
|
|
61
|
+
export declare function finishMemberKemRotation(text: string, epoch: number): string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byok-sdk/core",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.1",
|
|
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",
|