Skip to content

Commit

Permalink
fix: use @peculiar/webcrypto instead of isomorphic-webcrypto (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
amine7536 committed Nov 7, 2020
1 parent 185e8cc commit 82a74bc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 118 deletions.
121 changes: 7 additions & 114 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
"semantic-release": "semantic-release"
},
"dependencies": {
"@peculiar/webcrypto": "^1.1.3",
"axios": "^0.21.0",
"bs58": "^4.0.1",
"byte-base64": "^1.1.0",
"chalk": "^4.1.0",
"commander": "^6.2.0",
"isomorphic-webcrypto": "^2.3.6",
"pako": "^1.0.11",
"pjson": "^1.0.9",
"yaml": "^1.10.0"
Expand Down Expand Up @@ -100,4 +100,4 @@
]
]
}
}
}
2 changes: 1 addition & 1 deletion src/cmd/send.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import commander from 'commander';
import chalk from 'chalk';
import YAML from 'yaml';
import crypto from 'isomorphic-webcrypto';
import { encode } from 'bs58';

import { crypto } from '../lib/crypto';
import { PrivatebinClient } from '../lib';
import { PrivatebinResponse, PrivatebinOutput, PrivatebinOptions } from '../lib';

Expand Down
4 changes: 3 additions & 1 deletion src/lib/crypto.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import crypto from 'isomorphic-webcrypto';
import { Crypto } from '@peculiar/webcrypto';
import { bytesToBase64, base64ToBytes } from 'byte-base64';

import { PrivatebinSpec, PrivatebinPasteRequest, PrivatebinAdata } from './types';

export const crypto = new Crypto();

export function importKey(key: Uint8Array): Promise<CryptoKey> {
return crypto.subtle.importKey('raw', key, 'PBKDF2', false, ['deriveBits', 'deriveKey']);
}
Expand Down

0 comments on commit 82a74bc

Please sign in to comment.