@session.js/blinded-session-id 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -27,13 +27,13 @@ await blindSessionId({
27
27
  - generateKAs — returns legacy and modern KAs as Uint8Array
28
28
  - convertToX25519Key, convertToEd25519Key — self explanatory
29
29
 
30
- ## Credit
30
+ ## Acknowledgements
31
31
 
32
32
  Credit to li0ard, this code was mostly taken from [https://github.com/theinfinityway/session_id/](https://github.com/theinfinityway/session_id/)
33
33
 
34
- ## Made for session.js
34
+ ## Made for Session.js
35
35
 
36
- Use Session messenger programmatically with [Session.js](https://github.com/sessionjs/client): Session bots, custom Session clients, and more.
36
+ Use Session messenger programmatically with [Session.js](https://git.hloth.dev/session.js/client): Session bots, custom Session clients, and more.
37
37
 
38
38
  ## Donate
39
39
 
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export declare const convertToX25519Key: (key: string) => string;
4
4
  export declare function crypto_core_ed25519_scalar_reduce(scalar: Uint8Array): Uint8Array;
5
5
  export declare const generateKA: (sessionId: string, serverPk: string) => Uint8Array;
6
6
  export declare const generateBlindedKeys: (sessionId: string, serverPk: string) => Uint8Array[];
7
- export declare const blindSessionId: ({ sessionId, serverPk }: {
7
+ export declare const blindSessionId: ({ sessionId, serverPk, }: {
8
8
  sessionId: string;
9
9
  serverPk: string;
10
10
  }) => string;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Huge thanks to li0ard for this code
2
- // CREDIT: https://github.com/theinfinityway/session_id/
2
+ // CREDIT: https://github.com/theinfinityway/session_id/ [MIT]
3
3
  /* eslint-disable prefer-const */
4
4
  import { ed25519 } from "@noble/curves/ed25519.js";
5
5
  import { bytesToHex, hexToBytes } from "@noble/curves/utils.js";
@@ -573,17 +573,17 @@ export const generateKA = (sessionId, serverPk) => {
573
573
  export const generateBlindedKeys = (sessionId, serverPk) => {
574
574
  const kA = generateKA(sessionId, serverPk);
575
575
  const key1 = kA;
576
- const modifiedByte = kA[31] & 0x7F;
576
+ const modifiedByte = kA[31] & 0x7f;
577
577
  const key2 = new Uint8Array(32);
578
578
  key2.set(kA.slice(0, 31), 0);
579
579
  key2[31] = modifiedByte;
580
580
  return [key1, key2];
581
581
  };
582
- export const blindSessionId = ({ sessionId, serverPk }) => {
582
+ export const blindSessionId = ({ sessionId, serverPk, }) => {
583
583
  const [key1, key2] = generateBlindedKeys(sessionId, serverPk);
584
584
  const isKey2 = key1[31] & 0x80;
585
585
  if (isKey2) {
586
- return '15' + bytesToHex(key2);
586
+ return "15" + bytesToHex(key2);
587
587
  }
588
- return '15' + bytesToHex(key1);
588
+ return "15" + bytesToHex(key1);
589
589
  };
package/package.json CHANGED
@@ -1,37 +1,43 @@
1
1
  {
2
- "name": "@session.js/blinded-session-id",
3
- "type": "module",
4
- "description": "Utility JavaScript library with methods to work with Session's blinded Session ID",
5
- "version": "1.0.3",
6
- "author": "Viktor Shchelochkov <hi@hloth.dev> (https://hloth.dev)",
7
- "main": "dist/index.js",
8
- "types": "dist/index.d.ts",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://git.hloth.dev/session.js/blinded-session-id.git"
12
- },
13
- "bugs": {
14
- "url": "https://git.hloth.dev/session.js/blinded-session-id/issues"
15
- },
16
- "homepage": "https://git.hloth.dev/session.js/blinded-session-id#readme",
17
- "license": "MIT",
18
- "funding": "https://hloth.dev/donate",
19
- "scripts": {
20
- "build": "rm -rf dist && tsc --project tsconfig.build.json"
21
- },
22
- "files": [
23
- "dist/index.js",
24
- "dist/index.d.ts"
25
- ],
26
- "dependencies": {
27
- "@noble/curves": "^2.0.1",
28
- "@noble/hashes": "^2.0.1"
29
- },
30
- "peerDependencies": {
31
- "typescript": "^5.0.0"
32
- },
33
- "devDependencies": {
34
- "@types/bun": "^1.1.6",
35
- "@types/lodash": "^4.17.7"
36
- }
2
+ "name": "@session.js/blinded-session-id",
3
+ "version": "1.0.4",
4
+ "description": "Utility JavaScript library with methods to work with Session's blinded Session ID",
5
+ "homepage": "https://git.hloth.dev/session.js/blinded-session-id#readme",
6
+ "bugs": {
7
+ "url": "https://git.hloth.dev/session.js/blinded-session-id/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://git.hloth.dev/session.js/blinded-session-id.git"
12
+ },
13
+ "funding": "https://hloth.dev/donate",
14
+ "license": "MIT",
15
+ "author": "Viktor Shchelochkov <hi@hloth.dev> (https://hloth.dev)",
16
+ "type": "module",
17
+ "main": "dist/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "files": [
20
+ "dist/index.js",
21
+ "dist/index.d.ts",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "scripts": {
26
+ "build": "rm -rf dist && tsc --project tsconfig.build.json"
27
+ },
28
+ "dependencies": {
29
+ "@noble/curves": "^2.0.1",
30
+ "@noble/hashes": "^2.0.1"
31
+ },
32
+ "devDependencies": {
33
+ "@eslint/compat": "^2.0.1",
34
+ "@eslint/js": "^9.39.2",
35
+ "@types/bun": "latest",
36
+ "eslint-config-prettier": "^10.1.8",
37
+ "prettier": "^3.8.0",
38
+ "typescript-eslint": "^8.53.1"
39
+ },
40
+ "peerDependencies": {
41
+ "typescript": "^5.0.0"
42
+ }
37
43
  }