From 78e833236adb1e9f98cc99b334a1313b7f7bf9ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Tremblay?= <1619947+marctrem@users.noreply.github.com> Date: Mon, 31 Aug 2026 15:37:48 -0400 Subject: [PATCH] keys: add derivation_version to DerivedKey Add a version discriminator so consumers can distinguish derivation constructions. Version 0 is the legacy construction; proto3 scalar defaults make every already-stored DerivedKey read 0 and keep deriving byte-identically. Consumers must reject an unknown version instead of falling back to a default. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01TyAMGaLYMykDnnCA5ZNKsS --- .../splitsecure/keys/v1/derived_key_pb.ts | 11 +++++++- .../splitsecure/keys/v1/derived_key.pb.go | 26 ++++++++++++++----- proto/splitsecure/keys/v1/derived_key.proto | 4 +++ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/gen/es/proto/splitsecure/keys/v1/derived_key_pb.ts b/gen/es/proto/splitsecure/keys/v1/derived_key_pb.ts index 4e06bac..5f8990e 100644 --- a/gen/es/proto/splitsecure/keys/v1/derived_key_pb.ts +++ b/gen/es/proto/splitsecure/keys/v1/derived_key_pb.ts @@ -12,7 +12,7 @@ import type { Message } from "@bufbuild/protobuf"; * Describes the file splitsecure/keys/v1/derived_key.proto. */ export const file_splitsecure_keys_v1_derived_key: GenFile = /*@__PURE__*/ - fileDesc("CiVzcGxpdHNlY3VyZS9rZXlzL3YxL2Rlcml2ZWRfa2V5LnByb3RvEhNzcGxpdHNlY3VyZS5rZXlzLnYxIlsKCkRlcml2ZWRLZXkSEAoIdGVhbV9pZHMYASADKAwSJwoEc3BlYxgCIAEoCzIZLnNwbGl0c2VjdXJlLmtleXMudjEuU3BlYxISCgpkZXJpdmF0aW9uGAMgASgMQt0BChdjb20uc3BsaXRzZWN1cmUua2V5cy52MUIPRGVyaXZlZEtleVByb3RvUAFaQ2dpdGh1Yi5jb20vc3BsaXRzZWN1cmUvYXBpcy9nZW4vZ28vcHJvdG8vc3BsaXRzZWN1cmUva2V5cy92MTtrZXlzdjGiAgNTS1iqAhNTcGxpdHNlY3VyZS5LZXlzLlYxygITU3BsaXRzZWN1cmVcS2V5c1xWMeICH1NwbGl0c2VjdXJlXEtleXNcVjFcR1BCTWV0YWRhdGHqAhVTcGxpdHNlY3VyZTo6S2V5czo6VjFiBnByb3RvMw", [file_splitsecure_keys_v1_spec]); + fileDesc("CiVzcGxpdHNlY3VyZS9rZXlzL3YxL2Rlcml2ZWRfa2V5LnByb3RvEhNzcGxpdHNlY3VyZS5rZXlzLnYxIncKCkRlcml2ZWRLZXkSEAoIdGVhbV9pZHMYASADKAwSJwoEc3BlYxgCIAEoCzIZLnNwbGl0c2VjdXJlLmtleXMudjEuU3BlYxISCgpkZXJpdmF0aW9uGAMgASgMEhoKEmRlcml2YXRpb25fdmVyc2lvbhgEIAEoDULdAQoXY29tLnNwbGl0c2VjdXJlLmtleXMudjFCD0Rlcml2ZWRLZXlQcm90b1ABWkNnaXRodWIuY29tL3NwbGl0c2VjdXJlL2FwaXMvZ2VuL2dvL3Byb3RvL3NwbGl0c2VjdXJlL2tleXMvdjE7a2V5c3YxogIDU0tYqgITU3BsaXRzZWN1cmUuS2V5cy5WMcoCE1NwbGl0c2VjdXJlXEtleXNcVjHiAh9TcGxpdHNlY3VyZVxLZXlzXFYxXEdQQk1ldGFkYXRh6gIVU3BsaXRzZWN1cmU6OktleXM6OlYxYgZwcm90bzM", [file_splitsecure_keys_v1_spec]); /** * @generated from message splitsecure.keys.v1.DerivedKey @@ -34,6 +34,15 @@ export type DerivedKey = Message<"splitsecure.keys.v1.DerivedKey"> & { * @generated from field: bytes derivation = 3; */ derivation: Uint8Array; + + /** + * Version of the derivation construction. 0 is the legacy + * construction. Consumers must reject an unknown version + * instead of falling back to a default. + * + * @generated from field: uint32 derivation_version = 4; + */ + derivationVersion: number; }; /** diff --git a/gen/go/proto/splitsecure/keys/v1/derived_key.pb.go b/gen/go/proto/splitsecure/keys/v1/derived_key.pb.go index 82723e9..94445bd 100644 --- a/gen/go/proto/splitsecure/keys/v1/derived_key.pb.go +++ b/gen/go/proto/splitsecure/keys/v1/derived_key.pb.go @@ -24,11 +24,15 @@ const ( type DerivedKey struct { state protoimpl.MessageState `protogen:"open.v1"` // team_id can be repeated if this key depends on multiple teams. - TeamIds [][]byte `protobuf:"bytes,1,rep,name=team_ids,json=teamIds,proto3" json:"team_ids,omitempty"` - Spec *Spec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec,omitempty"` - Derivation []byte `protobuf:"bytes,3,opt,name=derivation,proto3" json:"derivation,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + TeamIds [][]byte `protobuf:"bytes,1,rep,name=team_ids,json=teamIds,proto3" json:"team_ids,omitempty"` + Spec *Spec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec,omitempty"` + Derivation []byte `protobuf:"bytes,3,opt,name=derivation,proto3" json:"derivation,omitempty"` + // Version of the derivation construction. 0 is the legacy + // construction. Consumers must reject an unknown version + // instead of falling back to a default. + DerivationVersion uint32 `protobuf:"varint,4,opt,name=derivation_version,json=derivationVersion,proto3" json:"derivation_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DerivedKey) Reset() { @@ -82,18 +86,26 @@ func (x *DerivedKey) GetDerivation() []byte { return nil } +func (x *DerivedKey) GetDerivationVersion() uint32 { + if x != nil { + return x.DerivationVersion + } + return 0 +} + var File_splitsecure_keys_v1_derived_key_proto protoreflect.FileDescriptor const file_splitsecure_keys_v1_derived_key_proto_rawDesc = "" + "\n" + - "%splitsecure/keys/v1/derived_key.proto\x12\x13splitsecure.keys.v1\x1a\x1esplitsecure/keys/v1/spec.proto\"v\n" + + "%splitsecure/keys/v1/derived_key.proto\x12\x13splitsecure.keys.v1\x1a\x1esplitsecure/keys/v1/spec.proto\"\xa5\x01\n" + "\n" + "DerivedKey\x12\x19\n" + "\bteam_ids\x18\x01 \x03(\fR\ateamIds\x12-\n" + "\x04spec\x18\x02 \x01(\v2\x19.splitsecure.keys.v1.SpecR\x04spec\x12\x1e\n" + "\n" + "derivation\x18\x03 \x01(\fR\n" + - "derivationB\xdd\x01\n" + + "derivation\x12-\n" + + "\x12derivation_version\x18\x04 \x01(\rR\x11derivationVersionB\xdd\x01\n" + "\x17com.splitsecure.keys.v1B\x0fDerivedKeyProtoP\x01ZCgithub.com/splitsecure/apis/gen/go/proto/splitsecure/keys/v1;keysv1\xa2\x02\x03SKX\xaa\x02\x13Splitsecure.Keys.V1\xca\x02\x13Splitsecure\\Keys\\V1\xe2\x02\x1fSplitsecure\\Keys\\V1\\GPBMetadata\xea\x02\x15Splitsecure::Keys::V1b\x06proto3" var ( diff --git a/proto/splitsecure/keys/v1/derived_key.proto b/proto/splitsecure/keys/v1/derived_key.proto index 202abf6..f80f555 100644 --- a/proto/splitsecure/keys/v1/derived_key.proto +++ b/proto/splitsecure/keys/v1/derived_key.proto @@ -8,4 +8,8 @@ message DerivedKey { repeated bytes team_ids = 1; Spec spec = 2; bytes derivation = 3; + // Version of the derivation construction. 0 is the legacy + // construction. Consumers must reject an unknown version + // instead of falling back to a default. + uint32 derivation_version = 4; }