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

@interledger/http-signature-utils

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interledger/http-signature-utils - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

2

dist/index.d.ts
export { createHeaders, getKeyId, Headers } from './utils/headers';
export { generateJwk, JWK } from './utils/jwk';
export { parseOrProvisionKey } from './utils/key';
export { parseOrProvisionKey, loadBase64Key } from './utils/key';
export { createSignatureHeaders } from './utils/signatures';

@@ -5,0 +5,0 @@ export { validateSignatureHeaders, validateSignature } from './utils/validation';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateTestKeys = exports.validateSignature = exports.validateSignatureHeaders = exports.createSignatureHeaders = exports.parseOrProvisionKey = exports.generateJwk = exports.getKeyId = exports.createHeaders = void 0;
exports.generateTestKeys = exports.validateSignature = exports.validateSignatureHeaders = exports.createSignatureHeaders = exports.loadBase64Key = exports.parseOrProvisionKey = exports.generateJwk = exports.getKeyId = exports.createHeaders = void 0;
var headers_1 = require("./utils/headers");

@@ -11,2 +11,3 @@ Object.defineProperty(exports, "createHeaders", { enumerable: true, get: function () { return headers_1.createHeaders; } });

Object.defineProperty(exports, "parseOrProvisionKey", { enumerable: true, get: function () { return key_1.parseOrProvisionKey; } });
Object.defineProperty(exports, "loadBase64Key", { enumerable: true, get: function () { return key_1.loadBase64Key; } });
var signatures_1 = require("./utils/signatures");

@@ -13,0 +14,0 @@ Object.defineProperty(exports, "createSignatureHeaders", { enumerable: true, get: function () { return signatures_1.createSignatureHeaders; } });

/// <reference types="node" />
import * as crypto from 'crypto';
export declare function parseOrProvisionKey(keyFile: string | undefined): crypto.KeyObject;
export declare function loadBase64Key(base64Key: string): crypto.KeyObject | undefined;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.parseOrProvisionKey = void 0;
exports.loadBase64Key = exports.parseOrProvisionKey = void 0;
const crypto = __importStar(require("crypto"));

@@ -35,4 +35,3 @@ const fs = __importStar(require("fs"));

const key = crypto.createPrivateKey(fs.readFileSync(keyFile));
const jwk = key.export({ format: 'jwk' });
if (jwk.crv === 'Ed25519') {
if (checkKey(key)) {
console.log(`Key ${keyFile} loaded.`);

@@ -58,1 +57,13 @@ return key;

exports.parseOrProvisionKey = parseOrProvisionKey;
function loadBase64Key(base64Key) {
const privateKey = Buffer.from(base64Key, 'base64').toString('utf-8');
const key = crypto.createPrivateKey(privateKey);
if (checkKey(key)) {
return key;
}
}
exports.loadBase64Key = loadBase64Key;
function checkKey(key) {
const jwk = key.export({ format: 'jwk' });
return jwk.crv === 'Ed25519';
}
{
"name": "@interledger/http-signature-utils",
"version": "1.0.4",
"version": "1.1.0",
"description": "Provides utilities for working with HTTP signatures",

@@ -5,0 +5,0 @@ "repository": {

@@ -28,2 +28,10 @@ # HTTP Signature Utils Library

Load a base64 encoded Ed25519 private key:
```ts
const key = loadBase64Key(
'LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1DNENBUUF3QlFZREsyVndCQ0lFSUkvWHBwdkZPOWltNE9odWkxNytVMnpWNUNuMDJBWXBZWFpwcUlSQ1M0UFkKLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQo='
)
```
Create JWK from private Ed25519 key:

@@ -30,0 +38,0 @@

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