How do I compare two Principals for equality in JavaScript?

I’ve been converting Principals to strings and doing === on those, but is there an easier way?

The principle library could certainly use an .eq function if it doesn’t have it. If I remember one of the sub properties is just a uint8 array. You can loop from 0 to length longest and break when a byte doesn’t match.(I guess check length equality first)

1 Like