@sockethub/util 1.0.0-alpha.1 → 1.0.0-alpha.10
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/dist/crypto/index.d.ts +19 -1
- package/dist/crypto/index.js +2832 -3017
- package/dist/crypto/index.js.map +4 -4
- package/dist/error/index.js +11 -9
- package/dist/error/index.js.map +2 -2
- package/dist/index.js +32 -19
- package/dist/index.js.map +3 -3
- package/dist/net/dispatcher.d.ts +12 -2
- package/dist/net/index.js +30 -17
- package/dist/net/index.js.map +3 -3
- package/package.json +3 -3
package/dist/crypto/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
|
-
export declare function getPlatformId(platform: string, actor?: string, _crypto?: Crypto): string;
|
|
2
|
+
export declare function getPlatformId(platform: string, actor?: string, scope?: string, _crypto?: Crypto): string;
|
|
3
3
|
export declare class Crypto {
|
|
4
4
|
randomBytes: typeof randomBytes;
|
|
5
5
|
constructor();
|
|
@@ -15,6 +15,16 @@ export declare class Crypto {
|
|
|
15
15
|
* different (platform, actor) pairs to the same instance.
|
|
16
16
|
*/
|
|
17
17
|
hashFull(text: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Stable hash of a credential object, used as the verifier that decides
|
|
20
|
+
* whether a session may reuse an existing platform connection.
|
|
21
|
+
*
|
|
22
|
+
* `object-hash` defaults to SHA-1; pinned to SHA-256 instead, since this
|
|
23
|
+
* backs an authorization decision. Not an exploit fix — the value is never
|
|
24
|
+
* exposed to clients, and forging a match needs a second preimage of an
|
|
25
|
+
* unknown credential object, which SHA-1 does not give you — but a new
|
|
26
|
+
* security-sensitive verifier should not be built on a deprecated digest.
|
|
27
|
+
*/
|
|
18
28
|
objectHash(object: object): string;
|
|
19
29
|
/**
|
|
20
30
|
* Derive a high-entropy secret from multiple input secrets.
|
|
@@ -23,6 +33,14 @@ export declare class Crypto {
|
|
|
23
33
|
*/
|
|
24
34
|
deriveSecret(...secrets: string[]): string;
|
|
25
35
|
randToken(len: number): string;
|
|
36
|
+
/**
|
|
37
|
+
* Random alphanumeric identifier. Use this instead of randToken() for
|
|
38
|
+
* values that end up in Redis key names, logger namespaces, HTTP headers,
|
|
39
|
+
* or shell commands: randToken()'s charset includes `*?[]^@$#!`, which are
|
|
40
|
+
* Redis glob metacharacters and shell specials. randToken() remains the
|
|
41
|
+
* generator for secrets, where the wider charset adds entropy.
|
|
42
|
+
*/
|
|
43
|
+
randId(len: number): string;
|
|
26
44
|
private static ensureSecret;
|
|
27
45
|
}
|
|
28
46
|
export declare const crypto: Crypto;
|