本文整理汇总了C++中DOMArrayPiece::bytes方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMArrayPiece::bytes方法的具体用法?C++ DOMArrayPiece::bytes怎么用?C++ DOMArrayPiece::bytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMArrayPiece
的用法示例。
在下文中一共展示了DOMArrayPiece::bytes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unwrapKey
ScriptPromise SubtleCrypto::unwrapKey(ScriptState* scriptState, const String& rawFormat, const DOMArrayPiece& wrappedKey, CryptoKey* unwrappingKey, const AlgorithmIdentifier& rawUnwrapAlgorithm, const AlgorithmIdentifier& rawUnwrappedKeyAlgorithm, bool extractable, const Vector<String>& rawKeyUsages)
{
RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
ScriptPromise promise = result->promise();
if (!canAccessWebCrypto(scriptState, result.get()))
return promise;
WebCryptoKeyFormat format;
if (!CryptoKey::parseFormat(rawFormat, format, result.get()))
return promise;
WebCryptoKeyUsageMask keyUsages;
if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get()))
return promise;
WebCryptoAlgorithm unwrapAlgorithm;
if (!parseAlgorithm(rawUnwrapAlgorithm, WebCryptoOperationUnwrapKey, unwrapAlgorithm, result.get()))
return promise;
WebCryptoAlgorithm unwrappedKeyAlgorithm;
if (!parseAlgorithm(rawUnwrappedKeyAlgorithm, WebCryptoOperationImportKey, unwrappedKeyAlgorithm, result.get()))
return promise;
if (!unwrappingKey->canBeUsedForAlgorithm(unwrapAlgorithm, WebCryptoKeyUsageUnwrapKey, result.get()))
return promise;
histogramAlgorithmAndKey(scriptState->executionContext(), unwrapAlgorithm, unwrappingKey->key());
histogramAlgorithm(scriptState->executionContext(), unwrappedKeyAlgorithm);
Platform::current()->crypto()->unwrapKey(format, wrappedKey.bytes(), wrappedKey.byteLength(), unwrappingKey->key(), unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages, result->result());
return promise;
}
示例2: digest
ScriptPromise SubtleCrypto::digest(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, const DOMArrayPiece& data)
{
RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
ScriptPromise promise = result->promise();
if (!canAccessWebCrypto(scriptState, result.get()))
return promise;
WebCryptoAlgorithm algorithm;
if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationDigest, algorithm, result.get()))
return promise;
histogramAlgorithm(scriptState->executionContext(), algorithm);
Platform::current()->crypto()->digest(algorithm, data.bytes(), data.byteLength(), result->result());
return promise;
}
示例3: verifySignature
ScriptPromise SubtleCrypto::verifySignature(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& signature, const DOMArrayPiece& data)
{
RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState);
ScriptPromise promise = result->promise();
if (!canAccessWebCrypto(scriptState, result.get()))
return promise;
WebCryptoAlgorithm algorithm;
if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationVerify, algorithm, result.get()))
return promise;
if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageVerify, result.get()))
return promise;
histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, key->key());
Platform::current()->crypto()->verifySignature(algorithm, key->key(), signature.bytes(), signature.byteLength(), data.bytes(), data.byteLength(), result->result());
return promise;
}
示例4: sign
ScriptPromise SubtleCrypto::sign(ScriptState* scriptState, const AlgorithmIdentifier& rawAlgorithm, CryptoKey* key, const DOMArrayPiece& data)
{
CryptoResultImpl* result = CryptoResultImpl::create(scriptState);
ScriptPromise promise = result->promise();
if (!canAccessWebCrypto(scriptState, result))
return promise;
WebCryptoAlgorithm algorithm;
if (!parseAlgorithm(rawAlgorithm, WebCryptoOperationSign, algorithm, result))
return promise;
if (!key->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageSign, result))
return promise;
histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, key->key());
Platform::current()->crypto()->sign(algorithm, key->key(), data.bytes(), data.byteLength(), result->result());
return promise;
}
示例5: writeValue
ScriptPromise BluetoothGATTCharacteristic::writeValue(ScriptState* scriptState, const DOMArrayPiece& value)
{
WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptState);
// Partial implementation of writeValue algorithm:
// https://webbluetoothchrome.github.io/web-bluetooth/#dom-bluetoothgattcharacteristic-writevalue
// If bytes is more than 512 bytes long (the maximum length of an attribute
// value, per Long Attribute Values) return a promise rejected with an
// InvalidModificationError and abort.
if (value.byteLength() > 512)
return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidModificationError, "Value can't exceed 512 bytes."));
// Let valueVector be a copy of the bytes held by value.
WebVector<uint8_t> valueVector(value.bytes(), value.byteLength());
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
webbluetooth->writeValue(m_webCharacteristic->characteristicInstanceID, valueVector, new CallbackPromiseAdapter<void, BluetoothError>(resolver));
return promise;
}