@interncom/diplomatic 0.14.1 → 0.15.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.
@@ -1,9 +1,7 @@
1
1
  import { Enclave } from "../shared/crypto/enclave";
2
2
  import { type ValStat } from "../shared/valstat";
3
3
  import type { ISeedStore, SetSeedOpts } from "../types";
4
- import { type LargeBlobRp } from "./largeBlob";
5
- export { defaultWebAuthnRpId } from "./webauthn";
6
- export { LargeBlob, type LargeBlobCreateOpts, type LargeBlobRp, } from "./largeBlob";
4
+ import type { LargeBlobRp } from "../shared/webauthn/largeBlob";
7
5
  export type PasskeySeedStoreOpts = LargeBlobRp & {
8
6
  credId?: Uint8Array;
9
7
  };
@@ -1,25 +1,12 @@
1
1
  import { ICodecStruct } from "../codec.ts";
2
- import { type MasterSeed } from "../seed.ts";
3
- import { type ValStat } from "../valstat.ts";
4
2
  import { type BundleHost } from "./bundleHost.ts";
5
3
  export { type BundleHost, bundleHostCodec } from "./bundleHost.ts";
6
- export declare const IDENTITY_BUNDLE_VERSION = 1;
7
- export type IdentityBundle = {
8
- v: number;
9
- masterSeed: MasterSeed;
4
+ export type IdentityHosts = {
10
5
  hosts: BundleHost[];
11
6
  };
12
7
  /**
13
- * IdentityBundle wire layout:
14
- * v: varint
15
- * masterSeed: 32 fixed bytes
8
+ * Host list on the IdentityBundle wire:
16
9
  * hostsLen: varint
17
10
  * hosts: hostsLen × BundleHost
18
11
  */
19
- export declare const identityBundleCodec: ICodecStruct<IdentityBundle>;
20
- /**
21
- * Build a wire-format identity bundle from a branded {@link MasterSeed} + hosts.
22
- * Codec/tests only. Runtime seed I/O must go through Enclave.persistToLargeBlob
23
- * — never encode then hand seed-bearing bytes to outer layers.
24
- */
25
- export declare function createIdentityBundle(masterSeed: MasterSeed, hosts: BundleHost[]): ValStat<IdentityBundle>;
12
+ export declare const identityHostsCodec: ICodecStruct<IdentityHosts>;
@@ -125,6 +125,14 @@ export declare class Enclave {
125
125
  }>>;
126
126
  /** UV + overwrite largeBlob with zeros (destroys stored seed material). */
127
127
  static clearLargeBlob(credId: Uint8Array, opts?: LargeBlobRp): Promise<Status>;
128
+ /**
129
+ * Absorb seed‖hosts plaintext (pair AEAD inner).
130
+ * Encoder/Decoder never see the seed.
131
+ */
132
+ static fromPairPlain(plain: Uint8Array): ValStat<{
133
+ enclave: Enclave;
134
+ hosts: BundleHost[];
135
+ }>;
128
136
  static pairRequest(): Promise<ValStat<PairRequest>>;
129
137
  pairAccept(dhkeReq: DHKEReq, hosts: BundleHost[]): Promise<ValStat<DHKEResp>>;
130
138
  /**
@@ -1,4 +1,3 @@
1
- import { Status } from "../consts.ts";
2
1
  import { type ValStat } from "../valstat.ts";
3
2
  import { type WebAuthnRp } from "./common.ts";
4
3
  export type LargeBlobRp = WebAuthnRp;
@@ -10,8 +9,6 @@ export type LargeBlobCreateOpts = LargeBlobRp & {
10
9
  export declare function largeBlobCapable(): Promise<boolean>;
11
10
  /** Create discoverable largeBlob-capable credential; returns credential id. */
12
11
  export declare function largeBlobCreateCred(opts?: LargeBlobCreateOpts): Promise<ValStat<Uint8Array>>;
13
- /** UV write of opaque bytes to largeBlob. */
14
- export declare function largeBlobWrite(credId: Uint8Array, data: Uint8Array, opts?: LargeBlobRp): Promise<Status>;
15
12
  /** UV read from largeBlob; `credId` undefined = discoverable then targeted read. */
16
13
  export declare function largeBlobRead(credId: Uint8Array | undefined, opts?: LargeBlobRp): Promise<ValStat<{
17
14
  blob: Uint8Array;
@@ -1,4 +1,3 @@
1
- import { type ValStat } from "../valstat.ts";
2
1
  import { type AuthenticatorAttachmentName, type WebAuthnRp } from "./common.ts";
3
2
  export type PrfRp = WebAuthnRp;
4
3
  export type PrfCreateOpts = PrfRp & {
@@ -17,8 +16,6 @@ export type PrfCreateOpts = PrfRp & {
17
16
  export declare const DEFAULT_PRF_SALT: Uint8Array<ArrayBufferLike>;
18
17
  /** Default WebAuthn user.name / displayName when none is supplied. */
19
18
  export declare const DEFAULT_PRF_USER_NAME = "diplomatic-prf";
20
- /** Bytes of PRF output we consume (first N of `results.first`). */
21
- export declare const PRF_OUTPUT_LEN = 32;
22
19
  /** Public ceremony facts (no PRF bytes). */
23
20
  export type PrfCeremony = {
24
21
  credId: Uint8Array;
@@ -27,15 +24,6 @@ export type PrfCeremony = {
27
24
  transports?: string[];
28
25
  aaguid?: Uint8Array;
29
26
  };
30
- export type PrfCreateResult = PrfCeremony & {
31
- prfEnabled: boolean;
32
- /** Present when the UA evaluated PRF during create (no second get). */
33
- prf?: Uint8Array;
34
- };
35
- /** Internal: PRF output + cred id. For Enclave only — do not re-export to apps. */
36
- export type PrfEvalResult = PrfCeremony & {
37
- prf: Uint8Array;
38
- };
39
27
  export type PrfEvalOpts = PrfRp & {
40
28
  /** One id, or every bound id so a spare key can assert in one get(). */
41
29
  credId?: Uint8Array | readonly Uint8Array[];
@@ -43,10 +31,3 @@ export type PrfEvalOpts = PrfRp & {
43
31
  };
44
32
  /** Best-effort: client advertises PRF extension. */
45
33
  export declare function prfCapable(): Promise<boolean>;
46
- /** Create a discoverable credential that enables PRF. */
47
- export declare function createPrfCred(opts?: PrfCreateOpts): Promise<ValStat<PrfCreateResult>>;
48
- /**
49
- * Evaluate PRF (UV). Returns PRF bytes — only Enclave should call this and must
50
- * zero/drop PRF after seal/unseal. Apps must not hold PRF alongside sealed meta.
51
- */
52
- export declare function evalPrf(opts?: PrfEvalOpts): Promise<ValStat<PrfEvalResult>>;