Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mysten/zklogin

Package Overview
Dependencies
Maintainers
4
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mysten/zklogin - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

5

./dist/cjs/index.js

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

__export(src_exports, {
computeZkAddress: () => import_address.computeZkAddress,
computeZkLoginAddress: () => import_address.computeZkLoginAddress,
genAddressSeed: () => import_utils.genAddressSeed,

@@ -29,3 +29,4 @@ generateNonce: () => import_nonce.generateNonce,

jwtToAddress: () => import_address.jwtToAddress,
poseidonHash: () => import_poseidon.poseidonHash
poseidonHash: () => import_poseidon.poseidonHash,
toBigIntBE: () => import_utils.toBigIntBE
});

@@ -32,0 +33,0 @@ module.exports = __toCommonJS(src_exports);

# @mysten/zklogin
## 0.1.6
### Patch Changes
- c5684bb52: rename zk to zkLogin
- Updated dependencies [faa13ded9]
- Updated dependencies [c5684bb52]
- @mysten/sui.js@0.43.1
## 0.1.5

@@ -4,0 +13,0 @@

4

dist/cjs/address.d.ts
export declare function jwtToAddress(jwt: string, userSalt: bigint): string;
export interface ComputeZKAddressOptions {
export interface ComputeZkLoginAddressOptions {
claimName: string;

@@ -9,2 +9,2 @@ claimValue: string;

}
export declare function computeZkAddress({ claimName, claimValue, iss, aud, userSalt, }: ComputeZKAddressOptions): string;
export declare function computeZkLoginAddress({ claimName, claimValue, iss, aud, userSalt, }: ComputeZkLoginAddressOptions): string;

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

__export(address_exports, {
computeZkAddress: () => computeZkAddress,
computeZkLoginAddress: () => computeZkLoginAddress,
jwtToAddress: () => jwtToAddress

@@ -37,3 +37,3 @@ });

}
return computeZkAddress({
return computeZkLoginAddress({
userSalt,

@@ -46,3 +46,3 @@ claimName: "sub",

}
function computeZkAddress({
function computeZkLoginAddress({
claimName,

@@ -49,0 +49,0 @@ claimValue,

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

export { computeZkAddress, jwtToAddress } from './address.js';
export type { ComputeZKAddressOptions } from './address.js';
export { computeZkLoginAddress, jwtToAddress } from './address.js';
export type { ComputeZkLoginAddressOptions } from './address.js';
export { getZkLoginSignature } from '@mysten/sui.js/zklogin';
export { poseidonHash } from './poseidon.js';
export { generateNonce, generateRandomness } from './nonce.js';
export { hashASCIIStrToField, genAddressSeed } from './utils.js';
export { hashASCIIStrToField, genAddressSeed, toBigIntBE } from './utils.js';

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

__export(src_exports, {
computeZkAddress: () => import_address.computeZkAddress,
computeZkLoginAddress: () => import_address.computeZkLoginAddress,
genAddressSeed: () => import_utils.genAddressSeed,

@@ -29,3 +29,4 @@ generateNonce: () => import_nonce.generateNonce,

jwtToAddress: () => import_address.jwtToAddress,
poseidonHash: () => import_poseidon.poseidonHash
poseidonHash: () => import_poseidon.poseidonHash,
toBigIntBE: () => import_utils.toBigIntBE
});

@@ -32,0 +33,0 @@ module.exports = __toCommonJS(src_exports);

@@ -27,11 +27,11 @@ "use strict";

var import_utils = require("@noble/hashes/utils");
var import_bigint_buffer = require("bigint-buffer");
var import_jose = require("jose");
var import_poseidon = require("./poseidon.js");
var import_utils2 = require("./utils.js");
const NONCE_LENGTH = 27;
function generateRandomness() {
return (0, import_bigint_buffer.toBigIntBE)(Buffer.from((0, import_utils.randomBytes)(16)));
return (0, import_utils2.toBigIntBE)(Buffer.from((0, import_utils.randomBytes)(16)));
}
function generateNonce(publicKey, maxEpoch, randomness) {
const publicKeyBytes = (0, import_bigint_buffer.toBigIntBE)(Buffer.from(publicKey.toSuiBytes()));
const publicKeyBytes = (0, import_utils2.toBigIntBE)(Buffer.from(publicKey.toSuiBytes()));
const eph_public_key_0 = publicKeyBytes / 2n ** 128n;

@@ -38,0 +38,0 @@ const eph_public_key_1 = publicKeyBytes % 2n ** 128n;

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

/// <reference types="node" />
export declare function toBigIntBE(buffer: Buffer): bigint;
/**

@@ -2,0 +4,0 @@ * Splits an array into chunks of size chunk_size. If the array is not evenly

@@ -23,3 +23,4 @@ "use strict";

genAddressSeed: () => genAddressSeed,
hashASCIIStrToField: () => hashASCIIStrToField
hashASCIIStrToField: () => hashASCIIStrToField,
toBigIntBE: () => toBigIntBE
});

@@ -32,2 +33,9 @@ module.exports = __toCommonJS(utils_exports);

const PACK_WIDTH = 248;
function toBigIntBE(buffer) {
const hex = buffer.toString("hex");
if (hex.length === 0) {
return BigInt(0);
}
return BigInt(`0x${hex}`);
}
function chunkArray(array, chunk_size) {

@@ -34,0 +42,0 @@ const chunks = Array(Math.ceil(array.length / chunk_size));

export declare function jwtToAddress(jwt: string, userSalt: bigint): string;
export interface ComputeZKAddressOptions {
export interface ComputeZkLoginAddressOptions {
claimName: string;

@@ -9,2 +9,2 @@ claimValue: string;

}
export declare function computeZkAddress({ claimName, claimValue, iss, aud, userSalt, }: ComputeZKAddressOptions): string;
export declare function computeZkLoginAddress({ claimName, claimValue, iss, aud, userSalt, }: ComputeZkLoginAddressOptions): string;

@@ -12,3 +12,3 @@ import { computeZkLoginAddressFromSeed } from "@mysten/sui.js/zklogin";

}
return computeZkAddress({
return computeZkLoginAddress({
userSalt,

@@ -21,3 +21,3 @@ claimName: "sub",

}
function computeZkAddress({
function computeZkLoginAddress({
claimName,

@@ -32,5 +32,5 @@ claimValue,

export {
computeZkAddress,
computeZkLoginAddress,
jwtToAddress
};
//# sourceMappingURL=address.js.map

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

export { computeZkAddress, jwtToAddress } from './address.js';
export type { ComputeZKAddressOptions } from './address.js';
export { computeZkLoginAddress, jwtToAddress } from './address.js';
export type { ComputeZkLoginAddressOptions } from './address.js';
export { getZkLoginSignature } from '@mysten/sui.js/zklogin';
export { poseidonHash } from './poseidon.js';
export { generateNonce, generateRandomness } from './nonce.js';
export { hashASCIIStrToField, genAddressSeed } from './utils.js';
export { hashASCIIStrToField, genAddressSeed, toBigIntBE } from './utils.js';

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

import { computeZkAddress, jwtToAddress } from "./address.js";
import { computeZkLoginAddress, jwtToAddress } from "./address.js";
import { getZkLoginSignature } from "@mysten/sui.js/zklogin";
import { poseidonHash } from "./poseidon.js";
import { generateNonce, generateRandomness } from "./nonce.js";
import { hashASCIIStrToField, genAddressSeed } from "./utils.js";
import { hashASCIIStrToField, genAddressSeed, toBigIntBE } from "./utils.js";
export {
computeZkAddress,
computeZkLoginAddress,
genAddressSeed,

@@ -14,4 +14,5 @@ generateNonce,

jwtToAddress,
poseidonHash
poseidonHash,
toBigIntBE
};
//# sourceMappingURL=index.js.map
import { toBigEndianBytes } from "@mysten/sui.js/zklogin";
import { randomBytes } from "@noble/hashes/utils";
import { toBigIntBE } from "bigint-buffer";
import { base64url } from "jose";
import { poseidonHash } from "./poseidon.js";
import { toBigIntBE } from "./utils.js";
const NONCE_LENGTH = 27;

@@ -7,0 +7,0 @@ function generateRandomness() {

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

/// <reference types="node" />
export declare function toBigIntBE(buffer: Buffer): bigint;
/**

@@ -2,0 +4,0 @@ * Splits an array into chunks of size chunk_size. If the array is not evenly

@@ -6,2 +6,9 @@ import { poseidonHash } from "./poseidon.js";

const PACK_WIDTH = 248;
function toBigIntBE(buffer) {
const hex = buffer.toString("hex");
if (hex.length === 0) {
return BigInt(0);
}
return BigInt(`0x${hex}`);
}
function chunkArray(array, chunk_size) {

@@ -39,4 +46,5 @@ const chunks = Array(Math.ceil(array.length / chunk_size));

genAddressSeed,
hashASCIIStrToField
hashASCIIStrToField,
toBigIntBE
};
//# sourceMappingURL=utils.js.map
{
"name": "@mysten/zklogin",
"version": "0.1.5",
"version": "0.1.6",
"description": "Utilities for interacting with zkLogin in Sui",

@@ -32,2 +32,3 @@ "license": "Apache-2.0",

"devDependencies": {
"@types/node": "^20.4.2",
"typescript": "^5.1.6",

@@ -38,3 +39,2 @@ "@mysten/build-scripts": "0.0.0"

"@noble/hashes": "^1.3.1",
"bigint-buffer": "^1.1.5",
"jose": "^4.14.4",

@@ -44,3 +44,3 @@ "poseidon-lite": "^0.2.0",

"@mysten/bcs": "0.8.0",
"@mysten/sui.js": "0.43.0"
"@mysten/sui.js": "0.43.1"
},

@@ -47,0 +47,0 @@ "scripts": {

@@ -19,3 +19,3 @@ // Copyright (c) Mysten Labs, Inc.

return computeZkAddress({
return computeZkLoginAddress({
userSalt,

@@ -29,3 +29,3 @@ claimName: 'sub',

export interface ComputeZKAddressOptions {
export interface ComputeZkLoginAddressOptions {
claimName: string;

@@ -38,3 +38,3 @@ claimValue: string;

export function computeZkAddress({
export function computeZkLoginAddress({
claimName,

@@ -45,4 +45,4 @@ claimValue,

userSalt,
}: ComputeZKAddressOptions) {
}: ComputeZkLoginAddressOptions) {
return computeZkLoginAddressFromSeed(genAddressSeed(userSalt, claimName, claimValue, aud), iss);
}
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
export { computeZkAddress, jwtToAddress } from './address.js';
export type { ComputeZKAddressOptions } from './address.js';
export { computeZkLoginAddress, jwtToAddress } from './address.js';
export type { ComputeZkLoginAddressOptions } from './address.js';

@@ -13,2 +13,2 @@ export { getZkLoginSignature } from '@mysten/sui.js/zklogin';

export { hashASCIIStrToField, genAddressSeed } from './utils.js';
export { hashASCIIStrToField, genAddressSeed, toBigIntBE } from './utils.js';

@@ -7,6 +7,6 @@ // Copyright (c) Mysten Labs, Inc.

import { randomBytes } from '@noble/hashes/utils';
import { toBigIntBE } from 'bigint-buffer';
import { base64url } from 'jose';
import { poseidonHash } from './poseidon.js';
import { toBigIntBE } from './utils.js';

@@ -13,0 +13,0 @@ const NONCE_LENGTH = 27;

@@ -11,2 +11,10 @@ // Copyright (c) Mysten Labs, Inc.

export function toBigIntBE(buffer: Buffer) {
const hex = buffer.toString('hex');
if (hex.length === 0) {
return BigInt(0);
}
return BigInt(`0x${hex}`);
}
/**

@@ -13,0 +21,0 @@ * Splits an array into chunks of size chunk_size. If the array is not evenly

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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