{"id":15065321,"url":"https://github.com/liyipeng3/sms-code","last_synced_at":"2025-07-12T08:31:43.433Z","repository":{"id":57364326,"uuid":"291115476","full_name":"liyipeng3/sms-code","owner":"liyipeng3","description":"用于生成短信随机验证码以及验证验证码的npm库","archived":false,"fork":false,"pushed_at":"2020-11-06T13:20:16.000Z","size":56,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T14:34:41.382Z","etag":null,"topics":["nodejs","npmjs","sms-code"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sms-code","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liyipeng3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-28T18:11:27.000Z","updated_at":"2021-04-22T09:19:02.000Z","dependencies_parsed_at":"2022-09-13T21:00:54.926Z","dependency_job_id":null,"html_url":"https://github.com/liyipeng3/sms-code","commit_stats":null,"previous_names":["liyipeng3/sms-code","liyipeng123/sms-code"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/liyipeng3/sms-code","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liyipeng3%2Fsms-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liyipeng3%2Fsms-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liyipeng3%2Fsms-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liyipeng3%2Fsms-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liyipeng3","download_url":"https://codeload.github.com/liyipeng3/sms-code/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liyipeng3%2Fsms-code/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263593478,"owners_count":23485853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","npmjs","sms-code"],"created_at":"2024-09-25T00:36:45.657Z","updated_at":"2025-07-12T08:31:43.178Z","avatar_url":"https://github.com/liyipeng3.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sms-code\n\n[![NPM](https://nodei.co/npm/sms-code.png?downloads=true\u0026downloadRank=true\u0026stars=false)](https://nodei.co/npm/sms-code/)\n\n## Installation\nUsing npm:\n```shell\n$ npm i sms-code\n```\nNote: add `--save` if you are using npm \u003c 5.0.0\n\n## Usage\n0.快速开始\n```javascript\n    // nodejs 运行环境\n    const smsCode = require('sms-code')\n    // es6\n    import smsCode from 'sms-code'\n\n    const code = smsCode.getCode('188888888888')     // 随机数 如：3333\n    smsCode.verifyCode('18888888888', code)   // 验证结果 true/false\n```\n\n\n1.用于生成随机验证码以及验证验证码\n\n```javascript\n    smsCode.getCode('188888888888')     // 随机数 如：3333\n    smsCode.verifyCode('18888888888', '3333')   // 验证结果 true/false\n```\n\n2.每个手机号对应的验证码只能被验证一次且可自定义有效期\n\n3.可以设置验证码过期时间以及验证码长度\n\n```javascript\n    smsCode.setOptions({\n        age: 5, // 默认有效时间为五分钟\n        length: 4   // 默认长度为四位\n    })\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliyipeng3%2Fsms-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliyipeng3%2Fsms-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliyipeng3%2Fsms-code/lists"}