assertSame($encoder->encode($unsigned->toMap()), $signer->getLastSignedMessage()); $this->assertSame($unsigned->getDid(), $commit->getDid()); $this->assertSame($unsigned->getData()->getCid(), $commit->getData()->getCid()); $this->assertSame($unsigned->getRev(), $commit->getRev()); $this->assertSame($unsigned->getPrev()?->getCid(), $commit->getPrev()?->getCid()); $this->assertSame($signature, $commit->getSignature()); } public function testToMapIncludesVersionAndWrapsSignatureInCborBytes(): void { $dataCid = CidUtil::computeForDagCbor('mst-root'); $signature = str_repeat("\xef", 64); $commit = new Commit( did: 'did:plc:alice', data: new CidLink($dataCid), rev: '3m4example', prev: null, signature: $signature, ); $map = $commit->toMap(); $this->assertSame('did:plc:alice', $map['did']); $this->assertSame(Commit::VERSION, $map['version']); $this->assertInstanceOf(CidLink::class, $map['data']); $this->assertSame('3m4example', $map['rev']); $this->assertNull($map['prev']); $this->assertInstanceOf(CborBytes::class, $map['sig']); $this->assertSame($signature, $map['sig']->getBytes()); } }