@@ -78,9 +78,9 @@ pub enum DecodingError {
7878 InvalidKey { source : KeyParsingError } ,
7979}
8080
81- /// Extension methods for [`EndpointId `] to encode to and decode from [`z32`],
81+ /// Extension methods for [`PublicKey `] to encode to and decode from [`z32`],
8282/// which is the encoding used in [`pkarr`] domain names.
83- pub trait EndpointIdExt {
83+ pub trait PublicKeyExt {
8484 /// Encodes a [`EndpointId`] in [`z-base-32`] encoding.
8585 ///
8686 /// [`z-base-32`]: https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt
@@ -92,7 +92,7 @@ pub trait EndpointIdExt {
9292 fn from_z32 ( s : & str ) -> Result < PublicKey , DecodingError > ;
9393}
9494
95- impl EndpointIdExt for PublicKey {
95+ impl PublicKeyExt for PublicKey {
9696 fn to_z32 ( & self ) -> String {
9797 z32:: encode ( self . as_bytes ( ) )
9898 }
@@ -462,7 +462,7 @@ impl std::ops::DerefMut for EndpointInfo {
462462/// [`IROH_TXT_NAME`] and the second label to be a z32 encoded [`EndpointId`]. Ignores
463463/// subsequent labels.
464464#[ cfg( not( wasm_browser) ) ]
465- fn endpoint_id_from_txt_name ( name : & str ) -> Result < PublicKey , ParseError > {
465+ fn public_key_from_txt_name ( name : & str ) -> Result < PublicKey , ParseError > {
466466 let num_labels = name. split ( "." ) . count ( ) ;
467467 if num_labels < 2 {
468468 return Err ( e ! ( ParseError :: NumLabels { num_labels } ) ) ;
@@ -502,7 +502,7 @@ pub(crate) enum IrohAttr {
502502/// [`Display`].
503503#[ derive( Debug ) ]
504504pub ( crate ) struct TxtAttrs < T > {
505- endpoint_id : PublicKey ,
505+ public_key : PublicKey ,
506506 attrs : BTreeMap < T , Vec < String > > ,
507507}
508508
@@ -529,19 +529,19 @@ impl From<&EndpointInfo> for TxtAttrs<IrohAttr> {
529529impl < T : FromStr + Display + Hash + Ord > TxtAttrs < T > {
530530 /// Creates [`TxtAttrs`] from an endpoint id and an iterator of key-value pairs.
531531 pub ( crate ) fn from_parts (
532- endpoint_id : PublicKey ,
532+ public_key : PublicKey ,
533533 pairs : impl Iterator < Item = ( T , String ) > ,
534534 ) -> Self {
535535 let mut attrs: BTreeMap < T , Vec < String > > = BTreeMap :: new ( ) ;
536536 for ( k, v) in pairs {
537537 attrs. entry ( k) . or_default ( ) . push ( v) ;
538538 }
539- Self { attrs, endpoint_id }
539+ Self { attrs, public_key }
540540 }
541541
542542 /// Creates [`TxtAttrs`] from an endpoint id and an iterator of "{key}={value}" strings.
543543 pub ( crate ) fn from_strings (
544- endpoint_id : PublicKey ,
544+ public_key : PublicKey ,
545545 strings : impl Iterator < Item = String > ,
546546 ) -> Result < Self , ParseError > {
547547 let mut attrs: BTreeMap < T , Vec < String > > = BTreeMap :: new ( ) ;
@@ -557,7 +557,7 @@ impl<T: FromStr + Display + Hash + Ord> TxtAttrs<T> {
557557 } ) ?;
558558 attrs. entry ( attr) . or_default ( ) . push ( value. to_string ( ) ) ;
559559 }
560- Ok ( Self { attrs, endpoint_id } )
560+ Ok ( Self { attrs, public_key } )
561561 }
562562
563563 /// Returns the parsed attributes.
@@ -567,7 +567,7 @@ impl<T: FromStr + Display + Hash + Ord> TxtAttrs<T> {
567567
568568 /// Returns the endpoint id.
569569 pub ( crate ) fn endpoint_id ( & self ) -> PublicKey {
570- self . endpoint_id
570+ self . public_key
571571 }
572572
573573 /// Parses a [`pkarr::SignedPacket`].
@@ -603,7 +603,7 @@ impl<T: FromStr + Display + Hash + Ord> TxtAttrs<T> {
603603 name : String ,
604604 lookup : impl Iterator < Item = crate :: dns:: TxtRecordData > ,
605605 ) -> Result < Self , ParseError > {
606- let queried_endpoint_id = endpoint_id_from_txt_name ( & name) ?;
606+ let queried_endpoint_id = public_key_from_txt_name ( & name) ?;
607607
608608 let strings = lookup. map ( |record| record. to_string ( ) ) ;
609609 Self :: from_strings ( queried_endpoint_id, strings)
@@ -674,7 +674,7 @@ mod tests {
674674 use iroh_base:: { PublicKey , SecretKey , TransportAddr } ;
675675 use n0_error:: { Result , StdResultExt } ;
676676
677- use super :: { EndpointData , EndpointIdExt , EndpointInfo } ;
677+ use super :: { EndpointData , PublicKeyExt , EndpointInfo } ;
678678 use crate :: dns:: TxtRecordData ;
679679
680680 #[ test]
0 commit comments