@airgap/beacon-utils
Advanced tools
Comparing version 4.2.2 to 4.2.3-alpha.0
export { keys } from './utils/keys'; | ||
export { ExposedPromise, ExposedPromiseStatus } from './utils/exposed-promise'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, isValidAddress, prefixPublicKey, encodePoeChallengePayload } from './utils/crypto'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, isValidAddress, prefixPublicKey, encodePoeChallengePayload, isPublicKeySC } from './utils/crypto'; | ||
export { generateGUID } from './utils/generate-uuid'; | ||
@@ -5,0 +5,0 @@ export declare const CONTRACT_PREFIX = "KT1"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.secretbox_MACBYTES = exports.secretbox_NONCEBYTES = exports.CONTRACT_PREFIX = exports.generateGUID = exports.encodePoeChallengePayload = exports.prefixPublicKey = exports.isValidAddress = exports.signMessage = exports.recipientString = exports.openCryptobox = exports.sealCryptobox = exports.getHexHash = exports.encryptCryptoboxPayload = exports.decryptCryptoboxPayload = exports.getAddressFromPublicKey = exports.toHex = exports.getKeypairFromSeed = exports.ExposedPromiseStatus = exports.ExposedPromise = exports.keys = void 0; | ||
exports.secretbox_MACBYTES = exports.secretbox_NONCEBYTES = exports.CONTRACT_PREFIX = exports.generateGUID = exports.isPublicKeySC = exports.encodePoeChallengePayload = exports.prefixPublicKey = exports.isValidAddress = exports.signMessage = exports.recipientString = exports.openCryptobox = exports.sealCryptobox = exports.getHexHash = exports.encryptCryptoboxPayload = exports.decryptCryptoboxPayload = exports.getAddressFromPublicKey = exports.toHex = exports.getKeypairFromSeed = exports.ExposedPromiseStatus = exports.ExposedPromise = exports.keys = void 0; | ||
var keys_1 = require("./utils/keys"); | ||
@@ -23,2 +23,3 @@ Object.defineProperty(exports, "keys", { enumerable: true, get: function () { return keys_1.keys; } }); | ||
Object.defineProperty(exports, "encodePoeChallengePayload", { enumerable: true, get: function () { return crypto_1.encodePoeChallengePayload; } }); | ||
Object.defineProperty(exports, "isPublicKeySC", { enumerable: true, get: function () { return crypto_1.isPublicKeySC; } }); | ||
var generate_uuid_1 = require("./utils/generate-uuid"); | ||
@@ -25,0 +26,0 @@ Object.defineProperty(exports, "generateGUID", { enumerable: true, get: function () { return generate_uuid_1.generateGUID; } }); |
@@ -76,1 +76,8 @@ /// <reference types="node" /> | ||
export declare function encodePoeChallengePayload(payload: string): string; | ||
/** | ||
* Shallow Check (SC): Perform a superficial check to determine if the string contains a public key. | ||
* Do not use this function to validate the key itself. | ||
* @param publicKey the public key to analyze | ||
* @returns true if it contains a known prefix, false otherwise | ||
*/ | ||
export declare function isPublicKeySC(publicKey: string): boolean; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.encodePoeChallengePayload = exports.isValidAddress = exports.signMessage = exports.recipientString = exports.prefixPublicKey = exports.getAddressFromPublicKey = exports.openCryptobox = exports.sealCryptobox = exports.decryptCryptoboxPayload = exports.encryptCryptoboxPayload = exports.getKeypairFromSeed = exports.getHexHash = exports.toHex = exports.secretbox_MACBYTES = exports.secretbox_NONCEBYTES = void 0; | ||
exports.isPublicKeySC = exports.encodePoeChallengePayload = exports.isValidAddress = exports.signMessage = exports.recipientString = exports.prefixPublicKey = exports.getAddressFromPublicKey = exports.openCryptobox = exports.sealCryptobox = exports.decryptCryptoboxPayload = exports.encryptCryptoboxPayload = exports.getKeypairFromSeed = exports.getHexHash = exports.toHex = exports.secretbox_MACBYTES = exports.secretbox_NONCEBYTES = void 0; | ||
const bs58check = require("bs58check"); | ||
@@ -163,2 +163,7 @@ const nacl_1 = require("@stablelib/nacl"); | ||
prefix: Buffer.from(new Uint8Array([6, 161, 164])) | ||
}, | ||
// tz4... | ||
BLpk: { | ||
length: 55, | ||
prefix: Buffer.from(new Uint8Array([6, 161, 166])) | ||
} | ||
@@ -263,3 +268,19 @@ }; | ||
exports.encodePoeChallengePayload = encodePoeChallengePayload; | ||
/** | ||
* Shallow Check (SC): Perform a superficial check to determine if the string contains a public key. | ||
* Do not use this function to validate the key itself. | ||
* @param publicKey the public key to analyze | ||
* @returns true if it contains a known prefix, false otherwise | ||
*/ | ||
function isPublicKeySC(publicKey) { | ||
if (!publicKey) { | ||
return false; | ||
} | ||
return (publicKey.startsWith('edpk') || | ||
publicKey.startsWith('sppk') || | ||
publicKey.startsWith('p2pk') || | ||
publicKey.startsWith('BLpk')); | ||
} | ||
exports.isPublicKeySC = isPublicKeySC; | ||
/* eslint-enable prefer-arrow/prefer-arrow-functions */ | ||
//# sourceMappingURL=crypto.js.map |
export { keys } from './utils/keys'; | ||
export { ExposedPromise, ExposedPromiseStatus } from './utils/exposed-promise'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, isValidAddress, prefixPublicKey, encodePoeChallengePayload } from './utils/crypto'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, isValidAddress, prefixPublicKey, encodePoeChallengePayload, isPublicKeySC } from './utils/crypto'; | ||
export { generateGUID } from './utils/generate-uuid'; | ||
@@ -5,0 +5,0 @@ export declare const CONTRACT_PREFIX = "KT1"; |
export { keys } from './utils/keys'; | ||
export { ExposedPromise, ExposedPromiseStatus } from './utils/exposed-promise'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, isValidAddress, prefixPublicKey, encodePoeChallengePayload } from './utils/crypto'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, isValidAddress, prefixPublicKey, encodePoeChallengePayload, isPublicKeySC } from './utils/crypto'; | ||
export { generateGUID } from './utils/generate-uuid'; | ||
@@ -5,0 +5,0 @@ export const CONTRACT_PREFIX = 'KT1'; |
@@ -76,1 +76,8 @@ /// <reference types="node" /> | ||
export declare function encodePoeChallengePayload(payload: string): string; | ||
/** | ||
* Shallow Check (SC): Perform a superficial check to determine if the string contains a public key. | ||
* Do not use this function to validate the key itself. | ||
* @param publicKey the public key to analyze | ||
* @returns true if it contains a known prefix, false otherwise | ||
*/ | ||
export declare function isPublicKeySC(publicKey: string): boolean; |
@@ -130,2 +130,7 @@ import * as bs58check from 'bs58check'; | ||
prefix: Buffer.from(new Uint8Array([6, 161, 164])) | ||
}, | ||
// tz4... | ||
BLpk: { | ||
length: 55, | ||
prefix: Buffer.from(new Uint8Array([6, 161, 166])) | ||
} | ||
@@ -223,3 +228,18 @@ }; | ||
} | ||
/** | ||
* Shallow Check (SC): Perform a superficial check to determine if the string contains a public key. | ||
* Do not use this function to validate the key itself. | ||
* @param publicKey the public key to analyze | ||
* @returns true if it contains a known prefix, false otherwise | ||
*/ | ||
export function isPublicKeySC(publicKey) { | ||
if (!publicKey) { | ||
return false; | ||
} | ||
return (publicKey.startsWith('edpk') || | ||
publicKey.startsWith('sppk') || | ||
publicKey.startsWith('p2pk') || | ||
publicKey.startsWith('BLpk')); | ||
} | ||
/* eslint-enable prefer-arrow/prefer-arrow-functions */ | ||
//# sourceMappingURL=crypto.js.map |
{ | ||
"name": "@airgap/beacon-utils", | ||
"version": "4.2.2", | ||
"version": "4.2.3-alpha.0", | ||
"description": "This package contains utility functions that are used throughout the beacon-sdk", | ||
@@ -43,3 +43,3 @@ "author": "Andreas Gassmann <a.gassmann@papers.ch>", | ||
}, | ||
"gitHead": "82a6778e61907dec4db93e5d4b6c5729fc4cea7c" | ||
"gitHead": "c5ebb518fae3a9c8881ca53a7c00720033f9961b" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
65135
1057
1