| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import axios from "axios"
- import { createHash } from "crypto"
- const account = "account_Rcsgogogo"
- const key = "76a44e4d-b960-412d-8624-b66881ad61d6"
- function sign(account, key, nonce, timestamp) {
- const hash = createHash("sha256")
- hash.update(`${account}_${nonce}_${timestamp}_${key}`)
- return hash.digest("hex")
- }
- function getHeader() {
- const nonce = '123456'
- const timestamp = Date.now()
- const signStr = sign(account, key, nonce, timestamp)
- console.log({
- gatewayId: account,
- nonce,
- timestamp,
- signature: signStr
- })
- return {
- gatewayId: account,
- nonce,
- timestamp,
- sign: signStr
- }
- }
- async function getPhone() {
- const { data } = await axios.post(
- "http://api.code-sms.net:54722/sms/openApi/phone",
- {
- country: "USA",
- appId: 25
- },
- {
- headers: {
- ...getHeader()
- }
- }
- )
- console.log(data)
- }
- getPhone()
|