Skip to content

Commit 6a9216b

Browse files
committed
Update params and return types
1 parent 8f169fe commit 6a9216b

9 files changed

Lines changed: 24 additions & 11 deletions

src/MLS/Commit/CommitInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function getSender(): SenderInterface;
2424
*/
2525
public function getProposals(): array;
2626

27-
public function getPath(): ?array;
27+
public function getPath(): ?UpdatePathInterface;
2828

2929
public function getSignature(): string;
3030
}

src/MLS/Commit/UpdatePathInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313

1414
namespace MLS\Commit;
1515

16+
use MLS\Tree\LeafNodeInterface;
17+
1618
interface UpdatePathInterface
1719
{
1820
/**
1921
* The leaf node presented in the path (serialized).
2022
*/
21-
public function getLeafNode(): string;
23+
public function getLeafNode(): LeafNodeInterface;
2224

2325
/**
2426
* Array of UpdatePathNodeInterface.

src/MLS/Credentials/CredentialInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ public function getIdentity(): string;
2222
public function getPublicKey(): string;
2323

2424
public function verifySignature(string $message, string $signature): bool;
25+
26+
/**
27+
* Provide a string representation suitable for logging or use where a string is required.
28+
*/
29+
public function __toString(): string;
2530
}

src/MLS/Group/GroupInfoInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace MLS\Group;
1515

16+
use MLS\Credentials\CredentialInterface;
1617
use MLS\Tree\TreeInterface;
1718

1819
interface GroupInfoInterface
@@ -30,7 +31,7 @@ public function getConfirmedTranscriptHash(): string;
3031
*/
3132
public function getExtensions(): array;
3233

33-
public function getSigner(): string;
34+
public function getSigner(): CredentialInterface;
3435

3536
public function verifySignature(string $signature): bool;
3637
}

src/MLS/Group/GroupInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use MLS\Crypto\CipherSuiteInterface;
1818
use MLS\Message\MLSMessageInterface;
1919
use MLS\Proposal\ProposalInterface;
20+
use MLS\Proposal\ProposalListInterface;
2021

2122
interface GroupInterface
2223
{
@@ -30,7 +31,7 @@ public function addMember(string $identity): ProposalInterface;
3031

3132
public function removeMember(string $identity): ProposalInterface;
3233

33-
public function commit(array $proposals): CommitInterface;
34+
public function commit(ProposalListInterface $proposals): CommitInterface;
3435

3536
public function applyCommit(CommitInterface $commit): void;
3637

src/MLS/Group/GroupMembershipInterface.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313

1414
namespace MLS\Group;
1515

16+
use MLS\Handshake\KeyPackageBundleInterface;
17+
1618
interface GroupMembershipInterface
1719
{
1820
/**
19-
* Add members to the group. Returns an array of proposal objects or identifiers to be committed.
21+
* Add members to the group. Accepts a KeyPackage bundle.
2022
*
21-
* @param array $keyPackages Array of KeyPackageInterface or raw key package representations
23+
* @param \MLS\Handshake\KeyPackageBundleInterface $bundle
2224
* @return array<int,mixed>
2325
*/
24-
public function addMembers(array $keyPackages): array;
26+
public function addMembers(KeyPackageBundleInterface $bundle): array;
2527

2628
/**
2729
* Remove members by identity or index. Returns proposals or identifiers.

src/MLS/MLSInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
interface MLSInterface
2020
{
21-
public function createGroup(string $groupId, CipherSuiteInterface $ciphers): Group\GroupInterface;
21+
public function createGroup(string $groupId, CipherSuiteInterface $ciphers): GroupInterface;
2222

2323
public function loadGroup(string $groupId): ?GroupInterface;
2424

src/MLS/Tree/TreeInterface.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
namespace MLS\Tree;
1515

16+
use MLS\Commit\UpdatePathInterface;
17+
1618
interface TreeInterface
1719
{
1820
public function getLeafCount(): int;
@@ -29,7 +31,7 @@ public function getParent(int $index): ?ParentNodeInterface;
2931
* Compute the path for a leaf index.
3032
*
3133
* @param int $leafIndex
32-
* @return \MLS\Commit\UpdatePathNodeInterface[]
34+
* @return \MLS\Commit\UpdatePathInterface
3335
*/
34-
public function computePath(int $leafIndex): array;
36+
public function computePath(int $leafIndex): UpdatePathInterface;
3537
}

tests/MLSInterfacesExtendedTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testTreeComputePathDocblock(): void
6363
$t = new ReflectionClass('MLS\\Tree\\TreeInterface');
6464
$this->assertTrue($t->hasMethod('computePath'));
6565
$doc = $t->getMethod('computePath')->getDocComment();
66-
$this->assertStringContainsString('UpdatePathNodeInterface', (string) $doc);
66+
$this->assertStringContainsString('UpdatePathInterface', (string) $doc);
6767
}
6868

6969
public function testGroupInfoExtensionsDoc(): void

0 commit comments

Comments
 (0)