Skip to content

Commit

Permalink
fix: incorporate review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
britsta committed Jul 12, 2024
1 parent 8405ac7 commit 7890936
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 63 deletions.
15 changes: 0 additions & 15 deletions apps/enmeshed/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1054,21 +1054,6 @@
"Rejected": "Abgelehnte Kontaktanfrage",
"Revoked": "Zurückgezogene Kontaktanfrage"
},
"relationshipChange": {
"Accepted": "Akzeptierte Anfrage",
"Creation": "Eingehen einer Beziehung",
"Pending": "Offene Anfrage",
"Rejected": "Abgelehnte Anfrage",
"request": {
"name": "Anfrage zum Ändern einer Beziehung"
},
"response": {
"name": "Antwort zum Ändern einer Beziehung"
},
"Revoked": "Zurückgezogene Anfrage",
"Termination": "Auflösen einer Beziehung",
"TerminationCancellation": "Wiederaufnahme einer Beziehung"
},
"requestItem": {
"AuthenticationRequestItem": {
"name": "Hat eine Bestätigung angefordert"
Expand Down
15 changes: 0 additions & 15 deletions apps/enmeshed/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1054,21 +1054,6 @@
"Rejected": "Rejected contact request",
"Revoked": "Withdrawn contact request"
},
"relationshipChange": {
"Accepted": "Accepted relationship change",
"Creation": "Relationship Creation",
"Pending": "Pending relationship change",
"Rejected": "Rejected relationship change",
"request": {
"name": "Relationship Change Request"
},
"response": {
"name": "Relationship Change Response"
},
"Revoked": "Revoked relationship change",
"Termination": "Relationship Termination",
"TerminationCancellation": "Cancellation of Relationship Termination"
},
"requestItem": {
"AuthenticationRequestItem": {
"name": "Requested your authentication"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,10 @@ void run(EnmeshedRuntime runtime) {
);

final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey', owner: ThirdPartyRelationshipAttributeQueryOwner.recipient, thirdParty: [thirdPartyAddress]);
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.recipient,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down Expand Up @@ -1110,7 +1113,10 @@ void run(EnmeshedRuntime runtime) {

final receivedAttributeResult = await recipient.consumptionServices.attributes.executeThirdPartyRelationshipAttributeQuery(
query: ThirdPartyRelationshipAttributeQuery(
key: 'website', owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty, thirdParty: [account1.address!]),
key: 'website',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [account1.address!],
),
);

expect(receivedAttributeResult, isSuccessful<List<LocalAttributeDTO>>());
Expand Down Expand Up @@ -1612,7 +1618,10 @@ void run(EnmeshedRuntime runtime) {
(await sender.consumptionServices.attributes.getAttribute(attributeId: thirdPartyOwnSharedRelationshipAttribute.id)).value;

final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey', owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty, thirdParty: [thirdPartyAddress]);
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down Expand Up @@ -1643,7 +1652,10 @@ void run(EnmeshedRuntime runtime) {
(await sender.consumptionServices.attributes.getAttribute(attributeId: thirdPartyOwnSharedRelationshipAttribute.id)).value;

final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey', owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty, thirdParty: [thirdPartyAddress]);
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down Expand Up @@ -1677,7 +1689,10 @@ void run(EnmeshedRuntime runtime) {
(await sender.consumptionServices.attributes.getAttribute(attributeId: thirdPartyOwnSharedRelationshipAttribute.id)).value;

final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey', owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty, thirdParty: [thirdPartyAddress]);
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down Expand Up @@ -1721,7 +1736,10 @@ void run(EnmeshedRuntime runtime) {
(await sender.consumptionServices.attributes.getAttribute(attributeId: thirdPartyOwnSharedRelationshipAttribute.id)).value;

final query = ThirdPartyRelationshipAttributeQuery(
key: 'aKey', owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty, thirdParty: [thirdPartyAddress]);
key: 'aKey',
owner: ThirdPartyRelationshipAttributeQueryOwner.thirdParty,
thirdParty: [thirdPartyAddress],
);
final requestItem = ReadAttributeRequestItem(mustBeAccepted: true, query: query);

final senderThirdPartyOwnedRelationshipAttribute = await executeFullRequestAndShareThirdPartyRelationshipAttributeFlow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void run(EnmeshedRuntime runtime) {
final identityInfoResult = await session.transportServices.account.getIdentityInfo();

expect(identityInfoResult, isSuccessful<GetIdentityInfoResponse>());
final RegExp regExp = RegExp(r'^did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}$');
final regExp = RegExp(r'^did:e:[a-zA-Z0-9.-]+:dids:[0-9a-f]{22}$');
expect(regExp.hasMatch(identityInfoResult.value.address), true);
expect(identityInfoResult.value.publicKey.length, equals(82));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void run(EnmeshedRuntime runtime) {
});

group('Message errors', () {
const fakeAddress = 'did:e:prod.enmeshed.eu:dids:fef1992c5e529adc413288';
const fakeAddress = 'did:e:a-domain:dids:fef1992c5e529adc413288';
test('should throw correct error for empty "to" in the Message', () async {
final result = await session1.transportServices.messages.sendMessage(
recipients: [fakeAddress],
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
part of 'attribute_query.dart';

enum ThirdPartyRelationshipAttributeQueryOwner { thirdParty, recipient, empty }
enum ThirdPartyRelationshipAttributeQueryOwner {
@JsonValue('thirdParty')
thirdParty,
@JsonValue('recipient')
recipient,
@JsonValue('')
empty,
}

@JsonSerializable(includeIfNull: false)
class ThirdPartyRelationshipAttributeQuery extends AttributeQuery {
final String key;
final ThirdPartyRelationshipAttributeQueryOwner owner;
Expand All @@ -17,32 +25,10 @@ class ThirdPartyRelationshipAttributeQuery extends AttributeQuery {
this.validTo,
});

factory ThirdPartyRelationshipAttributeQuery.fromJson(Map json) {
return ThirdPartyRelationshipAttributeQuery(
key: json['key'],
owner: json['owner'] == ''
? ThirdPartyRelationshipAttributeQueryOwner.empty
: ThirdPartyRelationshipAttributeQueryOwner.values.byName(json['owner']),
thirdParty: (json['thirdParty'] as List<dynamic>).map((e) => e as String).toList(),
validFrom: json['validTo'],
validTo: json['validTo'],
);
}
factory ThirdPartyRelationshipAttributeQuery.fromJson(Map json) => _$ThirdPartyRelationshipAttributeQueryFromJson(Map<String, dynamic>.from(json));

@override
Map<String, dynamic> toJson() {
final json = <String, dynamic>{
'@type': 'ThirdPartyRelationshipAttributeQuery',
'key': key,
'owner': owner == ThirdPartyRelationshipAttributeQueryOwner.empty ? '' : owner.name,
'thirdParty': thirdParty,
'validFrom': validFrom,
'validTo': validTo,
};

json.removeWhere((key, value) => value == null);
return json;
}
Map<String, dynamic> toJson() => {'@type': 'ThirdPartyRelationshipAttributeQuery', ..._$ThirdPartyRelationshipAttributeQueryToJson(this)};

@override
List<Object?> get props => [
Expand Down

0 comments on commit 7890936

Please sign in to comment.