Skip to content

Commit

Permalink
Update DidDocument.php
Browse files Browse the repository at this point in the history
  • Loading branch information
puklipo committed Nov 30, 2024
1 parent 7c1cd0e commit 6d0cb2f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Support/DidDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ public function serviceAuthAud(): string
return Str::replace(search: 'https://', replace: 'did:web:', subject: $this->pdsUrl());
}

/**
* Get public key.
*/
public function publicKey(?string $default = null): ?string
{
$verification = collect($this->didDoc->get('verificationMethod', []))
->firstWhere('type', 'Multikey');

return data_get($verification, 'publicKeyMultibase', $default);
}

public function get(string $key, ?string $default = null): mixed
{
return data_get($this->didDoc, $key, $default);
Expand Down

0 comments on commit 6d0cb2f

Please sign in to comment.