@vtecx/vtecxdocument 1.0.3 → 1.0.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.
- package/docs/api/index.md +2 -2
- package/docs/api/util.md +34 -0
- package/package.json +2 -2
package/docs/api/index.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
| PDF・署名 | [pdf.md](pdf.md) | `toPdf`, `putSignature`, `checkSignature` |
|
|
23
23
|
| OAuth・TOTP | [oauth.md](oauth.md) | `oauthLine`, `getTotpLink`, `createTotp`, `loginWithTotp` |
|
|
24
24
|
| ACL・エイリアス | [acl.md](acl.md) | `addacl`, `removeacl`, `addalias`, `removealias` |
|
|
25
|
-
| ユーティリティ | [util.md](util.md) | `checkXRequestedWith`, `response`, `getParameter`, `log`, `property` |
|
|
25
|
+
| ユーティリティ | [util.md](util.md) | `checkXRequestedWith`, `response`, `getParameter`, `log`, `property`, `verifyRecaptcha` |
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
### ユーティリティ
|
|
86
86
|
`getParameter` / `hasParameter` / `buffer` / `isBlank` / `null2blank` /
|
|
87
87
|
`checkXRequestedWith` / `setResponseHeader` / `response` / `sendMessage` /
|
|
88
|
-
`property` / `log` / `isVtecxNextError`
|
|
88
|
+
`property` / `log` / `isVtecxNextError` / `verifyRecaptcha`
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
package/docs/api/util.md
CHANGED
|
@@ -143,6 +143,40 @@ await vtecxnext.log('エラーが発生しました', 'MyApp', 'ERROR')
|
|
|
143
143
|
|
|
144
144
|
---
|
|
145
145
|
|
|
146
|
+
## reCAPTCHA検証
|
|
147
|
+
|
|
148
|
+
### `verifyRecaptcha(token, action)`
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
verifyRecaptcha(token: string, action: string): Promise<RecaptchaVerifyResult>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
reCAPTCHA トークンを検証する。
|
|
155
|
+
|
|
156
|
+
| 引数 | 型 | 説明 |
|
|
157
|
+
| --- | --- | --- |
|
|
158
|
+
| `token` | `string` | reCAPTCHA トークン |
|
|
159
|
+
| `action` | `string` | reCAPTCHA アクション |
|
|
160
|
+
|
|
161
|
+
戻り値の型:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
type RecaptchaVerifyResult = {
|
|
165
|
+
valid: boolean
|
|
166
|
+
action?: string
|
|
167
|
+
reason?: string
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
const result = await vtecxnext.verifyRecaptcha(token, 'submit')
|
|
173
|
+
if (!result.valid) {
|
|
174
|
+
return vtecxnext.response(400, { feed: { title: 'reCAPTCHA verification failed.', subtitle: result.reason } })
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
146
180
|
## 型チェック
|
|
147
181
|
|
|
148
182
|
### `isVtecxNextError(e)`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtecx/vtecxdocument",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "vte.cx BaaS framework and API documentation",
|
|
5
5
|
"main": "",
|
|
6
6
|
"files": [
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
"url": "https://github.com/reflexworks/vtecxdocument/issues"
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/reflexworks/vtecxdocument#readme"
|
|
24
|
-
}
|
|
24
|
+
}
|