Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 7a64814

Browse files
authored
Use nanoid instead of cuid for oauth code (#302)
1 parent 764992d commit 7a64814

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

oauth2.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var _ = require('lodash');
44
var async = require('async');
5-
var cuid = require('cuid');
5+
var secureId = require('nanoid');
66

77
module.exports = function (options) {
88
var seneca = this;
@@ -35,11 +35,11 @@ module.exports = function (options) {
3535
if (err) return cb(err);
3636
if (auths.length > 0) return cb(null, auths[0].code);
3737

38-
var code = cuid();
38+
var code = secureId();
3939
var ucEnt = seneca.make$(OAUTH2_ENTITY);
4040
ucEnt.userid = user.id;
4141
ucEnt.code = code;
42-
ucEnt.token = cuid();
42+
ucEnt.token = secureId();
4343
ucEnt.created = new Date();
4444
ucEnt.save$(function (err) {
4545
if (err) return cb(err);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
"camelcase": "^4.1.0",
3232
"cp-i18n-lib": "git+https://github.com/CoderDojo/cp-i18n-lib.git",
3333
"cp-logs-lib": "git://github.com/CoderDojo/cp-logs-lib#1.1.0",
34-
"cp-permissions-plugin": "git://github.com/CoderDojo/cp-permissions-plugin#1.0.4",
34+
"cp-permissions-plugin": "git://github.com/CoderDojo/cp-permissions-plugin#1.0.5",
3535
"cp-translations": "^1.0.109",
36-
"cuid": "1.2.5",
3736
"decamelize": "^1.2.0",
3837
"ejs": "1.0.0",
3938
"jed": "1.1.0",
4039
"js-yaml": "3.2.7",
4140
"le_node": "1.1.0",
4241
"lodash": "4.17.10",
4342
"moment": "2.10.3",
43+
"nanoid": "^1.3.3",
4444
"newrelic": "^2.6.0",
4545
"node-uuid": "1.4.3",
4646
"optimist": "0.6.1",

yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,9 @@ [email protected], core-util-is@~1.0.0:
903903
le_node "1.4"
904904
lodash "4.13.1"
905905

906-
"cp-permissions-plugin@git://github.com/CoderDojo/cp-permissions-plugin#1.0.4":
907-
version "1.0.4"
908-
resolved "git://github.com/CoderDojo/cp-permissions-plugin#9490f27a8fa89da484a78fe3ac0ec80b127e1314"
906+
"cp-permissions-plugin@git://github.com/CoderDojo/cp-permissions-plugin#1.0.5":
907+
version "1.0.5"
908+
resolved "git://github.com/CoderDojo/cp-permissions-plugin#4d401a9a13fa90971b99430ee2894953fdf1a7a0"
909909
dependencies:
910910
async "^2.0.0-rc.5"
911911
lodash "^4.13.1"
@@ -969,10 +969,6 @@ [email protected]:
969969
version "0.5.3"
970970
resolved "https://registry.yarnpkg.com/ctype/-/ctype-0.5.3.tgz#82c18c2461f74114ef16c135224ad0b9144ca12f"
971971

972-
973-
version "1.2.5"
974-
resolved "https://registry.yarnpkg.com/cuid/-/cuid-1.2.5.tgz#4b36176987f9063ce05ee0934e89ccee4b9de8a6"
975-
976972
d@1:
977973
version "1.0.0"
978974
resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f"
@@ -3412,6 +3408,10 @@ nan@^2.0.8, nan@^2.3.0, nan@^2.4.0:
34123408
version "2.8.0"
34133409
resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a"
34143410

3411+
nanoid@^1.3.3:
3412+
version "1.3.3"
3413+
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-1.3.3.tgz#23d4130cb3dcb455c742cbf281163d52f0cd51b0"
3414+
34153415
native-promise-only@^0.8.1:
34163416
version "0.8.1"
34173417
resolved "https://registry.yarnpkg.com/native-promise-only/-/native-promise-only-0.8.1.tgz#20a318c30cb45f71fe7adfbf7b21c99c1472ef11"

0 commit comments

Comments
 (0)