@structured-id/proto 0.1.0 → 0.2.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +72 -4
  3. package/dist/generated/sid/v1/authn/auth.client.d.ts +46 -3
  4. package/dist/generated/sid/v1/authn/auth.client.js +73 -49
  5. package/dist/generated/sid/v1/authn/auth.client.js.map +1 -1
  6. package/dist/generated/sid/v1/authn/auth.d.ts +42 -27
  7. package/dist/generated/sid/v1/authn/auth.js +39 -50
  8. package/dist/generated/sid/v1/authn/auth.js.map +1 -1
  9. package/dist/generated/sid/v1/authn/password_history.client.d.ts +68 -0
  10. package/dist/generated/sid/v1/authn/password_history.client.js +36 -0
  11. package/dist/generated/sid/v1/authn/password_history.client.js.map +1 -1
  12. package/dist/generated/sid/v1/authn/password_history.d.ts +254 -0
  13. package/dist/generated/sid/v1/authn/password_history.js +348 -2
  14. package/dist/generated/sid/v1/authn/password_history.js.map +1 -1
  15. package/dist/generated/sid/v1/identity/identity.d.ts +118 -0
  16. package/dist/generated/sid/v1/identity/identity.js +143 -1
  17. package/dist/generated/sid/v1/identity/identity.js.map +1 -1
  18. package/dist/transport/adaptive.d.ts +4 -1
  19. package/dist/transport/adaptive.js +40 -21
  20. package/dist/transport/adaptive.js.map +1 -1
  21. package/dist/transport/framing.js +2 -1
  22. package/dist/transport/framing.js.map +1 -1
  23. package/dist/transport/transport-failure.d.ts +7 -0
  24. package/dist/transport/transport-failure.js +17 -0
  25. package/dist/transport/transport-failure.js.map +1 -0
  26. package/dist/transport/webtransport.d.ts +4 -0
  27. package/dist/transport/webtransport.js +100 -28
  28. package/dist/transport/webtransport.js.map +1 -1
  29. package/package.json +5 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## [0.2.0](https://github.com/structured-id/sdk/compare/typescript-proto-v0.1.1...typescript-proto-v0.2.0) (2026-10-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * **proto:** password change with the current password ([#10](https://github.com/structured-id/sdk/issues/10)) ([92ca841](https://github.com/structured-id/sdk/commit/92ca841115dc9a164c90693b286022d40366f8f9)), closes [#9](https://github.com/structured-id/sdk/issues/9)
