mirror of
https://github.com/amark/gun.git
synced 2025-06-06 14:16:44 +00:00
WIP: textencoder for RN
This commit is contained in:
parent
a2a7ef91bb
commit
0311969060
10
sea.js
10
sea.js
@ -173,14 +173,16 @@
|
||||
api.TextDecoder = window.TextDecoder;
|
||||
api.random = (len) => Buffer.from(api.crypto.getRandomValues(new Uint8Array(Buffer.alloc(len))))
|
||||
}
|
||||
if(!api.TextDecoder)
|
||||
{
|
||||
const { TextEncoder, TextDecoder } = require('text-encoding')
|
||||
api.TextDecoder = TextDecoder
|
||||
api.TextEncoder = TextEncoder
|
||||
}
|
||||
if(!api.crypto){try{
|
||||
var crypto = USE('crypto', 1);
|
||||
const { TextEncoder, TextDecoder } = USE('text-encoding', 1)
|
||||
Object.assign(api, {
|
||||
crypto,
|
||||
//subtle,
|
||||
TextEncoder,
|
||||
TextDecoder,
|
||||
random: (len) => Buffer.from(crypto.randomBytes(len))
|
||||
});
|
||||
//try{
|
||||
|
Loading…
x
Reference in New Issue
Block a user