feat(api): move encrypt logic to api class