@airgap/beacon-utils
Advanced tools
Comparing version 4.1.3-beta.0 to 4.1.3-beta.1
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 } from './utils/crypto'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, isValidAddress, prefixPublicKey, encodePoeChallengePayload } 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.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.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"); | ||
@@ -22,2 +22,3 @@ Object.defineProperty(exports, "keys", { enumerable: true, get: function () { return keys_1.keys; } }); | ||
Object.defineProperty(exports, "prefixPublicKey", { enumerable: true, get: function () { return crypto_1.prefixPublicKey; } }); | ||
Object.defineProperty(exports, "encodePoeChallengePayload", { enumerable: true, get: function () { return crypto_1.encodePoeChallengePayload; } }); | ||
var generate_uuid_1 = require("./utils/generate-uuid"); | ||
@@ -24,0 +25,0 @@ Object.defineProperty(exports, "generateGUID", { enumerable: true, get: function () { return generate_uuid_1.generateGUID; } }); |
@@ -75,1 +75,2 @@ /// <reference types="node" /> | ||
export declare const isValidAddress: (address: string) => boolean; | ||
export declare function encodePoeChallengePayload(payload: string): string; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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.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"); | ||
@@ -26,2 +26,4 @@ const nacl_1 = require("@stablelib/nacl"); | ||
exports.secretbox_MACBYTES = 16; // crypto_secretbox_MACBYTES | ||
const POE_CHALLENGE_BYTES_LENGTH = 20; | ||
const POE_CHALLENGE_PREFIX = 110; | ||
/* eslint-disable prefer-arrow/prefer-arrow-functions */ | ||
@@ -255,3 +257,11 @@ /** | ||
exports.isValidAddress = isValidAddress; | ||
function encodePoeChallengePayload(payload) { | ||
const poeBlake2b = new blake2b_2.BLAKE2b(POE_CHALLENGE_BYTES_LENGTH); | ||
return bs58check.encode(Buffer.concat([ | ||
new Uint8Array([POE_CHALLENGE_PREFIX]), | ||
Buffer.from(poeBlake2b.update(Buffer.from(payload)).digest()) | ||
])); | ||
} | ||
exports.encodePoeChallengePayload = encodePoeChallengePayload; | ||
/* 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 } from './utils/crypto'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, isValidAddress, prefixPublicKey, encodePoeChallengePayload } 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 } from './utils/crypto'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, isValidAddress, prefixPublicKey, encodePoeChallengePayload } from './utils/crypto'; | ||
export { generateGUID } from './utils/generate-uuid'; | ||
@@ -5,0 +5,0 @@ export const CONTRACT_PREFIX = 'KT1'; |
@@ -75,1 +75,2 @@ /// <reference types="node" /> | ||
export declare const isValidAddress: (address: string) => boolean; | ||
export declare function encodePoeChallengePayload(payload: string): string; |
@@ -13,2 +13,4 @@ import * as bs58check from 'bs58check'; | ||
export const secretbox_MACBYTES = 16; // crypto_secretbox_MACBYTES | ||
const POE_CHALLENGE_BYTES_LENGTH = 20; | ||
const POE_CHALLENGE_PREFIX = 110; | ||
/* eslint-disable prefer-arrow/prefer-arrow-functions */ | ||
@@ -214,3 +216,10 @@ /** | ||
}; | ||
export function encodePoeChallengePayload(payload) { | ||
const poeBlake2b = new BLAKE2b(POE_CHALLENGE_BYTES_LENGTH); | ||
return bs58check.encode(Buffer.concat([ | ||
new Uint8Array([POE_CHALLENGE_PREFIX]), | ||
Buffer.from(poeBlake2b.update(Buffer.from(payload)).digest()) | ||
])); | ||
} | ||
/* eslint-enable prefer-arrow/prefer-arrow-functions */ | ||
//# sourceMappingURL=crypto.js.map |
{ | ||
"name": "@airgap/beacon-utils", | ||
"version": "4.1.3-beta.0", | ||
"version": "4.1.3-beta.1", | ||
"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": "ca90120c05ba9a81bc5e4953eae063978a61ab81" | ||
"gitHead": "b61caadbc7113294ec2f1b88be2398d866e185ac" | ||
} |
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
62105
999