Socket
Socket
Sign inDemoInstall

@celo/base

Package Overview
Dependencies
Maintainers
21
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@celo/base - npm Package Compare versions

Comparing version 3.2.0 to 4.0.0-beta.1

lib/identifier.d.ts

2

lib/index.d.ts
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc