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
1 changed files with 105813 additions and 5 deletions
|
|
@ -83,10 +83,16 @@ import 'package:halkyon_base_server/src/generated/profile/profile_refusal.dart'
|
|||
as _idszjcpz;
|
||||
import 'package:halkyon_base_server/src/generated/shared_space/shared_space_info.dart'
|
||||
as _i582118y;
|
||||
import 'package:halkyon_base_server/src/generated/shared_space/shared_space_key_need.dart'
|
||||
as _ije0apa9;
|
||||
import 'package:halkyon_base_server/src/generated/shared_space/shared_space_member_info.dart'
|
||||
as _izxzwa6x;
|
||||
import 'package:halkyon_base_server/src/generated/shared_space/shared_space_member_keys.dart'
|
||||
as _ia0j1un6;
|
||||
import 'package:halkyon_base_server/src/generated/shared_space/shared_space_role.dart'
|
||||
as _i4jk9by9;
|
||||
import 'package:halkyon_base_server/src/generated/shared_space/shared_space_sealed_key.dart'
|
||||
as _ik1elru1;
|
||||
import 'package:halkyon_base_server/src/generated/simplelogin/simplelogin_completed.dart'
|
||||
as _i8g1l2iv;
|
||||
import 'package:halkyon_base_server/src/generated/simplelogin/simplelogin_return.dart'
|
||||
|
|
@ -261,6 +267,8 @@ class TestEndpoints {
|
|||
|
||||
late final _SharedSpaceEndpoint sharedSpace;
|
||||
|
||||
late final _SharedSpaceKeysEndpoint sharedSpaceKeys;
|
||||
|
||||
late final _SimpleLoginEndpoint simpleLogin;
|
||||
}
|
||||
|
||||
|
|
@ -335,6 +343,10 @@ class _InternalTestEndpoints extends TestEndpoints
|
|||
endpoints,
|
||||
serializationManager,
|
||||
);
|
||||
sharedSpaceKeys = _SharedSpaceKeysEndpoint(
|
||||
endpoints,
|
||||
serializationManager,
|
||||
);
|
||||
simpleLogin = _SimpleLoginEndpoint(
|
||||
endpoints,
|
||||
serializationManager,
|
||||
|
|
@ -3199,6 +3211,145 @@ class _SharedSpaceEndpoint {
|
|||
}
|
||||
}
|
||||
|
||||
class _SharedSpaceKeysEndpoint {
|
||||
_SharedSpaceKeysEndpoint(
|
||||
this._endpointDispatch,
|
||||
this._serializationManager,
|
||||
);
|
||||
|
||||
final _is.EndpointDispatch _endpointDispatch;
|
||||
|
||||
final _is.SerializationManager _serializationManager;
|
||||
|
||||
_ida.Future<List<_ia0j1un6.SharedSpaceMemberKeys>> memberKeys(
|
||||
_ist.TestSessionBuilder sessionBuilder,
|
||||
_is.UuidValue space,
|
||||
) async {
|
||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
||||
var _localUniqueSession =
|
||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
||||
endpoint: 'sharedSpaceKeys',
|
||||
method: 'memberKeys',
|
||||
);
|
||||
try {
|
||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
||||
createSessionCallback: (_) => _localUniqueSession,
|
||||
endpointPath: 'sharedSpaceKeys',
|
||||
methodName: 'memberKeys',
|
||||
parameters: _ist.testObjectToJson({'space': space}),
|
||||
serializationManager: _serializationManager,
|
||||
);
|
||||
var _localReturnValue =
|
||||
await (_localCallContext.method.call(
|
||||
_localUniqueSession,
|
||||
_localCallContext.arguments,
|
||||
)
|
||||
as _ida.Future<List<_ia0j1un6.SharedSpaceMemberKeys>>);
|
||||
return _localReturnValue;
|
||||
} finally {
|
||||
await _localUniqueSession.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_ida.Future<List<_ije0apa9.SharedSpaceKeyNeed>> keysNeeded(
|
||||
_ist.TestSessionBuilder sessionBuilder,
|
||||
_is.UuidValue space,
|
||||
) async {
|
||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
||||
var _localUniqueSession =
|
||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
||||
endpoint: 'sharedSpaceKeys',
|
||||
method: 'keysNeeded',
|
||||
);
|
||||
try {
|
||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
||||
createSessionCallback: (_) => _localUniqueSession,
|
||||
endpointPath: 'sharedSpaceKeys',
|
||||
methodName: 'keysNeeded',
|
||||
parameters: _ist.testObjectToJson({'space': space}),
|
||||
serializationManager: _serializationManager,
|
||||
);
|
||||
var _localReturnValue =
|
||||
await (_localCallContext.method.call(
|
||||
_localUniqueSession,
|
||||
_localCallContext.arguments,
|
||||
)
|
||||
as _ida.Future<List<_ije0apa9.SharedSpaceKeyNeed>>);
|
||||
return _localReturnValue;
|
||||
} finally {
|
||||
await _localUniqueSession.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_ida.Future<void> seal(
|
||||
_ist.TestSessionBuilder sessionBuilder,
|
||||
_is.UuidValue space,
|
||||
List<_ik1elru1.SharedSpaceSealedKey> keys,
|
||||
) async {
|
||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
||||
var _localUniqueSession =
|
||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
||||
endpoint: 'sharedSpaceKeys',
|
||||
method: 'seal',
|
||||
);
|
||||
try {
|
||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
||||
createSessionCallback: (_) => _localUniqueSession,
|
||||
endpointPath: 'sharedSpaceKeys',
|
||||
methodName: 'seal',
|
||||
parameters: _ist.testObjectToJson({
|
||||
'space': space,
|
||||
'keys': keys,
|
||||
}),
|
||||
serializationManager: _serializationManager,
|
||||
);
|
||||
var _localReturnValue =
|
||||
await (_localCallContext.method.call(
|
||||
_localUniqueSession,
|
||||
_localCallContext.arguments,
|
||||
)
|
||||
as _ida.Future<void>);
|
||||
return _localReturnValue;
|
||||
} finally {
|
||||
await _localUniqueSession.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_ida.Future<List<_ik1elru1.SharedSpaceSealedKey>> mine(
|
||||
_ist.TestSessionBuilder sessionBuilder,
|
||||
_is.UuidValue space,
|
||||
) async {
|
||||
return _ist.callAwaitableFunctionAndHandleExceptions(() async {
|
||||
var _localUniqueSession =
|
||||
(sessionBuilder as _ist.InternalTestSessionBuilder).internalBuild(
|
||||
endpoint: 'sharedSpaceKeys',
|
||||
method: 'mine',
|
||||
);
|
||||
try {
|
||||
var _localCallContext = await _endpointDispatch.getMethodCallContext(
|
||||
createSessionCallback: (_) => _localUniqueSession,
|
||||
endpointPath: 'sharedSpaceKeys',
|
||||
methodName: 'mine',
|
||||
parameters: _ist.testObjectToJson({'space': space}),
|
||||
serializationManager: _serializationManager,
|
||||
);
|
||||
var _localReturnValue =
|
||||
await (_localCallContext.method.call(
|
||||
_localUniqueSession,
|
||||
_localCallContext.arguments,
|
||||
)
|
||||
as _ida.Future<List<_ik1elru1.SharedSpaceSealedKey>>);
|
||||
return _localReturnValue;
|
||||
} finally {
|
||||
await _localUniqueSession.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class _SimpleLoginEndpoint {
|
||||
_SimpleLoginEndpoint(
|
||||
this._endpointDispatch,
|
||||
|
|
|
|||
Loading…
Reference in a new issue