|
| 1 | +/******************************************************************************** |
| 2 | + * Copyright (c) 2025 Contributors to the Eclipse Foundation |
| 3 | + * |
| 4 | + * See the NOTICE file(s) distributed with this work for additional |
| 5 | + * information regarding copyright ownership. |
| 6 | + * |
| 7 | + * This program and the accompanying materials are made available under the |
| 8 | + * terms of the Eclipse Public License v. 2.0 which is available at |
| 9 | + * http://www.eclipse.org/legal/epl-2.0, or the W3C Software Notice and |
| 10 | + * Document License (2015-05-13) which is available at |
| 11 | + * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document. |
| 12 | + * |
| 13 | + * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513 |
| 14 | + ********************************************************************************/ |
| 15 | + |
| 16 | +// global W3C WoT Scripting API definitions |
| 17 | +import * as TDT from "wot-thing-description-types"; |
| 18 | +import { SecurityScheme } from "@node-wot/core"; |
| 19 | +export interface OPCUASecuritySchemeBase extends SecurityScheme, TDT.AdditionalSecurityScheme { |
| 20 | + scheme: "uav:channel-security" | "uav:authentication"; |
| 21 | +} |
| 22 | + |
| 23 | +export type ValidOPCUASecurityPolicy = |
| 24 | + | "Basic128" |
| 25 | + | "http://opcfoundation.org/UA/SecurityPolicy#Basic128" |
| 26 | + | "Basic192" |
| 27 | + | "http://opcfoundation.org/UA/SecurityPolicy#Basic192" |
| 28 | + | "Basic192Rsa15" |
| 29 | + | "http://opcfoundation.org/UA/SecurityPolicy#Basic192Rsa15" |
| 30 | + | "Basic256Rsa15" |
| 31 | + | "http://opcfoundation.org/UA/SecurityPolicy#Basic256Rsa15" |
| 32 | + | "Basic256Sha256" |
| 33 | + | "http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256" |
| 34 | + | "Aes128_Sha256_RsaOaep" |
| 35 | + | "http://opcfoundation.org/UASecurityPolicy#Aes128_Sha256_RsaOaep" |
| 36 | + | "Aes256_Sha256_RsaPss" |
| 37 | + | "http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss" |
| 38 | + | "PubSub_Aes128_CTR" |
| 39 | + | "http://opcfoundation.org/UA/SecurityPolicy#PubSub_Aes128_CTR" |
| 40 | + | "PubSub_Aes256_CTR" |
| 41 | + | "http://opcfoundation.org/UA/SecurityPolicy#PubSub_Aes256_CTR"; |
| 42 | +// deprecated | "Basic128Rsa15" | "http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15" |
| 43 | +// deprecated | "Basic256" | "http://opcfoundation.org/UA/SecurityPolicy#Basic256" |
| 44 | + |
| 45 | +/** |
| 46 | + * |
| 47 | + */ |
| 48 | +export interface OPCUASecureSecurityScheme extends OPCUASecuritySchemeBase { |
| 49 | + scheme: "uav:channel-security"; |
| 50 | + policy: ValidOPCUASecurityPolicy; |
| 51 | + messageMode: "sign" | "sign_encrypt"; |
| 52 | +} |
| 53 | +export interface OPCUAUnsecureChannelScheme extends OPCUASecuritySchemeBase { |
| 54 | + scheme: "uav:channel-security"; |
| 55 | + policy: never; |
| 56 | + messageMode: "none"; |
| 57 | +} |
| 58 | + |
| 59 | +export type OPCUAChannelSecurityScheme = OPCUASecureSecurityScheme | OPCUAUnsecureChannelScheme; |
| 60 | +export interface OPCUACAuthenticationSchemeBase extends OPCUASecuritySchemeBase { |
| 61 | + scheme: "uav:authentication"; |
| 62 | + tokenType: "username" | "certificate" | "anonymous"; |
| 63 | +} |
| 64 | + |
| 65 | +export interface OPCUACUserNameAuthenticationScheme extends OPCUACAuthenticationSchemeBase { |
| 66 | + scheme: "uav:authentication"; |
| 67 | + tokenType: "username"; |
| 68 | + userName: string; |
| 69 | + password?: string; |
| 70 | +} |
| 71 | +export interface OPCUACertificateAuthenticationScheme extends OPCUACAuthenticationSchemeBase { |
| 72 | + scheme: "uav:authentication"; |
| 73 | + tokenType: "certificate"; |
| 74 | + // the certificate in PEM format |
| 75 | + // -----BEGIN CERTIFICATE---- |
| 76 | + // ... |
| 77 | + // -----END CERTIFICATE----- |
| 78 | + certificate: string; |
| 79 | + // the private key in PEM format that is associated with the certificate |
| 80 | + // For instance |
| 81 | + // -----BEGIN PRIVATE KEY----- |
| 82 | + // ... |
| 83 | + // -----END PRIVATE KEY----- |
| 84 | + privateKey?: string; |
| 85 | +} |
| 86 | +export interface OPCUAAnonymousAuthenticationScheme extends OPCUACAuthenticationSchemeBase { |
| 87 | + scheme: "uav:authentication"; |
| 88 | + tokenType: "anonymous"; |
| 89 | +} |
| 90 | +export type OPCUACAuthenticationScheme = |
| 91 | + | OPCUAAnonymousAuthenticationScheme |
| 92 | + | OPCUACertificateAuthenticationScheme |
| 93 | + | OPCUACUserNameAuthenticationScheme; |
0 commit comments