@sapphire/plugin-api 5.1.2-next.f9ed91b.0 → 5.1.2-next.fb3df70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
2
13
|
var _Auth_secret;
|
|
3
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
15
|
exports.Auth = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
16
|
const utilities_1 = require("@sapphire/utilities");
|
|
7
17
|
const crypto_1 = require("crypto");
|
|
8
18
|
const discord_js_1 = require("discord.js");
|
|
@@ -70,7 +80,7 @@ class Auth {
|
|
|
70
80
|
this.cookie = options.cookie ?? 'SAPPHIRE_AUTH';
|
|
71
81
|
this.scopes = options.scopes ?? [discord_js_1.OAuth2Scopes.Identify];
|
|
72
82
|
this.redirect = options.redirect;
|
|
73
|
-
|
|
83
|
+
__classPrivateFieldSet(this, _Auth_secret, options.secret, "f");
|
|
74
84
|
this.transformers = options.transformers ?? [];
|
|
75
85
|
this.domainOverwrite = options.domainOverwrite ?? null;
|
|
76
86
|
}
|
|
@@ -79,7 +89,7 @@ class Auth {
|
|
|
79
89
|
* @since 1.0.0
|
|
80
90
|
*/
|
|
81
91
|
get secret() {
|
|
82
|
-
return
|
|
92
|
+
return __classPrivateFieldGet(this, _Auth_secret, "f");
|
|
83
93
|
}
|
|
84
94
|
/**
|
|
85
95
|
* Encrypts an object with aes-256-cbc to use as a token.
|
|
@@ -89,7 +99,7 @@ class Auth {
|
|
|
89
99
|
*/
|
|
90
100
|
encrypt(data) {
|
|
91
101
|
const iv = (0, crypto_1.randomBytes)(16);
|
|
92
|
-
const cipher = (0, crypto_1.createCipheriv)('aes-256-cbc',
|
|
102
|
+
const cipher = (0, crypto_1.createCipheriv)('aes-256-cbc', __classPrivateFieldGet(this, _Auth_secret, "f"), iv);
|
|
93
103
|
return `${cipher.update(JSON.stringify(data), 'utf8', 'base64') + cipher.final('base64')}.${iv.toString('base64')}`;
|
|
94
104
|
}
|
|
95
105
|
/**
|
|
@@ -100,7 +110,7 @@ class Auth {
|
|
|
100
110
|
*/
|
|
101
111
|
decrypt(token) {
|
|
102
112
|
const [data, iv] = token.split('.');
|
|
103
|
-
const decipher = (0, crypto_1.createDecipheriv)('aes-256-cbc',
|
|
113
|
+
const decipher = (0, crypto_1.createDecipheriv)('aes-256-cbc', __classPrivateFieldGet(this, _Auth_secret, "f"), Buffer.from(iv, 'base64'));
|
|
104
114
|
try {
|
|
105
115
|
const parsed = JSON.parse(decipher.update(data, 'base64', 'utf8') + decipher.final('utf8'));
|
|
106
116
|
// If the token expired, return null:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Auth.js","sourceRoot":"","sources":["../../../../src/lib/structures/http/Auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Auth.js","sourceRoot":"","sources":["../../../../src/lib/structures/http/Auth.ts"],"names":[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
"description": "Plugin for @sapphire/framework to expose a REST API",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@types/ws": "^8.5.5",
|
|
40
40
|
"tldts": "^6.0.14",
|
|
41
41
|
"tslib": "^2.6.2",
|
|
42
|
-
"undici": "^5.
|
|
42
|
+
"undici": "^5.24.0"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"!dist/.tsbuildinfo"
|
|
52
52
|
],
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
55
|
-
"npm": ">=7
|
|
54
|
+
"node": ">=v18",
|
|
55
|
+
"npm": ">=7"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"sapphiredev",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@favware/cliff-jumper": "^2.1.
|
|
74
|
+
"@favware/cliff-jumper": "^2.1.2",
|
|
75
75
|
"gen-esm-wrapper": "^1.1.3",
|
|
76
|
-
"typedoc": "^0.
|
|
76
|
+
"typedoc": "^0.25.1",
|
|
77
77
|
"typedoc-json-parser": "^8.2.0",
|
|
78
|
-
"typescript": "^5.
|
|
78
|
+
"typescript": "^5.2.2"
|
|
79
79
|
}
|
|
80
80
|
}
|