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

@hapi/iron

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hapi/iron - npm Package Compare versions

Comparing version 5.1.3 to 5.1.4

147

lib/index.d.ts

@@ -1,15 +0,44 @@

export interface Options {
saltBits: number;
salt?: string;
algorithm: string;
iterations: number;
iv?: string;
minPasswordlength: number;
/**
Configuration options for built-in algorithms.
*/
export interface Algorithms {
'aes-128-ctr': {
keyBits: number;
ivBits: number;
};
'aes-256-cbc': {
keyBits: number;
ivBits: number;
};
'sha256': {
keyBits: number;
};
}
/**
seal() method options.
*/
export interface SealOptionsSub {
/**
The length of the salt (random buffer used to ensure that two identical objects will generate a different encrypted result). Defaults to 256.
*/
saltBits: number;
algorithm: string;
/**
The algorithm used. Defaults to 'aes-256-cbc' for encryption and 'sha256' for integrity.
*/
algorithm: keyof Algorithms;
/**
The number of iterations used to derive a key from the password. Defaults to 1.
*/
iterations: number;
/**
Minimum password size. Defaults to 32.
*/
minPasswordlength: number;

@@ -19,7 +48,41 @@ }

/**
generateKey() method options.
*/
export interface GenerateKeyOptions extends Pick<SealOptionsSub, 'algorithm' | 'iterations' | 'minPasswordlength'> {
saltBits?: number;
salt?: string;
iv?: string;
}
/**
Options for customizing the key derivation algorithm used to generate encryption and integrity verification keys as well as the algorithms and salt sizes used.
*/
export interface SealOptions {
/**
Encryption step options.
*/
encryption: SealOptionsSub;
/**
Integrity step options.
*/
integrity: SealOptionsSub;
/**
Sealed object lifetime in milliseconds where 0 means forever. Defaults to 0.
*/
ttl: number;
/**
Number of seconds of permitted clock skew for incoming expirations. Defaults to 60 seconds.
*/
timestampSkewSec: number;
/**
Local clock time offset, expressed in number of milliseconds (positive or negative). Defaults to 0.
*/
localtimeOffsetMsec: number;

@@ -29,4 +92,7 @@ }

/**
Generated internal key object.
*/
export interface Key {
key: string;
key: Buffer;
salt: string;

@@ -37,2 +103,14 @@ iv: string;

/**
Generated HMAC internal results.
*/
export interface HMacResult {
digest: string;
salt: string;
}
/**
Password secret string or buffer.
*/
type Password = string | Buffer

@@ -43,2 +121,5 @@

/**
Secret object with optional id.
*/
interface Secret {

@@ -49,2 +130,5 @@ id?: string,

/**
Secret object with optional id and specified password for each encryption and integrity.
*/
interface Specific {

@@ -56,2 +140,5 @@ id?: string,

/**
Key-value pairs hash of password id to value
*/
interface Hash {

@@ -64,2 +151,26 @@ [id: string]: Password | Secret | Specific;

/**
The default encryption and integrity settings.
*/
export const defaults: SealOptions;
/**
Configuration of each supported algorithm.
*/
export const algorithms: Algorithms;
/**
MAC normalization format version.
*/
export const macFormatVersion: string;
/**
MAC normalization prefix.
*/
export const macPrefix: string;
/**
Generates a key from the password

@@ -72,6 +183,5 @@

*/
export function generateKey(password: Password, options: GenerateKeyOptions): Promise<Key>
export function generateKey(password: Password, options: Options): Key
/**

@@ -86,6 +196,5 @@ Encrypt data

*/
export function encrypt(password: Password, options: GenerateKeyOptions, data: string): Promise<{ encrypted: Buffer, key: Key }>
export function encrypt(password: Password, options: Options, data: string): { encrypted: Buffer, key: Key }
/**

@@ -100,6 +209,5 @@ Decrypt data

*/
export function decrypt(password: Password, options: GenerateKeyOptions, data: string): Promise<string>
export function decrypt(password: Password, options: Options, data: string): string
/**

@@ -114,6 +222,5 @@ Calculates a HMAC digest

*/
export function hmacWithPassword(password: Password, options: GenerateKeyOptions, data: string): Promise<HMacResult>
export function hmacWithPassword(password: Password, options: Options, data: string): { digest: string, salt: string }
/**

@@ -128,6 +235,5 @@ Serializes, encrypts, and signs objects into an iron protocol string

*/
export function seal(object: any, password: Password | password.Secret | password.Specific, options: SealOptions): Promise<string>
export function seal(object: any, password: Password | password.Secret | password.Specific, options: SealOptions): string
/**

@@ -142,3 +248,2 @@ Verifies, decrypts, and reconstruct an iron protocol string into an object

*/
export function unseal(sealed: string, password: Password | password.Hash, options?: SealOptions): object
export function unseal(sealed: string, password: Password | password.Hash, options?: SealOptions): Promise<any>

2

package.json
{
"name": "@hapi/iron",
"description": "Encapsulated tokens (encrypted and mac'ed objects)",
"version": "5.1.3",
"version": "5.1.4",
"repository": "git://github.com/hueniverse/iron",

@@ -6,0 +6,0 @@ "main": "lib/index.js",

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