If you were not in possession, you'd have been searched & on your way, false positive. I know it's no help but bigger fish than you have been caught up in security checkpoints by DHS. I'm not sure what wrecking the scooter has to do with this unless you were on pain meds... and if so, were they legally prescribed & labeled. I travel with prescription meds (a freaking drug store) all the time & am careful to keep them in original containers.
The trained dog alerted. That's enough probable cause for a full search without consent or a warrant. This is one of our rights that has gone Bye Bye! since 9-11. If they found illegal substances, that is all the evidence they need. They don't need your statements, so Miranda is a moot point.
I get it, that you are feeling betrayed by your former friend. I'm sorry about this. All I can say is live & learn. There are very many who would turn their back on someone in a time of crisis to save themselves. What you need to do is get representation & try to minimize the damages done.