feat(base,app,keys): keys of shared spaces, sealed to each member
Step 3 of ADR 0044 (D3, D18, D19). A shared space's data keys are sealed on a device to each member's public keys; the instance keeps what devices sealed and never opens it. - halkyon_keys: the safety code of two accounts' public keys (`safetyCode`), 60 digits, the same on both sides. - halkyon_base: the register hands out accounts' public keys (`public-keys-of`, local and remote); the table `shared_space_key` and the endpoint `sharedSpaceKeys` (memberKeys, keysNeeded, seal, mine). Only the Owner and Editors seal, the first key sealed to a member stays, and a member's keys go with their membership. Every host's migration creates the table. - halkyon_app: `ContentCipher` seals a key to another account and opens one sealed by another; `SharedKeys` shares a space's key with its members, seals keys to newcomers and opens the person's own, holding each member to the public keys `KeyPins` pinned on first sight (`key_pins.json` in the person's folder), a change refused until trusted anew. Learn takes them into its `Privacy` in step 4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
d08d8ad545
commit
b72cea1fe0
5 changed files with 105813 additions and 5 deletions
|
|
@ -80,10 +80,16 @@ import 'package:halkyon_base_client/src/protocol/profile/profile_refusal.dart'
|
|||
as _ih722tf9;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_info.dart'
|
||||
as _i9dv6y4h;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_key_need.dart'
|
||||
as _ixm5azhv;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_member_info.dart'
|
||||
as _iyon0cg8;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_member_keys.dart'
|
||||
as _i6d21238;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_role.dart'
|
||||
as _i1fyjuki;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_sealed_key.dart'
|
||||
as _ie2by8eg;
|
||||
import 'package:halkyon_base_client/src/protocol/simplelogin/simplelogin_completed.dart'
|
||||
as _ianfx7qj;
|
||||
import 'package:halkyon_base_client/src/protocol/simplelogin/simplelogin_return.dart'
|
||||
|
|
@ -1442,6 +1448,66 @@ class EndpointSharedSpace extends _isc.EndpointRef {
|
|||
);
|
||||
}
|
||||
|
||||
/// The data keys of a space you share, each sealed on a device to one
|
||||
/// member (ADR 0044, D3): the members' public keys to seal to and pin
|
||||
/// (D18), the keys a member still lacks, sealing them, and your own. The
|
||||
/// instance keeps what devices sealed and never opens it. Only for people
|
||||
/// with an identity; a space you aren't a member of can't be told from one
|
||||
/// that doesn't exist ([SharedSpaceNotFoundException]).
|
||||
/// {@category Endpoint}
|
||||
class EndpointSharedSpaceKeys extends _isc.EndpointRef {
|
||||
EndpointSharedSpaceKeys(_isc.EndpointCaller caller) : super(caller);
|
||||
|
||||
@override
|
||||
String get name => 'halkyon_base.sharedSpaceKeys';
|
||||
|
||||
/// The public keys of [space]'s members who have keys, you among them,
|
||||
/// as the register keeps them.
|
||||
_ida.Future<List<_i6d21238.SharedSpaceMemberKeys>> memberKeys(
|
||||
_isc.UuidValue space,
|
||||
) => caller.callServerEndpoint<List<_i6d21238.SharedSpaceMemberKeys>>(
|
||||
'halkyon_base.sharedSpaceKeys',
|
||||
'memberKeys',
|
||||
{'space': space},
|
||||
);
|
||||
|
||||
/// The keys of [space] you hold that members who have keys lack, for
|
||||
/// your device to seal to them; none while you may not seal ([seal]).
|
||||
_ida.Future<List<_ixm5azhv.SharedSpaceKeyNeed>> keysNeeded(
|
||||
_isc.UuidValue space,
|
||||
) => caller.callServerEndpoint<List<_ixm5azhv.SharedSpaceKeyNeed>>(
|
||||
'halkyon_base.sharedSpaceKeys',
|
||||
'keysNeeded',
|
||||
{'space': space},
|
||||
);
|
||||
|
||||
/// Keeps [keys], each sealed on your device to the member it names, as
|
||||
/// sealed by you; one a member has already stays as it was, as does the
|
||||
/// first of two the call names alike. Refused for a
|
||||
/// Viewer: only those who write, the Owner and Editors, seal keys, so a
|
||||
/// reader can't hand a newcomer a key of their own making.
|
||||
_ida.Future<void> seal(
|
||||
_isc.UuidValue space,
|
||||
List<_ie2by8eg.SharedSpaceSealedKey> keys,
|
||||
) => caller.callServerEndpoint<void>(
|
||||
'halkyon_base.sharedSpaceKeys',
|
||||
'seal',
|
||||
{
|
||||
'space': space,
|
||||
'keys': keys,
|
||||
},
|
||||
);
|
||||
|
||||
/// The keys of [space] sealed to you, each naming who sealed it.
|
||||
_ida.Future<List<_ie2by8eg.SharedSpaceSealedKey>> mine(
|
||||
_isc.UuidValue space,
|
||||
) => caller.callServerEndpoint<List<_ie2by8eg.SharedSpaceSealedKey>>(
|
||||
'halkyon_base.sharedSpaceKeys',
|
||||
'mine',
|
||||
{'space': space},
|
||||
);
|
||||
}
|
||||
|
||||
/// Signing in with SimpleLogin (ADR 0020, 3 to 5), signed out or, to add it
|
||||
/// to one's account, signed in. The instance's register keeps the attempts
|
||||
/// and checks SimpleLogin's codes (ADR 0016); a session is this server's.
|
||||
|
|
@ -1597,6 +1663,7 @@ class Caller extends _isc.ModuleEndpointCaller {
|
|||
profile = EndpointProfile(this);
|
||||
profiles = EndpointProfiles(this);
|
||||
sharedSpace = EndpointSharedSpace(this);
|
||||
sharedSpaceKeys = EndpointSharedSpaceKeys(this);
|
||||
simpleLogin = EndpointSimpleLogin(this);
|
||||
}
|
||||
|
||||
|
|
@ -1632,6 +1699,8 @@ class Caller extends _isc.ModuleEndpointCaller {
|
|||
|
||||
late final EndpointSharedSpace sharedSpace;
|
||||
|
||||
late final EndpointSharedSpaceKeys sharedSpaceKeys;
|
||||
|
||||
late final EndpointSimpleLogin simpleLogin;
|
||||
|
||||
@override
|
||||
|
|
@ -1652,6 +1721,7 @@ class Caller extends _isc.ModuleEndpointCaller {
|
|||
'halkyon_base.profile': profile,
|
||||
'halkyon_base.profiles': profiles,
|
||||
'halkyon_base.sharedSpace': sharedSpace,
|
||||
'halkyon_base.sharedSpaceKeys': sharedSpaceKeys,
|
||||
'halkyon_base.simpleLogin': simpleLogin,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,14 @@ import 'package:halkyon_base_client/src/protocol/password/authenticator.dart'
|
|||
as _ivfmflch;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_info.dart'
|
||||
as _i9dv6y4h;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_key_need.dart'
|
||||
as _ixm5azhv;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_member_info.dart'
|
||||
as _iyon0cg8;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_member_keys.dart'
|
||||
as _i6d21238;
|
||||
import 'package:halkyon_base_client/src/protocol/shared_space/shared_space_sealed_key.dart'
|
||||
as _ie2by8eg;
|
||||
import 'package:halkyon_oidc_client/halkyon_oidc_client.dart' as _ibkpwzgl;
|
||||
import 'package:serverpod_auth_core_client/serverpod_auth_core_client.dart'
|
||||
as _iacc;
|
||||
|
|
@ -95,11 +101,14 @@ import 'profile/profile_not_found_exception.dart' as _iim3hfcf;
|
|||
import 'profile/profile_refusal.dart' as _i6j6efd1;
|
||||
import 'profile/profile_refused_exception.dart' as _idvc5e7p;
|
||||
import 'shared_space/shared_space_info.dart' as _i1rvc02f;
|
||||
import 'shared_space/shared_space_key_need.dart' as _imxqlbwp;
|
||||
import 'shared_space/shared_space_member_info.dart' as _iz8z2oju;
|
||||
import 'shared_space/shared_space_member_keys.dart' as _iqkqjhh4;
|
||||
import 'shared_space/shared_space_not_found_exception.dart' as _ixm56fil;
|
||||
import 'shared_space/shared_space_refusal.dart' as _irg3s7i7;
|
||||
import 'shared_space/shared_space_refused_exception.dart' as _iooym5cy;
|
||||
import 'shared_space/shared_space_role.dart' as _i2fude1g;
|
||||
import 'shared_space/shared_space_sealed_key.dart' as _ifx6y5sl;
|
||||
import 'simplelogin/simplelogin_completed.dart' as _i51ry5s2;
|
||||
import 'simplelogin/simplelogin_outcome.dart' as _i5ar1hzl;
|
||||
import 'simplelogin/simplelogin_return.dart' as _i8dcjd27;
|
||||
|
|
@ -169,11 +178,14 @@ export 'profile/profile_not_found_exception.dart';
|
|||
export 'profile/profile_refusal.dart';
|
||||
export 'profile/profile_refused_exception.dart';
|
||||
export 'shared_space/shared_space_info.dart';
|
||||
export 'shared_space/shared_space_key_need.dart';
|
||||
export 'shared_space/shared_space_member_info.dart';
|
||||
export 'shared_space/shared_space_member_keys.dart';
|
||||
export 'shared_space/shared_space_not_found_exception.dart';
|
||||
export 'shared_space/shared_space_refusal.dart';
|
||||
export 'shared_space/shared_space_refused_exception.dart';
|
||||
export 'shared_space/shared_space_role.dart';
|
||||
export 'shared_space/shared_space_sealed_key.dart';
|
||||
export 'simplelogin/simplelogin_completed.dart';
|
||||
export 'simplelogin/simplelogin_outcome.dart';
|
||||
export 'simplelogin/simplelogin_return.dart';
|
||||
|
|
@ -422,9 +434,15 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (t == _i1rvc02f.SharedSpaceInfo) {
|
||||
return _i1rvc02f.SharedSpaceInfo.fromJson(data) as T;
|
||||
}
|
||||
if (t == _imxqlbwp.SharedSpaceKeyNeed) {
|
||||
return _imxqlbwp.SharedSpaceKeyNeed.fromJson(data) as T;
|
||||
}
|
||||
if (t == _iz8z2oju.SharedSpaceMemberInfo) {
|
||||
return _iz8z2oju.SharedSpaceMemberInfo.fromJson(data) as T;
|
||||
}
|
||||
if (t == _iqkqjhh4.SharedSpaceMemberKeys) {
|
||||
return _iqkqjhh4.SharedSpaceMemberKeys.fromJson(data) as T;
|
||||
}
|
||||
if (t == _ixm56fil.SharedSpaceNotFoundException) {
|
||||
return _ixm56fil.SharedSpaceNotFoundException.fromJson(data) as T;
|
||||
}
|
||||
|
|
@ -437,6 +455,9 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (t == _i2fude1g.SharedSpaceRole) {
|
||||
return _i2fude1g.SharedSpaceRole.fromJson(data) as T;
|
||||
}
|
||||
if (t == _ifx6y5sl.SharedSpaceSealedKey) {
|
||||
return _ifx6y5sl.SharedSpaceSealedKey.fromJson(data) as T;
|
||||
}
|
||||
if (t == _i51ry5s2.SimpleLoginCompleted) {
|
||||
return _i51ry5s2.SimpleLoginCompleted.fromJson(data) as T;
|
||||
}
|
||||
|
|
@ -722,12 +743,22 @@ class Protocol extends _isc.SerializationManager {
|
|||
return (data != null ? _i1rvc02f.SharedSpaceInfo.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_imxqlbwp.SharedSpaceKeyNeed?>()) {
|
||||
return (data != null ? _imxqlbwp.SharedSpaceKeyNeed.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_iz8z2oju.SharedSpaceMemberInfo?>()) {
|
||||
return (data != null
|
||||
? _iz8z2oju.SharedSpaceMemberInfo.fromJson(data)
|
||||
: null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_iqkqjhh4.SharedSpaceMemberKeys?>()) {
|
||||
return (data != null
|
||||
? _iqkqjhh4.SharedSpaceMemberKeys.fromJson(data)
|
||||
: null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_ixm56fil.SharedSpaceNotFoundException?>()) {
|
||||
return (data != null
|
||||
? _ixm56fil.SharedSpaceNotFoundException.fromJson(data)
|
||||
|
|
@ -748,6 +779,12 @@ class Protocol extends _isc.SerializationManager {
|
|||
return (data != null ? _i2fude1g.SharedSpaceRole.fromJson(data) : null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_ifx6y5sl.SharedSpaceSealedKey?>()) {
|
||||
return (data != null
|
||||
? _ifx6y5sl.SharedSpaceSealedKey.fromJson(data)
|
||||
: null)
|
||||
as T;
|
||||
}
|
||||
if (t == _isc.getType<_i51ry5s2.SimpleLoginCompleted?>()) {
|
||||
return (data != null
|
||||
? _i51ry5s2.SimpleLoginCompleted.fromJson(data)
|
||||
|
|
@ -859,6 +896,24 @@ class Protocol extends _isc.SerializationManager {
|
|||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<_i6d21238.SharedSpaceMemberKeys>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_i6d21238.SharedSpaceMemberKeys>(e))
|
||||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<_ixm5azhv.SharedSpaceKeyNeed>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_ixm5azhv.SharedSpaceKeyNeed>(e))
|
||||
.toList()
|
||||
as T;
|
||||
}
|
||||
if (t == List<_ie2by8eg.SharedSpaceSealedKey>) {
|
||||
return (data as List)
|
||||
.map((e) => deserialize<_ie2by8eg.SharedSpaceSealedKey>(e))
|
||||
.toList()
|
||||
as T;
|
||||
}
|
||||
try {
|
||||
return _ibkpwzgl.Protocol().deserialize<T>(data, t);
|
||||
} on _isc.DeserializationTypeNotFoundException catch (_) {}
|
||||
|
|
@ -939,11 +994,14 @@ class Protocol extends _isc.SerializationManager {
|
|||
_i6j6efd1.ProfileRefusal => 'ProfileRefusal',
|
||||
_idvc5e7p.ProfileRefusedException => 'ProfileRefusedException',
|
||||
_i1rvc02f.SharedSpaceInfo => 'SharedSpaceInfo',
|
||||
_imxqlbwp.SharedSpaceKeyNeed => 'SharedSpaceKeyNeed',
|
||||
_iz8z2oju.SharedSpaceMemberInfo => 'SharedSpaceMemberInfo',
|
||||
_iqkqjhh4.SharedSpaceMemberKeys => 'SharedSpaceMemberKeys',
|
||||
_ixm56fil.SharedSpaceNotFoundException => 'SharedSpaceNotFoundException',
|
||||
_irg3s7i7.SharedSpaceRefusal => 'SharedSpaceRefusal',
|
||||
_iooym5cy.SharedSpaceRefusedException => 'SharedSpaceRefusedException',
|
||||
_i2fude1g.SharedSpaceRole => 'SharedSpaceRole',
|
||||
_ifx6y5sl.SharedSpaceSealedKey => 'SharedSpaceSealedKey',
|
||||
_i51ry5s2.SimpleLoginCompleted => 'SimpleLoginCompleted',
|
||||
_i5ar1hzl.SimpleLoginOutcome => 'SimpleLoginOutcome',
|
||||
_i8dcjd27.SimpleLoginReturn => 'SimpleLoginReturn',
|
||||
|
|
@ -1096,8 +1154,12 @@ class Protocol extends _isc.SerializationManager {
|
|||
return 'ProfileRefusedException';
|
||||
case _i1rvc02f.SharedSpaceInfo():
|
||||
return 'SharedSpaceInfo';
|
||||
case _imxqlbwp.SharedSpaceKeyNeed():
|
||||
return 'SharedSpaceKeyNeed';
|
||||
case _iz8z2oju.SharedSpaceMemberInfo():
|
||||
return 'SharedSpaceMemberInfo';
|
||||
case _iqkqjhh4.SharedSpaceMemberKeys():
|
||||
return 'SharedSpaceMemberKeys';
|
||||
case _ixm56fil.SharedSpaceNotFoundException():
|
||||
return 'SharedSpaceNotFoundException';
|
||||
case _irg3s7i7.SharedSpaceRefusal():
|
||||
|
|
@ -1106,6 +1168,8 @@ class Protocol extends _isc.SerializationManager {
|
|||
return 'SharedSpaceRefusedException';
|
||||
case _i2fude1g.SharedSpaceRole():
|
||||
return 'SharedSpaceRole';
|
||||
case _ifx6y5sl.SharedSpaceSealedKey():
|
||||
return 'SharedSpaceSealedKey';
|
||||
case _i51ry5s2.SimpleLoginCompleted():
|
||||
return 'SimpleLoginCompleted';
|
||||
case _i5ar1hzl.SimpleLoginOutcome():
|
||||
|
|
@ -1320,9 +1384,15 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (dataClassName == 'SharedSpaceInfo') {
|
||||
return deserialize<_i1rvc02f.SharedSpaceInfo>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'SharedSpaceKeyNeed') {
|
||||
return deserialize<_imxqlbwp.SharedSpaceKeyNeed>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'SharedSpaceMemberInfo') {
|
||||
return deserialize<_iz8z2oju.SharedSpaceMemberInfo>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'SharedSpaceMemberKeys') {
|
||||
return deserialize<_iqkqjhh4.SharedSpaceMemberKeys>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'SharedSpaceNotFoundException') {
|
||||
return deserialize<_ixm56fil.SharedSpaceNotFoundException>(data['data']);
|
||||
}
|
||||
|
|
@ -1335,6 +1405,9 @@ class Protocol extends _isc.SerializationManager {
|
|||
if (dataClassName == 'SharedSpaceRole') {
|
||||
return deserialize<_i2fude1g.SharedSpaceRole>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'SharedSpaceSealedKey') {
|
||||
return deserialize<_ifx6y5sl.SharedSpaceSealedKey>(data['data']);
|
||||
}
|
||||
if (dataClassName == 'SimpleLoginCompleted') {
|
||||
return deserialize<_i51ry5s2.SimpleLoginCompleted>(data['data']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// A key the caller holds that a member of the space lacks: for the
|
||||
/// caller's device to seal to them (ADR 0044, D3).
|
||||
abstract class SharedSpaceKeyNeed
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
SharedSpaceKeyNeed._({
|
||||
required this.keyId,
|
||||
required this.person,
|
||||
});
|
||||
|
||||
factory SharedSpaceKeyNeed({
|
||||
required String keyId,
|
||||
required _isc.UuidValue person,
|
||||
}) = _SharedSpaceKeyNeedImpl;
|
||||
|
||||
factory SharedSpaceKeyNeed.fromJson(Map<String, dynamic> jsonSerialization) {
|
||||
return SharedSpaceKeyNeed(
|
||||
keyId: jsonSerialization['keyId'] as String,
|
||||
person: _isc.UuidValueJsonExtension.fromJson(jsonSerialization['person']),
|
||||
);
|
||||
}
|
||||
|
||||
String keyId;
|
||||
|
||||
/// The member who lacks it.
|
||||
_isc.UuidValue person;
|
||||
|
||||
/// Returns a shallow copy of this [SharedSpaceKeyNeed]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
SharedSpaceKeyNeed copyWith({
|
||||
String? keyId,
|
||||
_isc.UuidValue? person,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.SharedSpaceKeyNeed',
|
||||
'keyId': keyId,
|
||||
'person': person.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.SharedSpaceKeyNeed',
|
||||
'keyId': keyId,
|
||||
'person': person.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _SharedSpaceKeyNeedImpl extends SharedSpaceKeyNeed {
|
||||
_SharedSpaceKeyNeedImpl({
|
||||
required String keyId,
|
||||
required _isc.UuidValue person,
|
||||
}) : super._(
|
||||
keyId: keyId,
|
||||
person: person,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [SharedSpaceKeyNeed]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
SharedSpaceKeyNeed copyWith({
|
||||
String? keyId,
|
||||
_isc.UuidValue? person,
|
||||
}) {
|
||||
return SharedSpaceKeyNeed(
|
||||
keyId: keyId ?? this.keyId,
|
||||
person: person ?? this.person,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:typed_data' as _idt;
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// A member's public keys, as the register keeps them, which a device pins
|
||||
/// the first time it sees them and seals keys to (ADR 0044, D3 and D18).
|
||||
/// Named by the member's account ID, as the space's synced rows name their
|
||||
/// authors: a device pins keys per person, across every space it shares
|
||||
/// with them.
|
||||
abstract class SharedSpaceMemberKeys
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
SharedSpaceMemberKeys._({
|
||||
required this.person,
|
||||
this.handle,
|
||||
required this.encryption,
|
||||
required this.signing,
|
||||
});
|
||||
|
||||
factory SharedSpaceMemberKeys({
|
||||
required _isc.UuidValue person,
|
||||
String? handle,
|
||||
required _idt.ByteData encryption,
|
||||
required _idt.ByteData signing,
|
||||
}) = _SharedSpaceMemberKeysImpl;
|
||||
|
||||
factory SharedSpaceMemberKeys.fromJson(
|
||||
Map<String, dynamic> jsonSerialization,
|
||||
) {
|
||||
return SharedSpaceMemberKeys(
|
||||
person: _isc.UuidValueJsonExtension.fromJson(jsonSerialization['person']),
|
||||
handle: jsonSerialization['handle'] as String?,
|
||||
encryption: _isc.ByteDataJsonExtension.fromJson(
|
||||
jsonSerialization['encryption'],
|
||||
),
|
||||
signing: _isc.ByteDataJsonExtension.fromJson(
|
||||
jsonSerialization['signing'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_isc.UuidValue person;
|
||||
|
||||
/// Their handle; null without a public profile.
|
||||
String? handle;
|
||||
|
||||
/// X25519's, which keys are sealed to.
|
||||
_idt.ByteData encryption;
|
||||
|
||||
/// Ed25519's, which their signatures check against.
|
||||
_idt.ByteData signing;
|
||||
|
||||
/// Returns a shallow copy of this [SharedSpaceMemberKeys]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
SharedSpaceMemberKeys copyWith({
|
||||
_isc.UuidValue? person,
|
||||
String? handle,
|
||||
_idt.ByteData? encryption,
|
||||
_idt.ByteData? signing,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.SharedSpaceMemberKeys',
|
||||
'person': person.toJson(),
|
||||
if (handle != null) 'handle': handle,
|
||||
'encryption': encryption.toJson(),
|
||||
'signing': signing.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.SharedSpaceMemberKeys',
|
||||
'person': person.toJson(),
|
||||
if (handle != null) 'handle': handle,
|
||||
'encryption': encryption.toJson(),
|
||||
'signing': signing.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _Undefined {}
|
||||
|
||||
class _SharedSpaceMemberKeysImpl extends SharedSpaceMemberKeys {
|
||||
_SharedSpaceMemberKeysImpl({
|
||||
required _isc.UuidValue person,
|
||||
String? handle,
|
||||
required _idt.ByteData encryption,
|
||||
required _idt.ByteData signing,
|
||||
}) : super._(
|
||||
person: person,
|
||||
handle: handle,
|
||||
encryption: encryption,
|
||||
signing: signing,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [SharedSpaceMemberKeys]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
SharedSpaceMemberKeys copyWith({
|
||||
_isc.UuidValue? person,
|
||||
Object? handle = _Undefined,
|
||||
_idt.ByteData? encryption,
|
||||
_idt.ByteData? signing,
|
||||
}) {
|
||||
return SharedSpaceMemberKeys(
|
||||
person: person ?? this.person,
|
||||
handle: handle is String? ? handle : this.handle,
|
||||
encryption: encryption ?? this.encryption.clone(),
|
||||
signing: signing ?? this.signing.clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
|
||||
/* To generate run: "serverpod generate" */
|
||||
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: library_private_types_in_public_api
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: public_member_api_docs
|
||||
// ignore_for_file: type_literal_in_constant_pattern
|
||||
// ignore_for_file: use_super_parameters
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:typed_data' as _idt;
|
||||
import 'package:serverpod_client/serverpod_client.dart' as _isc;
|
||||
|
||||
/// A key a device sealed to a member, as it sends it (ADR 0044, D3), or as
|
||||
/// the member gets it back: [person] is whom it is sealed to on the way
|
||||
/// in, and who sealed it on the way out.
|
||||
abstract class SharedSpaceSealedKey
|
||||
implements _isc.SerializableModel, _isc.ProtocolSerialization {
|
||||
SharedSpaceSealedKey._({
|
||||
required this.keyId,
|
||||
required this.person,
|
||||
required this.sealedKey,
|
||||
});
|
||||
|
||||
factory SharedSpaceSealedKey({
|
||||
required String keyId,
|
||||
required _isc.UuidValue person,
|
||||
required _idt.ByteData sealedKey,
|
||||
}) = _SharedSpaceSealedKeyImpl;
|
||||
|
||||
factory SharedSpaceSealedKey.fromJson(
|
||||
Map<String, dynamic> jsonSerialization,
|
||||
) {
|
||||
return SharedSpaceSealedKey(
|
||||
keyId: jsonSerialization['keyId'] as String,
|
||||
person: _isc.UuidValueJsonExtension.fromJson(jsonSerialization['person']),
|
||||
sealedKey: _isc.ByteDataJsonExtension.fromJson(
|
||||
jsonSerialization['sealedKey'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String keyId;
|
||||
|
||||
_isc.UuidValue person;
|
||||
|
||||
/// The sealer's signature, then the sealed box.
|
||||
_idt.ByteData sealedKey;
|
||||
|
||||
/// Returns a shallow copy of this [SharedSpaceSealedKey]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
SharedSpaceSealedKey copyWith({
|
||||
String? keyId,
|
||||
_isc.UuidValue? person,
|
||||
_idt.ByteData? sealedKey,
|
||||
});
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.SharedSpaceSealedKey',
|
||||
'keyId': keyId,
|
||||
'person': person.toJson(),
|
||||
'sealedKey': sealedKey.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJsonForProtocol() {
|
||||
return {
|
||||
'__className__': 'halkyon_base.SharedSpaceSealedKey',
|
||||
'keyId': keyId,
|
||||
'person': person.toJson(),
|
||||
'sealedKey': sealedKey.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return _isc.SerializationManager.encode(this);
|
||||
}
|
||||
}
|
||||
|
||||
class _SharedSpaceSealedKeyImpl extends SharedSpaceSealedKey {
|
||||
_SharedSpaceSealedKeyImpl({
|
||||
required String keyId,
|
||||
required _isc.UuidValue person,
|
||||
required _idt.ByteData sealedKey,
|
||||
}) : super._(
|
||||
keyId: keyId,
|
||||
person: person,
|
||||
sealedKey: sealedKey,
|
||||
);
|
||||
|
||||
/// Returns a shallow copy of this [SharedSpaceSealedKey]
|
||||
/// with some or all fields replaced by the given arguments.
|
||||
@_isc.useResult
|
||||
@override
|
||||
SharedSpaceSealedKey copyWith({
|
||||
String? keyId,
|
||||
_isc.UuidValue? person,
|
||||
_idt.ByteData? sealedKey,
|
||||
}) {
|
||||
return SharedSpaceSealedKey(
|
||||
keyId: keyId ?? this.keyId,
|
||||
person: person ?? this.person,
|
||||
sealedKey: sealedKey ?? this.sealedKey.clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue