@interncom/diplomatic 0.21.1 → 0.22.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.
@@ -3,7 +3,7 @@ import { Status } from "../consts.ts";
3
3
  import { MASTER_SEED_LEN, type MasterSeed, type SealedMasterKey } from "../seed.ts";
4
4
  import type { ICrypto, PublicKey } from "../types.ts";
5
5
  import { type ValStat } from "../valstat.ts";
6
- import { type DHKEReq, type DHKEResp, PairRequest } from "./pairing.ts";
6
+ import { type DHKEReq, type DHKEResp } from "./pairing.ts";
7
7
  import { type LargeBlobCreateOpts, type LargeBlobRp } from "../webauthn/largeBlob.ts";
8
8
  import { type PrfCeremony, type PrfCreateOpts, type PrfEvalOpts, type PrfRp } from "../webauthn/prf.ts";
9
9
  export type { LargeBlobCreateOpts, LargeBlobRp };
@@ -65,6 +65,18 @@ declare const SEAL_KEY_LEN = 32;
65
65
  declare const SEAL_PRF_MIN_LEN = 16;
66
66
  /** Minimum musec length (Mandatory User-Space Entropy Contribution). */
67
67
  declare const MUSEC_MIN_LEN = 32;
68
+ declare class PairRequest {
69
+ #private;
70
+ private constructor();
71
+ static create(): Promise<ValStat<PairRequest>>;
72
+ wipe(): void;
73
+ get dhkeReq(): DHKEReq;
74
+ finish(dhkeResp: DHKEResp): Promise<ValStat<{
75
+ enclave: Enclave;
76
+ hosts: BundleHost[];
77
+ }>>;
78
+ }
79
+ export type { PairRequest };
68
80
  /** Brand `bytes` as {@link MasterSeed} only if length is {@link MASTER_SEED_LEN}. */
69
81
  export declare function asMasterSeed(bytes: Uint8Array): ValStat<MasterSeed>;
70
82
  export declare class Enclave {
@@ -149,16 +161,19 @@ export declare class Enclave {
149
161
  * Web bundles set DIP_CLI_DUMP=false; the write is compiled out.
150
162
  */
151
163
  dumpToTty(): Promise<Status>;
164
+ static pairRequest(): Promise<ValStat<PairRequest>>;
152
165
  /**
153
- * Absorb seed‖hosts plaintext (pair AEAD inner).
154
- * Encoder/Decoder never see the seed.
166
+ * Seals seed+hosts for dhkeReq. Returns dhkeResp to send back.
167
+ * @param acks Set fields only after explicit user affirmation (e.g. a checkbox).
168
+ * Do not default these to `true` in application code.
155
169
  */
156
- static fromPairPlain(plain: Uint8Array): ValStat<{
157
- enclave: Enclave;
158
- hosts: BundleHost[];
159
- }>;
160
- static pairRequest(): Promise<ValStat<PairRequest>>;
161
- pairAccept(dhkeReq: DHKEReq, hosts: BundleHost[]): Promise<ValStat<DHKEResp>>;
170
+ pairAccept(dhkeReq: DHKEReq, hosts: BundleHost[], acks: {
171
+ /**
172
+ * Set `true` only after the user explicitly affirms they control both
173
+ * devices in this pair. Never hard-code in a client.
174
+ */
175
+ userControlsBothSidesOfPair: true;
176
+ }): Promise<ValStat<DHKEResp>>;
162
177
  /**
163
178
  * Spawn a new sync Worker from the embedded bundle and inject this enclave's
164
179
  * master seed into it (transfer). Seed never goes to a caller-supplied port —
@@ -1,6 +1,4 @@
1
- import type { BundleHost } from "../codecs/bundleHost.ts";
2
1
  import { type ValStat } from "../valstat.ts";
3
- import { Enclave } from "./enclave.ts";
4
2
  import type { X25519Sk } from "./x25519.ts";
5
3
  export declare const SEAL_PAIR_DOMAIN: Uint8Array<ArrayBufferLike>;
6
4
  export declare const X25519_PUB_LEN = 32;
@@ -20,15 +18,4 @@ export declare function pairKey(sk: X25519Sk, // local X25519 priv
20
18
  peer: Uint8Array, // ECDH peer pub (enroller: dhkeReq; enrollee: respPub)
21
19
  reqPub: Uint8Array, // enrollee pub, bound into KDF
22
20
  respPub: Uint8Array): Promise<ValStat<Uint8Array>>;
23
- export declare class PairRequest {
24
- #private;
25
- private constructor();
26
- static create(): Promise<ValStat<PairRequest>>;
27
- wipe(): void;
28
- get dhkeReq(): DHKEReq;
29
- finish(dhkeResp: DHKEResp): Promise<ValStat<{
30
- enclave: Enclave;
31
- hosts: BundleHost[];
32
- }>>;
33
- }
34
21
  export {};