verify-phone-sms 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.env.example +20 -0
  2. package/CHANGELOG.md +71 -0
  3. package/DEPLOYMENT.md +151 -0
  4. package/README.md +475 -0
  5. package/bun.lock +1110 -0
  6. package/docs/.source/index.ts +11 -0
  7. package/docs/.source/source.config.mjs +9 -0
  8. package/docs/app/(home)/layout.tsx +7 -0
  9. package/docs/app/(home)/page.tsx +38 -0
  10. package/docs/app/docs/[[...slug]]/page.tsx +59 -0
  11. package/docs/app/docs/layout.tsx +12 -0
  12. package/docs/app/docs-og/[...slug]/route.ts +24 -0
  13. package/docs/app/globals.css +587 -0
  14. package/docs/app/layout.config.tsx +13 -0
  15. package/docs/app/layout.tsx +27 -0
  16. package/docs/app/logo.tsx +35 -0
  17. package/docs/bun.lock +923 -0
  18. package/docs/content/docs/API_AUTHENTICATION.md +91 -0
  19. package/docs/content/docs/DEPLOYMENT.md +181 -0
  20. package/docs/content/docs/api/post.mdx +35 -0
  21. package/docs/content/docs/api/verify.mdx +34 -0
  22. package/docs/content/docs/meta.json +8 -0
  23. package/docs/content/docs/verify-legal-name.md +339 -0
  24. package/docs/lib/source.ts +14 -0
  25. package/docs/mdx-components.tsx +12 -0
  26. package/docs/next.config.mjs +51 -0
  27. package/docs/openapi.json +329 -0
  28. package/docs/package.json +37 -0
  29. package/docs/postcss.config.mjs +5 -0
  30. package/docs/scripts/generate-docs.mjs +23 -0
  31. package/docs/source.config.ts +5 -0
  32. package/docs/tsconfig.json +29 -0
  33. package/docs/worker.js +35 -0
  34. package/docs/wrangler.toml +26 -0
  35. package/examples/client.ts +105 -0
  36. package/examples/demo.html +325 -0
  37. package/examples/libphonenumber-example.ts +120 -0
  38. package/openapi.json +329 -0
  39. package/package.json +75 -0
  40. package/scripts/deploy.sh +63 -0
  41. package/src/identity-verification-server.ts +677 -0
  42. package/src/index.ts +8 -0
  43. package/src/sns.ts +265 -0
  44. package/src/verify-phone-server.ts +503 -0
  45. package/src/verify-phone.ts +577 -0
  46. package/test/api.test.ts +205 -0
  47. package/test/integration.test.ts +152 -0
  48. package/test/metadata-test.ts +73 -0
  49. package/test/server.test.ts +143 -0
  50. package/test/setup.ts +32 -0
  51. package/test/utils.test.ts +186 -0
  52. package/test/verify.test.ts +20 -0
  53. package/test/voip.test.ts +113 -0
  54. package/tsconfig.json +24 -0
  55. package/vitest.config.ts +10 -0
  56. package/wrangler.toml +24 -0