9
+
10
+ ## 0.1.1 (2026-10-09)
11
+
12
+
13
+ ### Features
14
+
15
+ * **typescript:** add the @structured-id/proto package ([#7](https://github.com/structured-id/sdk/issues/7)) ([a17ea4d](https://github.com/structured-id/sdk/commit/a17ea4da15aa2a053d084296fbe722322b2f8e64)), closes [#6](https://github.com/structured-id/sdk/issues/6)
package/README.md CHANGED
@@ -44,13 +44,24 @@ message text.
44
44
  ### Transport
45
45
 
46
46
  `AdaptiveRpcTransport` sends every unary call over WebTransport while the
47
- connection is up. A transport-level failure (`UNAVAILABLE`, `CANCELLED`,
48
- `UNKNOWN` or a stream error) retries that call over gRPC-web and reconnects
49
- WebTransport in the background; an application error (`NOT_FOUND`,
50
- `PERMISSION_DENIED`, ...) is returned as is. Server streaming always goes over
47
+ connection is up. A locally observed connection or stream I/O failure retries
48
+ that call over gRPC-web and reconnects WebTransport in the background. Server
49
+ statuses, including `UNAVAILABLE`, `CANCELLED` and `UNKNOWN`, are returned as is:
50
+ a status code alone is not evidence of a failed connection. Malformed protobuf
51
+ responses report `DATA_LOSS`; local encoding errors report `INTERNAL`. Neither
52
+ triggers failover. A server error status rejects the call's headers, response,
53
+ status and trailers promises, preserving its metadata on `RpcError`.
54
+ Server streaming always goes over
51
55
  gRPC-web. Without a `webTransportUrl`, or where the runtime has no
52
56
  `WebTransport`, it is plain gRPC-web.
53
57
 
58
+ `RpcOptions.abort` cancels an active stream and prevents a fallback attempt for
59
+ that cancelled call. `close()` stops background reconnects, including an
60
+ attempt already in progress. Transport-change callbacks are observers: an
61
+ exception in one cannot change connection health or the call's result.
62
+ Remote closure also switches to gRPC-web and starts recovery when no RPC is
63
+ active. A late failure from a retired connection cannot disable its replacement.
64
+
54
65
  `WebTransportRpcTransport`, `WebTransportConnection` and the frame helpers are
55
66
  exported for applications that manage the connection themselves.
56
67
 
@@ -75,6 +86,50 @@ const id = required(ResourceId, target.id); // throws on a missing or invalid id
75
86
  ES modules only. Node loads them from CommonJS through `require` (Node 20.19
76
87
  and later).
77
88
 
89
+ ### Other TypeScript protobuf clients
90
+
91
+ There is no message-key rewriting layer. The protobuf-ts generator uses its
92
+ standard lowerCamelCase local field names and numeric TypeScript enums. On
93
+ binary transports, fields are identified by number, `bytes` remain `Uint8Array`,
94
+ 64-bit integers remain `bigint`, and timestamps retain `{ seconds: bigint,
95
+ nanos: number }`. The finishing script only reuses the identifier message
96
+ objects and adds `.js` to relative module imports.
97
+
98
+ Use message `toJson`/`fromJson` for ProtoJSON, rather than `JSON.stringify`
99
+ on a message object. ProtoJSON uses decimal strings for 64-bit integers,
100
+ base64 for bytes, full schema names for enums, and RFC 3339 timestamps.
101
+ Explicit schema `json_name` is honored: `UserInfo.givenName` becomes
102
+ `given_name` at the OIDC JSON boundary; ordinary fields use lowerCamelCase.
103
+
104
+ For independent [ts-proto](https://github.com/stephenh/ts-proto) clients, this
105
+ tested generator profile preserves binary values without Date conversion:
106
+
107
+ ```text
108
+ forceLong=bigint,useDate=false,snakeToCamel=keys_json,useJsonName=false,stringEnums=false
109
+ ```
110
+
111
+ `useDate=false` gives the matching seconds/nanos structure. In ts-proto
112
+ 2.13.0, that option's default JSON conversion goes through `Date` and loses
113
+ sub-millisecond precision; it is not a lossless Timestamp ProtoJSON bridge.
114
+ The `string-nano` alternative tested with nano-date 4.1.0 also failed
115
+ pre-epoch and calendar-boundary round trips. Keep timestamps structured on
116
+ binary transports, and use the SDK's standard Timestamp ProtoJSON codec when
117
+ exact JSON interchange is needed. `useJsonTimestamp=raw` emits an object
118
+ instead of the standard RFC 3339 string and is not an equivalent REST contract.
119
+ JavaScript `Date` should only be a display conversion when that precision is
120
+ not needed.
121
+
122
+ Local enum constant names can differ between generators; use named constants
123
+ from your own generated module. Both codecs preserve unknown enum numbers in
124
+ binary protobuf. ts-proto 2.13.0's generated JSON enum helpers map unknown
125
+ values to `UNRECOGNIZED`; that path does not preserve future numeric values.
126
+ The interop suite checks both codecs against the actual SID schema, in both
127
+ directions for binary values and for JSON scalars, including 64-bit boundaries,
128
+ nanosecond calendar boundaries, optional zero/false values and explicit OIDC
129
+ JSON field names. Timestamp JSON precision is checked against the SDK codec;
130
+ the ts-proto limitations above are not declared compatible. The independent
131
+ codec is test-only, outside this package's runtime closure.
132
+
78
133
  ## Verify
79
134
 
80
135
  From the `typescript/` directory of the SDK repository, with its `proto`
@@ -87,6 +142,19 @@ yarn test
87
142
  ci/check-package.sh
88
143
  ```
89
144
 
145
+ The release workflow checks every runtime dependency range in the **packed
146
+ archive** against npm before publishing. Missing dependencies or registry
147
+ errors fail the job before a registry write; rerun the existing release's
148
+ publish job after the dependency is available. This applies even when different
149
+ package releases execute in concurrent workflows.
150
+ Within a run, one publish job processes release tags sequentially, with `ids`
151
+ before `proto`; a failed publication stops the sequence. Each package is built
152
+ from its own immutable release tag.
153
+
154
+ The registry bootstrap already published `0.1.0`. The first automated release
155
+ starts at `0.1.1`, so it publishes the reviewed implementation rather than
156
+ skipping an immutable version that already exists in npm.
157
+
90
158
  ## License
91
159
 
92
160
  Apache License, version 2.0. See `LICENSE` and `NOTICE`.
@@ -95,7 +95,8 @@ import type { WebAuthnRegistrationFinishResponse } from "./auth.js";
95
95
  import type { WebAuthnRegistrationFinishRequest } from "./auth.js";
96
96
  import type { WebAuthnRegistrationStartResponse } from "./auth.js";
97
97
  import type { WebAuthnRegistrationStartRequest } from "./auth.js";
98
- import type { PasswordChangeFinishResponse } from "./auth.js";
98
+ import type { Duration } from "../../../google/protobuf/duration.js";
99
+ import type { Empty } from "../../../google/protobuf/empty.js";
99
100
  import type { PasswordChangeFinishRequest } from "./auth.js";
100
101
  import type { PasswordChangeExecuteResponse } from "./auth.js";
101
102
  import type { PasswordChangeExecuteRequest } from "./auth.js";
@@ -141,6 +142,9 @@ export interface IAuthServiceClient {
141
142
  opaqueLoginFinish(input: OpaqueLoginFinishRequest, options?: RpcOptions): UnaryCall<OpaqueLoginFinishRequest, OpaqueLoginFinishResponse>;
142
143
  /**
143
144
  * OPAQUE-ZKPP: OPAQUE with zero-knowledge password policy proof (Pallas curve).
145
+ * Stores the registration's password operation and prepares its history
146
+ * (which may create or replace the owner's history key), so a retry is a new
147
+ * operation, not the same answer.
144
148
  *
145
149
  * @generated from protobuf rpc: OpaqueZkppRegistrationStart
146
150
  */
@@ -150,6 +154,9 @@ export interface IAuthServiceClient {
150
154
  */
151
155
  opaqueZkppRegistrationFinish(input: OpaqueZkppRegistrationFinishRequest, options?: RpcOptions): UnaryCall<OpaqueZkppRegistrationFinishRequest, OpaqueZkppRegistrationFinishResponse>;
152
156
  /**
157
+ * Counts a current-password attempt when the request carries KE1, so a
158
+ * retry is not free.
159
+ *
153
160
  * @generated from protobuf rpc: PasswordChangeChallenge
154
161
  */
155
162
  passwordChangeChallenge(input: PasswordChangeChallengeRequest, options?: RpcOptions): UnaryCall<PasswordChangeChallengeRequest, PasswordChangeChallengeResponse>;
@@ -158,9 +165,24 @@ export interface IAuthServiceClient {
158
165
  */
159
166
  passwordChangeExecute(input: PasswordChangeExecuteRequest, options?: RpcOptions): UnaryCall<PasswordChangeExecuteRequest, PasswordChangeExecuteResponse>;
160
167
  /**
168
+ * Answers nothing beyond success, so it returns Empty rather than an empty
169
+ * message of its own; this API keeps no type aliases for older clients.
170
+ *
161
171
  * @generated from protobuf rpc: PasswordChangeFinish
162
172
  */
163
- passwordChangeFinish(input: PasswordChangeFinishRequest, options?: RpcOptions): UnaryCall<PasswordChangeFinishRequest, PasswordChangeFinishResponse>;
173
+ passwordChangeFinish(input: PasswordChangeFinishRequest, options?: RpcOptions): UnaryCall<PasswordChangeFinishRequest, Empty>;
174
+ /**
175
+ * How long from the moment of this answer, measured on the server's clock, a
176
+ * password change of the caller's session (from the Bearer token) may still
177
+ * go without proving the current password; zero when it is required now.
178
+ * A client arms a timer rather than comparing wall clocks: this duration
179
+ * less the time its own request took from sending to receiving the answer,
180
+ * so the timer never fires late; it asks for the current password when the
181
+ * timer fires, exactly then and not before.
182
+ *
183
+ * @generated from protobuf rpc: GetPasswordChangeRequirement
184
+ */
185
+ getPasswordChangeRequirement(input: Empty, options?: RpcOptions): UnaryCall<Empty, Duration>;
164
186
  /**
165
187
  * WebAuthn (passkeys).
166
188
  *
@@ -439,6 +461,9 @@ export declare class AuthServiceClient implements IAuthServiceClient, ServiceInf
439
461
  opaqueLoginFinish(input: OpaqueLoginFinishRequest, options?: RpcOptions): UnaryCall<OpaqueLoginFinishRequest, OpaqueLoginFinishResponse>;
440
462
  /**
441
463
  * OPAQUE-ZKPP: OPAQUE with zero-knowledge password policy proof (Pallas curve).
464
+ * Stores the registration's password operation and prepares its history
465
+ * (which may create or replace the owner's history key), so a retry is a new
466
+ * operation, not the same answer.
442
467
  *
443
468
  * @generated from protobuf rpc: OpaqueZkppRegistrationStart
444
469
  */
@@ -448,6 +473,9 @@ export declare class AuthServiceClient implements IAuthServiceClient, ServiceInf
448
473
  */
449
474
  opaqueZkppRegistrationFinish(input: OpaqueZkppRegistrationFinishRequest, options?: RpcOptions): UnaryCall<OpaqueZkppRegistrationFinishRequest, OpaqueZkppRegistrationFinishResponse>;
450
475
  /**
476
+ * Counts a current-password attempt when the request carries KE1, so a
477
+ * retry is not free.
478
+ *
451
479
  * @generated from protobuf rpc: PasswordChangeChallenge
452
480
  */
453
481
  passwordChangeChallenge(input: PasswordChangeChallengeRequest, options?: RpcOptions): UnaryCall<PasswordChangeChallengeRequest, PasswordChangeChallengeResponse>;
@@ -456,9 +484,24 @@ export declare class AuthServiceClient implements IAuthServiceClient, ServiceInf
456
484
  */
457
485
  passwordChangeExecute(input: PasswordChangeExecuteRequest, options?: RpcOptions): UnaryCall<PasswordChangeExecuteRequest, PasswordChangeExecuteResponse>;
458
486
  /**
487
+ * Answers nothing beyond success, so it returns Empty rather than an empty
488
+ * message of its own; this API keeps no type aliases for older clients.
489
+ *
459
490
  * @generated from protobuf rpc: PasswordChangeFinish
460
491
  */
461
- passwordChangeFinish(input: PasswordChangeFinishRequest, options?: RpcOptions): UnaryCall<PasswordChangeFinishRequest, PasswordChangeFinishResponse>;
492
+ passwordChangeFinish(input: PasswordChangeFinishRequest, options?: RpcOptions): UnaryCall<PasswordChangeFinishRequest, Empty>;
493
+ /**
494
+ * How long from the moment of this answer, measured on the server's clock, a
495
+ * password change of the caller's session (from the Bearer token) may still
496
+ * go without proving the current password; zero when it is required now.
497
+ * A client arms a timer rather than comparing wall clocks: this duration
498
+ * less the time its own request took from sending to receiving the answer,
499
+ * so the timer never fires late; it asks for the current password when the
500
+ * timer fires, exactly then and not before.
501
+ *
502
+ * @generated from protobuf rpc: GetPasswordChangeRequirement
503
+ */
504
+ getPasswordChangeRequirement(input: Empty, options?: RpcOptions): UnaryCall<Empty, Duration>;
462
505
  /**
463
506
  * WebAuthn (passkeys).
464
507
  *