@bitspark/archon-server 0.8.2 → 0.10.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.
@@ -0,0 +1,88 @@
1
+ /** How long a pending enrollment lives, in seconds, when the config names no ttl. */
2
+ export declare const ENROLL_DEFAULT_TTL_SECONDS = 300;
3
+ /** A pending enrollment: written once by `prepare`, persisted by the service, never changed —
4
+ * completion consumes it, it does not edit it. */
5
+ export interface EnrollmentRecord {
6
+ transaction: Uint8Array;
7
+ /** What authorized the enrollment: the session, or the bootstrap credential reserved to this
8
+ * record. An identifier, never a secret — a session's id, not its cookie — since the record
9
+ * is stored. */
10
+ authorization: Uint8Array;
11
+ /** The intended account, opaque to archon. */
12
+ account: Uint8Array;
13
+ purpose: string;
14
+ newKey: Uint8Array;
15
+ nonce: Uint8Array;
16
+ /** SHA-256 of the service's immutable intent bytes. */
17
+ intentDigest: Uint8Array;
18
+ /** Seconds since the epoch. */
19
+ expires: number;
20
+ }
21
+ /** What the client needs to prove: the record's public half and the audience. */
22
+ export interface EnrollmentChallenge {
23
+ transaction: Uint8Array;
24
+ nonce: Uint8Array;
25
+ purpose: string;
26
+ audience: string;
27
+ intentDigest: Uint8Array;
28
+ expires: number;
29
+ }
30
+ /** What the service supplies to `prepare`, after validating the authorizing credential. */
31
+ export interface EnrollmentBegin {
32
+ authorization: Uint8Array;
33
+ account: Uint8Array;
34
+ purpose: string;
35
+ newKey: Uint8Array;
36
+ /** The immutable intent bytes — what the service will record. archon binds their digest and
37
+ * never interprets them. A digest is not confidentiality: keep guessable account data out. */
38
+ intent: Uint8Array;
39
+ }
40
+ export type EnrollmentOutcome = "completed" | "notPending" | "unavailable";
41
+ /** The service's authorizing integration: its persistence of pending records and its atomic
42
+ * completion. */
43
+ export interface EnrollmentIntegration {
44
+ /** The record for `transaction`, or undefined when there is none. A throw means it cannot
45
+ * answer, and the completion fails closed. */
46
+ load(transaction: Uint8Array): EnrollmentRecord | undefined | Promise<EnrollmentRecord | undefined>;
47
+ /**
48
+ * The service's atomic business operation. In one persistence transaction it checks that
49
+ * `record` is still pending and its authorizing context still acceptable under the service's
50
+ * policy, records `record.newKey` as `record.account`'s for `record.purpose`, and consumes the
51
+ * record (and any bootstrap credential reserved to it). Concurrent calls for one record answer
52
+ * "completed" at most once.
53
+ */
54
+ complete(record: EnrollmentRecord): EnrollmentOutcome | Promise<EnrollmentOutcome>;
55
+ }
56
+ export interface EnrollerConfig {
57
+ /** The configured audience every binding is rebuilt from (docs/request.md §2). */
58
+ audience: string;
59
+ /** Required: without it, possession alone would suffice. */
60
+ integration: EnrollmentIntegration;
61
+ /** Seconds; defaults to ENROLL_DEFAULT_TTL_SECONDS. */
62
+ ttl?: number;
63
+ /** Seconds since the epoch; defaults to the system clock. */
64
+ clock?: () => number;
65
+ entropy?: (n: number) => Uint8Array;
66
+ }
67
+ /** Why a completion failed, with the HTTP status a service's route answers: 400 for a malformed
68
+ * completion, 401 for a proof that does not verify, 403 for a completion under another
69
+ * authorization, 404 for an unknown or expired transaction, 409 for one already completed or no
70
+ * longer eligible, 503 when the integration cannot answer. */
71
+ export declare class EnrollmentRefusal extends Error {
72
+ readonly status: number;
73
+ constructor(status: number, message: string);
74
+ }
75
+ /** Prepares and completes enrollments under one configuration. */
76
+ export declare class Enroller {
77
+ #private;
78
+ constructor(config: EnrollerConfig);
79
+ /** The pending record for `begin`, and the challenge to send the client. The service persists
80
+ * the record; nothing here stores it. */
81
+ prepare(begin: EnrollmentBegin): Promise<{
82
+ record: EnrollmentRecord;
83
+ challenge: EnrollmentChallenge;
84
+ }>;
85
+ /** Complete the enrollment `transaction` names, under `authorization`, with `proof`. Returns
86
+ * the completed record; throws an EnrollmentRefusal. */
87
+ complete(transaction: Uint8Array, proof: Uint8Array, authorization: Uint8Array): Promise<EnrollmentRecord>;
88
+ }
@@ -0,0 +1,157 @@
1
+ // The server's half of key enrollment (ADR 0010 §7; docs/request.md §6, version 1, fixed by
2
+ // ADR 0010's status note of 4 October 2026).
3
+ //
4
+ // An enrollment has a new key prove its own possession while a separate authority — the
5
+ // service's session, or a bootstrap credential — says whose key it is. The sdk holds the binding
6
+ // and the proof. This module holds what only a server can, in two halves:
7
+ //
8
+ // - `prepare` builds the PENDING RECORD, the immutable association of authorizing context,
9
+ // intended account, purpose, new key, a fresh nonce, the intent's digest and an expiry. The
10
+ // service calls it only after validating the session or bootstrap credential, persists the
11
+ // record in its own transaction (reserving a bootstrap credential to it atomically, when there
12
+ // is one), and sends the client the challenge.
13
+ // - `complete` takes what a completion request carries — the transaction id and the proof — and
14
+ // the authorization the service extracted from that request. It checks, in order: the record
15
+ // exists and has not expired; the same authorization began it; the proof verifies under the
16
+ // record's new key, over the binding rebuilt from the record and the configured audience. Only
17
+ // then does it call the integration's `complete`, the service's ATOMIC business operation: the
18
+ // key-account association recorded and the record consumed, in one persistence transaction.
19
+ // archon cannot promise that atomicity across a callback and a separate database (ADR 0010
20
+ // §7), so it does not pretend to: the operation is the service's.
21
+ //
22
+ // There is NO "possession alone suffices" mode: the constructor refuses a missing integration.
23
+ // Possession identifies a key; only the service's authority ties it to an account. And a
24
+ // completion cannot substitute anything: it names a record, and the account, key, purpose, nonce
25
+ // and intent all come from that record.
26
+ //
27
+ // archon defines no enrollment route. The service mounts completion wherever it serves its
28
+ // accounts, behind its own session and CSRF protection.
29
+ import { ENROLL_DIGEST_SIZE, ENROLL_MAX_TRANSACTION_SIZE, MIN_NONCE_SIZE, enrollBinding, verifyEnroll } from "@bitspark/archon-sdk";
30
+ /** How long a pending enrollment lives, in seconds, when the config names no ttl. */
31
+ export const ENROLL_DEFAULT_TTL_SECONDS = 300;
32
+ /** The generated transaction id's and nonce's size: the possession scheme's floor, and enough
33
+ * that an id is not guessable. */
34
+ const ID_SIZE = MIN_NONCE_SIZE;
35
+ /** Why a completion failed, with the HTTP status a service's route answers: 400 for a malformed
36
+ * completion, 401 for a proof that does not verify, 403 for a completion under another
37
+ * authorization, 404 for an unknown or expired transaction, 409 for one already completed or no
38
+ * longer eligible, 503 when the integration cannot answer. */
39
+ export class EnrollmentRefusal extends Error {
40
+ status;
41
+ constructor(status, message) {
42
+ super(message);
43
+ this.status = status;
44
+ }
45
+ }
46
+ function equal(a, b) {
47
+ if (a.length !== b.length)
48
+ return false;
49
+ let diff = 0;
50
+ for (let i = 0; i < a.length; i++)
51
+ diff |= a[i] ^ b[i];
52
+ return diff === 0;
53
+ }
54
+ function request(r) {
55
+ return { nonce: r.nonce, transaction: r.transaction, purpose: r.purpose, newKey: r.newKey, intentDigest: r.intentDigest };
56
+ }
57
+ /** Prepares and completes enrollments under one configuration. */
58
+ export class Enroller {
59
+ #audience;
60
+ #integration;
61
+ #ttl;
62
+ #clock;
63
+ #entropy;
64
+ constructor(config) {
65
+ if (config.integration === undefined || config.integration === null) {
66
+ throw new Error("enroll: an integration is required — possession identifies a key; only the service's authority ties it to an account");
67
+ }
68
+ // The binding's audience rules, checked once here rather than failing every completion.
69
+ enrollBinding(config.audience, {
70
+ nonce: new Uint8Array(ID_SIZE),
71
+ transaction: new Uint8Array(1),
72
+ purpose: "add-key",
73
+ newKey: new Uint8Array(32),
74
+ intentDigest: new Uint8Array(ENROLL_DIGEST_SIZE),
75
+ });
76
+ this.#audience = config.audience;
77
+ this.#integration = config.integration;
78
+ this.#ttl = config.ttl ?? ENROLL_DEFAULT_TTL_SECONDS;
79
+ this.#clock = config.clock ?? (() => Math.floor(Date.now() / 1000));
80
+ this.#entropy = config.entropy ?? ((n) => crypto.getRandomValues(new Uint8Array(n)));
81
+ }
82
+ /** The pending record for `begin`, and the challenge to send the client. The service persists
83
+ * the record; nothing here stores it. */
84
+ async prepare(begin) {
85
+ if (begin.authorization.length === 0)
86
+ throw new Error("enroll: an enrollment needs the authorization that began it");
87
+ if (begin.account.length === 0)
88
+ throw new Error("enroll: an enrollment needs the account it is for");
89
+ const intent = new Uint8Array(begin.intent);
90
+ const record = {
91
+ transaction: this.#entropy(ID_SIZE).slice(),
92
+ authorization: begin.authorization.slice(),
93
+ account: begin.account.slice(),
94
+ purpose: begin.purpose,
95
+ newKey: begin.newKey.slice(),
96
+ nonce: this.#entropy(ID_SIZE).slice(),
97
+ intentDigest: new Uint8Array(await crypto.subtle.digest("SHA-256", intent)),
98
+ expires: this.#clock() + this.#ttl,
99
+ };
100
+ // The sdk's binding rules, refused here rather than at completion.
101
+ enrollBinding(this.#audience, request(record));
102
+ return {
103
+ record,
104
+ challenge: {
105
+ transaction: record.transaction,
106
+ nonce: record.nonce,
107
+ purpose: record.purpose,
108
+ audience: this.#audience,
109
+ intentDigest: record.intentDigest,
110
+ expires: record.expires,
111
+ },
112
+ };
113
+ }
114
+ /** Complete the enrollment `transaction` names, under `authorization`, with `proof`. Returns
115
+ * the completed record; throws an EnrollmentRefusal. */
116
+ async complete(transaction, proof, authorization) {
117
+ if (transaction.length === 0 || transaction.length > ENROLL_MAX_TRANSACTION_SIZE) {
118
+ throw new EnrollmentRefusal(400, "enroll: malformed transaction id");
119
+ }
120
+ let record;
121
+ try {
122
+ record = await this.#integration.load(transaction);
123
+ }
124
+ catch {
125
+ throw new EnrollmentRefusal(503, "enroll: the integration cannot load");
126
+ }
127
+ if (record === undefined)
128
+ throw new EnrollmentRefusal(404, "enroll: unknown or expired transaction");
129
+ // A record for another transaction is an integration fault, and is never verified against.
130
+ if (!equal(record.transaction, transaction)) {
131
+ throw new EnrollmentRefusal(503, "enroll: the integration returned another transaction's record");
132
+ }
133
+ if (this.#clock() >= record.expires)
134
+ throw new EnrollmentRefusal(404, "enroll: unknown or expired transaction");
135
+ // The same authorization that began it — checked before the proof, so a stranger's
136
+ // completion learns nothing about it.
137
+ if (authorization.length === 0 || !equal(record.authorization, authorization)) {
138
+ throw new EnrollmentRefusal(403, "enroll: not the authorization that began this enrollment");
139
+ }
140
+ if (!verifyEnroll(this.#audience, request(record), proof)) {
141
+ throw new EnrollmentRefusal(401, "enroll: the proof does not verify");
142
+ }
143
+ let outcome;
144
+ try {
145
+ outcome = await this.#integration.complete(record);
146
+ }
147
+ catch {
148
+ outcome = "unavailable";
149
+ }
150
+ if (outcome === "completed")
151
+ return record;
152
+ if (outcome === "notPending")
153
+ throw new EnrollmentRefusal(409, "enroll: already completed or no longer eligible");
154
+ throw new EnrollmentRefusal(503, "enroll: the integration cannot complete");
155
+ }
156
+ }
157
+ //# sourceMappingURL=enroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enroll.js","sourceRoot":"","sources":["../../src/enroll.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,6CAA6C;AAC7C,EAAE;AACF,wFAAwF;AACxF,iGAAiG;AACjG,0EAA0E;AAC1E,EAAE;AACF,2FAA2F;AAC3F,8FAA8F;AAC9F,6FAA6F;AAC7F,iGAAiG;AACjG,iDAAiD;AACjD,gGAAgG;AAChG,+FAA+F;AAC/F,8FAA8F;AAC9F,iGAAiG;AACjG,iGAAiG;AACjG,8FAA8F;AAC9F,6FAA6F;AAC7F,oEAAoE;AACpE,EAAE;AACF,+FAA+F;AAC/F,yFAAyF;AACzF,iGAAiG;AACjG,wCAAwC;AACxC,EAAE;AACF,2FAA2F;AAC3F,wDAAwD;AACxD,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAsB,MAAM,sBAAsB,CAAC;AAExJ,qFAAqF;AACrF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAE9C;mCACmC;AACnC,MAAM,OAAO,GAAG,cAAc,CAAC;AAwE/B;;;+DAG+D;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAE/B,MAAM;IADjB,YACW,MAAc,EACvB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;sBAHN,MAAM;IAIjB,CAAC;CACF;AAED,SAAS,KAAK,CAAC,CAAa,EAAE,CAAa;IACzC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACxC,IA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,IAAI,iBAAiB,CAAC,GAAG,EAAE,wCAAwC,CAAC,CAAC;QAChH,mFAAmF;QACnF,sCAAsC;QACtC,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,CAAC;YAC9E,MAAM,IAAI,iBAAiB,CAAC,GAAG,EAAE,0DAA0D,CAAC,CAAC;QAC/F,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;YAC1D,MAAM,IAAI,iBAAiB,CAAC,GAAG,EAAE,mCAAmC,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,OAA0B,CAAC;QAC/B,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,GAAG,aAAa,CAAC;QAC1B,CAAC;QACD,IAAI,OAAO,KAAK,WAAW;YAAE,OAAO,MAAM,CAAC;QAC3C,IAAI,OAAO,KAAK,YAAY;YAAE,MAAM,IAAI,iBAAiB,CAAC,GAAG,EAAE,iDAAiD,CAAC,CAAC;QAClH,MAAM,IAAI,iBAAiB,CAAC,GAAG,EAAE,yCAAyC,CAAC,CAAC;IAC9E,CAAC;CACF"}
@@ -1,2 +1,4 @@
1
1
  export * from "./login.js";
2
+ export * from "./request.js";
3
+ export * from "./enroll.js";
2
4
  export { fromHex, MAX_BODY_BYTES, rfc3339, scanTopLevel, stripMount, toHex } from "./json.js";
package/dist/src/index.js CHANGED
@@ -7,6 +7,13 @@
7
7
  // them. It opens no socket, starts no timer, persists nothing, and interprets no authority:
8
8
  // that is ADR 0007 §B, and it is what makes the tier adoptable by a service that has already
9
9
  // chosen its stack.
10
+ //
11
+ // It also carries the server's half of request authentication (docs/request.md §7, version 1):
12
+ // a `RequestVerifier` in front of a replay store, under the same constraints. And the server's
13
+ // half of key enrollment (docs/request.md §6, version 1): an `Enroller` that cannot be built
14
+ // without the service's authorizing integration.
10
15
  export * from "./login.js";
16
+ export * from "./request.js";
17
+ export * from "./enroll.js";
11
18
  export { fromHex, MAX_BODY_BYTES, rfc3339, scanTopLevel, stripMount, toHex } from "./json.js";
12
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,EAAE;AACF,+FAA+F;AAC/F,qEAAqE;AACrE,uFAAuF;AACvF,0FAA0F;AAC1F,4FAA4F;AAC5F,6FAA6F;AAC7F,oBAAoB;AACpB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,EAAE;AACF,+FAA+F;AAC/F,qEAAqE;AACrE,uFAAuF;AACvF,0FAA0F;AAC1F,4FAA4F;AAC5F,6FAA6F;AAC7F,oBAAoB;AACpB,EAAE;AACF,+FAA+F;AAC/F,+FAA+F;AAC/F,6FAA6F;AAC7F,iDAAiD;AACjD,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC"}
@@ -7,14 +7,33 @@ export declare const DEFAULT_TTL_SECONDS = 300;
7
7
  export declare const DEFAULT_INTERVAL_SECONDS = 5;
8
8
  /**
9
9
  * Interprets the authority payload — the ONLY place one is interpreted, and archon ships no
10
- * implementation. THROWING refuses the answer with `403 invalid_grant` and stores nothing.
10
+ * implementation. It is handed the browser key the delegation is for, the principal that signed
11
+ * the proof, the opaque payload, and the request the proof is for (`Admitted`: its id and the
12
+ * scope and validity the person approved, exactly as the proof bound them), so the law evaluates
13
+ * what was signed rather than what it assumes (#61); a law written for the first three
14
+ * arguments keeps working. THROWING refuses the answer with `403 invalid_grant` and stores
15
+ * nothing.
11
16
  * Omitting it means the proof alone suffices, which is right for a service whose law needs
12
17
  * nothing beyond "this key holder was here and approved this scope".
13
18
  *
14
- * It may be async, and the handler awaits it. See the note on `answer` for why every check it
15
- * depends on is repeated afterwards.
19
+ * It may be async, and the handler awaits it. It is called AT MOST ONCE AT A TIME PER
20
+ * REQUEST, and never for an answer that arrives after another was stored (see `answer`). That
21
+ * is not an exactly-once boundary: a refused answer's law did run, and a process can stop
22
+ * after the law returns and before the answer is stored. So it must only validate, or make its
23
+ * effects idempotent (keyed by the request id it is handed), or leave them until the browser
24
+ * has collected.
16
25
  */
17
- export type AdmitAuthority = (browser: Uint8Array, principal: Uint8Array, authority: Uint8Array) => void | Promise<void>;
26
+ export type AdmitAuthority = (browser: Uint8Array, principal: Uint8Array, authority: Uint8Array, request: Admitted) => void | Promise<void>;
27
+ /** The request a verified answer is for, as its proof bound it. The law gets copies: nothing it
28
+ * does to them reaches the stored request. */
29
+ export interface Admitted {
30
+ /** The server's request id, unique per login — the key for idempotent effects. */
31
+ readonly id: Uint8Array;
32
+ /** The entries the person was shown and approved, in order. */
33
+ readonly scope: readonly string[];
34
+ /** The delegation's approved lifetime in seconds. */
35
+ readonly validFor: number;
36
+ }
18
37
  /** Seconds since the Unix epoch. A config field rather than a call to `Date.now()`, which is
19
38
  * the sdk's rule and the reason the suite never sleeps. */
20
39
  export type Clock = () => number;
package/dist/src/login.js CHANGED
@@ -277,6 +277,7 @@ export class Handler {
277
277
  expires: this.#clock() + this.ttlSeconds,
278
278
  answered: undefined,
279
279
  lastPoll: undefined,
280
+ admission: undefined,
280
281
  };
281
282
  // A request that cannot produce a binding must not be handed out: the CLI would fetch it,
282
283
  // show it, and fail at signing time with nothing to explain.
@@ -481,15 +482,18 @@ export class Handler {
481
482
  *
482
483
  * THE AWAIT IS THE HAZARD. `AdmitAuthority` is the SERVICE's code and may be async — a
483
484
  * database, a network call — and JavaScript hands the runtime to every other pending request
484
- * at that `await`. So the state this decision rests on is RE-CHECKED afterwards: a second
485
- * CLI answering the same login while the first was being admitted is ordinary (a person with
486
- * two terminals), and the loser must get 409 rather than overwrite an answer the browser may
487
- * already have collected.
485
+ * at that `await`. A second CLI answering the same login while the first is being admitted is
486
+ * ordinary (a person with two terminals), so a verified answer first TAKES THE REQUEST'S
487
+ * ADMISSION TURN and re-checks the record holding it: one law at a time per request, and none
488
+ * at all for an answer that arrives after another was stored — it gets 409 without the law
489
+ * running, where it used to run the law and then lose (#61). A REFUSED answer releases the
490
+ * turn, so a stranger's refused answer delays the person by the law's running time and never
491
+ * denies them.
488
492
  *
489
- * The three server lanes reach the same rule from opposite directions: go and rs must keep
490
- * the law OUT of the store's mutex so one slow law cannot decide the throughput of every
491
- * login; here there is no mutex to hold, and the danger is the interleaving that an `await`
492
- * makes certain rather than merely possible.
493
+ * The three server lanes reach the same rule from opposite directions: go and rs keep the
494
+ * law OUT of the store's mutex, behind a per-request turn, so one slow law cannot decide the
495
+ * throughput of every login; here there is no mutex to hold, and the turn is a promise chained
496
+ * on the record.
493
497
  */
494
498
  async #answer(request, idHex) {
495
499
  let body;
@@ -533,25 +537,51 @@ export class Handler {
533
537
  if (!verifyLogin(principal, this.audience, toRequest(record), possession)) {
534
538
  return fail(403, ERR_INVALID_GRANT);
535
539
  }
536
- if (this.#admit !== undefined) {
537
- try {
538
- await this.#admit(record.browser, principal, new TextEncoder().encode(authority ?? ""));
540
+ // Take the turn. Reading the previous holder and installing this one happen with no
541
+ // `await` between them, so two answers can never both believe they hold it.
542
+ const previous = record.admission;
543
+ let release = () => { };
544
+ const mine = new Promise((resolve) => {
545
+ release = resolve;
546
+ });
547
+ record.admission = mine;
548
+ try {
549
+ await previous;
550
+ // Everything the decision rests on, re-read now that the turn is ours.
551
+ const live = this.#live(idHex);
552
+ if (live === undefined)
553
+ return fail(404, ERR_EXPIRED_TOKEN);
554
+ if (live.answered !== undefined) {
555
+ // Another answer was stored while this one waited. Storing here would discard a proof
556
+ // the browser may already have collected, and running the law for it would be an
557
+ // admission nobody can use.
558
+ return fail(409, ERR_INVALID_REQUEST);
539
559
  }
540
- catch {
541
- return fail(403, ERR_INVALID_GRANT);
560
+ if (this.#admit !== undefined) {
561
+ try {
562
+ await this.#admit(live.browser, principal, new TextEncoder().encode(authority ?? ""), {
563
+ id: new Uint8Array(live.id),
564
+ scope: [...live.scope],
565
+ validFor: live.validFor,
566
+ });
567
+ }
568
+ catch {
569
+ return fail(403, ERR_INVALID_GRANT);
570
+ }
542
571
  }
572
+ // The record can expire while the law runs. Nothing else can change: only the holder of
573
+ // the turn stores an answer.
574
+ const still = this.#live(idHex);
575
+ if (still === undefined)
576
+ return fail(404, ERR_EXPIRED_TOKEN);
577
+ still.answered = { principal: principalText, possession: possessionText, authority };
578
+ return new Response(null, { status: 204 });
543
579
  }
544
- // Everything the decision rested on, re-read after the await.
545
- const still = this.#live(idHex);
546
- if (still === undefined)
547
- return fail(404, ERR_EXPIRED_TOKEN);
548
- if (still.answered !== undefined) {
549
- // Another answer won while this one was being admitted. Storing here would discard a
550
- // proof the browser may already have collected.
551
- return fail(409, ERR_INVALID_REQUEST);
580
+ finally {
581
+ release();
582
+ if (record.admission === mine)
583
+ record.admission = undefined;
552
584
  }
553
- still.answered = { principal: principalText, possession: possessionText, authority };
554
- return new Response(null, { status: 204 });
555
585
  }
556
586
  /**
557
587
  * Hands the answer to the browser ONCE and drops the record.
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/login.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,2FAA2F;AAC3F,yFAAyF;AACzF,+DAA+D;AAC/D,EAAE;AACF,qEAAqE;AACrE,0FAA0F;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,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,114 @@
1
+ import { type RequestPolicy, type VerifiedRequest } from "@bitspark/archon-sdk";
2
+ /** The largest body a verifier reads to recompute the digest. A larger one is refused, never
3
+ * truncated: a digest over part of a body verifies nothing. */
4
+ export declare const REQUEST_MAX_BODY_BYTES: number;
5
+ export type ReplayOutcome = "inserted" | "alreadyPresent" | "unavailable";
6
+ /** What a replay store remembers. Never the signature bytes: a signature is one spelling of a
7
+ * proof, the identifier is the proof's. */
8
+ export interface ReplayKey {
9
+ /** REQUEST_TAG. */
10
+ profile: string;
11
+ audience: string;
12
+ /** The canonical key text. */
13
+ principal: string;
14
+ /** Hex. */
15
+ nonce: string;
16
+ }
17
+ /** One insertion: the key, and the window in which any verifier could accept the proof — `from`
18
+ * is created − δ, `until` is expires + δ, both in seconds since the epoch. A store retains the
19
+ * key at least until `until`; `from` is what lets a store that lost its memory refuse proofs it
20
+ * might have seen. */
21
+ export interface ReplayEntry {
22
+ key: ReplayKey;
23
+ from: number;
24
+ until: number;
25
+ }
26
+ /**
27
+ * Makes a proof usable at most once. Requirements (ADR 0010 §5): one winner across every
28
+ * verifier in the acceptance scope — concurrent inserts of one key return "inserted" at most
29
+ * once; a key retained at least until its `until`, when no verifier can still accept the proof;
30
+ * and a store that cannot guarantee both answers "unavailable" rather than "inserted".
31
+ */
32
+ export interface ReplayStore {
33
+ insertIfAbsent(entry: ReplayEntry): ReplayOutcome | Promise<ReplayOutcome>;
34
+ }
35
+ /**
36
+ * The reference ReplayStore: one process, in memory. It is correct for exactly one verifier
37
+ * process, and its RESTART POLICY is what makes it correct across a restart at all (ADR 0010 §5:
38
+ * losing accepted identifiers reopens old proofs).
39
+ *
40
+ * A proof is acceptable from `entry.from` (created − δ). A process started at `start` cannot know
41
+ * what an earlier process accepted, so it admits only proofs whose window opened at or after
42
+ * `start`, and answers "unavailable" for anything older — waiting out, rather than guessing about,
43
+ * the proofs a previous incarnation could have seen. A deployment with more than one verifier, or
44
+ * that cannot afford the wait, supplies a shared store with the same contract.
45
+ */
46
+ export declare class MemoryReplayStore implements ReplayStore {
47
+ #private;
48
+ readonly start: number;
49
+ /** `start`: when this incarnation began, in seconds since the epoch. */
50
+ constructor(start: number);
51
+ insertIfAbsent(entry: ReplayEntry): ReplayOutcome;
52
+ /** Forgets every identifier whose `until` is not after `now`, and returns how many. Optional
53
+ * and caller-driven: nothing here starts a timer, and retaining a key longer is always safe. */
54
+ sweep(now: number): number;
55
+ }
56
+ /** ADR 0010 §6's `AuthenticatedRequest`: a request that verified and was admitted by the replay
57
+ * store — the principal, and the request descriptor authentication verified. Authorization
58
+ * evaluates this, not a re-parse. (Go and Rust name it `request.Authenticated`, as the sdk names
59
+ * `VerifiedRequest` `request.Verified` there: the module supplies the noun.) */
60
+ export type AuthenticatedRequest = VerifiedRequest;
61
+ /** Why a request was not authenticated, with the HTTP status to answer: 400 for a request the
62
+ * profile does not accept as transported, 401 for one that does not authenticate, 413 for an
63
+ * oversized body, 503 when the replay store is unavailable. */
64
+ export declare class RequestRefusal extends Error {
65
+ readonly status: number;
66
+ constructor(status: number, message: string);
67
+ }
68
+ /** A request as received: the method, the raw request-target, every header field in order, the
69
+ * body after transfer framing, and the trailer fields (any is refused in v1). */
70
+ export interface RawRequest {
71
+ method: string;
72
+ requestTarget: string;
73
+ headers: ReadonlyArray<readonly [string, string]>;
74
+ body: Uint8Array;
75
+ trailers?: ReadonlyArray<readonly [string, string]>;
76
+ }
77
+ /** The shape of node:http's IncomingMessage that `readNodeRequest` reads — structural, so this
78
+ * package depends on no server. */
79
+ export interface NodeRequestLike extends AsyncIterable<Uint8Array | string> {
80
+ method?: string | undefined;
81
+ url?: string | undefined;
82
+ rawHeaders: string[];
83
+ rawTrailers: string[];
84
+ }
85
+ /** Read a node:http request as received: its raw request-target, its raw header lines, its body
86
+ * (refused, not truncated, past REQUEST_MAX_BODY_BYTES) and its trailers.
87
+ *
88
+ * Past the limit it keeps no more bytes but reads on to the end, as node:http itself drains an
89
+ * unread body: abandoning the stream would destroy the socket, and the client would get a reset
90
+ * instead of the 413. The server's request timeout bounds how long that can take. */
91
+ export declare function readNodeRequest(req: NodeRequestLike): Promise<RawRequest>;
92
+ export interface VerifierConfig {
93
+ policy: RequestPolicy;
94
+ store: ReplayStore;
95
+ /** Seconds since the epoch; defaults to the system clock. */
96
+ clock?: () => number;
97
+ }
98
+ /** Authenticates requests under one policy against one replay store. */
99
+ export declare class RequestVerifier {
100
+ #private;
101
+ constructor(config: VerifierConfig);
102
+ /** Authenticate a request as received. Throws a RequestRefusal. */
103
+ authenticateRaw(raw: RawRequest): Promise<AuthenticatedRequest>;
104
+ /** Authenticate a fetch Request — the normalised request a fetch application routes on — and
105
+ * return the body it read alongside. Throws a RequestRefusal. */
106
+ authenticate(request: Request): Promise<{
107
+ auth: AuthenticatedRequest;
108
+ body: Uint8Array<ArrayBuffer>;
109
+ }>;
110
+ /** The fetch-style middleware: authenticate every request before `next` sees it. A refused
111
+ * request never reaches `next`; it is answered with the refusal's status and a one-line reason.
112
+ * `next` gets a fresh Request carrying the body that was verified. */
113
+ guard(next: (request: Request, auth: AuthenticatedRequest) => Response | Promise<Response>): (request: Request) => Promise<Response>;
114
+ }
@@ -0,0 +1,242 @@
1
+ // The server's half of request authentication (ADR 0010 §5–§6; docs/request.md §7 steps 8–9,
2
+ // version 1, fixed by ADR 0010's status note of 4 October 2026).
3
+ //
4
+ // The sdk's verifyRequest checks a proof: one spelling, the coverage, the audience echo, the
5
+ // digest, freshness and the signature. It does not remember. This module adds what only a
6
+ // server can: the HTTP extraction, the clock, and the REPLAY STORE — the one operation that makes
7
+ // a proof usable at most once:
8
+ //
9
+ // insertIfAbsent({key: (profile, audience, principal, nonce), from, until}) → inserted | alreadyPresent | unavailable
10
+ //
11
+ // A request reaches the application only as an AuthenticatedRequest, and only after a proof verified
12
+ // AND its identifier was inserted. `alreadyPresent` is a replay; `unavailable` FAILS CLOSED — a
13
+ // store that cannot answer, or throws, is never permission to skip the check.
14
+ //
15
+ // Two ways in, because a fetch-style Request has already lost the request line:
16
+ //
17
+ // - `authenticateRaw` takes the request as received. `readNodeRequest` builds one from
18
+ // node:http's IncomingMessage — its raw `url` and `rawHeaders` — so a Node server verifies
19
+ // exactly what arrived, as the Go and Rust lanes do.
20
+ // - `authenticate` (and `guard`) take a fetch Request, and verify against its URL's pathname and
21
+ // search. The WHATWG URL parser has normalised those (dot segments resolved, `\` read as `/`,
22
+ // some characters percent-encoded), and a Headers object has joined repeated fields with ", ".
23
+ // That normalised request is the only one a fetch application ever sees and routes on, so it is
24
+ // the one verified: what authentication checked and what authorization evaluates stay the same
25
+ // request. A proof signed over any other spelling is refused.
26
+ //
27
+ // Like the login handler, nothing here opens a socket, starts a timer or depends on a framework.
28
+ import { REQUEST_TAG, verifyRequest } from "@bitspark/archon-sdk";
29
+ /** The largest body a verifier reads to recompute the digest. A larger one is refused, never
30
+ * truncated: a digest over part of a body verifies nothing. */
31
+ export const REQUEST_MAX_BODY_BYTES = 1 << 20;
32
+ /**
33
+ * The reference ReplayStore: one process, in memory. It is correct for exactly one verifier
34
+ * process, and its RESTART POLICY is what makes it correct across a restart at all (ADR 0010 §5:
35
+ * losing accepted identifiers reopens old proofs).
36
+ *
37
+ * A proof is acceptable from `entry.from` (created − δ). A process started at `start` cannot know
38
+ * what an earlier process accepted, so it admits only proofs whose window opened at or after
39
+ * `start`, and answers "unavailable" for anything older — waiting out, rather than guessing about,
40
+ * the proofs a previous incarnation could have seen. A deployment with more than one verifier, or
41
+ * that cannot afford the wait, supplies a shared store with the same contract.
42
+ */
43
+ export class MemoryReplayStore {
44
+ start;
45
+ #seen = new Map();
46
+ /** `start`: when this incarnation began, in seconds since the epoch. */
47
+ constructor(start) {
48
+ this.start = start;
49
+ }
50
+ insertIfAbsent(entry) {
51
+ if (entry.from < this.start)
52
+ return "unavailable";
53
+ const k = JSON.stringify([entry.key.profile, entry.key.audience, entry.key.principal, entry.key.nonce]);
54
+ if (this.#seen.has(k))
55
+ return "alreadyPresent";
56
+ this.#seen.set(k, entry.until);
57
+ return "inserted";
58
+ }
59
+ /** Forgets every identifier whose `until` is not after `now`, and returns how many. Optional
60
+ * and caller-driven: nothing here starts a timer, and retaining a key longer is always safe. */
61
+ sweep(now) {
62
+ let n = 0;
63
+ for (const [k, until] of this.#seen) {
64
+ if (until <= now) {
65
+ this.#seen.delete(k);
66
+ n++;
67
+ }
68
+ }
69
+ return n;
70
+ }
71
+ }
72
+ /** Why a request was not authenticated, with the HTTP status to answer: 400 for a request the
73
+ * profile does not accept as transported, 401 for one that does not authenticate, 413 for an
74
+ * oversized body, 503 when the replay store is unavailable. */
75
+ export class RequestRefusal extends Error {
76
+ status;
77
+ constructor(status, message) {
78
+ super(message);
79
+ this.status = status;
80
+ }
81
+ }
82
+ function pairs(flat) {
83
+ const out = [];
84
+ for (let i = 0; i + 1 < flat.length; i += 2)
85
+ out.push([flat[i], flat[i + 1]]);
86
+ return out;
87
+ }
88
+ function concat(chunks, total) {
89
+ const out = new Uint8Array(total);
90
+ let at = 0;
91
+ for (const c of chunks) {
92
+ out.set(c, at);
93
+ at += c.length;
94
+ }
95
+ return out;
96
+ }
97
+ function tooLarge() {
98
+ return new RequestRefusal(413, "request: the body is over the verifier's limit");
99
+ }
100
+ /** Read a node:http request as received: its raw request-target, its raw header lines, its body
101
+ * (refused, not truncated, past REQUEST_MAX_BODY_BYTES) and its trailers.
102
+ *
103
+ * Past the limit it keeps no more bytes but reads on to the end, as node:http itself drains an
104
+ * unread body: abandoning the stream would destroy the socket, and the client would get a reset
105
+ * instead of the 413. The server's request timeout bounds how long that can take. */
106
+ export async function readNodeRequest(req) {
107
+ const chunks = [];
108
+ let total = 0;
109
+ for await (const chunk of req) {
110
+ const bytes = typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk;
111
+ total += bytes.length;
112
+ if (total > REQUEST_MAX_BODY_BYTES) {
113
+ chunks.length = 0;
114
+ continue;
115
+ }
116
+ chunks.push(bytes);
117
+ }
118
+ if (total > REQUEST_MAX_BODY_BYTES)
119
+ throw tooLarge();
120
+ return {
121
+ method: req.method ?? "",
122
+ requestTarget: req.url ?? "",
123
+ headers: pairs(req.rawHeaders),
124
+ body: concat(chunks, total),
125
+ trailers: pairs(req.rawTrailers),
126
+ };
127
+ }
128
+ async function readBounded(body) {
129
+ if (body === null)
130
+ return new Uint8Array(0);
131
+ const reader = body.getReader();
132
+ const chunks = [];
133
+ let total = 0;
134
+ for (;;) {
135
+ const { done, value } = await reader.read();
136
+ if (done)
137
+ break;
138
+ total += value.length;
139
+ if (total > REQUEST_MAX_BODY_BYTES) {
140
+ await reader.cancel().catch(() => { });
141
+ throw tooLarge();
142
+ }
143
+ chunks.push(value);
144
+ }
145
+ return concat(chunks, total);
146
+ }
147
+ /** Authenticates requests under one policy against one replay store. */
148
+ export class RequestVerifier {
149
+ #policy;
150
+ #store;
151
+ #clock;
152
+ constructor(config) {
153
+ this.#policy = config.policy;
154
+ this.#store = config.store;
155
+ this.#clock = config.clock ?? (() => Math.floor(Date.now() / 1000));
156
+ }
157
+ /** Authenticate a request as received. Throws a RequestRefusal. */
158
+ async authenticateRaw(raw) {
159
+ if (raw.body.length > REQUEST_MAX_BODY_BYTES)
160
+ throw tooLarge();
161
+ // v1 accepts no content coding and no trailers (ADR 0010 §4): the digest is over the content
162
+ // as received, and a coded body would make "as received" ambiguous.
163
+ if (raw.headers.some(([n]) => n.toLowerCase() === "content-encoding") || (raw.trailers?.length ?? 0) > 0) {
164
+ throw new RequestRefusal(400, "request: content codings and trailers are not accepted in v1");
165
+ }
166
+ let verified;
167
+ try {
168
+ verified = verifyRequest(this.#policy, this.#clock(), {
169
+ method: raw.method,
170
+ requestTarget: raw.requestTarget,
171
+ headers: raw.headers,
172
+ body: raw.body,
173
+ });
174
+ }
175
+ catch (e) {
176
+ throw new RequestRefusal(401, e instanceof Error ? e.message : String(e));
177
+ }
178
+ // Only now, after the proof and its freshness verified (ADR 0010 §5: verify before
179
+ // inserting), is the identifier remembered — until no verifier can still accept it.
180
+ let outcome;
181
+ try {
182
+ outcome = await this.#store.insertIfAbsent({
183
+ key: {
184
+ profile: REQUEST_TAG,
185
+ audience: this.#policy.audience,
186
+ principal: verified.keyText,
187
+ nonce: Array.from(verified.nonce, (b) => b.toString(16).padStart(2, "0")).join(""),
188
+ },
189
+ from: verified.created - this.#policy.skew,
190
+ until: verified.expires + this.#policy.skew,
191
+ });
192
+ }
193
+ catch {
194
+ outcome = "unavailable";
195
+ }
196
+ if (outcome === "inserted")
197
+ return verified;
198
+ if (outcome === "alreadyPresent")
199
+ throw new RequestRefusal(401, "request: replayed");
200
+ throw new RequestRefusal(503, "request: the replay store is unavailable");
201
+ }
202
+ /** Authenticate a fetch Request — the normalised request a fetch application routes on — and
203
+ * return the body it read alongside. Throws a RequestRefusal. */
204
+ async authenticate(request) {
205
+ const body = await readBounded(request.body);
206
+ const url = new URL(request.url);
207
+ const auth = await this.authenticateRaw({
208
+ method: request.method,
209
+ requestTarget: url.pathname + url.search,
210
+ headers: [...request.headers],
211
+ body,
212
+ });
213
+ return { auth, body };
214
+ }
215
+ /** The fetch-style middleware: authenticate every request before `next` sees it. A refused
216
+ * request never reaches `next`; it is answered with the refusal's status and a one-line reason.
217
+ * `next` gets a fresh Request carrying the body that was verified. */
218
+ guard(next) {
219
+ return async (request) => {
220
+ let verified;
221
+ try {
222
+ verified = await this.authenticate(request);
223
+ }
224
+ catch (e) {
225
+ const status = e instanceof RequestRefusal ? e.status : 401;
226
+ return new Response(`${e instanceof Error ? e.message : String(e)}\n`, {
227
+ status,
228
+ headers: { "content-type": "text/plain; charset=utf-8" },
229
+ });
230
+ }
231
+ const bodiless = request.method === "GET" || request.method === "HEAD";
232
+ const forward = new Request(request.url, {
233
+ method: request.method,
234
+ headers: request.headers,
235
+ body: bodiless ? null : verified.body,
236
+ signal: request.signal,
237
+ });
238
+ return next(forward, verified.auth);
239
+ };
240
+ }
241
+ }
242
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,iEAAiE;AACjE,EAAE;AACF,6FAA6F;AAC7F,0FAA0F;AAC1F,kGAAkG;AAClG,+BAA+B;AAC/B,EAAE;AACF,wHAAwH;AACxH,EAAE;AACF,qGAAqG;AACrG,gGAAgG;AAChG,8EAA8E;AAC9E,EAAE;AACF,gFAAgF;AAChF,EAAE;AACF,uFAAuF;AACvF,6FAA6F;AAC7F,uDAAuD;AACvD,iGAAiG;AACjG,gGAAgG;AAChG,iGAAiG;AACjG,kGAAkG;AAClG,iGAAiG;AACjG,gEAAgE;AAChE,EAAE;AACF,iGAAiG;AACjG,OAAO,EAAE,WAAW,EAAE,aAAa,EAA4C,MAAM,sBAAsB,CAAC;AAE5G;gEACgE;AAChE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,CAAC;AAoC9C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,iBAAiB;IAIP,KAAK;IAHjB,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE3C,wEAAwE;IACxE,YAAqB,KAAa;qBAAb,KAAK;IAAW,CAAC;IAEtC,cAAc,CAAC,KAAkB;QAC/B,IAAI,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK;YAAE,OAAO,aAAa,CAAC;QAClD,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACxG,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,gBA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AAC,GAAG,CAAC;gBAC5D,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE;oBACrE,MAAM;oBACN,OAAO,EAAE,EAAE,cAAc,EAAE,2BAA2B,EAAE;iBACzD,CAAC,CAAC;YACL,CAAC;YACD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,KAAK,KAAK,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC;YACvE,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;gBACvC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI;gBACrC,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitspark/archon-server",
3
- "version": "0.8.2",
4
- "description": "archon login: the service-side handler — four routes, law-free, store-minimal. A fetch-style handler that opens no socket.",
3
+ "version": "0.10.0",
4
+ "description": "archon's service side: the login handler (four routes, law-free, store-minimal), the request profile's verifier with its replay store, and key enrollment's server half. Fetch-style; opens no socket.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -22,8 +22,8 @@
22
22
  "test": "tsc -p tsconfig.json && node --test dist/test/*.test.js"
23
23
  },
24
24
  "dependencies": {
25
- "@bitspark/archon": "^0.8.2",
26
- "@bitspark/archon-sdk": "^0.8.2"
25
+ "@bitspark/archon": "^0.10.0",
26
+ "@bitspark/archon-sdk": "^0.10.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^26",