-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
156 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
|
||
import baseconfig from './rollup.config'; | ||
|
||
export default { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import baseconfig from './rollup-browser.config'; | ||
|
||
export default { | ||
...baseconfig, | ||
output: { | ||
file: 'dist/es/index-rn.module.js', | ||
format: 'es' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ export default { | |
'jxt', | ||
'punycode', | ||
'sdp', | ||
'readable-stream', | ||
'stream', | ||
'tslib', | ||
'uuid', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as RNRandomBytes from 'react-native-randombytes'; | ||
|
||
import { createHash, createHmac, getHashes, Hash, Hmac } from './index-browser'; | ||
|
||
export { Hash, Hmac, createHash, createHmac, getHashes }; | ||
|
||
export function randomBytes(size: number) { | ||
return RNRandomBytes.randomBytes(size); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const punycode = require('punycode'); | ||
|
||
export const NATIVE_STRINGPREP = false; | ||
|
||
export function toUnicode(data) { | ||
return punycode.toUnicode(data); | ||
} | ||
|
||
export function nameprep(str) { | ||
return str.toLowerCase(); | ||
} | ||
|
||
export function nodeprep(str) { | ||
return str.toLowerCase(); | ||
} | ||
|
||
export function resourceprep(str) { | ||
return str; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const punycode = require('punycode'); | ||
|
||
let StringPrep; | ||
try { | ||
StringPrep = require('node-stringprep'); | ||
} catch (err) { | ||
StringPrep = false; | ||
} | ||
|
||
const HAS_STRINGPREP = !!StringPrep && !!StringPrep.StringPrep; | ||
export const NATIVE_STRINGPREP = HAS_STRINGPREP && new StringPrep.StringPrep('nodeprep').isNative(); | ||
|
||
export function toUnicode(data) { | ||
if (HAS_STRINGPREP) { | ||
return punycode.toUnicode(StringPrep.toUnicode(data)); | ||
} else { | ||
return punycode.toUnicode(data); | ||
} | ||
} | ||
|
||
export function nameprep(str) { | ||
if (HAS_STRINGPREP) { | ||
const name = new StringPrep.StringPrep('nameprep'); | ||
return name.prepare(str); | ||
} else { | ||
return str.toLowerCase(); | ||
} | ||
} | ||
|
||
export function nodeprep(str) { | ||
if (HAS_STRINGPREP) { | ||
const node = new StringPrep.StringPrep('nodeprep'); | ||
return node.prepare(str); | ||
} else { | ||
return str.toLowerCase(); | ||
} | ||
} | ||
|
||
export function resourceprep(str) { | ||
if (HAS_STRINGPREP) { | ||
const resource = new StringPrep.StringPrep('resourceprep'); | ||
return resource.prepare(str); | ||
} else { | ||
return str; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default WebSocket; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import WS from 'ws'; | ||
|
||
export default WS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module 'react-native-randombytes' { | ||
export function randomBytes(size: number): Buffer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters