@structured-id/proto 0.1.1 → 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.
@@ -197,6 +197,91 @@ export var ProfileVisibility;
197
197
  */
198
198
  ProfileVisibility[ProfileVisibility["PRIVATE"] = 2] = "PRIVATE";
199
199
  })(ProfileVisibility || (ProfileVisibility = {}));
200
+ /**
201
+ * Complete OPAQUE configurations (RFC 9807 §7): each value fixes the OPRF, the
202
+ * KDF, MAC and hash, the KSF with its parameters, the group and the context.
203
+ * A change of any of them is a new value, never a new meaning of an old one.
204
+ * A value names a credential's configuration; it does not state that a given
205
+ * deployment installs or accepts it.
206
+ *
207
+ * Common to every value: the key exchange is 3DH (RFC 9807 §6) on the OPRF's
208
+ * group, with HKDF, HMAC and the hash named below; the identities are the
209
+ * parties' public keys (the defaults of RFC 9807 §4); the KSF output is as
210
+ * long as the OPRF output (Nh: 32 bytes for SHA-256, 48 for SHA-384, 64 for
211
+ * SHA-512). No password is longer than 65,534 bytes: OPRF inputs must be
212
+ * smaller than 2^16 - 1 bytes (RFC 9497 §5.1), and a client refuses a longer
213
+ * one. The context is empty for an ordinary sign-in; a sign-in inside another
214
+ * operation replaces it with that operation's context, which the operation
215
+ * defines (the password change: PasswordChangeChallenge).
216
+ *
217
+ * @generated from protobuf enum sid.v1.identity.OpaqueSuite
218
+ */
219
+ export var OpaqueSuite;
220
+ (function (OpaqueSuite) {
221
+ /**
222
+ * @generated from protobuf enum value: OPAQUE_SUITE_UNSPECIFIED = 0;
223
+ */
224
+ OpaqueSuite[OpaqueSuite["UNSPECIFIED"] = 0] = "UNSPECIFIED";
225
+ /**
226
+ * A custom suite, not an RFC 9497 one, and the one the ZKPP password proof
227
+ * is defined for. OPRF Pallas-Poseidon-SHA256: the DST is ignored; a
228
+ * password of at most 128 bytes is zero-padded to 128, a longer one is not
229
+ * padded; its bytes are packed 31 per Pallas base-field element,
230
+ * little-endian, the last element zero-padded, and chained with Poseidon;
231
+ * the point is the first of 2^8 offsets that lies on the curve, with the
232
+ * even root of y. The padding applies only to that element, which the proof
233
+ * covers: Finalize (RFC 9497 §3.3.1) hashes the password as given, with its
234
+ * length, so a password and the same one with trailing zero bytes have
235
+ * different OPRF outputs and neither signs in to the other's credential. A
236
+ * provable password is at most 128 bytes with no zero byte; a longer one
237
+ * installs without the proof. The proof binds the password as it enters the
238
+ * element M, not Finalize, the KSF or the final record, which the server
239
+ * never sees. A modified client can therefore prove P and install P
240
+ * followed by zero bytes, the only other input with the same M; it gains
241
+ * nothing a policy or history check protects: the history entry is that of
242
+ * P, so reusing the installed password means proving P again and is caught,
243
+ * and every character property the policy counts is that of P. Policy
244
+ * evidence attests the proved password, not the uploaded record. Hash
245
+ * SHA-256; KSF Argon2id v1.3 with m = 19456 KiB, t = 2, p = 1 and a salt of
246
+ * 16 zero bytes. Normative definition, fixed at this revision: "The Pallas
247
+ * OPAQUE suite" in
248
+ * https://github.com/structured-id/zkpp/blob/235e3e966b5133cd11b41db83bbdd7dfec44dbb4/docs/construction.md.
249
+ *
250
+ * @generated from protobuf enum value: OPAQUE_SUITE_PALLAS_V1 = 1;
251
+ */
252
+ OpaqueSuite[OpaqueSuite["PALLAS_V1"] = 1] = "PALLAS_V1";
253
+ /**
254
+ * OPRF ristretto255-SHA512 (RFC 9497 §4.1), hash SHA-512, KSF Argon2id
255
+ * v1.3 with m = 19456 KiB, t = 2, p = 1 and a salt of 16 zero bytes.
256
+ *
257
+ * @generated from protobuf enum value: OPAQUE_SUITE_RISTRETTO255_V1 = 2;
258
+ */
259
+ OpaqueSuite[OpaqueSuite["RISTRETTO255_V1"] = 2] = "RISTRETTO255_V1";
260
+ /**
261
+ * OPRF P256-SHA256 (RFC 9497 §4.3), hash SHA-256, KSF PBKDF2-HMAC-SHA256
262
+ * (RFC 8018) with 600000 iterations, the salt "sid-opaque-ksf" and
263
+ * dkLen = 32.
264
+ *
265
+ * @generated from protobuf enum value: OPAQUE_SUITE_P256_V1 = 3;
266
+ */
267
+ OpaqueSuite[OpaqueSuite["P256_V1"] = 3] = "P256_V1";
268
+ /**
269
+ * OPRF P384-SHA384 (RFC 9497 §4.4), hash SHA-384, KSF PBKDF2-HMAC-SHA384
270
+ * (RFC 8018) with 600000 iterations, the salt "sid-opaque-ksf" and
271
+ * dkLen = 48.
272
+ *
273
+ * @generated from protobuf enum value: OPAQUE_SUITE_P384_V1 = 4;
274
+ */
275
+ OpaqueSuite[OpaqueSuite["P384_V1"] = 4] = "P384_V1";
276
+ /**
277
+ * OPRF P521-SHA512 (RFC 9497 §4.5), hash SHA-512, KSF PBKDF2-HMAC-SHA512
278
+ * (RFC 8018) with 600000 iterations, the salt "sid-opaque-ksf" and
279
+ * dkLen = 64.
280
+ *
281
+ * @generated from protobuf enum value: OPAQUE_SUITE_P521_V1 = 5;
282
+ */
283
+ OpaqueSuite[OpaqueSuite["P521_V1"] = 5] = "P521_V1";
284
+ })(OpaqueSuite || (OpaqueSuite = {}));
200
285
  /**
201
286
  * @generated from protobuf enum sid.v1.identity.AuthenticatorTransport
202
287
  */
@@ -997,7 +1082,8 @@ class Credential$Type extends MessageType {
997
1082
  { no: 5, name: "label", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
998
1083
  { no: 6, name: "created_at", kind: "message", T: () => Timestamp },
999
1084
  { no: 7, name: "last_used_at", kind: "message", T: () => Timestamp },
1000
- { no: 8, name: "webauthn_info", kind: "message", oneof: "info", T: () => WebAuthnCredentialInfo }
1085
+ { no: 8, name: "webauthn_info", kind: "message", oneof: "info", T: () => WebAuthnCredentialInfo },
1086
+ { no: 9, name: "opaque_info", kind: "message", oneof: "info", T: () => OpaqueCredentialInfo }
1001
1087
  ]);
1002
1088
  }
1003
1089
  create(value) {
@@ -1043,6 +1129,12 @@ class Credential$Type extends MessageType {
1043
1129
  webauthnInfo: WebAuthnCredentialInfo.internalBinaryRead(reader, reader.uint32(), options, message.info.webauthnInfo)
1044
1130
  };
1045
1131
  break;
1132
+ case /* sid.v1.identity.OpaqueCredentialInfo opaque_info */ 9:
1133
+ message.info = {
1134
+ oneofKind: "opaqueInfo",
1135
+ opaqueInfo: OpaqueCredentialInfo.internalBinaryRead(reader, reader.uint32(), options, message.info.opaqueInfo)
1136
+ };
1137
+ break;
1046
1138
  default:
1047
1139
  let u = options.readUnknownField;
1048
1140
  if (u === "throw")
@@ -1079,6 +1171,9 @@ class Credential$Type extends MessageType {
1079
1171
  /* sid.v1.identity.WebAuthnCredentialInfo webauthn_info = 8; */
1080
1172
  if (message.info.oneofKind === "webauthnInfo")
1081
1173
  WebAuthnCredentialInfo.internalBinaryWrite(message.info.webauthnInfo, writer.tag(8, WireType.LengthDelimited).fork(), options).join();
1174
+ /* sid.v1.identity.OpaqueCredentialInfo opaque_info = 9; */
1175
+ if (message.info.oneofKind === "opaqueInfo")
1176
+ OpaqueCredentialInfo.internalBinaryWrite(message.info.opaqueInfo, writer.tag(9, WireType.LengthDelimited).fork(), options).join();
1082
1177
  let u = options.writeUnknownFields;
1083
1178
  if (u !== false)
1084
1179
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -1090,6 +1185,53 @@ class Credential$Type extends MessageType {
1090
1185
  */
1091
1186
  export const Credential = new Credential$Type();
1092
1187
  // @generated message type with reflection information, may provide speed optimized methods
1188
+ class OpaqueCredentialInfo$Type extends MessageType {
1189
+ constructor() {
1190
+ super("sid.v1.identity.OpaqueCredentialInfo", [
1191
+ { no: 1, name: "suite", kind: "enum", T: () => ["sid.v1.identity.OpaqueSuite", OpaqueSuite, "OPAQUE_SUITE_"] }
1192
+ ]);
1193
+ }
1194
+ create(value) {
1195
+ const message = globalThis.Object.create((this.messagePrototype));
1196
+ message.suite = 0;
1197
+ if (value !== undefined)
1198
+ reflectionMergePartial(this, message, value);
1199
+ return message;
1200
+ }
1201
+ internalBinaryRead(reader, length, options, target) {
1202
+ let message = target ?? this.create(), end = reader.pos + length;
1203
+ while (reader.pos < end) {
1204
+ let [fieldNo, wireType] = reader.tag();
1205
+ switch (fieldNo) {
1206
+ case /* sid.v1.identity.OpaqueSuite suite */ 1:
1207
+ message.suite = reader.int32();
1208
+ break;
1209
+ default:
1210
+ let u = options.readUnknownField;
1211
+ if (u === "throw")
1212
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1213
+ let d = reader.skip(wireType);
1214
+ if (u !== false)
1215
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1216
+ }
1217
+ }
1218
+ return message;
1219
+ }
1220
+ internalBinaryWrite(message, writer, options) {
1221
+ /* sid.v1.identity.OpaqueSuite suite = 1; */
1222
+ if (message.suite !== 0)
1223
+ writer.tag(1, WireType.Varint).int32(message.suite);
1224
+ let u = options.writeUnknownFields;
1225
+ if (u !== false)
1226
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1227
+ return writer;
1228
+ }
1229
+ }
1230
+ /**
1231
+ * @generated MessageType for protobuf message sid.v1.identity.OpaqueCredentialInfo
1232
+ */
1233
+ export const OpaqueCredentialInfo = new OpaqueCredentialInfo$Type();
1234
+ // @generated message type with reflection information, may provide speed optimized methods
1093
1235
  class WebAuthnCredentialInfo$Type extends MessageType {
1094
1236
  constructor() {
1095
1237
  super("sid.v1.identity.WebAuthnCredentialInfo", [