@oneaddress/partner-sdk 2.7.0 → 2.9.0
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/CHANGELOG.md +172 -0
- package/README.md +203 -62
- package/dist/{chunk-OKAJO4T6.mjs → chunk-OKPEOGR5.mjs} +588 -51
- package/dist/{chunk-CLV6TLSP.mjs → chunk-PP2TM7HN.mjs} +80 -0
- package/dist/edge.d.mts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +591 -42
- package/dist/edge.mjs +28 -2
- package/dist/index.d.mts +452 -53
- package/dist/index.d.ts +452 -53
- package/dist/index.js +691 -49
- package/dist/index.mjs +52 -2
- package/dist/{src-FPYBM6X6.mjs → src-P3LR7F4A.mjs} +1 -1
- package/package.json +2 -2
|
@@ -3960,6 +3960,69 @@ function isBlockedIPv4(host) {
|
|
|
3960
3960
|
if (a === 192 && b === 168) return true;
|
|
3961
3961
|
if (a === 169 && b === 254) return true;
|
|
3962
3962
|
if (a === 100 && b >= 64 && b <= 127) return true;
|
|
3963
|
+
const c = octets[2];
|
|
3964
|
+
if (a === 192 && b === 0 && c === 0) return true;
|
|
3965
|
+
if (a === 198 && (b === 18 || b === 19)) return true;
|
|
3966
|
+
if (a >= 224 && a <= 239) return true;
|
|
3967
|
+
if (a >= 240) return true;
|
|
3968
|
+
return false;
|
|
3969
|
+
}
|
|
3970
|
+
function expandIPv6(clean2) {
|
|
3971
|
+
let text = clean2;
|
|
3972
|
+
const tail = [];
|
|
3973
|
+
const dotted = /^(.*:)(\d+\.\d+\.\d+\.\d+)$/.exec(text);
|
|
3974
|
+
if (dotted) {
|
|
3975
|
+
const parts = dotted[2].split(".").map((x) => Number.parseInt(x, 10));
|
|
3976
|
+
if (parts.some((x) => !Number.isInteger(x) || x > 255)) return null;
|
|
3977
|
+
tail.push(parts[0] << 8 | parts[1], parts[2] << 8 | parts[3]);
|
|
3978
|
+
text = dotted[1].endsWith("::") ? dotted[1] : dotted[1].slice(0, -1);
|
|
3979
|
+
}
|
|
3980
|
+
const halves = text.split("::");
|
|
3981
|
+
if (halves.length > 2) return null;
|
|
3982
|
+
const parse = (s) => {
|
|
3983
|
+
if (s === "") return [];
|
|
3984
|
+
const out = [];
|
|
3985
|
+
for (const g of s.split(":")) {
|
|
3986
|
+
if (!/^[0-9a-f]{1,4}$/.test(g)) return null;
|
|
3987
|
+
out.push(Number.parseInt(g, 16));
|
|
3988
|
+
}
|
|
3989
|
+
return out;
|
|
3990
|
+
};
|
|
3991
|
+
const head = parse(halves[0]);
|
|
3992
|
+
const rest = halves.length === 2 ? parse(halves[1]) : [];
|
|
3993
|
+
if (!head || !rest) return null;
|
|
3994
|
+
const known = head.length + rest.length + tail.length;
|
|
3995
|
+
if (halves.length === 1) {
|
|
3996
|
+
return known === 8 ? [...head, ...tail] : null;
|
|
3997
|
+
}
|
|
3998
|
+
if (known > 7) return null;
|
|
3999
|
+
return [...head, ...new Array(8 - known).fill(0), ...rest, ...tail];
|
|
4000
|
+
}
|
|
4001
|
+
function v4FromGroups(high, low) {
|
|
4002
|
+
return `${high >> 8 & 255}.${high & 255}.${low >> 8 & 255}.${low & 255}`;
|
|
4003
|
+
}
|
|
4004
|
+
function isBlockedIPv6Groups(g) {
|
|
4005
|
+
const first = g[0];
|
|
4006
|
+
if ((first & 65280) === 65280) return true;
|
|
4007
|
+
if ((first & 65472) === 65152) return true;
|
|
4008
|
+
if ((first & 65472) === 65216) return true;
|
|
4009
|
+
if ((first & 65024) === 64512) return true;
|
|
4010
|
+
if (first === 8194) return isBlockedIPv4(v4FromGroups(g[1], g[2]));
|
|
4011
|
+
if (first === 100 && g[1] === 65435) {
|
|
4012
|
+
if (g[2] === 0 && g[3] === 0 && g[4] === 0 && g[5] === 0) return isBlockedIPv4(v4FromGroups(g[6], g[7]));
|
|
4013
|
+
if (g[2] === 1) return isBlockedIPv4(v4FromGroups(g[6], g[7]));
|
|
4014
|
+
return true;
|
|
4015
|
+
}
|
|
4016
|
+
if (g[0] === 0 && g[1] === 0 && g[2] === 0 && g[3] === 0 && g[4] === 0) {
|
|
4017
|
+
if (g[5] === 65535 || g[5] === 0) {
|
|
4018
|
+
if (g[5] === 0 && g[6] === 0 && g[7] <= 1) return true;
|
|
4019
|
+
return isBlockedIPv4(v4FromGroups(g[6], g[7]));
|
|
4020
|
+
}
|
|
4021
|
+
return true;
|
|
4022
|
+
}
|
|
4023
|
+
if (g[0] === 0 && g[1] === 0 && g[2] === 0 && g[3] === 0 && g[4] === 65535 && g[5] === 0) {
|
|
4024
|
+
return isBlockedIPv4(v4FromGroups(g[6], g[7]));
|
|
4025
|
+
}
|
|
3963
4026
|
return false;
|
|
3964
4027
|
}
|
|
3965
4028
|
function v4FromHexPair(highHex, lowHex) {
|
|
@@ -3979,6 +4042,9 @@ function isBlockedIPv6(host) {
|
|
|
3979
4042
|
}
|
|
3980
4043
|
clean2 = clean2.split("%")[0];
|
|
3981
4044
|
if (!clean2.includes(":")) return false;
|
|
4045
|
+
const groups = expandIPv6(clean2);
|
|
4046
|
+
if (!groups) return true;
|
|
4047
|
+
if (isBlockedIPv6Groups(groups)) return true;
|
|
3982
4048
|
if (clean2 === "::1") return true;
|
|
3983
4049
|
if (clean2 === "::") return true;
|
|
3984
4050
|
if (clean2.startsWith("fe80:")) return true;
|
|
@@ -4327,12 +4393,26 @@ function hexToBytes4(hex) {
|
|
|
4327
4393
|
}
|
|
4328
4394
|
return out;
|
|
4329
4395
|
}
|
|
4396
|
+
function mapsAreCanonical(doc) {
|
|
4397
|
+
const canonical = (s) => typeof s === "string" && s === s.toLowerCase();
|
|
4398
|
+
for (const [partnerId, keyId] of Object.entries(doc.heads)) {
|
|
4399
|
+
if (!canonical(partnerId) || !canonical(keyId)) return false;
|
|
4400
|
+
}
|
|
4401
|
+
if (doc.staged === void 0) return true;
|
|
4402
|
+
if (!doc.staged || typeof doc.staged !== "object" || Array.isArray(doc.staged)) return false;
|
|
4403
|
+
for (const [partnerId, entry] of Object.entries(doc.staged)) {
|
|
4404
|
+
if (!canonical(partnerId) || !entry || typeof entry !== "object") return false;
|
|
4405
|
+
if (!canonical(entry.key_id) || !canonical(entry.key_sha256)) return false;
|
|
4406
|
+
}
|
|
4407
|
+
return true;
|
|
4408
|
+
}
|
|
4330
4409
|
async function verifyRegistryHead(doc, roots, now = /* @__PURE__ */ new Date()) {
|
|
4331
4410
|
try {
|
|
4332
4411
|
if (!doc || !KNOWN_VERSIONS.has(doc.version)) return "malformed";
|
|
4333
4412
|
if (doc.algorithm !== REGISTRY_HEAD_ALG) return "malformed";
|
|
4334
4413
|
if (typeof doc.signature !== "string" || !/^[0-9a-f]{128}$/i.test(doc.signature)) return "malformed";
|
|
4335
4414
|
if (!doc.heads || typeof doc.heads !== "object") return "malformed";
|
|
4415
|
+
if (!mapsAreCanonical(doc)) return "malformed";
|
|
4336
4416
|
const expires = Date.parse(doc.expires_at);
|
|
4337
4417
|
const issued = Date.parse(doc.issued_at);
|
|
4338
4418
|
if (Number.isNaN(expires) || Number.isNaN(issued)) return "malformed";
|
package/dist/edge.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { BlindIndexField, CURRENT_VERSION, ComparableAddress, DEFAULT_REPLAY_WINDOW_SECS, EncryptedPayload, OneAddressAccountVerifyEvent, OneAddressAddress, OneAddressCustomer, OneAddressCustomerMatch, OneAddressD5LOA, OneAddressHandlerOptions, OneAddressIdVerification, OneAddressLOA, OneAddressUpdateEvent, OneAddressVerifyEvent, SUPPORTED_VERSIONS, SessionData, SessionKeyShare, SessionUpdateType, VerifyResultCallbackParams, canonicalD5LoaForm, compareAddresses, computeBlindIndex, createOneAddressHandler, d5LoaRef, decrypt as decryptAddress, decryptLoaEncrypted, decryptSession, fetchLoaPublicKey, findMatchingStoredName, isEmailLike, isFreshTimestamp, namePoolMatches, normalizeForBlindIndex, sendVerifyResult, transform as transformAddress, transformSession, validateAddress, verifyD5LOA, verifyLOA, verify as verifySignature, verifyGrace as verifyWithGrace } from './index.mjs';
|
|
1
|
+
export { BlindIndexField, CURRENT_VERSION, ComparableAddress, DEFAULT_REPLAY_WINDOW_SECS, EncryptedPayload, LoaV2Context, LoaV2Refusal, LoaV2RefusedError, OneAddressAccountVerifyEvent, OneAddressAddress, OneAddressCustomer, OneAddressCustomerMatch, OneAddressD5LOA, OneAddressHandlerOptions, OneAddressIdVerification, OneAddressLOA, OneAddressUpdateEvent, OneAddressVerifyEvent, SUPPORTED_VERSIONS, SessionData, SessionKeyShare, SessionUpdateType, VerifyResultCallbackParams, acceptTypedAliases, canonicalD5LoaForm, canonicalD5LoaFormV2, checkLoaV2, compareAddresses, computeBlindIndex, createOneAddressHandler, d5LoaRef, decrypt as decryptAddress, decryptLoaEncrypted, decryptSession, fetchLoaPublicKey, findMatchingStoredName, hasLoaV2, isAcceptableAlias, isEmailLike, isFreshTimestamp, loaEnvelopeSha256, loaFirstName, loaNamesMatch, loaSurname, namePoolMatches, normaliseLoaName, normalizeForBlindIndex, sendVerifyResult, transform as transformAddress, transformSession, typedAliasesOf, validateAddress, verifyD5LOA, verifyD5LOAv2, verifyLOA, verify as verifySignature, verifyGrace as verifyWithGrace } from './index.mjs';
|
package/dist/edge.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { BlindIndexField, CURRENT_VERSION, ComparableAddress, DEFAULT_REPLAY_WINDOW_SECS, EncryptedPayload, OneAddressAccountVerifyEvent, OneAddressAddress, OneAddressCustomer, OneAddressCustomerMatch, OneAddressD5LOA, OneAddressHandlerOptions, OneAddressIdVerification, OneAddressLOA, OneAddressUpdateEvent, OneAddressVerifyEvent, SUPPORTED_VERSIONS, SessionData, SessionKeyShare, SessionUpdateType, VerifyResultCallbackParams, canonicalD5LoaForm, compareAddresses, computeBlindIndex, createOneAddressHandler, d5LoaRef, decrypt as decryptAddress, decryptLoaEncrypted, decryptSession, fetchLoaPublicKey, findMatchingStoredName, isEmailLike, isFreshTimestamp, namePoolMatches, normalizeForBlindIndex, sendVerifyResult, transform as transformAddress, transformSession, validateAddress, verifyD5LOA, verifyLOA, verify as verifySignature, verifyGrace as verifyWithGrace } from './index.js';
|
|
1
|
+
export { BlindIndexField, CURRENT_VERSION, ComparableAddress, DEFAULT_REPLAY_WINDOW_SECS, EncryptedPayload, LoaV2Context, LoaV2Refusal, LoaV2RefusedError, OneAddressAccountVerifyEvent, OneAddressAddress, OneAddressCustomer, OneAddressCustomerMatch, OneAddressD5LOA, OneAddressHandlerOptions, OneAddressIdVerification, OneAddressLOA, OneAddressUpdateEvent, OneAddressVerifyEvent, SUPPORTED_VERSIONS, SessionData, SessionKeyShare, SessionUpdateType, VerifyResultCallbackParams, acceptTypedAliases, canonicalD5LoaForm, canonicalD5LoaFormV2, checkLoaV2, compareAddresses, computeBlindIndex, createOneAddressHandler, d5LoaRef, decrypt as decryptAddress, decryptLoaEncrypted, decryptSession, fetchLoaPublicKey, findMatchingStoredName, hasLoaV2, isAcceptableAlias, isEmailLike, isFreshTimestamp, loaEnvelopeSha256, loaFirstName, loaNamesMatch, loaSurname, namePoolMatches, normaliseLoaName, normalizeForBlindIndex, sendVerifyResult, transform as transformAddress, transformSession, typedAliasesOf, validateAddress, verifyD5LOA, verifyD5LOAv2, verifyLOA, verify as verifySignature, verifyGrace as verifyWithGrace } from './index.js';
|