def public_key_from_address(address: str) -> bytes: """Extracts public key from an address Stellar address is in format: <1-byte version> <32-bytes ed25519 public key> <2-bytes CRC-16 checksum> """ b = base32.decode(address) _crc16_checksum_verify(b[:-2], b[-2:]) return b[1:-2]
def test_decode(self): for a, b in self.vectors: self.assertEqual(base32.decode(b), a)