@celo/base
Advanced tools
Comparing version 3.2.0 to 4.0.0-beta.1
export * from './account'; | ||
export * from './address'; | ||
export * from './async'; | ||
export * from './attestations'; | ||
export * from './collections'; | ||
@@ -10,2 +9,3 @@ export * from './contacts'; | ||
export * from './future'; | ||
export * from './identifier'; | ||
export * from './inputValidation'; | ||
@@ -12,0 +12,0 @@ export * from './io'; |
@@ -20,3 +20,2 @@ "use strict"; | ||
__exportStar(require("./async"), exports); | ||
__exportStar(require("./attestations"), exports); | ||
__exportStar(require("./collections"), exports); | ||
@@ -27,2 +26,3 @@ __exportStar(require("./contacts"), exports); | ||
__exportStar(require("./future"), exports); | ||
__exportStar(require("./identifier"), exports); | ||
__exportStar(require("./inputValidation"), exports); | ||
@@ -29,0 +29,0 @@ __exportStar(require("./io"), exports); |
@@ -8,8 +8,6 @@ export interface ParsedPhoneNumber { | ||
} | ||
export declare const getPhoneHash: (sha3: (a: string) => string | null, phoneNumber: string, salt?: string) => string; | ||
export declare function isE164Number(phoneNumber: string): boolean; | ||
export declare function anonymizedPhone(phoneNumber: string): string; | ||
export declare const PhoneNumberBase: { | ||
getPhoneHash: (sha3: (a: string) => string | null, phoneNumber: string, salt?: string) => string; | ||
isE164Number: typeof isE164Number; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PhoneNumberBase = exports.anonymizedPhone = exports.isE164Number = exports.getPhoneHash = void 0; | ||
var attestations_1 = require("./attestations"); | ||
var PHONE_SALT_SEPARATOR = '__'; | ||
exports.PhoneNumberBase = exports.anonymizedPhone = exports.isE164Number = void 0; | ||
var E164_REGEX = /^\+[1-9][0-9]{1,14}$/; | ||
var getPhoneHash = function (sha3, phoneNumber, salt) { | ||
if (!phoneNumber || !isE164Number(phoneNumber)) { | ||
throw Error('Attempting to hash a non-e164 number: ' + phoneNumber); | ||
} | ||
var prefix = (0, attestations_1.getIdentifierPrefix)(attestations_1.IdentifierType.PHONE_NUMBER); | ||
var value = prefix + (salt ? phoneNumber + PHONE_SALT_SEPARATOR + salt : phoneNumber); | ||
return sha3(value); | ||
}; | ||
exports.getPhoneHash = getPhoneHash; | ||
function isE164Number(phoneNumber) { | ||
@@ -25,5 +14,4 @@ return E164_REGEX.test(phoneNumber); | ||
exports.PhoneNumberBase = { | ||
getPhoneHash: exports.getPhoneHash, | ||
isE164Number: isE164Number, | ||
}; | ||
//# sourceMappingURL=phoneNumbers.js.map |
{ | ||
"name": "@celo/base", | ||
"version": "3.2.0", | ||
"version": "4.0.0-beta.1", | ||
"description": "Celo base common utils, no dependencies", | ||
@@ -5,0 +5,0 @@ "author": "Celo", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1
125582
66
1895
2