|
8 | 8 | - [v3: Get OAuth2 Authorization URL](#v3-get-oauth2-authorization-url) |
9 | 9 | - [v3: Exchange OAuth2 Code and Store Token](#v3-exchange-oauth2-code-and-store-token) |
10 | 10 | - [v3: Revoke and Delete OAuth2 Token](#v3-revoke-and-delete-oauth2-token) |
| 11 | + - [v3: Get PNBA Code](#v3-get-pnba-code) |
| 12 | + - [v3: Exchange PNBA Code and Store Token](#v3-exchange-pnba-code-and-store-token) |
| 13 | + - [v3: Revoke and Delete PNBA Token](#v3-revoke-and-delete-pnba-token) |
11 | 14 | - [Version 2 API](#version-2-api) |
12 | 15 | - [v2: Get OAuth2 Authorization URL](#v2-get-oauth2-authorization-url) |
13 | 16 | - [v2: Exchange OAuth2 Code and Store Token](#v2-exchange-oauth2-code-and-store-token) |
@@ -147,7 +150,6 @@ Generates an OAuth2 authorization URL for initiating the OAuth2 flow. |
147 | 150 | **Example:** |
148 | 151 |
|
149 | 152 | ```bash |
150 | | -# Note: Headers must be correctly prepared with encryption |
151 | 153 | grpcurl -plaintext \ |
152 | 154 | -H 'x-payload-bin: <encrypted_payload_binary>' \ |
153 | 155 | -H 'x-public-key-bin: <client_pk_binary>' \ |
@@ -260,6 +262,136 @@ grpcurl -plaintext \ |
260 | 262 |
|
261 | 263 | --- |
262 | 264 |
|
| 265 | +### v3: Get PNBA Code |
| 266 | + |
| 267 | +Requests a one-time passcode (OTP) for Phone Number-Based Authentication. |
| 268 | + |
| 269 | +**Request:** `GetPNBACodeRequest` |
| 270 | + |
| 271 | +| Field | Type | Required | Description | |
| 272 | +| :--- | :--- | :--- | :--- | |
| 273 | +| platform | string | Yes | Platform identifier | |
| 274 | +| phone_number | string | Yes | Phone number to receive OTP | |
| 275 | +| request_identifier | string | Optional | Request identifier for tracking | |
| 276 | + |
| 277 | +**Response:** `GetPNBACodeResponse` |
| 278 | + |
| 279 | +| Field | Type | Description | |
| 280 | +| :--- | :--- | :--- | |
| 281 | +| success | bool | Operation success | |
| 282 | +| message | string | Response message | |
| 283 | + |
| 284 | +**Example:** |
| 285 | + |
| 286 | +```bash |
| 287 | +grpcurl -plaintext \ |
| 288 | + -H 'x-payload-bin: <encrypted_payload_binary>' \ |
| 289 | + -H 'x-public-key-bin: <client_pk_binary>' \ |
| 290 | + -H 'x-key-id: <key_id>' \ |
| 291 | + -H 'x-nonce-bin: <nonce_binary>' \ |
| 292 | + -H 'x-timestamp: <timestamp>' \ |
| 293 | + -d '{ |
| 294 | + "platform": "telegram", |
| 295 | + "phone_number": "+1234567890" |
| 296 | + }' \ |
| 297 | + -proto protos/v3/publisher.proto \ |
| 298 | + <your_host>:<your_port> publisher.v3.Publisher/GetPNBACode |
| 299 | +``` |
| 300 | + |
| 301 | +--- |
| 302 | + |
| 303 | +### v3: Exchange PNBA Code and Store Token |
| 304 | + |
| 305 | +Exchanges a one-time passcode (OTP) for a token, stores it, and returns encrypted token data. |
| 306 | + |
| 307 | +**Request:** `ExchangePNBACodeAndStoreRequest` |
| 308 | + |
| 309 | +| Field | Type | Required | Description | |
| 310 | +| :--- | :--- | :--- | :--- | |
| 311 | +| platform | string | Yes | Platform identifier | |
| 312 | +| phone_number | string | Yes | Phone number that received OTP | |
| 313 | +| authorization_code | string | Yes | PNBA authorization code | |
| 314 | +| password | string | Optional | Password for two-step verification | |
| 315 | +| request_identifier | string | Optional | Request identifier for tracking | |
| 316 | +| client_ephemeral_public_keys | list[PublicKey] | Yes | Exactly 256 ephemeral public keys generated by the client | |
| 317 | + |
| 318 | +**Response:** `ExchangePNBACodeAndStoreResponse` |
| 319 | + |
| 320 | +| Field | Type | Description | |
| 321 | +| :--- | :--- | :--- | |
| 322 | +| success | bool | Operation success | |
| 323 | +| message | string | Response message | |
| 324 | +| two_step_verification_enabled | bool | Two-step verification status | |
| 325 | +| account_identifier | string | Account identifier | |
| 326 | +| token_ciphertext | bytes | Encrypted token ciphertext | |
| 327 | +| token_id | bytes | Unique identifier for the stored token | |
| 328 | +| server_ephemeral_public_keys | list[PublicKey] | Exactly 256 ephemeral public keys generated by the server | |
| 329 | +| key_id | uint32 | Key ID used for encrypting token | |
| 330 | + |
| 331 | +**Example:** |
| 332 | + |
| 333 | +```bash |
| 334 | +grpcurl -plaintext \ |
| 335 | + -H 'x-payload-bin: <encrypted_payload_binary>' \ |
| 336 | + -H 'x-public-key-bin: <client_pk_binary>' \ |
| 337 | + -H 'x-key-id: <key_id>' \ |
| 338 | + -H 'x-nonce-bin: <nonce_binary>' \ |
| 339 | + -H 'x-timestamp: <timestamp>' \ |
| 340 | + -d @ \ |
| 341 | + -proto protos/v3/publisher.proto \ |
| 342 | + <your_host>:<your_port> publisher.v3.Publisher/ExchangePNBACodeAndStore <<EOF |
| 343 | +{ |
| 344 | + "platform": "telegram", |
| 345 | + "phone_number": "+1234567890", |
| 346 | + "authorization_code": "auth_code", |
| 347 | + "client_ephemeral_public_keys": [ |
| 348 | + {"key_id": 0, "public_key": "..."}, |
| 349 | + ... 254 more keys ... |
| 350 | + {"key_id": 255, "public_key": "..."} |
| 351 | + ] |
| 352 | +} |
| 353 | +EOF |
| 354 | +``` |
| 355 | + |
| 356 | +--- |
| 357 | + |
| 358 | +### v3: Revoke and Delete PNBA Token |
| 359 | + |
| 360 | +Revokes and deletes a stored PNBA token. |
| 361 | + |
| 362 | +**Request:** `RevokePNBATokenRequest` |
| 363 | + |
| 364 | +| Field | Type | Required | Description | |
| 365 | +| :--- | :--- | :--- | :--- | |
| 366 | +| token_id | bytes | Yes | Unique identifier for the stored token | |
| 367 | +| key_id | uint32 | Yes | Key index used for encrypting the token | |
| 368 | + |
| 369 | +**Response:** `RevokePNBATokenResponse` |
| 370 | + |
| 371 | +| Field | Type | Description | |
| 372 | +| :--- | :--- | :--- | |
| 373 | +| success | bool | Operation success | |
| 374 | +| message | string | Response message | |
| 375 | + |
| 376 | +**Example:** |
| 377 | + |
| 378 | +```bash |
| 379 | +grpcurl -plaintext \ |
| 380 | + -H 'x-payload-bin: <encrypted_payload_binary>' \ |
| 381 | + -H 'x-public-key-bin: <client_pk_binary>' \ |
| 382 | + -H 'x-key-id: <key_id>' \ |
| 383 | + -H 'x-nonce-bin: <nonce_binary>' \ |
| 384 | + -H 'x-timestamp: <timestamp>' \ |
| 385 | + -d '{ |
| 386 | + "token_id": "<token_id_binary>", |
| 387 | + "key_id": 123 |
| 388 | + }' \ |
| 389 | + -proto protos/v3/publisher.proto \ |
| 390 | + <your_host>:<your_port> publisher.v3.Publisher/RevokePNBAToken |
| 391 | +``` |
| 392 | + |
| 393 | +--- |
| 394 | + |
263 | 395 | ## Version 2 API |
264 | 396 |
|
265 | 397 | **Package:** `publisher.v2` |
|
0 commit comments