Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@tanker/identity

Package Overview
Dependencies
Maintainers
5
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanker/identity - npm Package Compare versions

Comparing version
3.2.0
to
3.2.1
+2
-2
dist/browser/errors/errors/InvalidArgument.js

@@ -8,3 +8,3 @@ "use strict";

var InvalidArgument = /** @class */ (function (_super) {
tslib_1.__extends(InvalidArgument, _super);
(0, tslib_1.__extends)(InvalidArgument, _super);
function InvalidArgument(name, expectedType, value) {

@@ -14,3 +14,3 @@ var _this = this;

if (expectedType) {
message = "name: " + name + " (" + expectedType + "), value: " + print_1.safePrintValue(value) + " (" + print_1.safePrintType(value) + ")";
message = "name: ".concat(name, " (").concat(expectedType, "), value: ").concat((0, print_1.safePrintValue)(value), " (").concat((0, print_1.safePrintType)(value), ")");
}

@@ -17,0 +17,0 @@ else {

@@ -24,3 +24,3 @@ "use strict";

if ('length' in value)
return constructorName + "(" + value.length + ")";
return "".concat(constructorName, "(").concat(value.length, ")");
return constructorName;

@@ -56,3 +56,3 @@ }

catch (err) {
return "" + value;
return "".concat(value);
}

@@ -59,0 +59,0 @@ }

@@ -6,3 +6,3 @@ "use strict";

var TankerError = /** @class */ (function (_super) {
tslib_1.__extends(TankerError, _super);
(0, tslib_1.__extends)(TankerError, _super);
function TankerError(name, message) {

@@ -21,3 +21,3 @@ if (name === void 0) { name = 'TankerError'; }

TankerError.prototype.toString = function () {
return "[Tanker] " + _super.prototype.toString.call(this);
return "[Tanker] ".concat(_super.prototype.toString.call(this));
};

@@ -24,0 +24,0 @@ return TankerError;

@@ -35,5 +35,5 @@ "use strict";

if (!aIdx)
throw new errors_1.InvalidArgument("Assertion error: unknown identity JSON key: " + a);
throw new errors_1.InvalidArgument("Assertion error: unknown identity JSON key: ".concat(a));
if (!bIdx)
throw new errors_1.InvalidArgument("Assertion error: unknown identity JSON key: " + b);
throw new errors_1.InvalidArgument("Assertion error: unknown identity JSON key: ".concat(b));
return aIdx - bIdx;

@@ -46,3 +46,3 @@ }

try {
for (var keys_1 = tslib_1.__values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
for (var keys_1 = (0, tslib_1.__values)(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
var k = keys_1_1.value;

@@ -54,3 +54,3 @@ var val = void 0;

val = JSON.stringify(o[k]);
json.push("\"" + k + "\":" + val);
json.push("\"".concat(k, "\":").concat(val));
}

@@ -65,3 +65,3 @@ }

}
return "{" + json.join(',') + "}";
return "{".concat(json.join(','), "}");
}

@@ -93,3 +93,3 @@ function toIdentityOrderedJson(identity) {

catch (e) {
throw new errors_1.InvalidArgument("Invalid identity provided: " + identity);
throw new errors_1.InvalidArgument("Invalid identity provided: ".concat(identity));
}

@@ -104,9 +104,9 @@ }

catch (e) {
throw new errors_1.InvalidArgument("Invalid secret permanent identity provided: " + identity);
throw new errors_1.InvalidArgument("Invalid secret permanent identity provided: ".concat(identity));
}
if (!isPermanentIdentity(result)) {
throw new errors_1.InvalidArgument("Expected a secret permanent identity, but got provisional identity with target: \"" + result.target + "\"");
throw new errors_1.InvalidArgument("Expected a secret permanent identity, but got provisional identity with target: \"".concat(result.target, "\""));
}
if (isPublicPermanentIdentity(result)) {
throw new errors_1.InvalidArgument("Expected a secret permanent identity, but got a public permanent identity: " + identity + "\"");
throw new errors_1.InvalidArgument("Expected a secret permanent identity, but got a public permanent identity: ".concat(identity, "\""));
}

@@ -122,6 +122,6 @@ return result;

catch (e) {
throw new errors_1.InvalidArgument("Invalid provisional identity provided: " + identity);
throw new errors_1.InvalidArgument("Invalid provisional identity provided: ".concat(identity));
}
if (!isProvisionalIdentity(result)) {
throw new errors_1.InvalidArgument("Expected a provisional identity, but contained target \"" + result.target + "\"");
throw new errors_1.InvalidArgument("Expected a provisional identity, but contained target \"".concat(result.target, "\""));
}

@@ -136,3 +136,3 @@ return result;

catch (e) {
throw new errors_1.InvalidArgument("Invalid public identity provided: " + identity);
throw new errors_1.InvalidArgument("Invalid public identity provided: ".concat(identity));
}

@@ -146,3 +146,3 @@ }

try {
for (var identities_1 = tslib_1.__values(identities), identities_1_1 = identities_1.next(); !identities_1_1.done; identities_1_1 = identities_1.next()) {
for (var identities_1 = (0, tslib_1.__values)(identities), identities_1_1 = identities_1.next(); !identities_1_1.done; identities_1_1 = identities_1.next()) {
var identity = identities_1_1.value;

@@ -183,5 +183,5 @@ if (isPermanentIdentity(identity)) {

function createIdentity(appId, appSecret, userId) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
var obfuscatedUserId, appSecretBytes, gerenatedAppId, ephemeralKeyPair, toSign, delegationSignature, userSecret, permanentIdentity;
return tslib_1.__generator(this, function (_a) {
return (0, tslib_1.__generator)(this, function (_a) {
switch (_a.label) {

@@ -198,3 +198,3 @@ case 0:

_a.sent();
obfuscatedUserId = userId_1.obfuscateUserId(crypto_1.utils.fromBase64(appId), userId);
obfuscatedUserId = (0, userId_1.obfuscateUserId)(crypto_1.utils.fromBase64(appId), userId);
appSecretBytes = crypto_1.utils.fromBase64(appSecret);

@@ -207,3 +207,3 @@ gerenatedAppId = _generateAppId(appSecretBytes);

delegationSignature = crypto_1.tcrypto.sign(toSign, appSecretBytes);
userSecret = userSecret_1.createUserSecretB64(appId, userId);
userSecret = (0, userSecret_1.createUserSecretB64)(appId, userId);
permanentIdentity = {

@@ -225,5 +225,5 @@ trustchain_id: appId,

function createProvisionalIdentity(appId, target, value) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
var encryptionKeys, signatureKeys, provisionalIdentity;
return tslib_1.__generator(this, function (_a) {
return (0, tslib_1.__generator)(this, function (_a) {
switch (_a.label) {

@@ -260,5 +260,5 @@ case 0:

function _getPublicHashedValueFromSecretProvisional(identity) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
var _a, _b, hashSalt, _c, _d;
return tslib_1.__generator(this, function (_e) {
return (0, tslib_1.__generator)(this, function (_e) {
switch (_e.label) {

@@ -268,13 +268,13 @@ case 0:

_b = (_a = crypto_1.utils).toBase64;
return [4 /*yield*/, crypto_1.generichash(crypto_1.utils.fromString(identity.value))];
return [4 /*yield*/, (0, crypto_1.generichash)(crypto_1.utils.fromString(identity.value))];
case 1: return [2 /*return*/, _b.apply(_a, [_e.sent()])];
case 2:
if (!(identity.target === 'phone_number')) return [3 /*break*/, 5];
return [4 /*yield*/, crypto_1.generichash(crypto_1.utils.fromBase64(identity.private_signature_key))];
return [4 /*yield*/, (0, crypto_1.generichash)(crypto_1.utils.fromBase64(identity.private_signature_key))];
case 3:
hashSalt = _e.sent();
_d = (_c = crypto_1.utils).toBase64;
return [4 /*yield*/, crypto_1.generichash(crypto_1.utils.concatArrays(hashSalt, crypto_1.utils.fromString(identity.value)))];
return [4 /*yield*/, (0, crypto_1.generichash)(crypto_1.utils.concatArrays(hashSalt, crypto_1.utils.fromString(identity.value)))];
case 4: return [2 /*return*/, _d.apply(_c, [_e.sent()])];
case 5: throw new errors_1.InvalidArgument("Unsupported identity target to hash: " + identity.target);
case 5: throw new errors_1.InvalidArgument("Unsupported identity target to hash: ".concat(identity.target));
}

@@ -286,5 +286,5 @@ });

function getPublicIdentity(tankerIdentity) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
var identity, trustchain_id, target, value, provIdentity, trustchain_id, public_signature_key, public_encryption_key, target, value, publicIdentity;
return tslib_1.__generator(this, function (_a) {
return (0, tslib_1.__generator)(this, function (_a) {
switch (_a.label) {

@@ -309,3 +309,3 @@ case 0:

trustchain_id = provIdentity.trustchain_id, public_signature_key = provIdentity.public_signature_key, public_encryption_key = provIdentity.public_encryption_key;
target = "hashed_" + provIdentity.target;
target = "hashed_".concat(provIdentity.target);
return [4 /*yield*/, _getPublicHashedValueFromSecretProvisional(provIdentity)];

@@ -322,3 +322,3 @@ case 2:

return [2 /*return*/, _serializeIdentity(publicIdentity)];
case 3: throw new errors_1.InvalidArgument("Invalid secret identity provided: " + tankerIdentity);
case 3: throw new errors_1.InvalidArgument("Invalid secret identity provided: ".concat(tankerIdentity));
}

@@ -330,5 +330,5 @@ });

function upgradeIdentity(tankerIdentity) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
var frozenIdentity, identity, pubIdentity, _a;
return tslib_1.__generator(this, function (_b) {
return (0, tslib_1.__generator)(this, function (_b) {
switch (_b.label) {

@@ -339,3 +339,3 @@ case 0:

frozenIdentity = _deserializeIdentity(tankerIdentity);
identity = tslib_1.__assign({}, frozenIdentity);
identity = (0, tslib_1.__assign)({}, frozenIdentity);
pubIdentity = identity;

@@ -342,0 +342,0 @@ if (!(identity.target === 'email' && !identity.private_encryption_key)) return [3 /*break*/, 2];

@@ -7,4 +7,4 @@ "use strict";

function obfuscateUserId(trustchainId, userId) {
return crypto_1.generichash(concatArrays(fromString(userId), trustchainId));
return (0, crypto_1.generichash)(concatArrays(fromString(userId), trustchainId));
}
exports.obfuscateUserId = obfuscateUserId;

@@ -14,3 +14,3 @@ "use strict";

// @ts-expect-error hash length always greater than 0
return crypto_1.generichash(input, hashSize)[0];
return (0, crypto_1.generichash)(input, hashSize)[0];
}

@@ -24,4 +24,4 @@ function createUserSecretBinary(trustchainId, userId) {

}
var rand = crypto_1.random(exports.USER_SECRET_SIZE - 1);
var checkByte = checksumByte(rand, userId_1.obfuscateUserId(fromBase64(trustchainId), userId));
var rand = (0, crypto_1.random)(exports.USER_SECRET_SIZE - 1);
var checkByte = checksumByte(rand, (0, userId_1.obfuscateUserId)(fromBase64(trustchainId), userId));
var secret = new Uint8Array(exports.USER_SECRET_SIZE);

@@ -39,9 +39,9 @@ secret.set(rand);

if (!(userId instanceof Uint8Array)) {
throw new Error("Assertion error: bad userId provided, expected a Uint8Array but got " + userId);
throw new Error("Assertion error: bad userId provided, expected a Uint8Array but got ".concat(userId));
}
if (!(secret instanceof Uint8Array)) {
throw new Error("Assertion error: bad secret provided, expected a Uint8Array but got " + secret);
throw new Error("Assertion error: bad secret provided, expected a Uint8Array but got ".concat(secret));
}
if (secret.length !== exports.USER_SECRET_SIZE) {
throw new Error("Assertion error: invalid secret length, expected " + exports.USER_SECRET_SIZE + " but got " + secret.length);
throw new Error("Assertion error: invalid secret length, expected ".concat(exports.USER_SECRET_SIZE, " but got ").concat(secret.length));
}

@@ -48,0 +48,0 @@ var checkByte = checksumByte(secret.subarray(0, exports.USER_SECRET_SIZE - 1), userId);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TANKER_IDENTITY_SDK_VERSION = void 0;
exports.TANKER_IDENTITY_SDK_VERSION = '3.2.0';
exports.TANKER_IDENTITY_SDK_VERSION = '3.2.1';

@@ -1,1 +0,1 @@

export const TANKER_IDENTITY_SDK_VERSION = '3.2.0';
export const TANKER_IDENTITY_SDK_VERSION = '3.2.1';

@@ -10,3 +10,3 @@ "use strict";

if (expectedType) {
message = `name: ${name} (${expectedType}), value: ${print_1.safePrintValue(value)} (${print_1.safePrintType(value)})`;
message = `name: ${name} (${expectedType}), value: ${(0, print_1.safePrintValue)(value)} (${(0, print_1.safePrintType)(value)})`;
}

@@ -13,0 +13,0 @@ else {

@@ -158,3 +158,3 @@ "use strict";

await crypto_1.ready;
const obfuscatedUserId = userId_1.obfuscateUserId(crypto_1.utils.fromBase64(appId), userId);
const obfuscatedUserId = (0, userId_1.obfuscateUserId)(crypto_1.utils.fromBase64(appId), userId);
const appSecretBytes = crypto_1.utils.fromBase64(appSecret);

@@ -167,3 +167,3 @@ const gerenatedAppId = _generateAppId(appSecretBytes);

const delegationSignature = crypto_1.tcrypto.sign(toSign, appSecretBytes);
const userSecret = userSecret_1.createUserSecretB64(appId, userId);
const userSecret = (0, userSecret_1.createUserSecretB64)(appId, userId);
const permanentIdentity = {

@@ -209,7 +209,7 @@ trustchain_id: appId,

if (identity.target === 'email') {
return crypto_1.utils.toBase64(await crypto_1.generichash(crypto_1.utils.fromString(identity.value)));
return crypto_1.utils.toBase64(await (0, crypto_1.generichash)(crypto_1.utils.fromString(identity.value)));
}
else if (identity.target === 'phone_number') {
const hashSalt = await crypto_1.generichash(crypto_1.utils.fromBase64(identity.private_signature_key));
return crypto_1.utils.toBase64(await crypto_1.generichash(crypto_1.utils.concatArrays(hashSalt, crypto_1.utils.fromString(identity.value))));
const hashSalt = await (0, crypto_1.generichash)(crypto_1.utils.fromBase64(identity.private_signature_key));
return crypto_1.utils.toBase64(await (0, crypto_1.generichash)(crypto_1.utils.concatArrays(hashSalt, crypto_1.utils.fromString(identity.value))));
}

@@ -216,0 +216,0 @@ else {

@@ -7,4 +7,4 @@ "use strict";

function obfuscateUserId(trustchainId, userId) {
return crypto_1.generichash(concatArrays(fromString(userId), trustchainId));
return (0, crypto_1.generichash)(concatArrays(fromString(userId), trustchainId));
}
exports.obfuscateUserId = obfuscateUserId;

@@ -14,3 +14,3 @@ "use strict";

// @ts-expect-error hash length always greater than 0
return crypto_1.generichash(input, hashSize)[0];
return (0, crypto_1.generichash)(input, hashSize)[0];
}

@@ -24,4 +24,4 @@ function createUserSecretBinary(trustchainId, userId) {

}
const rand = crypto_1.random(exports.USER_SECRET_SIZE - 1);
const checkByte = checksumByte(rand, userId_1.obfuscateUserId(fromBase64(trustchainId), userId));
const rand = (0, crypto_1.random)(exports.USER_SECRET_SIZE - 1);
const checkByte = checksumByte(rand, (0, userId_1.obfuscateUserId)(fromBase64(trustchainId), userId));
const secret = new Uint8Array(exports.USER_SECRET_SIZE);

@@ -28,0 +28,0 @@ secret.set(rand);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TANKER_IDENTITY_SDK_VERSION = void 0;
exports.TANKER_IDENTITY_SDK_VERSION = '3.2.0';
exports.TANKER_IDENTITY_SDK_VERSION = '3.2.1';

@@ -1,1 +0,1 @@

export declare const TANKER_IDENTITY_SDK_VERSION = "3.2.0";
export declare const TANKER_IDENTITY_SDK_VERSION = "3.2.1";
{
"name": "@tanker/identity",
"version": "3.2.0",
"version": "3.2.1",
"description": "Tanker Identity SDK",

@@ -29,3 +29,4 @@ "author": "Tanker Team",

"dependencies": {
"@tanker/crypto": "^2.15.0"
"@tanker/crypto": "^2.24.1",
"tslib": "^2.3.1"
},

@@ -32,0 +33,0 @@ "devDependencies": {