Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
console.log(nftContractPayload)
// prepare test contract for issuing & transferring NFT instances
const testSmartContractCode = `
actions.createSSC = function (payload) {
// Initialize the smart contract via the create action
}
actions.doIssuance = async function (payload) {
await api.executeSmartContract('nft', 'issue', payload);
}
`;
base64ContractCode = Base64.encode(testSmartContractCode);
let testContractPayload = {
name: 'testContract',
params: '',
code: base64ContractCode,
};
console.log(testContractPayload)
// nft
describe('nft', function() {
this.timeout(10000);
before((done) => {
new Promise(async (resolve) => {
client = await MongoClient.connect(conf.databaseURL, { useNewUrlParser: true });
compress (data) {
return new Uint32Array(
pack(
// convert to base64 (utf-16 safe)
Base64.encode(
JSON.stringify(data)
)
)
).buffer
}
decompress (data) {
return {
content: Utf8.encode(content),
encoding: 'utf-8',
};
} else if (typeof Buffer !== 'undefined' && content instanceof Buffer) {
log('We appear to be in Node');
return {
content: content.toString('base64'),
encoding: 'base64',
};
} else if (typeof Blob !== 'undefined' && content instanceof Blob) {
log('We appear to be in the browser');
return {
content: Base64.encode(content),
encoding: 'base64',
};
} else { // eslint-disable-line
log(`Not sure what this content is: ${typeof content}, ${JSON.stringify(content)}`);
throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)');
}
}
const extractCodeValue = (fileType, base64Data, metaData) => {
const { extensionMap } = config.INTERNAL_SETTINGS;
const errorCtx = { error: 'unsupported file type', message: 'application zips should be uploaded through Project > import existing application' }
// Default return the encoded data as is
let result = base64Data;
try {
if (fileType === extensionMap.get('zip')) {
// Prettify the data, as ace editor will not do this for us
result = Base64.encode(
JSON.stringify((metaData.Configuration ?
JSON.parse(Base64.decode(base64Data)) :
errorCtx),
null, '\t')
);
}
}
catch (e) {
// Error context can be modified by any closure, and add a throw to get into this block
toastr.error(errorCtx.error, errorCtx.message);
}
return result;
};
public importApi(): void {
this.error = null;
let importApi: ImportApi = new ImportApi();
if (this.model.url) {
importApi.url = this.model.url;
} else if (this.model.data) {
try {
importApi.data = Base64.encode(this.model.data);
} catch (e) {
console.error(e);
}
}
this.onImportApi.emit(importApi);
}
fetchLogin(password: string): Promise {
return this.httpService.post(API_PATH.LOGIN, { password: Base64.encode(password) })
.then(auth => {
if (auth.result.access_token) {
localStorage.setItem(TOKEN, auth.result.access_token);
this.router.navigate(['/dashboard']);
this.fetchAdminInfo();
}
})
.catch(error => {
console.warn('登陆系统失败!', error);
});
}
bc.on('found', res => {
res.clientIP = externalIP;
if (argv.obfuscate) {
res.urlEncoded = Base64.encode(res.url);
delete res.url;
}
console.log(JSON.stringify(res));
if (argv.collector)
axios.post(argv.collector, res)
.then(function (response) {
})
.catch(function (error) {
console.error(error);
});
});
static encodeCursor (cursor) {
return Base64.encode(JSON.stringify(cursor))
}
.toLowerCase());
await this.genericK8sClient.createSecret(
{
apiVersion: 'v1',
kind: 'Secret',
metadata: {
name: this.azureStorageSecretName,
namespace: 'default',
labels: {
app: this.NNI_KUBERNETES_TRIAL_LABEL,
expId: getExperimentId()
}
},
type: 'Opaque',
data: {
azurestorageaccountname: Base64.encode(this.azureStorageAccountName),
azurestorageaccountkey: Base64.encode(storageAccountKey)
}
}
);
} catch (error) {
this.log.error(error);
return Promise.reject(error);
}
return Promise.resolve();
}
constructor(auth, apiBase, AcceptHeader) {
this.__apiBase = apiBase || 'https://api.github.com';
this.__auth = {
token: auth.token,
username: auth.username,
password: auth.password,
};
this.__AcceptHeader = AcceptHeader || 'v3';
if (auth.token) {
this.__authorizationHeader = 'token ' + auth.token;
} else if (auth.username && auth.password) {
this.__authorizationHeader = 'Basic ' + Base64.encode(auth.username + ':' + auth.password);
}
}