@xyo-network/xns-record-payload-plugins 5.3.1 → 5.3.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/dist/browser/Address/Payload.d.ts +1 -1
- package/dist/browser/Address/Payload.d.ts.map +1 -1
- package/dist/browser/DNS/Witness/Payload/Request.d.ts +2 -2
- package/dist/browser/DNS/Witness/Payload/Response.d.ts +2 -2
- package/dist/browser/Domain/Domain.d.ts +2 -2
- package/dist/browser/Domain/DomainLease.d.ts +2 -2
- package/dist/browser/DomainRegistration/DomainRegistration.d.ts +3 -3
- package/dist/browser/DomainRegistration/DomainRegistration.d.ts.map +1 -1
- package/dist/browser/DomainRegistration/DomainRegistrationLease.d.ts +2 -2
- package/dist/browser/Duration/validation/validateBoundWitnessAndDuration.d.ts.map +1 -1
- package/dist/browser/Hash/Payload.d.ts +1 -1
- package/dist/browser/Hash/Payload.d.ts.map +1 -1
- package/dist/browser/diviner/lib/parseEstimatesFromArray.d.ts.map +1 -1
- package/dist/browser/index.mjs +9 -10
- package/dist/browser/index.mjs.map +1 -1
- package/dist/neutral/Address/Payload.d.ts +1 -1
- package/dist/neutral/Address/Payload.d.ts.map +1 -1
- package/dist/neutral/DNS/Witness/Payload/Request.d.ts +2 -2
- package/dist/neutral/DNS/Witness/Payload/Response.d.ts +2 -2
- package/dist/neutral/Domain/Domain.d.ts +2 -2
- package/dist/neutral/Domain/DomainLease.d.ts +2 -2
- package/dist/neutral/DomainRegistration/DomainRegistration.d.ts +3 -3
- package/dist/neutral/DomainRegistration/DomainRegistration.d.ts.map +1 -1
- package/dist/neutral/DomainRegistration/DomainRegistrationLease.d.ts +2 -2
- package/dist/neutral/Duration/validation/validateBoundWitnessAndDuration.d.ts.map +1 -1
- package/dist/neutral/Hash/Payload.d.ts +1 -1
- package/dist/neutral/Hash/Payload.d.ts.map +1 -1
- package/dist/neutral/diviner/lib/parseEstimatesFromArray.d.ts.map +1 -1
- package/dist/neutral/index.mjs +9 -10
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/node/Address/Payload.d.ts +1 -1
- package/dist/node/Address/Payload.d.ts.map +1 -1
- package/dist/node/DNS/Witness/Payload/Request.d.ts +2 -2
- package/dist/node/DNS/Witness/Payload/Response.d.ts +2 -2
- package/dist/node/Domain/Domain.d.ts +2 -2
- package/dist/node/Domain/DomainLease.d.ts +2 -2
- package/dist/node/DomainRegistration/DomainRegistration.d.ts +3 -3
- package/dist/node/DomainRegistration/DomainRegistration.d.ts.map +1 -1
- package/dist/node/DomainRegistration/DomainRegistrationLease.d.ts +2 -2
- package/dist/node/Duration/validation/validateBoundWitnessAndDuration.d.ts.map +1 -1
- package/dist/node/Hash/Payload.d.ts +1 -1
- package/dist/node/Hash/Payload.d.ts.map +1 -1
- package/dist/node/diviner/lib/parseEstimatesFromArray.d.ts.map +1 -1
- package/dist/node/index.mjs +9 -10
- package/dist/node/index.mjs.map +1 -1
- package/package.json +32 -26
- package/src/Address/Payload.ts +0 -22
- package/src/Address/index.ts +0 -1
- package/src/DNS/Witness/Config.ts +0 -28
- package/src/DNS/Witness/Params.ts +0 -6
- package/src/DNS/Witness/Payload/Payload.ts +0 -4
- package/src/DNS/Witness/Payload/Request.ts +0 -39
- package/src/DNS/Witness/Payload/Response.ts +0 -28
- package/src/DNS/Witness/Payload/index.ts +0 -3
- package/src/DNS/Witness/Schema.ts +0 -4
- package/src/DNS/Witness/index.ts +0 -4
- package/src/DNS/index.ts +0 -2
- package/src/DNS/types/Answer.ts +0 -5
- package/src/DNS/types/Header.ts +0 -96
- package/src/DNS/types/OperationCodes.ts +0 -13
- package/src/DNS/types/Record.ts +0 -9
- package/src/DNS/types/Request.ts +0 -39
- package/src/DNS/types/ResourceRecord.ts +0 -229
- package/src/DNS/types/Response.ts +0 -12
- package/src/DNS/types/ResponseCodes.ts +0 -34
- package/src/DNS/types/index.ts +0 -8
- package/src/Domain/Domain.ts +0 -47
- package/src/Domain/DomainLease.ts +0 -35
- package/src/Domain/index.ts +0 -2
- package/src/DomainEstimate/DomainEstimate.ts +0 -11
- package/src/DomainEstimate/index.ts +0 -1
- package/src/DomainRegistration/DomainRegistration.ts +0 -42
- package/src/DomainRegistration/DomainRegistrationLease.ts +0 -39
- package/src/DomainRegistration/index.ts +0 -2
- package/src/Duration/Duration.ts +0 -11
- package/src/Duration/index.ts +0 -2
- package/src/Duration/validation/index.ts +0 -2
- package/src/Duration/validation/validateBoundWitness.ts +0 -13
- package/src/Duration/validation/validateBoundWitnessAndDuration.ts +0 -24
- package/src/Duration/validation/validateBoundWitnessWithDuration.ts +0 -16
- package/src/Duration/validation/validateDuration.ts +0 -14
- package/src/Hash/Payload.ts +0 -22
- package/src/Hash/index.ts +0 -1
- package/src/diviner/DomainLeaseEstimateDiviner/ErrorDetails/ErrorCodes.ts +0 -38
- package/src/diviner/DomainLeaseEstimateDiviner/ErrorDetails/Payload.ts +0 -46
- package/src/diviner/DomainLeaseEstimateDiviner/ErrorDetails/index.ts +0 -2
- package/src/diviner/DomainLeaseEstimateDiviner/Schema.ts +0 -6
- package/src/diviner/DomainLeaseEstimateDiviner/index.ts +0 -2
- package/src/diviner/index.ts +0 -2
- package/src/diviner/lib/index.ts +0 -1
- package/src/diviner/lib/parseEstimatesFromArray.ts +0 -82
- package/src/index.ts +0 -8
package/src/DNS/types/Request.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/member-ordering */
|
|
2
|
-
import type { DNSRequestHeader } from './Header.ts'
|
|
3
|
-
import { StandardRequestHeader } from './Header.ts'
|
|
4
|
-
import type { DNSResourceRecordTypeValue } from './ResourceRecord.ts'
|
|
5
|
-
import { DNSResourceRecordTypes } from './ResourceRecord.ts'
|
|
6
|
-
|
|
7
|
-
export interface DNSQuestion {
|
|
8
|
-
name: string // The domain name that was queried
|
|
9
|
-
type: DNSResourceRecordTypeValue // The record type (e.g., 1 for A record)
|
|
10
|
-
class?: number // Query Class (typically 1 for IN - Internet)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface DNSRequestFields extends DNSRequestHeader {
|
|
14
|
-
Question: DNSQuestion[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Helper for generating a DNS request for a given domain and record type
|
|
19
|
-
* @param domain The domain to query
|
|
20
|
-
* @param type The record type to query
|
|
21
|
-
* @returns A DNS request
|
|
22
|
-
*/
|
|
23
|
-
export const getRequestFor = (domain: string, type: DNSResourceRecordTypeValue = DNSResourceRecordTypes.A): DNSRequestFields => {
|
|
24
|
-
return {
|
|
25
|
-
...StandardRequestHeader,
|
|
26
|
-
ID: getRandomId(),
|
|
27
|
-
Question: [{
|
|
28
|
-
name: domain, type, class: 1,
|
|
29
|
-
}],
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Used to generate a random ID for a DNS request
|
|
35
|
-
* @returns A random number between 0 and 65,535
|
|
36
|
-
*/
|
|
37
|
-
export const getRandomId = (): number => {
|
|
38
|
-
return Math.floor(Math.random() * 65_536) // Math.random() generates a number between 0 and 1, multiply by 65536 to get the range 0-65535
|
|
39
|
-
}
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
// https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
|
|
2
|
-
|
|
3
|
-
export type DNSResourceRecordType
|
|
4
|
-
= | 'A'
|
|
5
|
-
| 'NS'
|
|
6
|
-
| 'MD'
|
|
7
|
-
| 'MF'
|
|
8
|
-
| 'CNAME'
|
|
9
|
-
| 'SOA'
|
|
10
|
-
| 'MB'
|
|
11
|
-
| 'MG'
|
|
12
|
-
| 'MR'
|
|
13
|
-
| 'NULL'
|
|
14
|
-
| 'WKS'
|
|
15
|
-
| 'PTR'
|
|
16
|
-
| 'HINFO'
|
|
17
|
-
| 'MINFO'
|
|
18
|
-
| 'MX'
|
|
19
|
-
| 'TXT'
|
|
20
|
-
| 'RP'
|
|
21
|
-
| 'AFSDB'
|
|
22
|
-
| 'X25'
|
|
23
|
-
| 'ISDN'
|
|
24
|
-
| 'RT'
|
|
25
|
-
| 'NSAP'
|
|
26
|
-
| 'NSAP-PTR'
|
|
27
|
-
| 'SIG'
|
|
28
|
-
| 'KEY'
|
|
29
|
-
| 'PX'
|
|
30
|
-
| 'GPOS'
|
|
31
|
-
| 'AAAA'
|
|
32
|
-
| 'LOC'
|
|
33
|
-
| 'NXT'
|
|
34
|
-
| 'EID'
|
|
35
|
-
| 'NIMLOC'
|
|
36
|
-
| 'SRV'
|
|
37
|
-
| 'ATMA'
|
|
38
|
-
| 'NAPTR'
|
|
39
|
-
| 'KX'
|
|
40
|
-
| 'CERT'
|
|
41
|
-
| 'A6'
|
|
42
|
-
| 'DNAME'
|
|
43
|
-
| 'SINK'
|
|
44
|
-
| 'OPT'
|
|
45
|
-
| 'APL'
|
|
46
|
-
| 'DS'
|
|
47
|
-
| 'SSHFP'
|
|
48
|
-
| 'IPSECKEY'
|
|
49
|
-
| 'RRSIG'
|
|
50
|
-
| 'NSEC'
|
|
51
|
-
| 'DNSKEY'
|
|
52
|
-
| 'DHCID'
|
|
53
|
-
| 'NSEC3'
|
|
54
|
-
| 'NSEC3PARAM'
|
|
55
|
-
| 'TLSA'
|
|
56
|
-
| 'SMIMEA'
|
|
57
|
-
| 'HIP'
|
|
58
|
-
| 'NINFO'
|
|
59
|
-
| 'RKEY'
|
|
60
|
-
| 'TALINK'
|
|
61
|
-
| 'CDS'
|
|
62
|
-
| 'CDNSKEY'
|
|
63
|
-
| 'OPENPGPKEY'
|
|
64
|
-
| 'CSYNC'
|
|
65
|
-
| 'ZONEMD'
|
|
66
|
-
| 'SVCB'
|
|
67
|
-
| 'HTTPS'
|
|
68
|
-
| 'SPF'
|
|
69
|
-
| 'UINFO'
|
|
70
|
-
| 'UID'
|
|
71
|
-
| 'GID'
|
|
72
|
-
| 'UNSPEC'
|
|
73
|
-
| 'NID'
|
|
74
|
-
| 'L32'
|
|
75
|
-
| 'L64'
|
|
76
|
-
| 'LP'
|
|
77
|
-
| 'EUI48'
|
|
78
|
-
| 'EUI64'
|
|
79
|
-
| 'NXNAME'
|
|
80
|
-
| 'TKEY'
|
|
81
|
-
| 'TSIG'
|
|
82
|
-
| 'IXFR'
|
|
83
|
-
| 'AXFR'
|
|
84
|
-
| 'MAILB'
|
|
85
|
-
| 'MAILA'
|
|
86
|
-
| '*'
|
|
87
|
-
| 'URI'
|
|
88
|
-
| 'CAA'
|
|
89
|
-
| 'AVC'
|
|
90
|
-
| 'DOA'
|
|
91
|
-
| 'AMTRELAY'
|
|
92
|
-
| 'RESINFO'
|
|
93
|
-
| 'WALLET'
|
|
94
|
-
| 'CLA'
|
|
95
|
-
| 'IPN'
|
|
96
|
-
| 'TA'
|
|
97
|
-
| 'DLV'
|
|
98
|
-
// Custom types here
|
|
99
|
-
| 'XYOA'
|
|
100
|
-
| 'XYOH'
|
|
101
|
-
|
|
102
|
-
export const DNSResourceRecordTypes: Readonly<Record<DNSResourceRecordType, number>> = {
|
|
103
|
-
'A': 1, // a host address
|
|
104
|
-
'NS': 2, // an authoritative name server
|
|
105
|
-
'MD': 3, // a mail destination (OBSOLETE - use MX)
|
|
106
|
-
'MF': 4, // a mail forwarder (OBSOLETE - use MX)
|
|
107
|
-
'CNAME': 5, // the canonical name for an alias
|
|
108
|
-
'SOA': 6, // marks the start of a zone of authority
|
|
109
|
-
'MB': 7, // a mailbox domain name (EXPERIMENTAL)
|
|
110
|
-
'MG': 8, // a mail group member (EXPERIMENTAL)
|
|
111
|
-
'MR': 9, // a mail rename domain name (EXPERIMENTAL)
|
|
112
|
-
'NULL': 10, // a null RR (EXPERIMENTAL)
|
|
113
|
-
'WKS': 11, // a well known service description
|
|
114
|
-
'PTR': 12, // a domain name pointer
|
|
115
|
-
'HINFO': 13, // host information
|
|
116
|
-
'MINFO': 14, // mailbox or mail list information
|
|
117
|
-
'MX': 15, // mail exchange
|
|
118
|
-
'TXT': 16, // text strings
|
|
119
|
-
'RP': 17, // for Responsible Person
|
|
120
|
-
'AFSDB': 18, // for AFS Data Base location
|
|
121
|
-
'X25': 19, // for X.25 PSDN address
|
|
122
|
-
'ISDN': 20, // for ISDN address
|
|
123
|
-
'RT': 21, // for Route Through
|
|
124
|
-
'NSAP': 22, // for NSAP address, NSAP style A record (DEPRECATED)
|
|
125
|
-
'NSAP-PTR': 23, // for domain name pointer, NSAP style (DEPRECATED)
|
|
126
|
-
'SIG': 24, // for security signature
|
|
127
|
-
'KEY': 25, // for security key
|
|
128
|
-
'PX': 26, // X.400 mail mapping information
|
|
129
|
-
'GPOS': 27, // Geographical Position
|
|
130
|
-
'AAAA': 28, // IP6 Address
|
|
131
|
-
'LOC': 29, // Location Information
|
|
132
|
-
'NXT': 30, // Next Domain (OBSOLETE)
|
|
133
|
-
'EID': 31, // Endpoint Identifier
|
|
134
|
-
'NIMLOC': 32, // Nimrod Locator
|
|
135
|
-
'SRV': 33, // Server Selection
|
|
136
|
-
'ATMA': 34, // ATM Address
|
|
137
|
-
'NAPTR': 35, // Naming Authority Pointer
|
|
138
|
-
'KX': 36, // Key Exchanger
|
|
139
|
-
'CERT': 37, // CERT
|
|
140
|
-
'A6': 38, // A6 (OBSOLETE - use AAAA)
|
|
141
|
-
'DNAME': 39, // DNAME
|
|
142
|
-
'SINK': 40, // SINK
|
|
143
|
-
'OPT': 41, // OPT
|
|
144
|
-
'APL': 42, // APL
|
|
145
|
-
'DS': 43, // Delegation Signer
|
|
146
|
-
'SSHFP': 44, // SSH Key Fingerprint
|
|
147
|
-
'IPSECKEY': 45, // IPSECKEY
|
|
148
|
-
'RRSIG': 46, // RRSIG
|
|
149
|
-
'NSEC': 47, // NSEC
|
|
150
|
-
'DNSKEY': 48, // DNSKEY
|
|
151
|
-
'DHCID': 49, // DHCID
|
|
152
|
-
'NSEC3': 50, // NSEC3
|
|
153
|
-
'NSEC3PARAM': 51, // NSEC3PARAM
|
|
154
|
-
'TLSA': 52, // TLSA
|
|
155
|
-
'SMIMEA': 53, // S/MIME cert association
|
|
156
|
-
'HIP': 55, // Host Identity Protocol
|
|
157
|
-
'NINFO': 56, // NINFO
|
|
158
|
-
'RKEY': 57, // RKEY
|
|
159
|
-
'TALINK': 58, // Trust Anchor LINK
|
|
160
|
-
'CDS': 59, // Child DS
|
|
161
|
-
'CDNSKEY': 60, // DNSKEY(s) the Child wants reflected in DS
|
|
162
|
-
'OPENPGPKEY': 61, // OpenPGP Key
|
|
163
|
-
'CSYNC': 62, // Child-To-Parent Synchronization
|
|
164
|
-
'ZONEMD': 63, // Message Digest Over Zone Data
|
|
165
|
-
'SVCB': 64, // General-purpose service binding
|
|
166
|
-
'HTTPS': 65, // SVCB-compatible type for use with HTTP
|
|
167
|
-
'SPF': 99,
|
|
168
|
-
'UINFO': 100,
|
|
169
|
-
'UID': 101,
|
|
170
|
-
'GID': 102,
|
|
171
|
-
'UNSPEC': 103,
|
|
172
|
-
'NID': 104,
|
|
173
|
-
'L32': 105,
|
|
174
|
-
'L64': 106,
|
|
175
|
-
'LP': 107,
|
|
176
|
-
'EUI48': 108, // an EUI-48 address
|
|
177
|
-
'EUI64': 109, // an EUI-64 address
|
|
178
|
-
'NXNAME': 128, // NXDOMAIN indicator for Compact Denial of Existence
|
|
179
|
-
'TKEY': 249, // Transaction Key
|
|
180
|
-
'TSIG': 250, // Transaction Signature
|
|
181
|
-
'IXFR': 251, // incremental transfer
|
|
182
|
-
'AXFR': 252, // transfer of an entire zone
|
|
183
|
-
'MAILB': 253, // mailbox-related RRs (MB, MG or MR)
|
|
184
|
-
'MAILA': 254, // mail agent RRs (OBSOLETE - see MX)
|
|
185
|
-
'*': 255, // A request for some or all records the server has available
|
|
186
|
-
'URI': 256, // URI
|
|
187
|
-
'CAA': 257, // Certification Authority Restriction
|
|
188
|
-
'AVC': 258, // Application Visibility and Control
|
|
189
|
-
'DOA': 259, // Digital Object Architecture
|
|
190
|
-
'AMTRELAY': 260, // Automatic Multicast Tunneling Relay
|
|
191
|
-
'RESINFO': 261, // Resolver Information as Key/Value Pairs
|
|
192
|
-
'WALLET': 262, // Public wallet address
|
|
193
|
-
'CLA': 263, // BP Convergence Layer Adapter
|
|
194
|
-
'IPN': 264, // BP Node Number
|
|
195
|
-
'TA': 32_768, // DNSSEC Trust Authorities
|
|
196
|
-
'DLV': 32_769, // DNSSEC Lookaside Validation (OBSOLETE)
|
|
197
|
-
|
|
198
|
-
// Custom types here chosen within the Private Use Range
|
|
199
|
-
// https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
|
|
200
|
-
// https://www.rfc-editor.org/rfc/rfc5226
|
|
201
|
-
// as, per the RFC, the Private Use Range is reserved
|
|
202
|
-
// "For private or local use only, with the type and
|
|
203
|
-
// purpose defined by the local site. No attempt is made to
|
|
204
|
-
// prevent multiple sites from using the same value in
|
|
205
|
-
// different (and incompatible) ways. There is no need for
|
|
206
|
-
// IANA to review such assignments (since IANA does not record
|
|
207
|
-
// them) and assignments are not generally useful for broad
|
|
208
|
-
// interoperability. It is the responsibility of the sites
|
|
209
|
-
// making use of the Private Use range to ensure that no
|
|
210
|
-
// conflicts occur (within the intended scope of use)."
|
|
211
|
-
// If we want to apply for a custom reserved code later
|
|
212
|
-
// on, once the usage is proven enough we can absolutely
|
|
213
|
-
// do that.
|
|
214
|
-
'XYOA': 65_432, // XYO Address
|
|
215
|
-
'XYOH': 65_433, // XYO Hash
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export type DNSResourceRecordTypeValue = (typeof DNSResourceRecordTypes)[keyof typeof DNSResourceRecordTypes]
|
|
219
|
-
|
|
220
|
-
export const findDNSResourceRecordTypesByValue = (value: DNSResourceRecordTypeValue): DNSResourceRecordType | undefined => {
|
|
221
|
-
// Iterate through the keys of the record
|
|
222
|
-
for (const key in DNSResourceRecordTypes) {
|
|
223
|
-
const resourceRecordType = key as DNSResourceRecordType
|
|
224
|
-
if (DNSResourceRecordTypes[resourceRecordType] === value) {
|
|
225
|
-
return resourceRecordType // Return the key if the value matches
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return undefined // Return undefined if no matching value is found
|
|
229
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { DNSAnswer } from './Answer.ts'
|
|
2
|
-
import type { DNSResponseHeader } from './Header.ts'
|
|
3
|
-
import type { DNSRecord } from './Record.ts'
|
|
4
|
-
import type { DNSQuestion } from './Request.ts'
|
|
5
|
-
|
|
6
|
-
/* eslint-disable @typescript-eslint/member-ordering */
|
|
7
|
-
export interface DNSResponseFields extends DNSResponseHeader {
|
|
8
|
-
Question: DNSQuestion[] // The questions that were asked
|
|
9
|
-
Answer: DNSAnswer[] // Reusing DNSAnswer for the Answer Section
|
|
10
|
-
Authority?: DNSRecord[]
|
|
11
|
-
Additional?: DNSRecord[]
|
|
12
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export type DNSRcode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18
|
|
2
|
-
|
|
3
|
-
export type DNSRcodeName
|
|
4
|
-
= | 'NOERROR'
|
|
5
|
-
| 'FORMERR'
|
|
6
|
-
| 'SERVFAIL'
|
|
7
|
-
| 'NXDOMAIN'
|
|
8
|
-
| 'NOTIMP'
|
|
9
|
-
| 'REFUSED'
|
|
10
|
-
| 'YXDOMAIN'
|
|
11
|
-
| 'YXRRSET'
|
|
12
|
-
| 'NXRRSET'
|
|
13
|
-
| 'NOTAUTH'
|
|
14
|
-
| 'NOTZONE'
|
|
15
|
-
| 'BADSIG'
|
|
16
|
-
| 'BADKEY'
|
|
17
|
-
| 'BADTIME'
|
|
18
|
-
|
|
19
|
-
export const DNSRcodes: Readonly<Record<DNSRcodeName, DNSRcode>> = {
|
|
20
|
-
NOERROR: 0,
|
|
21
|
-
FORMERR: 1,
|
|
22
|
-
SERVFAIL: 2,
|
|
23
|
-
NXDOMAIN: 3,
|
|
24
|
-
NOTIMP: 4,
|
|
25
|
-
REFUSED: 5,
|
|
26
|
-
YXDOMAIN: 6,
|
|
27
|
-
YXRRSET: 7,
|
|
28
|
-
NXRRSET: 8,
|
|
29
|
-
NOTAUTH: 9,
|
|
30
|
-
NOTZONE: 10,
|
|
31
|
-
BADSIG: 16,
|
|
32
|
-
BADKEY: 17,
|
|
33
|
-
BADTIME: 18,
|
|
34
|
-
}
|
package/src/DNS/types/index.ts
DELETED
package/src/Domain/Domain.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { AsObjectFactory } from '@xylabs/object'
|
|
2
|
-
import type { Payload, WithSources } from '@xyo-network/payload-model'
|
|
3
|
-
import {
|
|
4
|
-
asSchema, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources,
|
|
5
|
-
} from '@xyo-network/payload-model'
|
|
6
|
-
|
|
7
|
-
export type DomainSchema = typeof DomainSchema
|
|
8
|
-
export const DomainSchema = asSchema('network.xyo.ns.domain', true)
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The supported TLDs for XNS
|
|
12
|
-
*/
|
|
13
|
-
export type TopLevelDomain = 'xyo'
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The fields for a domain record
|
|
17
|
-
*/
|
|
18
|
-
export interface DomainFields {
|
|
19
|
-
/**
|
|
20
|
-
* The XNS domain of the record
|
|
21
|
-
*/
|
|
22
|
-
domain: string
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The Top-Level Domain of the domain
|
|
26
|
-
*/
|
|
27
|
-
tld: TopLevelDomain
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* A domain record is a record of a domain
|
|
32
|
-
*/
|
|
33
|
-
export type Domain = Payload<DomainFields, DomainSchema>
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Identity function for Domain payload
|
|
37
|
-
*/
|
|
38
|
-
export const isDomain = isPayloadOfSchemaType<Domain>(DomainSchema)
|
|
39
|
-
export const asDomain = AsObjectFactory.create<Domain>(isDomain)
|
|
40
|
-
export const asOptionalDomain = AsObjectFactory.createOptional<Domain>(isDomain)
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Identity function for Domain payload with sources
|
|
44
|
-
*/
|
|
45
|
-
export const isDomainWithSources = isPayloadOfSchemaTypeWithSources<WithSources<Domain>>(DomainSchema)
|
|
46
|
-
export const asDomainWithSources = AsObjectFactory.create<WithSources<Domain>>(isDomainWithSources)
|
|
47
|
-
export const asOptionalDomainWithSources = AsObjectFactory.createOptional<WithSources<Domain>>(isDomainWithSources)
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AsObjectFactory } from '@xylabs/object'
|
|
2
|
-
import type { Payload, WithSources } from '@xyo-network/payload-model'
|
|
3
|
-
import {
|
|
4
|
-
asSchema, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources,
|
|
5
|
-
} from '@xyo-network/payload-model'
|
|
6
|
-
|
|
7
|
-
import type { DurationFields } from '../Duration/index.ts'
|
|
8
|
-
import type { DomainFields } from './Domain.ts'
|
|
9
|
-
|
|
10
|
-
export type DomainLeaseSchema = typeof DomainLeaseSchema
|
|
11
|
-
export const DomainLeaseSchema = asSchema('network.xyo.ns.domain.lease', true)
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A domain is leased for a duration
|
|
15
|
-
*/
|
|
16
|
-
export interface DomainLeaseFields extends DomainFields, DurationFields {}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A domain lease is a record of a domain and the duration it is leased for
|
|
20
|
-
*/
|
|
21
|
-
export type DomainLease = Payload<DomainLeaseFields, DomainLeaseSchema>
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Identity function for DomainLease payload
|
|
25
|
-
*/
|
|
26
|
-
export const isDomainLease = isPayloadOfSchemaType<DomainLease>(DomainLeaseSchema)
|
|
27
|
-
export const asDomainLease = AsObjectFactory.create<DomainLease>(isDomainLease)
|
|
28
|
-
export const asOptionalDomainLease = AsObjectFactory.createOptional<DomainLease>(isDomainLease)
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Identity function for DomainLease payload with sources
|
|
32
|
-
*/
|
|
33
|
-
export const isDomainLeaseWithSources = isPayloadOfSchemaTypeWithSources<WithSources<DomainLease>>(DomainLeaseSchema)
|
|
34
|
-
export const asDomainLeaseWithSources = AsObjectFactory.create<WithSources<DomainLease>>(isDomainLeaseWithSources)
|
|
35
|
-
export const asOptionalDomainLeaseWithSources = AsObjectFactory.createOptional<WithSources<DomainLease>>(isDomainLeaseWithSources)
|
package/src/Domain/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import type { HashLeaseEstimate } from '@xyo-network/diviner-hash-lease'
|
|
3
|
-
import type { WithSources } from '@xyo-network/payload-model'
|
|
4
|
-
|
|
5
|
-
import type { DomainRegistrationLease } from '../DomainRegistration/index.ts'
|
|
6
|
-
|
|
7
|
-
export type DomainEstimate = [
|
|
8
|
-
BoundWitness,
|
|
9
|
-
WithSources<HashLeaseEstimate>,
|
|
10
|
-
WithSources<DomainRegistrationLease>,
|
|
11
|
-
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './DomainEstimate.ts'
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Address } from '@xylabs/hex'
|
|
2
|
-
import { AsObjectFactory } from '@xylabs/object'
|
|
3
|
-
import type { Payload, WithSources } from '@xyo-network/payload-model'
|
|
4
|
-
import {
|
|
5
|
-
asSchema, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources,
|
|
6
|
-
} from '@xyo-network/payload-model'
|
|
7
|
-
|
|
8
|
-
import type { DomainFields } from '../Domain/index.ts'
|
|
9
|
-
import { DomainSchema } from '../Domain/index.ts'
|
|
10
|
-
|
|
11
|
-
export const DomainRegistrationSchema = asSchema(`${DomainSchema}.registration`, true)
|
|
12
|
-
export type DomainRegistrationSchema = typeof DomainRegistrationSchema
|
|
13
|
-
|
|
14
|
-
export interface DomainRegistrationFields extends DomainFields {
|
|
15
|
-
/**
|
|
16
|
-
* The registrant of the domain
|
|
17
|
-
*/
|
|
18
|
-
registrant: Address[]
|
|
19
|
-
/**
|
|
20
|
-
* The registrar of the domain
|
|
21
|
-
*/
|
|
22
|
-
registrar: Address[]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Delegation of a domain to a registrar by a registrant
|
|
27
|
-
*/
|
|
28
|
-
export type DomainRegistration = Payload<DomainRegistrationFields, DomainRegistrationSchema>
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Identity function for DomainRegistration payload
|
|
32
|
-
*/
|
|
33
|
-
export const isDomainRegistration = isPayloadOfSchemaType<DomainRegistration>(DomainRegistrationSchema)
|
|
34
|
-
export const asDomainRegistration = AsObjectFactory.create<DomainRegistration>(isDomainRegistration)
|
|
35
|
-
export const asOptionalDomainRegistration = AsObjectFactory.createOptional<DomainRegistration>(isDomainRegistration)
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Identity function for DomainRegistration payload with sources
|
|
39
|
-
*/
|
|
40
|
-
export const isDomainRegistrationWithSources = isPayloadOfSchemaTypeWithSources<WithSources<DomainRegistration>>(DomainRegistrationSchema)
|
|
41
|
-
export const asDomainRegistrationWithSources = AsObjectFactory.create<WithSources<DomainRegistration>>(isDomainRegistrationWithSources)
|
|
42
|
-
export const asOptionalDomainRegistrationWithSources = AsObjectFactory.createOptional<WithSources<DomainRegistration>>(isDomainRegistrationWithSources)
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { AsObjectFactory } from '@xylabs/object'
|
|
2
|
-
import type { Payload, WithSources } from '@xyo-network/payload-model'
|
|
3
|
-
import {
|
|
4
|
-
asSchema, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources,
|
|
5
|
-
} from '@xyo-network/payload-model'
|
|
6
|
-
|
|
7
|
-
import type { DurationFields } from '../Duration/index.ts'
|
|
8
|
-
import type { DomainRegistrationFields } from './DomainRegistration.ts'
|
|
9
|
-
import { DomainRegistrationSchema } from './DomainRegistration.ts'
|
|
10
|
-
|
|
11
|
-
export const DomainRegistrationLeaseSchema = asSchema(`${DomainRegistrationSchema}.lease`, true)
|
|
12
|
-
export type DomainRegistrationLeaseSchema = typeof DomainRegistrationLeaseSchema
|
|
13
|
-
|
|
14
|
-
export interface DomainRegistrationLeaseFields extends DomainRegistrationFields, DurationFields {}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Temporal delegation of a domain to a registrar by a registrant
|
|
18
|
-
*/
|
|
19
|
-
export type DomainRegistrationLease = Payload<DomainRegistrationLeaseFields, DomainRegistrationLeaseSchema>
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Identity function for DomainRegistrationLease payload
|
|
23
|
-
*/
|
|
24
|
-
export const isDomainRegistrationLease = isPayloadOfSchemaType<DomainRegistrationLease>(DomainRegistrationLeaseSchema)
|
|
25
|
-
export const asDomainRegistrationLease = AsObjectFactory.create<DomainRegistrationLease>(isDomainRegistrationLease)
|
|
26
|
-
export const asOptionalDomainRegistrationLease = AsObjectFactory.createOptional<DomainRegistrationLease>(isDomainRegistrationLease)
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Identity function for DomainRegistrationLease payload with sources
|
|
30
|
-
*/
|
|
31
|
-
export const isDomainRegistrationLeaseWithSources = isPayloadOfSchemaTypeWithSources<WithSources<DomainRegistrationLease>>(DomainRegistrationLeaseSchema)
|
|
32
|
-
export const asDomainRegistrationLeaseWithSources = AsObjectFactory.create<WithSources<DomainRegistrationLease>>(isDomainRegistrationLeaseWithSources)
|
|
33
|
-
export const asOptionalDomainRegistrationLeaseWithSources = AsObjectFactory
|
|
34
|
-
.createOptional<WithSources<DomainRegistrationLease>>(isDomainRegistrationLeaseWithSources)
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated Use isDomainRegistrationLeaseWithSources instead
|
|
38
|
-
*/
|
|
39
|
-
export const isDomainRegistrationLeaseSources = isDomainRegistrationLeaseWithSources
|
package/src/Duration/Duration.ts
DELETED
package/src/Duration/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'
|
|
3
|
-
import type { Schema } from '@xyo-network/payload-model'
|
|
4
|
-
|
|
5
|
-
// BW Validations
|
|
6
|
-
export const validateBoundWitness = async (recordBw: BoundWitness, requiredSchemas: Schema[] = []): Promise<boolean> => {
|
|
7
|
-
// If the BW does not include all of the required schemas
|
|
8
|
-
if (!requiredSchemas.every(requiredSchema => recordBw.payload_schemas.includes(requiredSchema))) return false
|
|
9
|
-
// If the BW is valid (does not include any errors)
|
|
10
|
-
const validator = new BoundWitnessValidator(recordBw)
|
|
11
|
-
const errors = await validator.validate()
|
|
12
|
-
return errors.length === 0
|
|
13
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
3
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
4
|
-
|
|
5
|
-
import type { DurationFields } from '../Duration.ts'
|
|
6
|
-
|
|
7
|
-
// BW & Record Validations
|
|
8
|
-
export const validateBoundWitnessAndDuration = async (recordBw: BoundWitness, recordPayload: Payload<DurationFields>): Promise<boolean> => {
|
|
9
|
-
if (!(await recordIsInBoundWitness(recordBw, recordPayload))) return false
|
|
10
|
-
return (recordIsTemporallyValidToBoundWitness(recordBw, recordPayload))
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const recordIsInBoundWitness = async (recordBw: BoundWitness, recordPayload: Payload): Promise<boolean> => {
|
|
14
|
-
const hash = await PayloadBuilder.dataHash(recordPayload)
|
|
15
|
-
return recordBw.payload_hashes.includes(hash)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// TODO: Use sequence for this?
|
|
19
|
-
const recordIsTemporallyValidToBoundWitness = (_recordBw: BoundWitness, _recordPayload: Payload<DurationFields>): boolean => {
|
|
20
|
-
/* const { timestamp } = recordBw
|
|
21
|
-
const { exp } = recordPayload
|
|
22
|
-
return exp > timestamp */
|
|
23
|
-
return true
|
|
24
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
3
|
-
|
|
4
|
-
import type { DurationFields } from '../Duration.ts'
|
|
5
|
-
import { validateBoundWitness } from './validateBoundWitness.ts'
|
|
6
|
-
import { validateBoundWitnessAndDuration } from './validateBoundWitnessAndDuration.ts'
|
|
7
|
-
import { validateDuration } from './validateDuration.ts'
|
|
8
|
-
|
|
9
|
-
export const validateBoundWitnessWithDuration = async (recordBw: BoundWitness, recordPayload: Payload<DurationFields>): Promise<boolean> => {
|
|
10
|
-
// Validate the BW
|
|
11
|
-
if (!(await validateBoundWitness(recordBw, [recordPayload.schema]))) return false
|
|
12
|
-
// Validate the record
|
|
13
|
-
if (!validateDuration(recordPayload)) return false
|
|
14
|
-
// Validate the record relative to the BW
|
|
15
|
-
return (await validateBoundWitnessAndDuration(recordBw, recordPayload))
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
2
|
-
|
|
3
|
-
import type { DurationFields } from '../Duration.ts'
|
|
4
|
-
|
|
5
|
-
// Record Validations
|
|
6
|
-
export const validateDuration = (recordPayload: Payload<DurationFields>): boolean => {
|
|
7
|
-
// if (!isValidAddress(recordPayload)) return false
|
|
8
|
-
return isWithinDelegatedTimeframe(recordPayload)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const isWithinDelegatedTimeframe = (recordPayload: Payload<DurationFields>, now = Date.now()): boolean => {
|
|
12
|
-
// nbf < now < exp
|
|
13
|
-
return recordPayload.nbf < now && now < recordPayload.exp
|
|
14
|
-
}
|
package/src/Hash/Payload.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Hash } from '@xylabs/hex'
|
|
2
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
3
|
-
import { asSchema, isPayloadOfSchemaType } from '@xyo-network/payload-model'
|
|
4
|
-
|
|
5
|
-
import type { DomainFields } from '../Domain/index.ts'
|
|
6
|
-
|
|
7
|
-
export type HashRecordSchema = typeof HashRecordSchema
|
|
8
|
-
export const HashRecordSchema = asSchema('network.xyo.ns.record.hash', true)
|
|
9
|
-
|
|
10
|
-
export interface HashRecordFields extends DomainFields {
|
|
11
|
-
/**
|
|
12
|
-
* The hash the record points to
|
|
13
|
-
*/
|
|
14
|
-
hash: Hash[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* An hash record points a domain to an hash
|
|
19
|
-
*/
|
|
20
|
-
export type HashRecord = Payload<HashRecordFields, HashRecordSchema>
|
|
21
|
-
|
|
22
|
-
export const isHashRecord = isPayloadOfSchemaType<HashRecord>(HashRecordSchema)
|
package/src/Hash/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Payload.ts'
|