@koralabs/kora-labs-common 5.0.1 → 5.0.3
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.
- package/environment/index.d.ts +1 -1
- package/handles/api.d.ts +1 -1
- package/handles/api.js +4 -4
- package/handles/interfaces/index.d.ts +2 -1
- package/handles/policies.d.ts +1 -1
- package/http/index.js +2 -2
- package/package.json +3 -3
- package/utils/crypto/index.js +4 -4
package/environment/index.d.ts
CHANGED
package/handles/api.d.ts
CHANGED
package/handles/api.js
CHANGED
|
@@ -15,7 +15,7 @@ class HandlesApi {
|
|
|
15
15
|
}
|
|
16
16
|
static async getHandle(handle) {
|
|
17
17
|
if (!handle) {
|
|
18
|
-
throw new Error(
|
|
18
|
+
throw new Error('handle is required');
|
|
19
19
|
}
|
|
20
20
|
const handleJson = await this.apiRequest(`/handles/${handle}`);
|
|
21
21
|
// This should be coming from the API. The API needs to start setting this
|
|
@@ -29,9 +29,9 @@ class HandlesApi {
|
|
|
29
29
|
}
|
|
30
30
|
if (!headers) {
|
|
31
31
|
headers = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
'Accepts': 'application/json',
|
|
33
|
+
'User-Agent': constants_1.KORA_USER_AGENT,
|
|
34
|
+
'api-key': constants_1.HANDLES_API_KEY
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
// We should probably use cross-fetch since this might get called on the front-end as well
|
|
@@ -62,7 +62,8 @@ export interface IPersonalizationPortal {
|
|
|
62
62
|
type: string;
|
|
63
63
|
domain?: string | null;
|
|
64
64
|
custom_settings?: string[] | null;
|
|
65
|
-
gallery_settings?:
|
|
65
|
+
gallery_settings?: string | null;
|
|
66
|
+
text_setting?: string | null;
|
|
66
67
|
}
|
|
67
68
|
export declare enum ScriptType {
|
|
68
69
|
PZ_CONTRACT = "pz_contract",
|
package/handles/policies.d.ts
CHANGED
package/http/index.js
CHANGED
|
@@ -4,9 +4,9 @@ exports.Response = exports.Request = void 0;
|
|
|
4
4
|
class Request {
|
|
5
5
|
constructor(req) {
|
|
6
6
|
this.getCookie = (key) => {
|
|
7
|
-
let cookies = this.headers[
|
|
7
|
+
let cookies = this.headers['Cookie'];
|
|
8
8
|
if (!cookies) {
|
|
9
|
-
cookies = this.headers[
|
|
9
|
+
cookies = this.headers['cookie'];
|
|
10
10
|
}
|
|
11
11
|
let cookie = this._searchCookie(cookies, key);
|
|
12
12
|
if (!cookie) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koralabs/kora-labs-common",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Kora Labs Common Utilities",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
-
"lint": "eslint
|
|
21
|
+
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext=.js,.ts --fix --max-warnings=0 .",
|
|
22
22
|
"test": "NETWORK=mainnet node --experimental-vm-modules node_modules/.bin/jest",
|
|
23
23
|
"build": "tsc",
|
|
24
24
|
"build:local": "yarn build && cp package.json ./lib/package.json && cd lib && npm i --production",
|
|
@@ -47,4 +47,4 @@
|
|
|
47
47
|
"crc": "^4.3.2",
|
|
48
48
|
"pluralize-esm": "^9.0.5"
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|
package/utils/crypto/index.js
CHANGED
|
@@ -62,16 +62,16 @@ const sha256 = async (plain) => {
|
|
|
62
62
|
};
|
|
63
63
|
exports.sha256 = sha256;
|
|
64
64
|
function base64urlencode(a) {
|
|
65
|
-
let str =
|
|
65
|
+
let str = '';
|
|
66
66
|
const bytes = new Uint8Array(a);
|
|
67
67
|
const len = bytes.byteLength;
|
|
68
68
|
for (let i = 0; i < len; i++) {
|
|
69
69
|
str += String.fromCharCode(bytes[i]);
|
|
70
70
|
}
|
|
71
71
|
return btoa(str)
|
|
72
|
-
.replace(/\+/g,
|
|
73
|
-
.replace(/\//g,
|
|
74
|
-
.replace(/=+$/,
|
|
72
|
+
.replace(/\+/g, '-')
|
|
73
|
+
.replace(/\//g, '_')
|
|
74
|
+
.replace(/=+$/, '');
|
|
75
75
|
}
|
|
76
76
|
exports.base64urlencode = base64urlencode;
|
|
77
77
|
async function getChallengeFromVerifier(verifier) {
|