@helia/ipns 10.0.0 → 10.0.1-883ff053
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 +3 -7
- package/dist/index.min.js +16 -5
- package/dist/index.min.js.map +4 -4
- package/dist/src/errors.d.ts +0 -8
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +0 -8
- package/dist/src/errors.js.map +1 -1
- package/dist/src/index.d.ts +68 -31
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -11
- package/dist/src/index.js.map +1 -1
- package/dist/src/ipns/publisher.d.ts +2 -2
- package/dist/src/ipns/publisher.d.ts.map +1 -1
- package/dist/src/ipns/publisher.js +27 -14
- package/dist/src/ipns/publisher.js.map +1 -1
- package/dist/src/ipns/republisher.d.ts.map +1 -1
- package/dist/src/ipns/republisher.js +22 -9
- package/dist/src/ipns/republisher.js.map +1 -1
- package/dist/src/ipns/resolver.d.ts +2 -2
- package/dist/src/ipns/resolver.d.ts.map +1 -1
- package/dist/src/ipns/resolver.js +39 -17
- package/dist/src/ipns/resolver.js.map +1 -1
- package/dist/src/ipns.d.ts +3 -3
- package/dist/src/ipns.d.ts.map +1 -1
- package/dist/src/ipns.js +8 -8
- package/dist/src/ipns.js.map +1 -1
- package/dist/src/local-store.d.ts +4 -4
- package/dist/src/local-store.d.ts.map +1 -1
- package/dist/src/local-store.js +2 -1
- package/dist/src/local-store.js.map +1 -1
- package/dist/src/pb/ipns.d.ts +29 -29
- package/dist/src/pb/ipns.d.ts.map +1 -1
- package/dist/src/pb/ipns.js +15 -15
- package/dist/src/records.d.ts +27 -142
- package/dist/src/records.d.ts.map +1 -1
- package/dist/src/records.js +39 -46
- package/dist/src/records.js.map +1 -1
- package/dist/src/routing/helia.d.ts +5 -5
- package/dist/src/routing/helia.d.ts.map +1 -1
- package/dist/src/routing/helia.js +3 -3
- package/dist/src/routing/helia.js.map +1 -1
- package/dist/src/routing/index.d.ts +7 -7
- package/dist/src/routing/index.d.ts.map +1 -1
- package/dist/src/routing/index.js +2 -2
- package/dist/src/routing/index.js.map +1 -1
- package/dist/src/routing/local-store.d.ts +1 -1
- package/dist/src/routing/local-store.d.ts.map +1 -1
- package/dist/src/routing/local-store.js +3 -3
- package/dist/src/routing/local-store.js.map +1 -1
- package/dist/src/routing/pubsub.d.ts +11 -11
- package/dist/src/routing/pubsub.d.ts.map +1 -1
- package/dist/src/routing/pubsub.js +11 -12
- package/dist/src/routing/pubsub.js.map +1 -1
- package/dist/src/selector.d.ts +2 -2
- package/dist/src/selector.d.ts.map +1 -1
- package/dist/src/selector.js +13 -9
- package/dist/src/selector.js.map +1 -1
- package/dist/src/utils.d.ts +10 -11
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +20 -128
- package/dist/src/utils.js.map +1 -1
- package/dist/src/validator.d.ts +9 -3
- package/dist/src/validator.d.ts.map +1 -1
- package/dist/src/validator.js +57 -14
- package/dist/src/validator.js.map +1 -1
- package/package.json +6 -31
- package/src/errors.ts +0 -10
- package/src/index.ts +85 -36
- package/src/ipns/publisher.ts +29 -16
- package/src/ipns/republisher.ts +31 -13
- package/src/ipns/resolver.ts +40 -22
- package/src/ipns.ts +11 -11
- package/src/local-store.ts +8 -7
- package/src/pb/ipns.proto +1 -1
- package/src/pb/ipns.ts +37 -37
- package/src/records.ts +57 -210
- package/src/routing/helia.ts +6 -6
- package/src/routing/index.ts +7 -7
- package/src/routing/local-store.ts +6 -6
- package/src/routing/pubsub.ts +24 -25
- package/src/selector.ts +14 -11
- package/src/utils.ts +26 -148
- package/src/validator.ts +73 -16
- package/dist/typedoc-urls.json +0 -49
package/dist/src/records.d.ts
CHANGED
|
@@ -1,155 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { PrivateKey
|
|
1
|
+
import { IPNSEntry } from './pb/ipns.ts';
|
|
2
|
+
import type { PrivateKey } from '@helia/interface';
|
|
3
3
|
import type { AbortOptions } from 'abort-error';
|
|
4
|
-
|
|
5
|
-
export declare const namespace = "/ipns/";
|
|
6
|
-
export declare const namespaceLength: number;
|
|
7
|
-
export interface IPNSRecordV1V2 {
|
|
4
|
+
export interface CreateIPNSRecordOptions extends AbortOptions {
|
|
8
5
|
/**
|
|
9
|
-
*
|
|
6
|
+
* By default a IPNS V1 and a V2 signature is added to every record. Pass
|
|
7
|
+
* false here to only add a V2 signature.
|
|
8
|
+
*
|
|
9
|
+
* @default true
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* signature of the record
|
|
14
|
-
*/
|
|
15
|
-
signatureV1: Uint8Array;
|
|
16
|
-
/**
|
|
17
|
-
* Type of validation being used
|
|
18
|
-
*/
|
|
19
|
-
validityType: IpnsEntry.ValidityType;
|
|
20
|
-
/**
|
|
21
|
-
* expiration datetime for the record in RFC3339 format
|
|
22
|
-
*/
|
|
23
|
-
validity: string;
|
|
24
|
-
/**
|
|
25
|
-
* number representing the version of the record
|
|
26
|
-
*/
|
|
27
|
-
sequence: bigint;
|
|
28
|
-
/**
|
|
29
|
-
* ttl in nanoseconds
|
|
30
|
-
*/
|
|
31
|
-
ttl?: bigint;
|
|
32
|
-
/**
|
|
33
|
-
* the public portion of the key that signed this record
|
|
34
|
-
*/
|
|
35
|
-
publicKey: PublicKey;
|
|
36
|
-
/**
|
|
37
|
-
* the v2 signature of the record
|
|
38
|
-
*/
|
|
39
|
-
signatureV2: Uint8Array;
|
|
40
|
-
/**
|
|
41
|
-
* extensible data
|
|
42
|
-
*/
|
|
43
|
-
data: Uint8Array;
|
|
44
|
-
/**
|
|
45
|
-
* The marshalled record
|
|
46
|
-
*/
|
|
47
|
-
bytes: Uint8Array;
|
|
48
|
-
}
|
|
49
|
-
export interface IPNSRecordV2 {
|
|
50
|
-
/**
|
|
51
|
-
* value of the record
|
|
52
|
-
*/
|
|
53
|
-
value: string;
|
|
54
|
-
/**
|
|
55
|
-
* the v2 signature of the record
|
|
56
|
-
*/
|
|
57
|
-
signatureV2: Uint8Array;
|
|
58
|
-
/**
|
|
59
|
-
* Type of validation being used
|
|
60
|
-
*/
|
|
61
|
-
validityType: IpnsEntry.ValidityType;
|
|
62
|
-
/**
|
|
63
|
-
* If the validity type is EOL, this is the expiration datetime for the record
|
|
64
|
-
* in RFC3339 format
|
|
65
|
-
*/
|
|
66
|
-
validity: string;
|
|
67
|
-
/**
|
|
68
|
-
* number representing the version of the record
|
|
69
|
-
*/
|
|
70
|
-
sequence: bigint;
|
|
71
|
-
/**
|
|
72
|
-
* ttl in nanoseconds
|
|
73
|
-
*/
|
|
74
|
-
ttl?: bigint;
|
|
75
|
-
/**
|
|
76
|
-
* the public portion of the key that signed this record
|
|
77
|
-
*/
|
|
78
|
-
publicKey: PublicKey;
|
|
11
|
+
v1Compatible?: boolean;
|
|
79
12
|
/**
|
|
80
|
-
*
|
|
13
|
+
* The TTL of the record in ms - after this many ms have expired, resolving
|
|
14
|
+
* the record will query the routing for an updated version.
|
|
15
|
+
*
|
|
16
|
+
* Before this many ms have expired any locally stored copy will be treated as
|
|
17
|
+
* the latest version and the routing will not be queried.
|
|
18
|
+
*
|
|
19
|
+
* @default 300_000_000_000n
|
|
81
20
|
*/
|
|
82
|
-
|
|
21
|
+
ttlNs?: bigint;
|
|
83
22
|
/**
|
|
84
|
-
*
|
|
23
|
+
* Extensible data that will be added to the IPNS record data and signed to
|
|
24
|
+
* verify it's integrity.
|
|
25
|
+
*
|
|
26
|
+
* Note that this data will be encoded as DAG-CBOR so it must be valid.
|
|
85
27
|
*/
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
export type IPNSRecord = IPNSRecordV1V2 | IPNSRecordV2;
|
|
89
|
-
export interface IPNSRecordData {
|
|
90
|
-
Value: Uint8Array;
|
|
91
|
-
Validity: Uint8Array;
|
|
92
|
-
ValidityType: IpnsEntry.ValidityType;
|
|
93
|
-
Sequence: bigint;
|
|
94
|
-
TTL: bigint;
|
|
95
|
-
}
|
|
96
|
-
export interface IDKeys {
|
|
97
|
-
routingPubKey: Key;
|
|
98
|
-
pkKey: Key;
|
|
99
|
-
routingKey: Key;
|
|
100
|
-
ipnsKey: Key;
|
|
101
|
-
}
|
|
102
|
-
export interface CreateOptions extends AbortOptions {
|
|
103
|
-
ttlNs?: number | bigint;
|
|
104
|
-
v1Compatible?: boolean;
|
|
105
|
-
}
|
|
106
|
-
export interface CreateV2OrV1Options extends AbortOptions {
|
|
107
|
-
v1Compatible: true;
|
|
108
|
-
}
|
|
109
|
-
export interface CreateV2Options extends AbortOptions {
|
|
110
|
-
v1Compatible: false;
|
|
28
|
+
data?: Record<string, any>;
|
|
111
29
|
}
|
|
112
30
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* Note: This function does not embed the public key. If you want to do that, use `EmbedPublicKey`.
|
|
116
|
-
*
|
|
117
|
-
* The passed value can be a CID, a PublicKey or an arbitrary string path e.g. `/ipfs/...` or `/ipns/...`.
|
|
118
|
-
*
|
|
119
|
-
* CIDs will be converted to v1 and stored in the record as a string similar to: `/ipfs/${cid}`
|
|
120
|
-
* PublicKeys will create recursive records, eg. the record value will be `/ipns/${cidV1Libp2pKey}`
|
|
121
|
-
* String paths will be stored in the record as-is, but they must start with `"/"`
|
|
122
|
-
*
|
|
123
|
-
* @param {PrivateKey} privateKey - the private key for signing the record.
|
|
124
|
-
* @param {CID | PublicKey | string} value - content to be stored in the record.
|
|
125
|
-
* @param {number | bigint} seq - number representing the current version of the record.
|
|
126
|
-
* @param {number} lifetime - lifetime of the record (in milliseconds).
|
|
127
|
-
* @param {CreateOptions} options - additional create options.
|
|
128
|
-
*/
|
|
129
|
-
export declare function createIPNSRecord(privateKey: PrivateKey, value: string, seq: number | bigint, lifetime: number, options?: CreateV2OrV1Options): Promise<IPNSRecordV1V2>;
|
|
130
|
-
export declare function createIPNSRecord(privateKey: PrivateKey, value: string, seq: number | bigint, lifetime: number, options: CreateV2Options): Promise<IPNSRecordV2>;
|
|
131
|
-
export declare function createIPNSRecord(privateKey: PrivateKey, value: string, seq: number | bigint, lifetime: number, options: CreateOptions): Promise<IPNSRecordV1V2>;
|
|
132
|
-
/**
|
|
133
|
-
* Same as create(), but instead of generating a new Date, it receives the intended expiration time
|
|
134
|
-
* WARNING: nano precision is not standard, make sure the value in seconds is 9 orders of magnitude lesser than the one provided.
|
|
135
|
-
*
|
|
136
|
-
* The passed value can be a CID, a PublicKey or an arbitrary string path e.g. `/ipfs/...` or `/ipns/...`.
|
|
31
|
+
* A low-level function that creates a new IPNS record and signs it with the
|
|
32
|
+
* passed private key.
|
|
137
33
|
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* String paths will be stored in the record as-is, but they must start with `"/"`
|
|
34
|
+
* The IPNS Record validity should follow the [RFC3339]{@link https://www.ietf.org/rfc/rfc3339.txt}
|
|
35
|
+
* with nanosecond precision.
|
|
141
36
|
*
|
|
142
|
-
*
|
|
143
|
-
* @param {CID | PublicKey | string} value - content to be stored in the record.
|
|
144
|
-
* @param {number | bigint} seq - number representing the current version of the record.
|
|
145
|
-
* @param {string} expiration - expiration datetime for record in the [RFC3339]{@link https://www.ietf.org/rfc/rfc3339.txt} with nanoseconds precision.
|
|
146
|
-
* @param {CreateOptions} options - additional creation options.
|
|
37
|
+
* The passed value should be a string path e.g. `/ipfs/...` or `/ipns/...`.
|
|
147
38
|
*/
|
|
148
|
-
export declare function
|
|
149
|
-
export declare function createIPNSRecordWithExpiration(privateKey: PrivateKey, value: string, seq: number | bigint, expiration: string, options: CreateV2Options): Promise<IPNSRecordV2>;
|
|
150
|
-
export declare function createIPNSRecordWithExpiration(privateKey: PrivateKey, value: string, seq: number | bigint, expiration: string, options: CreateOptions): Promise<IPNSRecordV1V2>;
|
|
151
|
-
export { unmarshalIPNSRecord } from './utils.ts';
|
|
152
|
-
export { marshalIPNSRecord } from './utils.ts';
|
|
153
|
-
export { multihashToIPNSRoutingKey } from './utils.ts';
|
|
154
|
-
export { multihashFromIPNSRoutingKey } from './utils.ts';
|
|
39
|
+
export declare function createIPNSRecord(privateKey: PrivateKey, val: string, seq: number | bigint, lifetime: number, options?: CreateIPNSRecordOptions): Promise<IPNSEntry>;
|
|
155
40
|
//# sourceMappingURL=records.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/records.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/records.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAK/C,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC3B;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,SAAS,CAAC,CAgD1K"}
|
package/dist/src/records.js
CHANGED
|
@@ -2,70 +2,63 @@ import { logger } from '@libp2p/logger';
|
|
|
2
2
|
import NanoDate from 'timestamp-nano';
|
|
3
3
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
4
4
|
import { SignatureCreationError } from "./errors.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { IPNSEntry } from "./pb/ipns.js";
|
|
6
|
+
import { encodeExtensibleData, IDENTITY_CODEC, ipnsRecordDataForV1Sig, ipnsRecordDataForV2Sig } from "./utils.js";
|
|
7
7
|
const log = logger('ipns');
|
|
8
|
-
const DEFAULT_TTL_NS =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
const DEFAULT_TTL_NS = 300000000000n; // 5 Minutes or 300 Seconds, as suggested by https://specs.ipfs.tech/ipns/ipns-record/#ttl-uint64
|
|
9
|
+
/**
|
|
10
|
+
* A low-level function that creates a new IPNS record and signs it with the
|
|
11
|
+
* passed private key.
|
|
12
|
+
*
|
|
13
|
+
* The IPNS Record validity should follow the [RFC3339]{@link https://www.ietf.org/rfc/rfc3339.txt}
|
|
14
|
+
* with nanosecond precision.
|
|
15
|
+
*
|
|
16
|
+
* The passed value should be a string path e.g. `/ipfs/...` or `/ipns/...`.
|
|
17
|
+
*/
|
|
18
|
+
export async function createIPNSRecord(privateKey, val, seq, lifetime, options) {
|
|
19
|
+
seq = BigInt(seq);
|
|
20
|
+
const value = uint8ArrayFromString(val);
|
|
21
|
+
// convert ttl from milliseconds to nanoseconds as createIPNSRecord expects
|
|
22
|
+
const ttlNs = options?.ttlNs ?? DEFAULT_TTL_NS;
|
|
16
23
|
// Validity in ISOString with nanoseconds precision and validity type EOL
|
|
17
24
|
const expirationDate = new NanoDate(Date.now() + Number(lifetime));
|
|
18
|
-
const validityType =
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
seq = BigInt(seq);
|
|
30
|
-
const isoValidity = uint8ArrayFromString(validity);
|
|
31
|
-
const data = createCborData(value, validityType, isoValidity, seq, ttl);
|
|
25
|
+
const validityType = IPNSEntry.ValidityType.EOL;
|
|
26
|
+
const validity = uint8ArrayFromString(expirationDate.toString());
|
|
27
|
+
const data = encodeExtensibleData({
|
|
28
|
+
...(options?.data ?? {}),
|
|
29
|
+
Value: value,
|
|
30
|
+
Validity: validity,
|
|
31
|
+
// @ts-expect-error should be a number
|
|
32
|
+
ValidityType: 0,
|
|
33
|
+
Sequence: seq,
|
|
34
|
+
TTL: ttlNs
|
|
35
|
+
});
|
|
32
36
|
const sigData = ipnsRecordDataForV2Sig(data);
|
|
33
37
|
const signatureV2 = await privateKey.sign(sigData, options);
|
|
34
|
-
const publicKey = shouldEmbedPublicKey(privateKey.publicKey) ? privateKey.publicKey : undefined;
|
|
35
38
|
let record;
|
|
36
|
-
if (options
|
|
37
|
-
const signatureV1 = await signLegacyV1(privateKey, value, validityType, isoValidity);
|
|
39
|
+
if (options?.v1Compatible === false) {
|
|
38
40
|
record = {
|
|
39
|
-
value,
|
|
40
|
-
signatureV1,
|
|
41
|
-
validity,
|
|
42
|
-
validityType,
|
|
43
|
-
sequence: seq,
|
|
44
|
-
ttl,
|
|
45
41
|
signatureV2,
|
|
46
|
-
data
|
|
47
|
-
publicKey
|
|
42
|
+
data
|
|
48
43
|
};
|
|
49
44
|
}
|
|
50
45
|
else {
|
|
51
46
|
record = {
|
|
52
47
|
value,
|
|
53
|
-
validity,
|
|
48
|
+
signatureV1: await signLegacyV1(privateKey, value, validityType, validity),
|
|
54
49
|
validityType,
|
|
50
|
+
validity,
|
|
55
51
|
sequence: seq,
|
|
56
|
-
ttl,
|
|
52
|
+
ttl: ttlNs,
|
|
57
53
|
signatureV2,
|
|
58
|
-
data
|
|
59
|
-
publicKey
|
|
54
|
+
data
|
|
60
55
|
};
|
|
61
56
|
}
|
|
62
|
-
|
|
57
|
+
if (shouldEmbedPublicKey(privateKey.publicKey)) {
|
|
58
|
+
record.publicKey = privateKey.publicKey.toProtobuf();
|
|
59
|
+
}
|
|
63
60
|
return record;
|
|
64
|
-
}
|
|
65
|
-
export { unmarshalIPNSRecord } from "./utils.js";
|
|
66
|
-
export { marshalIPNSRecord } from "./utils.js";
|
|
67
|
-
export { multihashToIPNSRoutingKey } from "./utils.js";
|
|
68
|
-
export { multihashFromIPNSRoutingKey } from "./utils.js";
|
|
61
|
+
}
|
|
69
62
|
/**
|
|
70
63
|
* Sign ipns record data using the legacy V1 signature scheme
|
|
71
64
|
*/
|
|
@@ -83,6 +76,6 @@ const signLegacyV1 = async (privateKey, value, validityType, validity, options)
|
|
|
83
76
|
* Returns true if the public key multihash is not an identity hash
|
|
84
77
|
*/
|
|
85
78
|
function shouldEmbedPublicKey(key) {
|
|
86
|
-
return key.toMultihash().code !==
|
|
79
|
+
return key.toMultihash().code !== IDENTITY_CODEC;
|
|
87
80
|
}
|
|
88
81
|
//# sourceMappingURL=records.js.map
|
package/dist/src/records.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,oBAAoB,EAAE,c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AW;YACX,IAAI;SACL,CAAA;IACH,CAAC;SAAM,CAAC;QACN,MAAM,GAAG;YACP,KAAK;YACL,WAAW,EAAE,MAAM,YAAY,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC;YAC1E,YAAY;YACZ,QAAQ;YACR,QAAQ,EAAE,GAAG;YACb,GAAG,EAAE,KAAK;YACV,WAAW;YACX,IAAI;SACL,CAAA;IACH,CAAC;IAED,IAAI,oBAAoB,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/C,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,CAAA;IACtD,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;GAEG;AACH,MAAM,YAAY,GAAG,KAAK,EAAE,UAAsB,EAAE,KAAiB,EAAE,YAAoC,EAAE,QAAoB,EAAE,OAAsB,EAAoC,EAAE;IAC7L,IAAI,CAAC;QACH,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;QAE9E,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IACzD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,GAAG,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAA;QACpD,MAAM,IAAI,sBAAsB,CAAC,kCAAkC,CAAC,CAAA;IACtE,CAAC;AACH,CAAC,CAAA;AAED;;GAEG;AACH,SAAS,oBAAoB,CAAE,GAAc;IAC3C,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,KAAK,cAAc,CAAA;AAClD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IPNSRoutingGetOptions, IPNSRoutingPutOptions } from './index.ts';
|
|
2
2
|
import type { IPNSRouting } from '../index.ts';
|
|
3
3
|
import type { Routing } from '@helia/interface';
|
|
4
4
|
import type { ProgressEvent } from 'progress-events';
|
|
@@ -6,16 +6,16 @@ export interface HeliaRoutingComponents {
|
|
|
6
6
|
routing: Routing;
|
|
7
7
|
}
|
|
8
8
|
export type HeliaRoutingProgressEvents = ProgressEvent<'ipns:routing:helia:error', Error>;
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class HeliaIPNSRouting implements IPNSRouting {
|
|
10
10
|
private readonly routing;
|
|
11
11
|
constructor(routing: Routing);
|
|
12
|
-
put(routingKey: Uint8Array, marshaledRecord: Uint8Array, options?:
|
|
13
|
-
get(routingKey: Uint8Array, options?:
|
|
12
|
+
put(routingKey: Uint8Array, marshaledRecord: Uint8Array, options?: IPNSRoutingPutOptions): Promise<void>;
|
|
13
|
+
get(routingKey: Uint8Array, options?: IPNSRoutingGetOptions): Promise<Uint8Array<ArrayBuffer>>;
|
|
14
14
|
toString(): string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* The helia routing uses any available Routers configured on the passed Helia
|
|
18
18
|
* node. This could be libp2p, HTTP API Delegated Routing, etc.
|
|
19
19
|
*/
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function heliaIPNSRouting(routing: Routing): IPNSRouting;
|
|
21
21
|
//# sourceMappingURL=helia.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helia.d.ts","sourceRoot":"","sources":["../../../src/routing/helia.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"helia.d.ts","sourceRoot":"","sources":["../../../src/routing/helia.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,MAAM,0BAA0B,GACpC,aAAa,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAA;AAElD,qBAAa,gBAAiB,YAAW,WAAW;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAEpB,OAAO,EAAE,OAAO;IAIvB,GAAG,CAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7G,GAAG,CAAE,UAAU,EAAE,UAAU,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IASzG,QAAQ,IAAK,MAAM;CAGpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,OAAO,GAAG,WAAW,CAE/D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomProgressEvent } from 'progress-events';
|
|
2
|
-
export class
|
|
2
|
+
export class HeliaIPNSRouting {
|
|
3
3
|
routing;
|
|
4
4
|
constructor(routing) {
|
|
5
5
|
this.routing = routing;
|
|
@@ -30,7 +30,7 @@ export class HeliaRouting {
|
|
|
30
30
|
* The helia routing uses any available Routers configured on the passed Helia
|
|
31
31
|
* node. This could be libp2p, HTTP API Delegated Routing, etc.
|
|
32
32
|
*/
|
|
33
|
-
export function
|
|
34
|
-
return new
|
|
33
|
+
export function heliaIPNSRouting(routing) {
|
|
34
|
+
return new HeliaIPNSRouting(routing);
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=helia.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helia.js","sourceRoot":"","sources":["../../../src/routing/helia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAarD,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"helia.js","sourceRoot":"","sources":["../../../src/routing/helia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAarD,MAAM,OAAO,gBAAgB;IACV,OAAO,CAAS;IAEjC,YAAa,OAAgB;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,UAAsB,EAAE,eAA2B,EAAE,UAAiC,EAAE;QACjG,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,OAAO,CAAC,CAAA;QAC9D,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,mBAAmB,CAAQ,0BAA0B,EAAE,GAAG,CAAC,CAAC,CAAA;YACrF,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,UAAsB,EAAE,UAAiC,EAAE;QACpE,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QACpD,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,mBAAmB,CAAQ,0BAA0B,EAAE,GAAG,CAAC,CAAC,CAAA;YACrF,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;IAED,QAAQ;QACN,OAAO,gBAAgB,CAAA;IACzB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAE,OAAgB;IAChD,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAA;AACtC,CAAC"}
|
|
@@ -4,10 +4,10 @@ import type { PubSubProgressEvents } from './pubsub.ts';
|
|
|
4
4
|
import type { IPNSPublishMetadata } from '../pb/metadata.ts';
|
|
5
5
|
import type { AbortOptions } from '@libp2p/interface';
|
|
6
6
|
import type { ProgressOptions } from 'progress-events';
|
|
7
|
-
export interface
|
|
7
|
+
export interface IPNSRoutingPutOptions extends AbortOptions, ProgressOptions {
|
|
8
8
|
metadata?: IPNSPublishMetadata;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface IPNSRoutingGetOptions extends AbortOptions, ProgressOptions {
|
|
11
11
|
/**
|
|
12
12
|
* Pass false to not perform validation actions
|
|
13
13
|
*
|
|
@@ -16,14 +16,14 @@ export interface GetOptions extends AbortOptions, ProgressOptions {
|
|
|
16
16
|
validate?: boolean;
|
|
17
17
|
}
|
|
18
18
|
export interface IPNSRouting {
|
|
19
|
-
put(routingKey: Uint8Array, marshaledRecord: Uint8Array, options?:
|
|
20
|
-
get(routingKey: Uint8Array, options?:
|
|
19
|
+
put(routingKey: Uint8Array, marshaledRecord: Uint8Array, options?: IPNSRoutingPutOptions): Promise<void>;
|
|
20
|
+
get(routingKey: Uint8Array, options?: IPNSRoutingGetOptions): Promise<Uint8Array>;
|
|
21
21
|
}
|
|
22
22
|
export type { DatastoreProgressEvents };
|
|
23
23
|
export type { HeliaRoutingProgressEvents };
|
|
24
24
|
export type { PubSubProgressEvents };
|
|
25
25
|
export type IPNSRoutingProgressEvents = DatastoreProgressEvents | HeliaRoutingProgressEvents | PubSubProgressEvents;
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export type { PubsubRoutingComponents, PubSub,
|
|
26
|
+
export { heliaIPNSRouting } from './helia.ts';
|
|
27
|
+
export { pubSubIPNSRouting } from './pubsub.ts';
|
|
28
|
+
export type { PubsubRoutingComponents, PubSub, PubSubMessage, PublishResult, PubSubEvents, PubSubSubscription, PubSubSubscriptionChangeData } from './pubsub.ts';
|
|
29
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routing/index.ts"],"names":[],"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,OAAO,CAAC,UAAU,CAAC,CAAA;CAClF;AAED,YAAY,EAAE,uBAAuB,EAAE,CAAA;AACvC,YAAY,EAAE,0BAA0B,EAAE,CAAA;AAC1C,YAAY,EAAE,oBAAoB,EAAE,CAAA;AAEpC,MAAM,MAAM,yBAAyB,GACnC,uBAAuB,GACvB,0BAA0B,GAC1B,oBAAoB,CAAA;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,YAAY,EAAE,uBAAuB,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { heliaIPNSRouting } from "./helia.js";
|
|
2
|
+
export { pubSubIPNSRouting } from "./pubsub.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routing/index.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routing/index.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -3,5 +3,5 @@ import type { IPNSRouting } from './index.ts';
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns an IPNSRouting implementation that reads/writes to the local store
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function localStoreIPNSRouting(localStore: LocalStore): IPNSRouting;
|
|
7
7
|
//# sourceMappingURL=local-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-store.d.ts","sourceRoot":"","sources":["../../../src/routing/local-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"local-store.d.ts","sourceRoot":"","sources":["../../../src/routing/local-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAgD,MAAM,YAAY,CAAA;AAwB3F;;GAEG;AACH,wBAAgB,qBAAqB,CAAE,UAAU,EAAE,UAAU,GAAG,WAAW,CAE1E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class LocalStoreIPNSRouting {
|
|
2
2
|
localStore;
|
|
3
3
|
constructor(localStore) {
|
|
4
4
|
this.localStore = localStore;
|
|
@@ -17,7 +17,7 @@ class LocalStoreRouting {
|
|
|
17
17
|
/**
|
|
18
18
|
* Returns an IPNSRouting implementation that reads/writes to the local store
|
|
19
19
|
*/
|
|
20
|
-
export function
|
|
21
|
-
return new
|
|
20
|
+
export function localStoreIPNSRouting(localStore) {
|
|
21
|
+
return new LocalStoreIPNSRouting(localStore);
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=local-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-store.js","sourceRoot":"","sources":["../../../src/routing/local-store.ts"],"names":[],"mappings":"AAGA,MAAM,
|
|
1
|
+
{"version":3,"file":"local-store.js","sourceRoot":"","sources":["../../../src/routing/local-store.ts"],"names":[],"mappings":"AAGA,MAAM,qBAAqB;IACjB,UAAU,CAAY;IAE9B,YAAa,UAAsB;QACjC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,UAAsB,EAAE,eAA2B,EAAE,OAA+B;QAC7F,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,OAAO,CAAC,CAAA;IACjE,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,UAAsB,EAAE,OAA+B;QAChE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QAEjE,OAAO,MAAM,CAAA;IACf,CAAC;IAED,QAAQ;QACN,OAAO,qBAAqB,CAAA;IAC9B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAE,UAAsB;IAC3D,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAA;AAC9C,CAAC"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IPNSRoutingGetOptions, IPNSRouting, IPNSRoutingPutOptions } from './index.ts';
|
|
2
2
|
import type { Keychain } from '@helia/interface';
|
|
3
3
|
import type { Fetch } from '@libp2p/fetch';
|
|
4
4
|
import type { PeerId, PublicKey, TypedEventTarget, ComponentLogger, Startable, Metrics, Libp2p } from '@libp2p/interface';
|
|
5
5
|
import type { Datastore } from 'interface-datastore';
|
|
6
6
|
import type { MultihashDigest } from 'multiformats/hashes/interface';
|
|
7
7
|
import type { ProgressEvent } from 'progress-events';
|
|
8
|
-
export interface
|
|
8
|
+
export interface PubSubMessage {
|
|
9
9
|
type: 'signed' | 'unsigned';
|
|
10
10
|
from: PeerId;
|
|
11
11
|
topic: string;
|
|
12
12
|
data: Uint8Array;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface PubSubSubscription {
|
|
15
15
|
topic: string;
|
|
16
16
|
subscribe: boolean;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface PubSubSubscriptionChangeData {
|
|
19
19
|
peerId: PeerId;
|
|
20
|
-
subscriptions:
|
|
20
|
+
subscriptions: PubSubSubscription[];
|
|
21
21
|
}
|
|
22
22
|
export interface PubSubEvents {
|
|
23
|
-
'subscription-change': CustomEvent<
|
|
24
|
-
message: CustomEvent<
|
|
23
|
+
'subscription-change': CustomEvent<PubSubSubscriptionChangeData>;
|
|
24
|
+
message: CustomEvent<PubSubMessage>;
|
|
25
25
|
}
|
|
26
26
|
export interface PublishResult {
|
|
27
27
|
recipients: PeerId[];
|
|
@@ -69,7 +69,7 @@ export type PubSubProgressEvents = ProgressEvent<'ipns:pubsub:publish', {
|
|
|
69
69
|
}> | ProgressEvent<'ipns:pubsub:subscribe', {
|
|
70
70
|
topic: string;
|
|
71
71
|
}> | ProgressEvent<'ipns:pubsub:error', Error>;
|
|
72
|
-
export declare class
|
|
72
|
+
export declare class PubSubIPNSRouting implements IPNSRouting, Startable {
|
|
73
73
|
#private;
|
|
74
74
|
private readonly subscriptions;
|
|
75
75
|
private readonly localStore;
|
|
@@ -86,13 +86,13 @@ export declare class PubSubRouting implements IPNSRouting, Startable {
|
|
|
86
86
|
/**
|
|
87
87
|
* Put a value to the pubsub datastore indexed by the received key properly encoded
|
|
88
88
|
*/
|
|
89
|
-
put(routingKey: Uint8Array, marshaledRecord: Uint8Array, options?:
|
|
89
|
+
put(routingKey: Uint8Array, marshaledRecord: Uint8Array, options?: IPNSRoutingPutOptions): Promise<void>;
|
|
90
90
|
/**
|
|
91
91
|
* Get a value from the pubsub datastore indexed by the received key properly encoded.
|
|
92
92
|
* Also, the identifier topic is subscribed to and the pubsub datastore records will be
|
|
93
93
|
* updated once new publishes occur
|
|
94
94
|
*/
|
|
95
|
-
get(routingKey: Uint8Array, options?:
|
|
95
|
+
get(routingKey: Uint8Array, options?: IPNSRoutingGetOptions): Promise<Uint8Array<ArrayBuffer>>;
|
|
96
96
|
/**
|
|
97
97
|
* Get pubsub subscriptions related to ipns
|
|
98
98
|
*/
|
|
@@ -113,5 +113,5 @@ export declare class PubSubRouting implements IPNSRouting, Startable {
|
|
|
113
113
|
* updated records, so the first call to `.get` should be expected
|
|
114
114
|
* to fail!
|
|
115
115
|
*/
|
|
116
|
-
export declare function
|
|
116
|
+
export declare function pubSubIPNSRouting(components: PubsubRoutingComponents, init?: PubsubRoutingInit): IPNSRouting;
|
|
117
117
|
//# sourceMappingURL=pubsub.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../../../src/routing/pubsub.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../../../src/routing/pubsub.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAE3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAgB,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AACvI,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAIpD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,kBAAkB,EAAE,CAAA;CACpC;AAED,MAAM,WAAW,YAAY;IAC3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