@airgap/beacon-utils
Advanced tools
Comparing version 4.0.10-beta.2 to 4.0.10
export { keys } from './utils/keys'; | ||
export { ExposedPromise, ExposedPromiseStatus } from './utils/exposed-promise'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage } from './utils/crypto'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, prefixPublicKey } from './utils/crypto'; | ||
export { generateGUID } from './utils/generate-uuid'; | ||
export declare const secretbox_NONCEBYTES = 24; | ||
export declare const secretbox_MACBYTES = 16; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.secretbox_MACBYTES = exports.secretbox_NONCEBYTES = exports.generateGUID = 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.generateGUID = exports.prefixPublicKey = 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"); | ||
@@ -20,2 +20,3 @@ Object.defineProperty(exports, "keys", { enumerable: true, get: function () { return keys_1.keys; } }); | ||
Object.defineProperty(exports, "signMessage", { enumerable: true, get: function () { return crypto_1.signMessage; } }); | ||
Object.defineProperty(exports, "prefixPublicKey", { enumerable: true, get: function () { return crypto_1.prefixPublicKey; } }); | ||
var generate_uuid_1 = require("./utils/generate-uuid"); | ||
@@ -22,0 +23,0 @@ Object.defineProperty(exports, "generateGUID", { enumerable: true, get: function () { return generate_uuid_1.generateGUID; } }); |
@@ -59,2 +59,8 @@ /// <reference types="node" /> | ||
/** | ||
* Prefix the public key if it's not prefixed | ||
* | ||
* @param publicKey | ||
*/ | ||
export declare function prefixPublicKey(publicKey: string): Promise<string>; | ||
/** | ||
* Get the recipient string used in the matrix message | ||
@@ -61,0 +67,0 @@ * |
@@ -39,3 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.signMessage = exports.recipientString = 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.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; | ||
var bs58check = require("bs58check"); | ||
@@ -237,2 +237,20 @@ var nacl_1 = require("@stablelib/nacl"); | ||
/** | ||
* Prefix the public key if it's not prefixed | ||
* | ||
* @param publicKey | ||
*/ | ||
function prefixPublicKey(publicKey) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var payload; | ||
return __generator(this, function (_a) { | ||
if (publicKey.length !== 64) { | ||
return [2 /*return*/, publicKey]; | ||
} | ||
payload = Buffer.from(publicKey, 'hex'); | ||
return [2 /*return*/, bs58check.encode(Buffer.concat([new Uint8Array([13, 15, 37, 217]), Buffer.from(payload)]))]; | ||
}); | ||
}); | ||
} | ||
exports.prefixPublicKey = prefixPublicKey; | ||
/** | ||
* Get the recipient string used in the matrix message | ||
@@ -239,0 +257,0 @@ * |
export { keys } from './utils/keys'; | ||
export { ExposedPromise, ExposedPromiseStatus } from './utils/exposed-promise'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage } from './utils/crypto'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, prefixPublicKey } from './utils/crypto'; | ||
export { generateGUID } from './utils/generate-uuid'; | ||
export declare const secretbox_NONCEBYTES = 24; | ||
export declare const secretbox_MACBYTES = 16; |
export { keys } from './utils/keys'; | ||
export { ExposedPromise, ExposedPromiseStatus } from './utils/exposed-promise'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage } from './utils/crypto'; | ||
export { getKeypairFromSeed, toHex, getAddressFromPublicKey, decryptCryptoboxPayload, encryptCryptoboxPayload, getHexHash, sealCryptobox, openCryptobox, recipientString, signMessage, prefixPublicKey } from './utils/crypto'; | ||
export { generateGUID } from './utils/generate-uuid'; | ||
@@ -5,0 +5,0 @@ export const secretbox_NONCEBYTES = 24; // crypto_secretbox_NONCEBYTES |
@@ -59,2 +59,8 @@ /// <reference types="node" /> | ||
/** | ||
* Prefix the public key if it's not prefixed | ||
* | ||
* @param publicKey | ||
*/ | ||
export declare function prefixPublicKey(publicKey: string): Promise<string>; | ||
/** | ||
* Get the recipient string used in the matrix message | ||
@@ -61,0 +67,0 @@ * |
@@ -178,2 +178,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
/** | ||
* Prefix the public key if it's not prefixed | ||
* | ||
* @param publicKey | ||
*/ | ||
export function prefixPublicKey(publicKey) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (publicKey.length !== 64) { | ||
return publicKey; | ||
} | ||
const payload = Buffer.from(publicKey, 'hex'); | ||
return bs58check.encode(Buffer.concat([new Uint8Array([13, 15, 37, 217]), Buffer.from(payload)])); | ||
}); | ||
} | ||
/** | ||
* Get the recipient string used in the matrix message | ||
@@ -180,0 +194,0 @@ * |
{ | ||
"name": "@airgap/beacon-utils", | ||
"version": "4.0.10-beta.2", | ||
"description": "> TODO: description", | ||
"version": "4.0.10", | ||
"description": "This package contains utility functions that are used throughout the beacon-sdk", | ||
"author": "Andreas Gassmann <a.gassmann@papers.ch>", | ||
@@ -43,3 +43,3 @@ "homepage": "https://walletbeacon.io", | ||
}, | ||
"gitHead": "002d31e0818c444db548b9dda2d11fde00812a41" | ||
"gitHead": "b32a028d4d9036f561a97bc6ada75af792a6d6ee" | ||
} |
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
66869
1099
0