| 123456789101112131415161718192021222324252627 |
- import { createHash, randomUUID } from 'crypto'
- import axios from 'axios'
- const gatewayId = 'account_RcsTest'
- const key = 'd0f3acdd-9e4b-4625-880d-a7f9052b4a6d'
- async function getNumber() {
- const timestamp = new Date().getTime()
- const nonce = randomUUID()
- console.log(timestamp, nonce)
- const sign = createHash('sha256').update(`${gatewayId}_${nonce}_${new Date().getTime()}_${key}`).digest('hex')
- console.log(createHash('sha256').update("myname_ojlfdsnatdKDgtfdsaf_1669620328175_mykey",'utf8').digest('hex'))
- console.log(sign)
- const { data } = await axios.post(
- 'http://api.code-sms.net:54722/sms/openApi/phone',
- { country: 'USA', appId: 25 },
- {
- headers: {
- gatewayId: gatewayId,
- nonce: nonce,
- timestamp: timestamp,
- signature: sign
- }
- }
- )
- console.log(data)
- }
- getNumber()
|