Why does Jesus describe himself as the one who has the key of David?

Revelation 3:7 (ESV)

7 “And to the angel of the church in Philadelphia write: ‘The words of the holy one, the true one, who has the key of David, who opens and no one will shut, who shuts and no one opens.

David was the great king of Israel, whose kingdom God had promised to establish forever (see 2 Samuel 7:13; Psalm 89:27–37). David died, but Jesus was the great Son of David through whom the Lord would fulfill his promise (Matthew 1:1–25). So Christ after his victory on the cross could declare that all authority in heaven and on earth had been given to him (Matthew 28:18; see also Revelation 1:5). A key guarantees ownership of and access to a house (see Isaiah 22:22). Christ claims that he possesses the key that permits access to David, and thus to David’s kingdom. That would include the New Jerusalem (Revelation 3:12), the glorious new city of David.