getnumber.js 926 B

123456789101112131415161718192021222324252627
  1. import { createHash, randomUUID } from 'crypto'
  2. import axios from 'axios'
  3. const gatewayId = 'account_RcsTest'
  4. const key = 'd0f3acdd-9e4b-4625-880d-a7f9052b4a6d'
  5. async function getNumber() {
  6. const timestamp = new Date().getTime()
  7. const nonce = randomUUID()
  8. console.log(timestamp, nonce)
  9. const sign = createHash('sha256').update(`${gatewayId}_${nonce}_${new Date().getTime()}_${key}`).digest('hex')
  10. console.log(createHash('sha256').update("myname_ojlfdsnatdKDgtfdsaf_1669620328175_mykey",'utf8').digest('hex'))
  11. console.log(sign)
  12. const { data } = await axios.post(
  13. 'http://api.code-sms.net:54722/sms/openApi/phone',
  14. { country: 'USA', appId: 25 },
  15. {
  16. headers: {
  17. gatewayId: gatewayId,
  18. nonce: nonce,
  19. timestamp: timestamp,
  20. signature: sign
  21. }
  22. }
  23. )
  24. console.log(data)
  25. }
  26. getNumber()