The objective of this API is to enable smart card (PC/SC) applications to move to the Web Platform. It gives them access to the PC/SC implementation (and card reader drivers) available in the host OS. There is also a companion explainer document.
Status of This DocumentThis document is a draft of a potential specification. It has no official standing of any kind and does not represent the support or consensus of any standards organization.
Table of ContentsNavigator
interface
WorkerNavigator
interface
SmartCardResourceManager
interface
SmartCardContext
interface
SmartCardConnection
interface
SmartCardError
interface
[Exposed=Window, SecureContext]
partial interface Navigator {
[SameObject] readonly attribute SmartCardResourceManager
smartCard
;
};
When getting, the smartCard
attribute always returns the same instance of the SmartCardResourceManager
object.
[Exposed=(DedicatedWorker, SharedWorker), SecureContext]
partial interface WorkerNavigator {
[SameObject] readonly attribute SmartCardResourceManager
smartCard
;
};
When getting, the smartCard
attribute always returns the same instance of the SmartCardResourceManager
object.
[Exposed=(DedicatedWorker, SharedWorker, Window), SecureContext]
interface SmartCardResourceManager
{
Promise<SmartCardContext
> establishContext
();
};
Methods on this interface complete asynchronously, queuing work on the smart card task source.
Requests a PC/SC context from the platform's PC/SC stack.
TheestablishContext
()
method steps are:
SecurityError
" DOMException
.RESOURCEMANAGER
class.EstablishContext
method of resourceManager with a "system" Scope
parameter.RESPONSECODE
is not SCARD_S_SUCCESS
, perform the following steps:
corresponding
exception.SmartCardContext
whose [[resourceManager]]
internal slot is set to resourceManager.A context for communicating with the PC/SC resource manager.
[Exposed=(DedicatedWorker, SharedWorker, Window), SecureContext]
interface SmartCardContext
{
Promise<sequence<DOMString>> listReaders
();
Promise<sequence<SmartCardReaderStateOut
>> getStatusChange
(
sequence<SmartCardReaderStateIn
> readerStates,
optional SmartCardGetStatusChangeOptions
options = {});
Promise<SmartCardConnectResult
> connect
(
DOMString readerName,
SmartCardAccessMode
accessMode,
optional SmartCardConnectOptions
options = {});
};
Instances of SmartCardContext
are created with the internal slots described in the following table:
null
The platform's [PCSC5] RESOURCEMANAGER
to be used. [[operationInProgress]] false
Whether there is an ongoing PC/SC operation in this context. [[connections]] An empty ordered set The existing SmartCardConnection
s created by this context. [[tracker]] null
A [PCSC5] SCARDTRACK
instance. [[signal]] null
The AbortSignal
of the outstanding getStatusChange
()
call, if any.
The listReaders
()
method steps are:
[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[operationInProgress]]
to true
.RESOURCEQUERY
class, with this.[[resourceManager]]
as its constructor input parameter.STR[]
containing the list of group names that is equivalent to "all readers in the system" in that platform.
Note
This could be an emptySTR[]
in some [PCSC5] implementations.STR[]
.ListReaders
method of resourceQuery with groups as input and pcscReaders as output parameters.RESPONSECODE
.SCARD_S_SUCCESS
:
SCARD_E_NO_READERS_AVAILABLE
, resolve promise with an empty sequence
of DOMString
.
Note
SCARD_E_NO_READERS_AVAILABLE
is not part of [PCSC5] but it is still considered in this specification as existing PC/SC implementations use it.
corresponding
to responseCode.sequence
of DOMString
equivalent to pcscReaders.The getStatusChange
(readerStates, options)
method steps are:
[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.signal
"] exists, run the following steps:
signal
"].[[signal]]
to signalCancel the outstanding GetStatusChange
algorithm to signal.DWORD
set to [PCSC5] INFINITE
.timeout
"] exists, set pcscTimeout to options["timeout
"].SCARD_READERSTATE[]
corresponding to readerStates.[[operationInProgress]]
to true
.[[tracker]]
to a new instance of the platform's [PCSC5] SCARDTRACK
class, with this.[[resourceManager]]
as its constructor input parameter.[[tracker]]
.GetStatusChange()
with pcscReaderStates and pcscTimeout as input parameters.RESPONSECODE
.[[tracker]]
to null
.undefined
.[[signal]]
is not null
, run the following steps:
[[signal]]
is aborted then set abortReason to this.[[signal]]
's abort reason.cancel the outstanding GetStatusChange
algorithm from this.[[signal]]
.[[signal]]
to null
.SCARD_S_SUCCESS
, run the following steps:
SCARD_E_CANCELLED
and abortReason is not undefined
then reject promise with abortReason.corresponding
to responseCode.SmartCardReaderStateOut
corresponding to pcscReaderStates.dictionary SmartCardReaderStateIn
{
required DOMString readerName
;
required SmartCardReaderStateFlagsIn
currentState
;
unsigned long currentCount
;
};
readerName
member
currentState
member
currentCount
member
Given a sequence of SmartCardReaderStateIn
named readerStates, a corresponding [PCSC5] SCARD_READERSTATE[]
is created with the following steps:
SCARD_READERSTATE[]
.SCARD_READERSTATE
.Reader
to stateIn["readerName
"].CurrentState
to the DWORD
corresponding to stateIn["currentState
"].currentCount
"] exists, set the high word of pcscState.CurrentState
to stateIn["currentCount
"].EventState
to zero.dictionary SmartCardReaderStateFlagsIn
{
boolean unaware
= false;
boolean ignore
= false;
boolean unavailable
= false;
boolean empty
= false;
boolean present
= false;
boolean exclusive
= false;
boolean inuse
= false;
boolean mute
= false;
boolean unpowered
= false;
};
unaware
member
ignore
member
unavailable
member
empty
member
present
member
exclusive
member
inuse
member
mute
member
unpowered
member
The [PCSC5] DWORD
corresponding to a given SmartCardReaderStateFlagsIn
is created with the following steps:
SmartCardReaderStateFlagsIn
.DWORD
set to zero.unaware
"] is true
, add [PCSC5] SCARD_STATE_UNAWARE
to pcscFlags.ignore
"] is true
, add [PCSC5] SCARD_STATE_IGNORE
to pcscFlags.unavailable
"] is true
, add [PCSC5] SCARD_STATE_UNAVAILABLE
to pcscFlags.empty
"] is true
, add [PCSC5] SCARD_STATE_EMPTY
to pcscFlags.present
"] is true
, add [PCSC5] SCARD_STATE_PRESENT
to pcscFlags.exclusive
"] is true
, add [PCSC5] SCARD_STATE_EXCLUSIVE
to pcscFlags.inuse
"] is true
, add [PCSC5] SCARD_STATE_INUSE
to pcscFlags.mute
"] is true
, add SCARD_STATE_MUTE
to pcscFlags.unpowered
"] is true
, add SCARD_STATE_UNPOWERED
to pcscFlags.Note
SCARD_STATE_MUTE
and SCARD_STATE_UNPOWERED
are not part of [PCSC5] but are still considered in this specification as existing PC/SC implementations use it.
The actual state of a smart card reader.
dictionary SmartCardReaderStateOut
{
required DOMString readerName
;
required SmartCardReaderStateFlagsOut
eventState
;
required unsigned long eventCount
;
ArrayBuffer answerToReset
;
};
readerName
member
eventState
member
eventCount
member
answerToReset
member
Given a [PCSC5] SCARD_READERSTATE[]
named pcscReaderStates, a corresponding sequence of SmartCardReaderStateOut
is created with the following steps:
SmartCardReaderStateOut
.SmartCardReaderStateOut
.readerName
"] to pcscState.Reader
.eventState
"] to the SmartCardReaderStateFlagsOut
dictionary corresponding to pcscState.EventState
.eventCount
"] to the high word of pcscState.EventState
.
Note: Number of card insertion and removal events
Having the number of card insertion and removal events stored in the upper 2 bytes of the EventState
and CurrentState
DWORD
s is not part of [PCSC5] but it is still considered in this specification as several existing PC/SC implementations use it.
In PC/SC implementations where this information is not available, the upper two bytes of EventState
will always be zero and so the resulting "eventCount
" will be zero.
The algorithms in this specification assume that PC/SC implementations will define all [PCSC5] SCARD_STATE_*
flags to be DWORD
values no higher than 0xFFFF
.
SCARD_READERSTATE
structure has a member containing the card's [ISO7186-3] Answer To Reset, set stateOut["answerToReset
"] to that value.dictionary SmartCardReaderStateFlagsOut
{
boolean ignore
= false;
boolean changed
= false;
boolean unavailable
= false;
boolean unknown
= false;
boolean empty
= false;
boolean present
= false;
boolean exclusive
= false;
boolean inuse
= false;
boolean mute
= false;
boolean unpowered
= false;
};
ignore
member
changed
member
unavailable
member
unknown
member
empty
member
present
member
exclusive
member
inuse
member
mute
member
unpowered
member
Given a [PCSC5] DWORD
named pcscFlags, a corresponding SmartCardReaderStateFlagsOut
dictionary is created with the following steps:
SmartCardReaderStateFlagsOut
dictionary with default members.SCARD_STATE_IGNORE
, set flagsOut["ignore
"] to true
.SCARD_STATE_CHANGED
, set flagsOut["changed
"] to true
.SCARD_STATE_UNAVAILABLE
, set flagsOut["unavailable
"] to true
.SCARD_STATE_UNKNOWN
, set flagsOut["unknown
"] to true
.SCARD_STATE_EMPTY
, set flagsOut["empty
"] to true
.SCARD_STATE_PRESENT
, set flagsOut["present
"] to true
.SCARD_STATE_EXCLUSIVE
, set flagsOut["exclusive
"] to true
.SCARD_STATE_INUSE
, set flagsOut["inuse
"] to true
.SCARD_STATE_MUTE
, set flagsOut["mute
"] to true
.SCARD_STATE_UNPOWERED
, set flagsOut["unpowered
"] to true
.Note
SCARD_STATE_MUTE
and SCARD_STATE_UNPOWERED
are not part of [PCSC5] but are still considered in this specification as existing PC/SC implementations use it.
dictionary SmartCardGetStatusChangeOptions
{
DOMHighResTimeStamp timeout
;
AbortSignal signal
;
};
timeout
member
signal
member
The connect
(readerName, accessMode, options)
method steps are:
[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[operationInProgress]]
to true
.DWORD
corresponding to accessMode.DWORD
set to 0
.preferredProtocols
"] exists, set protocolFlags to its corresponding flags.DWORD
set to 0
.SCARDCOMM
class, with this.[[resourceManager]]
as its constructor parameter.Connect()
with readerName, accessFlags and protocolFlags as input and activeProtocol as output parameters.RESPONSECODE
.SCARD_S_SUCCESS
:
corresponding
to responseCode and abort these steps.SmartCardConnectResult
dictionary.SmartCardConnection
.[[connections]]
.[[comm]]
to comm.[[context]]
to this.[[activeProtocol]]
to activeProtocol.connection
"] to connection.activeProtocol
"] to the corresponding SmartCardProtocol
.enum SmartCardProtocol
{
"raw
",
"t0
",
"t1
"
};
raw
SCARD_PROTOCOL_RAW
DWORD
.
t0
SCARD_PROTOCOL_T0
DWORD
.
t1
SCARD_PROTOCOL_T1
DWORD
.
A [PCSC5] DWORD
is a valid protocol value if it is either [PCSC5] SCARD_PROTOCOL_T0
, [PCSC5] SCARD_PROTOCOL_T1
or [PCSC5] SCARD_PROTOCOL_RAW
.
Given a sequence of SmartCardProtocol
named protocols, a [PCSC5] DWORD
with the corresponding flags is created with the following steps:
DWORD
set to 0
.DWORD
of protocol to flags.dictionary SmartCardConnectResult
{
required SmartCardConnection
connection
;
SmartCardProtocol
activeProtocol
;
};
connection
member
activeProtocol
member
enum SmartCardAccessMode
{
"",
"exclusive
",
"direct
"
};
exclusive
direct
Given a SmartCardAccessMode
enum named accessMode, a corresponding [PCSC5] DWORD
is created with the following steps:
DWORD
set to 0
.SCARD_SHARE_SHARED
.exclusive
", set dword to [PCSC5] SCARD_SHARE_EXCLUSIVE
.direct
", set dword to [PCSC5] SCARD_SHARE_DIRECT
.dictionary SmartCardConnectOptions
{
sequence<SmartCardProtocol
> preferredProtocols
;
};
preferredProtocols
To clear the operationInProgress of a SmartCardContext
context, perform the following steps:
[[operationInProgress]]
is true
.[[operationInProgress]]
to false
.[[connections]]
:
[[operationInProgress]]
is true
, abort there steps.Note
A transaction ends when the Promise
returned by the SmartCardTransactionCallback
passed to startTransaction
()
settles. At this point the user agent should call [PCSC5] EndTransaction()
to effect that on the platform's PC/SC stack. But that won't be possible if at that moment there's already another PC/SC operation taking place in the connection's PC/SC context. The user agent then has to wait until this ongoing PC/SC operation finishes before ending that settled transaction.
The cancel the outstanding GetStatusChange algorithm steps are:
[[tracker]]
.Cancel()
.The high word of a [PCSC5] DWORD
is the result of an unsigned right shift of 16 bits on that DWORD
.
To set the high word of a [PCSC5] DWORD
named dword to a given number n, perform the following steps.
0xFFFF
.To add a flag f to a [PCSC5] DWORD
flags, set flags to flags bitwise OR f.
A [PCSC5] DWORD
flags has a flag f if flags bitwise AND f is f.
[Exposed=(DedicatedWorker, SharedWorker, Window), SecureContext]
interface SmartCardConnection
{
Promise<undefined> disconnect
(optional SmartCardDisposition
disposition = "leave");
Promise<ArrayBuffer> transmit
(BufferSource sendBuffer,
optional SmartCardTransmitOptions
options = {});
Promise<undefined> startTransaction
(SmartCardTransactionCallback
transaction,
optional SmartCardTransactionOptions
options = {});
Promise<SmartCardConnectionStatus
> status
();
Promise<ArrayBuffer> control
([EnforceRange] unsigned long controlCode,
BufferSource data);
Promise<ArrayBuffer> getAttribute
([EnforceRange] unsigned long tag);
Promise<undefined> setAttribute
([EnforceRange] unsigned long tag, BufferSource value);
};
callback SmartCardTransactionCallback
= Promise<SmartCardDisposition
?> ();
Instances of SmartCardConnection
are created with the internal slots described in the following table:
null
The platform's [PCSC5] SCARDCOMM
to be used. [[context]] null
The SmartCardContext
that created this instance. [[activeProtocol]] 0 The active protocol DWORD
, as returned by the platform's [PCSC5] implementation. [[transactionState]] null
Holds the state of an ongoing transaction started with startTransaction
()
, if any.
Note: Lack of the reconnect method
[PCSC5] mentions also the Reconnect
method, which has no equivalent here. This is because its behavior differs between implementations—PC/SC Lite does not release the transactions held by the process, while Microsoft's WinSCard does. While PCSC lite's behavior cannot be replicated cross-platform, Microsoft Windows WinSCard can be achieved via calling Disconnect
+ Connect
. Moreover, in case of the Javascript API the benefit of maintaining the same connection handle ID is lost, as the ID is not exposed, only the SmartCardConnection
which is an abstraction over it. Hence, there are no material benefits to including this method in the web API.
The disconnect
(disposition)
method steps are:
[[context]]
.[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[comm]]
is null
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[context]]
.[[operationInProgress]]
to true
.[[comm]]
.Disconnect()
with a DWORD
corresponding to disposition as input parameter.RESPONSECODE
.[[context]]
.SCARD_S_SUCCESS
, reject promise with an exception corresponding
to responseCode and abort these steps.[[comm]]
.[[comm]]
to null
.enum SmartCardDisposition
{
"leave
",
"reset
",
"unpower
",
"eject
"
};
leave
SCARD_LEAVE_CARD
DWORD
.
reset
SCARD_RESET_CARD
DWORD
.
unpower
SCARD_UNPOWER_CARD
DWORD
.
eject
SCARD_EJECT_CARD
DWORD
.
The transmit
(sendBuffer, options)
method steps are:
[[context]]
.[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[comm]]
is null
, reject promise with a "InvalidStateError
" DOMException
and return promise.DWORD
set to this.[[activeProtocol]]
.protocol
"] exists, set protocol to the DWORD
corresponding to options["protocol
"].InvalidStateError
" DOMException
and return promise.[[context]]
.[[operationInProgress]]
to true
.SCARD_IO_HEADER
corresponding to this.[[activeProtocol]]
.BYTE[]
containing sendBuffer.SCARD_IO_HEADER
equivalent of empty or null.BYTE[]
big enough to hold the largest [ISO7186-3] extended response APDU (65538 bytes).DWORD
set to 0
.[[comm]]
.Transmit()
with sendPci, pcscSendBuffer, recvPci, recvBuffer and recvLength as arguments.RESPONSECODE
.[[context]]
.SCARD_S_SUCCESS
, reject promise with an exception corresponding
to responseCode and abort these steps.ArrayBuffer
containing the first recvLength bytes of recvBuffer.dictionary SmartCardTransmitOptions
{
SmartCardProtocol
protocol
;
};
protocol
member
The startTransaction
(transaction, options)
method steps are:
[[context]]
.[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[comm]]
is null
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[transactionState]]
is not null
, reject promise with a "InvalidStateError
" DOMException
and return promise.AbortSignal
set to null
.signal
"] exists, run the following steps:
[[context]]
.[[operationInProgress]]
to true
.[[comm]]
.BeginTransaction()
.RESPONSECODE
.dictionary SmartCardTransactionOptions
{
AbortSignal signal
;
};
signal
member
A transaction state is a struct with the following items:
Item Description (non-normative) pendingDisposition If set, it means once the ongoing PC/SC operation finishes [PCSC5]EndTransaction()
should be called with this value as the SmartCardDisposition
parameter. pendingException The exception to be used when rejecting promise. promise The pending Promise
returned by a startTransaction
()
call.
To process the result of a BeginTransaction given a SmartCardConnection
connection, a [PCSC5] RESPONSECODE
responseCode, an AbortSignal
signal, a SmartCardTransactionCallback
transaction and a Promise
promise, perform the following steps:
[[context]]
.undefined
.null
:
cancel
algorithm from signal.SCARD_S_SUCCESS
:
SCARD_E_CANCELLED
and abortReason is not undefined
then reject promise with abortReason.corresponding
to responseCode.[[transactionState]]
to transactionState.reset
".undefined
, set disposition to v.[[context]]
.[[operationInProgress]]
is true
:
InvalidStateError
" DOMException
.[[context]]
.[[operationInProgress]]
is true
, set transactionState's pendingDisposition to "reset
".reset
".To end the transaction of a SmartCardConnection
connection with a SmartCardDisposition
disposition, perform the following steps:
[[context]]
.[[operationInProgress]]
is false
.[[transactionState]]
is not null
.[[transactionState]]
's pendingDisposition is null
.[[transactionState]]
's promise.[[comm]]
is null
:
InvalidStateError
" DOMException
.[[transactionState]]
to null
.[[context]]
.[[operationInProgress]]
to true
.[[comm]]
.EndTransaction()
with a DWORD
corresponding to disposition as input parameter.RESPONSECODE
.[[context]]
.[[transactionState]]
's pendingException.null
, perform the following steps:
SCARD_S_SUCCESS
, resolve transactionPromise.corresponding
to responseCode.[[transactionState]]
to null
.To end any settled transaction of a SmartCardConnection
connection, perform the following steps:
[[transactionState]]
is null
, abort these steps.[[transactionState]]
's pendingDisposition.null
, abort these steps.[[transactionState]]
's pendingDisposition to null
.To cancel outstanding [PCSC5] SCARDCOMM
operations, call this.[[comm]]
.Cancel()
.
The status
()
method steps are:
[[context]]
.[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[comm]]
is null
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[context]]
.[[operationInProgress]]
to true
.STR[]
.DWORD
set to 0
.DWORD
set to 0
.BYTE[]
big enough to hold any [ISO7186-3] Answer To Reset (ATR).[[comm]]
.Status()
with pcscReader, pcscState, activeProtocol and pcscAtr as output parameters.RESPONSECODE
.[[context]]
.SCARD_S_SUCCESS
, reject promise with an exception corresponding
to responseCode and abort these steps.SmartCardConnectionState
corresponding to pcscState and activeProtocol.undefined
, reject promise with an "UnknownError
" DOMException
and abort these steps.SmartCardConnectionStatus
.readerName
"] to pcscReader.state
"] to state.answerToReset
"] to an ArrayBuffer
with the bytes that were written to pcscAtr.dictionary SmartCardConnectionStatus
{
required DOMString readerName
;
required SmartCardConnectionState
state
;
ArrayBuffer answerToReset
;
};
readerName
member
state
member
answerToReset
member
enum SmartCardConnectionState
{
"absent
",
"present
",
"swallowed
",
"powered
",
"negotiable
",
"t0
",
"t1
",
"raw
"
};
absent
present
swallowed
powered
negotiable
t0
t1
raw
Given a [PCSC5] DWORD
pcscState and a DWORD
activeProtocol, a corresponding SmartCardConnectionState
is created with the following steps:
SCARD_ABSENT
, return "absent
".SCARD_PRESENT
, return "present
".SCARD_SWALLOWED
, return "swallowed
".SCARD_POWERED
, return "powered
".SCARD_NEGOTIABLE
, return "negotiable
".SCARD_SPECIFIC
, perform the following steps:
undefined
.The control
(controlCode, data)
method steps are:
[[context]]
.[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[comm]]
is null
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[context]]
.[[operationInProgress]]
to true
.DWORD
containing controlCode.BYTE[]
inBuffer.BYTE[]
large enough to hold any control command response.DWORD
set to 0
.[[comm]]
.Control()
with pcscControlCode, inBuffer, outBuffer and outBufferLength as arguments.RESPONSECODE
.[[context]]
.SCARD_S_SUCCESS
, reject promise with an exception corresponding
to responseCode and abort these steps.ArrayBuffer
from resultBytes in this's relevant Realm.The getAttribute
(tag)
method steps are:
[[context]]
.[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[comm]]
is null
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[context]]
.[[operationInProgress]]
to true
.DWORD
containing tag.BYTE[]
large enough to hold this reader attribute, as determined by the platform's [PCSC5] implementation.[[comm]]
.GetReaderCapabilities()
with pcscTag and buffer as arguments.RESPONSECODE
.[[context]]
.SCARD_S_SUCCESS
, reject promise with an exception corresponding
to responseCode and abort these steps.ArrayBuffer
from resultBytes in this's relevant Realm.Note: Output buffer size
Known [PCSC5] platform implementations allow either the output buffer to be automatically allocated or to query the size needed for it. This covers the gap left by [PCSC5] in that regard.
The setAttribute
(tag, value)
method steps are:
[[context]]
.[[operationInProgress]]
is true
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[comm]]
is null
, reject promise with a "InvalidStateError
" DOMException
and return promise.[[context]]
.[[operationInProgress]]
to true
.DWORD
containing tag.BYTE[]
buffer.[[comm]]
.SetReaderCapabilities()
with pcscTag and buffer as arguments.RESPONSECODE
.[[context]]
.SCARD_S_SUCCESS
, reject promise with an exception corresponding
to responseCode and abort these steps.[Exposed=(DedicatedWorker, SharedWorker, Window), Serializable]
interface SmartCardError
: DOMException {
constructor
(optional DOMString message = "", SmartCardErrorOptions
options);
readonly attribute SmartCardResponseCode
responseCode
;
};
The responseCode
attribute is the error or warning response code returned by the related [PCSC5] method.
Given a [PCSC5] RESPONSECODE
different from SCARD_S_SUCCESS
, a corresponding exception is created with the following steps:
Note: Unspecified response codes
The following RESPONSECODE
s are not part of [PCSC5] but are still considered in this specification as existing PC/SC implementations use them:
SCARD_E_SERVER_TOO_BUSY
SCARD_E_SERVICE_STOPPED
SCARD_P_SHUTDOWN
RESPONSECODE
.SCARD_E_NO_SERVICE
, return a new "no-service
" SmartCardError
.SCARD_E_NO_SMARTCARD
, return a new "no-smartcard
" SmartCardError
.SCARD_E_NOT_READY
, return a new "not-ready
" SmartCardError
.SCARD_E_NOT_TRANSACTED
, return a new "not-transacted
" SmartCardError
.SCARD_E_PROTO_MISMATCH
, return a new "proto-mismatch
" SmartCardError
.SCARD_E_READER_UNAVAILABLE
, return a new "reader-unavailable
" SmartCardError
.SCARD_W_REMOVED_CARD
, return a new "removed-card
" SmartCardError
.SCARD_W_RESET_CARD
, return a new "reset-card
" SmartCardError
.SCARD_E_SERVER_TOO_BUSY
, return a new "server-too-busy
" SmartCardError
.SCARD_E_SHARING_VIOLATION
, return a new "sharing-violation
" SmartCardError
.SCARD_E_SYSTEM_CANCELLED
, return a new "system-cancelled
" SmartCardError
.SCARD_E_UNKNOWN_READER
, return a new "unknown-reader
" SmartCardError
.SCARD_W_UNPOWERED_CARD
, return a new "unpowered-card
" SmartCardError
.SCARD_W_UNRESPONSIVE_CARD
, return a new "unresponsive-card
" SmartCardError
.SCARD_W_UNSUPPORTED_CARD
, return a new "unsupported-card
" SmartCardError
.SCARD_E_UNSUPPORTED_FEATURE
, return a new "unsupported-feature
" SmartCardError
.SCARD_E_INVALID_PARAMETER
, return a new TypeError
.SCARD_E_INVALID_HANDLE
, return a new "InvalidStateError
" DOMException
.SCARD_E_SERVICE_STOPPED
, return a new "InvalidStateError
" DOMException
.SCARD_P_SHUTDOWN
, return a new "AbortError
" DOMException
.UnknownError
" DOMException
.dictionary SmartCardErrorOptions
{
required SmartCardResponseCode
responseCode
;
};
The responseCode
member is the value for SmartCardError
's responseCode
attribute.
enum SmartCardResponseCode
{
"no-service
",
"no-smartcard
",
"not-ready
",
"not-transacted
",
"proto-mismatch
",
"reader-unavailable
",
"removed-card
",
"reset-card
",
"server-too-busy
",
"sharing-violation
",
"system-cancelled
",
"unknown-reader
",
"unpowered-card
",
"unresponsive-card
",
"unsupported-card
",
"unsupported-feature
"
};
no-service
no-smartcard
not-ready
not-transacted
proto-mismatch
reader-unavailable
removed-card
reset-card
server-too-busy
sharing-violation
system-cancelled
unknown-reader
unpowered-card
unresponsive-card
unsupported-card
unsupported-feature
This specification defines a feature that controls whether the methods exposed by the smartCard
attribute on the Navigator
object may be used.
The feature name for this feature is "smart-card".
The default allowlist for this feature is 'self'
.
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
Referenced in:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3