-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
resolves #119
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import type { GetRandomValuesFunction } from '../interfaces.d' | ||
import crypto from './webcrypto.js' | ||
|
||
const random: GetRandomValuesFunction = crypto.getRandomValues.bind(crypto) | ||
const random = crypto.getRandomValues.bind(crypto) | ||
|
||
export default random |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
import { randomFillSync } from 'crypto' | ||
import type { GetRandomValuesFunction } from '../interfaces.d' | ||
|
||
const random: GetRandomValuesFunction = randomFillSync | ||
|
||
export default random | ||
export default randomFillSync |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
export * from '../runtime/base64url.js' | ||
/* eslint-disable prefer-destructuring */ | ||
|
||
import * as base64url from '../runtime/base64url.js' | ||
|
||
/** | ||
* Utility function to encode a string or Uint8Array as a base64url string. | ||
* | ||
* @param input Value that will be base64url-encoded. | ||
*/ | ||
interface Base64UrlEncode { | ||
(input: Uint8Array | string): string | ||
} | ||
/** | ||
* Utility function to decode a base64url encoded string. | ||
* | ||
* @param input Value that will be base64url-decoded. | ||
*/ | ||
interface Base64UrlDecode { | ||
(input: Uint8Array | string): Uint8Array | ||
} | ||
|
||
export const encode: Base64UrlEncode = base64url.encode | ||
export const decode: Base64UrlDecode = base64url.decode |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import random from '../runtime/random.js' | ||
import runtimeRandom from '../runtime/random.js' | ||
|
||
interface GetRandomValuesFunction { | ||
(array: Uint8Array): Uint8Array | ||
} | ||
|
||
const random: GetRandomValuesFunction = runtimeRandom | ||
export default random |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "./base.json", | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"outDir": "../dist/types", | ||
"removeComments": false, | ||
"declaration": true, | ||
"emitDeclarationOnly": true | ||
} | ||
} |