@le-space/core 0.12.12 → 0.12.13
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/index.d.ts +21 -10
- package/index.js +20 -10
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -834,16 +834,27 @@ declare function verifyUcGoPeerReachability(args: {
|
|
|
834
834
|
checks: Record<string, Record<string, unknown>>;
|
|
835
835
|
}>;
|
|
836
836
|
|
|
837
|
+
/**
|
|
838
|
+
* An optional field of a signed payload, as it was recorded.
|
|
839
|
+
*
|
|
840
|
+
* `null` and "left out" mean the same thing to a reader, but they are two
|
|
841
|
+
* different signed texts: `{"version":null}` is not `{}`. The guest refresh
|
|
842
|
+
* scripts sign with Python's `json.dumps`, which writes an unset field as
|
|
843
|
+
* `null`; the helpers in this file sign with `JSON.stringify`, which leaves an
|
|
844
|
+
* `undefined` one out. A reader has to hand back whichever it was given, or
|
|
845
|
+
* the signature recovers somebody else's address.
|
|
846
|
+
*/
|
|
847
|
+
type SignedOptional<T> = T | null | undefined;
|
|
837
848
|
interface RelayBootstrapAuthorizationPayload {
|
|
838
849
|
ownerAddress: string;
|
|
839
850
|
publisherAddress: string;
|
|
840
851
|
peerId: string;
|
|
841
|
-
registrationId?: string
|
|
842
|
-
profile?: string
|
|
843
|
-
version?: string
|
|
844
|
-
instanceItemHash?: string
|
|
852
|
+
registrationId?: SignedOptional<string>;
|
|
853
|
+
profile?: SignedOptional<string>;
|
|
854
|
+
version?: SignedOptional<string>;
|
|
855
|
+
instanceItemHash?: SignedOptional<string>;
|
|
845
856
|
issuedAt: number;
|
|
846
|
-
expiresAt?: number
|
|
857
|
+
expiresAt?: SignedOptional<number>;
|
|
847
858
|
}
|
|
848
859
|
interface RelayBootstrapAuthorizationRecord {
|
|
849
860
|
scheme: string;
|
|
@@ -854,11 +865,11 @@ interface RelayBootstrapProofPayload {
|
|
|
854
865
|
peerId: string;
|
|
855
866
|
multiaddrs?: string[];
|
|
856
867
|
browserMultiaddrs?: string[];
|
|
857
|
-
multiaddrsHash?: string
|
|
858
|
-
browserMultiaddrsHash?: string
|
|
859
|
-
registrationId?: string
|
|
860
|
-
profile?: string
|
|
861
|
-
version?: string
|
|
868
|
+
multiaddrsHash?: SignedOptional<string>;
|
|
869
|
+
browserMultiaddrsHash?: SignedOptional<string>;
|
|
870
|
+
registrationId?: SignedOptional<string>;
|
|
871
|
+
profile?: SignedOptional<string>;
|
|
872
|
+
version?: SignedOptional<string>;
|
|
862
873
|
updatedAt: number;
|
|
863
874
|
}
|
|
864
875
|
interface RelayBootstrapProofRecord {
|
package/index.js
CHANGED
|
@@ -2797,6 +2797,14 @@ function asNumber3(value) {
|
|
|
2797
2797
|
}
|
|
2798
2798
|
return null;
|
|
2799
2799
|
}
|
|
2800
|
+
function asSignedOptionalString(value) {
|
|
2801
|
+
if (value === null) return null;
|
|
2802
|
+
return asTrimmedString(value) ?? void 0;
|
|
2803
|
+
}
|
|
2804
|
+
function asSignedOptionalNumber(value) {
|
|
2805
|
+
if (value === null) return null;
|
|
2806
|
+
return asNumber3(value) ?? void 0;
|
|
2807
|
+
}
|
|
2800
2808
|
function normalizeHost(host) {
|
|
2801
2809
|
return host.trim().toLowerCase();
|
|
2802
2810
|
}
|
|
@@ -2926,7 +2934,7 @@ function normalizeRelayBootstrapAuthorizationPayload(value) {
|
|
|
2926
2934
|
const publisherAddress = asTrimmedString(payload.publisherAddress);
|
|
2927
2935
|
const peerId = asTrimmedString(payload.peerId);
|
|
2928
2936
|
const issuedAt = asNumber3(payload.issuedAt);
|
|
2929
|
-
const expiresAt =
|
|
2937
|
+
const expiresAt = asSignedOptionalNumber(payload.expiresAt);
|
|
2930
2938
|
if (!ownerAddress || !publisherAddress || !peerId || issuedAt == null) {
|
|
2931
2939
|
return null;
|
|
2932
2940
|
}
|
|
@@ -2934,10 +2942,10 @@ function normalizeRelayBootstrapAuthorizationPayload(value) {
|
|
|
2934
2942
|
ownerAddress,
|
|
2935
2943
|
publisherAddress,
|
|
2936
2944
|
peerId,
|
|
2937
|
-
registrationId:
|
|
2938
|
-
profile:
|
|
2939
|
-
version:
|
|
2940
|
-
instanceItemHash:
|
|
2945
|
+
registrationId: asSignedOptionalString(payload.registrationId),
|
|
2946
|
+
profile: asSignedOptionalString(payload.profile),
|
|
2947
|
+
version: asSignedOptionalString(payload.version),
|
|
2948
|
+
instanceItemHash: asSignedOptionalString(payload.instanceItemHash),
|
|
2941
2949
|
issuedAt,
|
|
2942
2950
|
expiresAt
|
|
2943
2951
|
};
|
|
@@ -2967,11 +2975,13 @@ function normalizeRelayBootstrapProofPayload(value) {
|
|
|
2967
2975
|
peerId,
|
|
2968
2976
|
multiaddrs: multiaddrs.length > 0 ? dedupeMultiaddrs(multiaddrs) : void 0,
|
|
2969
2977
|
browserMultiaddrs: browserMultiaddrs ? dedupeMultiaddrs(browserMultiaddrs) : void 0,
|
|
2970
|
-
multiaddrsHash:
|
|
2971
|
-
browserMultiaddrsHash:
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2978
|
+
multiaddrsHash: asSignedOptionalString(payload.multiaddrsHash),
|
|
2979
|
+
browserMultiaddrsHash: asSignedOptionalString(
|
|
2980
|
+
payload.browserMultiaddrsHash
|
|
2981
|
+
),
|
|
2982
|
+
registrationId: asSignedOptionalString(payload.registrationId),
|
|
2983
|
+
profile: asSignedOptionalString(payload.profile),
|
|
2984
|
+
version: asSignedOptionalString(payload.version),
|
|
2975
2985
|
updatedAt
|
|
2976
2986
|
};
|
|
2977
2987
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.13",
|
|
4
4
|
"description": "Reusable Aleph deployment, runtime, and guest lifecycle logic.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/NiKrause/relay-button/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@le-space/aleph-bootstrap": "0.12.
|
|
28
|
-
"@le-space/shared-types": "0.12.
|
|
27
|
+
"@le-space/aleph-bootstrap": "0.12.13",
|
|
28
|
+
"@le-space/shared-types": "0.12.13"
|
|
29
29
|
}
|
|
30
30
|
}
|