package/.env.example ADDED
@@ -0,0 +1,20 @@
1
+ # Environment Variables for SMS Verification API
2
+ # Copy this file to .env and fill in your values
3
+
4
+ # AWS Configuration
5
+ AWS_REGION=us-east-1
6
+ AWS_ACCESS_KEY_ID=your_aws_access_key_id
7
+ AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
8
+
9
+ # SMS Configuration
10
+ SMS_SENDER_ID=Verify
11
+
12
+ # API Configuration
13
+ API_KEY=your_api_key_here
14
+
15
+ # Environment
16
+ ENVIRONMENT=development
17
+
18
+ # Cloudflare Configuration (for deployment)
19
+ CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id
20
+ CLOUDFLARE_API_TOKEN=your_cloudflare_api_token
package/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### [0.9.5](https://github.com/OpenSourceAGI/appdemo-dev-tools/compare/v0.9.3...v0.9.5) (2026-05-23)
6
+
7
+ ### [0.9.3](https://github.com/OpenSourceAGI/appdemo-dev-tools/compare/v1.1.5...v0.9.3) (2026-05-23)
8
+
9
+
10
+ ### Features
11
+
12
+ * add initial setup for Svelte template with Cloudflare Workers ([791308a](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/791308aee06fc0a01fecde061a7f8a0372329464))
13
+ * add theme toggle component and integrate WebGL shader background ([56551a3](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/56551a35ee3246d9d7530f88bbf91546e3c4e1fa))
14
+ * implement risk-based tool classification, runtime security policies, and granular configuration for OpenAPI MCP generators ([91ad054](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/91ad054b893f3807a5100eba4bf1953ef467815d))
15
+ * implement Sparkles decorative component and enhance home page UI aesthetics while updating git ignore rules. ([4f91b06](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/4f91b06ad0be897edf24a0dd160d02a385a1f4d7))
16
+ * scaffold shadcn demo environment and expand theme collection in theme-dropdown ([b366c1d](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/b366c1d39ca46556c6f4e597265b3af6236657c7))
17
+ * update system info installation and enhance theme styles ([46ead08](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/46ead086bfceeb49862c8054f4641134285d1ace))
18
+ * **vscode-cloud:** add Cloudflare Workers observability config ([#30](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/30)) ([c3b17c8](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/c3b17c8265e63895d77ec8124c321e65cbaff75f))
19
+ * **vscode-cloud:** add Cloudflare Workers observability config ([#31](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/31)) ([aebc1f3](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/aebc1f35fc56c0b99c9ccacb39e707bd73e5e20d))
20
+ * **vscode-cloud:** enhance Dockerfile with multi-language runtimes and language servers ([#27](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/27)) ([a43daf8](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/a43daf8b0081139c6854355b3a6e6b5e1ec4202a))
21
+ * **vscode-cloud:** enhance Dockerfile with multi-language runtimes and language servers ([#28](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/28)) ([2792bc6](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/2792bc6a6e0719be3fd9d60867e5726fdc2f23ef))
22
+ * **vscode-cloud:** enhance Dockerfile with multi-language runtimes and language servers ([#29](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/29)) ([7b91874](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/7b91874b86b2026bcc61a25ed4ee78f5f52118da))
23
+ * **vscode-cloud:** fix internet access, type safety, and improve UX ([a5827d6](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/a5827d66023c8fa382a400416e04b7e634f0c1bb))
24
+ * **vscode-cloud:** passwordless login, landing page, and pre-installed AI/dev extensions ([5765f80](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/5765f806961e32fd11e9fcab9e58e78e57835c61))
25
+ * **vscode-cloud:** provision KV namespace and D1 database IDs for deploy ([ad463e9](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/ad463e905c3c3c80665d4ad158fb147cb44f3358))
26
+ * **vscode-cloud:** provision KV namespace and D1 database IDs for deploy ([#24](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/24)) ([3cc9246](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/3cc924655c708f881ad352df83ff9eeaf289796d))
27
+ * **vscode-cloud:** teams dashboard, WakaTime tracking, and updated landing page ([815ff09](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/815ff0930778ba2e4c42e7a5cac62eb3df6d0454))
28
+
29
+ ### [0.9.2](https://github.com/OpenSourceAGI/appdemo-dev-tools/compare/v1.1.5...v0.9.2) (2026-05-23)
30
+
31
+
32
+ ### Features
33
+
34
+ * add initial setup for Svelte template with Cloudflare Workers ([791308a](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/791308aee06fc0a01fecde061a7f8a0372329464))
35
+ * add theme toggle component and integrate WebGL shader background ([56551a3](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/56551a35ee3246d9d7530f88bbf91546e3c4e1fa))
36
+ * implement risk-based tool classification, runtime security policies, and granular configuration for OpenAPI MCP generators ([91ad054](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/91ad054b893f3807a5100eba4bf1953ef467815d))
37
+ * implement Sparkles decorative component and enhance home page UI aesthetics while updating git ignore rules. ([4f91b06](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/4f91b06ad0be897edf24a0dd160d02a385a1f4d7))
38
+ * scaffold shadcn demo environment and expand theme collection in theme-dropdown ([b366c1d](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/b366c1d39ca46556c6f4e597265b3af6236657c7))
39
+ * update system info installation and enhance theme styles ([46ead08](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/46ead086bfceeb49862c8054f4641134285d1ace))
40
+ * **vscode-cloud:** add Cloudflare Workers observability config ([#30](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/30)) ([c3b17c8](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/c3b17c8265e63895d77ec8124c321e65cbaff75f))
41
+ * **vscode-cloud:** add Cloudflare Workers observability config ([#31](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/31)) ([aebc1f3](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/aebc1f35fc56c0b99c9ccacb39e707bd73e5e20d))
42
+ * **vscode-cloud:** enhance Dockerfile with multi-language runtimes and language servers ([#27](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/27)) ([a43daf8](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/a43daf8b0081139c6854355b3a6e6b5e1ec4202a))
43
+ * **vscode-cloud:** enhance Dockerfile with multi-language runtimes and language servers ([#28](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/28)) ([2792bc6](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/2792bc6a6e0719be3fd9d60867e5726fdc2f23ef))
44
+ * **vscode-cloud:** enhance Dockerfile with multi-language runtimes and language servers ([#29](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/29)) ([7b91874](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/7b91874b86b2026bcc61a25ed4ee78f5f52118da))
45
+ * **vscode-cloud:** fix internet access, type safety, and improve UX ([a5827d6](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/a5827d66023c8fa382a400416e04b7e634f0c1bb))
46
+ * **vscode-cloud:** passwordless login, landing page, and pre-installed AI/dev extensions ([5765f80](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/5765f806961e32fd11e9fcab9e58e78e57835c61))
47
+ * **vscode-cloud:** provision KV namespace and D1 database IDs for deploy ([ad463e9](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/ad463e905c3c3c80665d4ad158fb147cb44f3358))
48
+ * **vscode-cloud:** provision KV namespace and D1 database IDs for deploy ([#24](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/24)) ([3cc9246](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/3cc924655c708f881ad352df83ff9eeaf289796d))
49
+ * **vscode-cloud:** teams dashboard, WakaTime tracking, and updated landing page ([815ff09](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/815ff0930778ba2e4c42e7a5cac62eb3df6d0454))
50
+
51
+ ### [0.9.1](https://github.com/OpenSourceAGI/appdemo-dev-tools/compare/v1.1.5...v0.9.1) (2026-05-23)
52
+
53
+
54
+ ### Features
55
+
56
+ * add initial setup for Svelte template with Cloudflare Workers ([791308a](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/791308aee06fc0a01fecde061a7f8a0372329464))
57
+ * add theme toggle component and integrate WebGL shader background ([56551a3](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/56551a35ee3246d9d7530f88bbf91546e3c4e1fa))
58
+ * implement risk-based tool classification, runtime security policies, and granular configuration for OpenAPI MCP generators ([91ad054](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/91ad054b893f3807a5100eba4bf1953ef467815d))
59
+ * implement Sparkles decorative component and enhance home page UI aesthetics while updating git ignore rules. ([4f91b06](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/4f91b06ad0be897edf24a0dd160d02a385a1f4d7))
60
+ * scaffold shadcn demo environment and expand theme collection in theme-dropdown ([b366c1d](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/b366c1d39ca46556c6f4e597265b3af6236657c7))
61
+ * update system info installation and enhance theme styles ([46ead08](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/46ead086bfceeb49862c8054f4641134285d1ace))
62
+ * **vscode-cloud:** add Cloudflare Workers observability config ([#30](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/30)) ([c3b17c8](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/c3b17c8265e63895d77ec8124c321e65cbaff75f))
63
+ * **vscode-cloud:** add Cloudflare Workers observability config ([#31](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/31)) ([aebc1f3](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/aebc1f35fc56c0b99c9ccacb39e707bd73e5e20d))
64
+ * **vscode-cloud:** enhance Dockerfile with multi-language runtimes and language servers ([#27](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/27)) ([a43daf8](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/a43daf8b0081139c6854355b3a6e6b5e1ec4202a))
65
+ * **vscode-cloud:** enhance Dockerfile with multi-language runtimes and language servers ([#28](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/28)) ([2792bc6](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/2792bc6a6e0719be3fd9d60867e5726fdc2f23ef))
66
+ * **vscode-cloud:** enhance Dockerfile with multi-language runtimes and language servers ([#29](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/29)) ([7b91874](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/7b91874b86b2026bcc61a25ed4ee78f5f52118da))
67
+ * **vscode-cloud:** fix internet access, type safety, and improve UX ([a5827d6](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/a5827d66023c8fa382a400416e04b7e634f0c1bb))
68
+ * **vscode-cloud:** passwordless login, landing page, and pre-installed AI/dev extensions ([5765f80](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/5765f806961e32fd11e9fcab9e58e78e57835c61))
69
+ * **vscode-cloud:** provision KV namespace and D1 database IDs for deploy ([ad463e9](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/ad463e905c3c3c80665d4ad158fb147cb44f3358))
70
+ * **vscode-cloud:** provision KV namespace and D1 database IDs for deploy ([#24](https://github.com/OpenSourceAGI/appdemo-dev-tools/issues/24)) ([3cc9246](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/3cc924655c708f881ad352df83ff9eeaf289796d))
71
+ * **vscode-cloud:** teams dashboard, WakaTime tracking, and updated landing page ([815ff09](https://github.com/OpenSourceAGI/appdemo-dev-tools/commit/815ff0930778ba2e4c42e7a5cac62eb3df6d0454))
package/DEPLOYMENT.md ADDED
@@ -0,0 +1,151 @@
1
+ # Deployment Guide
2
+
3
+ This guide covers deploying both the SMS Verification API and documentation to Cloudflare.
4
+
5
+ ## Prerequisites
6
+
7
+ 1. Install Wrangler CLI:
8
+ ```bash
9
+ npm install -g wrangler
10
+ ```
11
+
12
+ 2. Login to Cloudflare:
13
+ ```bash
14
+ wrangler login
15
+ ```
16
+
17
+ 3. Set up your Cloudflare account and get your Account ID from the dashboard.
18
+
19
+ ## Environment Setup
20
+
21
+ ### 1. Set Secrets (Required)
22
+
23
+ Set the following secrets using wrangler:
24
+
25
+ ```bash
26
+ # For the main API
27
+ wrangler secret put AWS_ACCESS_KEY_ID
28
+ wrangler secret put AWS_SECRET_ACCESS_KEY
29
+ wrangler secret put API_KEY
30
+
31
+ # For staging environment
32
+ wrangler secret put AWS_ACCESS_KEY_ID --env staging
33
+ wrangler secret put AWS_SECRET_ACCESS_KEY --env staging
34
+ wrangler secret put API_KEY --env staging
35
+
36
+ # For production environment
37
+ wrangler secret put AWS_ACCESS_KEY_ID --env production
38
+ wrangler secret put AWS_SECRET_ACCESS_KEY --env production
39
+ wrangler secret put API_KEY --env production
40
+ ```
41
+
42
+ ### 2. Update wrangler.toml
43
+
44
+ Make sure your `wrangler.toml` has the correct account ID and zone ID if needed.
45
+
46
+ ## Deployment Commands
47
+
48
+ ### Deploy API Only
49
+
50
+ ```bash
51
+ # Deploy to default environment
52
+ npm run deploy
53
+
54
+ # Deploy to staging
55
+ npm run deploy:staging
56
+
57
+ # Deploy to production
58
+ npm run deploy:production
59
+ ```
60
+
61
+ ### Deploy Docs Only
62
+
63
+ ```bash
64
+ # Build docs first
65
+ npm run build:docs
66
+
67
+ # Deploy to default environment
68
+ npm run deploy:docs
69
+
70
+ # Deploy to staging
71
+ npm run deploy:docs:staging
72
+
73
+ # Deploy to production
74
+ npm run deploy:docs:production
75
+ ```
76
+
77
+ ### Deploy Both API and Docs
78
+
79
+ ```bash
80
+ # Deploy both to default environment
81
+ npm run deploy:all
82
+
83
+ # Deploy both to staging
84
+ npm run deploy:all:staging
85
+
86
+ # Deploy both to production
87
+ npm run deploy:all:production
88
+ ```
89
+
90
+ ## Manual Deployment Steps
91
+
92
+ ### 1. Deploy API (Workers)
93
+
94
+ ```bash
95
+ # From project root
96
+ wrangler deploy
97
+ wrangler deploy --env staging
98
+ wrangler deploy --env production
99
+ ```
100
+
101
+ ### 2. Deploy Docs (Static Site)
102
+
103
+ ```bash
104
+ # From docs directory
105
+ cd docs
106
+ npm run build
107
+ wrangler deploy
108
+ ```
109
+
110
+ ## Environment Variables
111
+
112
+ The following environment variables are automatically set:
113
+
114
+ - `ENVIRONMENT`: Set to "staging" or "production" based on deployment target
115
+ - `NODE_ENV`: Set to "production" for docs
116
+
117
+ ## Troubleshooting
118
+
119
+ ### Common Issues
120
+
121
+ 1. **Authentication Error**: Run `wrangler login` again
122
+ 2. **Build Failures**: Ensure all dependencies are installed with `npm install`
123
+ 3. **Secret Errors**: Verify all secrets are set using `wrangler secret list`
124
+
125
+ ### Checking Deployment Status
126
+
127
+ ```bash
128
+ # Check Workers deployment
129
+ wrangler deployments list
130
+
131
+ # Check static site deployment
132
+ wrangler deployments list
133
+ ```
134
+
135
+ ## Monitoring
136
+
137
+ - **Workers**: Check Cloudflare Workers dashboard for API performance
138
+ - **Pages**: Check Cloudflare Pages dashboard for docs deployment status
139
+ - **Logs**: Use `wrangler tail` to monitor real-time logs
140
+
141
+ ## Rollback
142
+
143
+ To rollback to a previous deployment:
144
+
145
+ ```bash
146
+ # For Workers
147
+ wrangler rollback [deployment-id]
148
+
149
+ # For static site
150
+ wrangler rollback [deployment-id]
151
+ ```