// IDFromPublicKey returns the Peer ID corresponding to pk func IDFromPublicKey(pk ic.PubKey) (ID, error) { b, err := pk.Bytes() if err != nil { return "", err } hash := u.Hash(b) return ID(hash), nil }
func CheckRecordSig(r *pb.Record, pk ci.PubKey) error { blob := RecordBlobForSig(r) good, err := pk.Verify(blob, r.Signature) if err != nil { return nil } if !good { return errors.New("invalid record signature") } return nil }