func UnmarshalAndValidateAnchorRecordV2(data []byte, extIDs [][]byte, publicKey interfaces.Verifier) (*AnchorRecord, bool, error) {
	if len(data) == 0 {
		return nil, false, fmt.Errorf("Invalid data passed")
	}
	if len(extIDs) != 1 {
		return nil, false, fmt.Errorf("Invalid External IDs passed")
	}

	sig := new(primitives.ByteSliceSig)
	sig.UnmarshalBinary(extIDs[0])
	fixed, err := sig.GetFixed()
	if err != nil {
		return nil, false, err
	}

	valid := publicKey.Verify(data, &fixed)
	if valid == false {
		return nil, false, nil
	}

	ar := new(AnchorRecord)
	err = ar.Unmarshal(data)
	if err != nil {
		return nil, false, err
	}
	return ar, true, nil
}
func UnmarshalAndValidateAnchorRecord(data []byte, publicKey interfaces.Verifier) (*AnchorRecord, bool, error) {
	if len(data) == 0 {
		return nil, false, fmt.Errorf("Invalid data passed")
	}
	str := string(data)
	end := strings.LastIndex(str, "}}")
	if end < 0 {
		return nil, false, fmt.Errorf("Found no closing bracket in `%v`", str)
	}
	anchorStr := str[:end+2]
	signatureStr := str[end+2:]

	sig := new(primitives.ByteSliceSig)
	sig.UnmarshalText([]byte(signatureStr))
	fixed, err := sig.GetFixed()
	if err != nil {
		return nil, false, err
	}

	valid := publicKey.Verify([]byte(anchorStr), &fixed)
	if valid == false {
		return nil, false, nil
	}

	ar := new(AnchorRecord)
	err = ar.Unmarshal(data)
	if err != nil {
		return nil, false, err
	}
	return ar, true, nil
}