File: base.R

package info (click to toggle)
r-cran-openssl 1.4.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,288 kB
  • sloc: ansic: 3,021; sh: 97; makefile: 5
file content (110 lines) | stat: -rw-r--r-- 1,750 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#' @export
`[[.cert` <- function(x, y) as.list(x)[[y]]

#' @export
`[[.key` <- `[[.cert`

#' @export
`[[.pubkey` <- `[[.cert`


#' @export
`$.cert` <- `[[.cert`

#' @export
`$.key` <- `[[.cert`

#' @export
`$.pubkey` <- `[[.cert`


#' @export
`[.cert` <- function(x, y) as.list(x)[y]

#' @export
`[.key` <- `[.cert`

#' @export
`[.pubkey` <- `[.cert`


#' @export
names.cert <- function(x) names(as.list(x))

#' @export
names.key <- names.cert

#' @export
names.pubkey <- names.cert


#' @export
as.environment.cert <- function(x) as.environment(as.list(x))

#' @export
as.environment.key <- as.environment.cert

#' @export
as.environment.pubkey <- as.environment.cert


#' @export
#' @importFrom utils .DollarNames
.DollarNames.cert <- function(x, pattern = "") {
  x <- as.list(x)
  matches <- grep(pattern, names(x), value = TRUE)
  structure(matches,
            types = vapply(x[matches], typeof, character(1), USE.NAMES = FALSE))
}

#' @export
.DollarNames.key <- .DollarNames.cert

#' @export
.DollarNames.pubkey <- .DollarNames.cert


#' @export
str.cert <- function(object, ...) utils::str(as.list(object), ...)

#' @export
str.key <- str.cert

#' @export
str.pubkey <- function(object, ...){
  x <- as.list(object)
  x$ssh <- paste(substring(x$ssh, 1, getOption('width') - 30), "...")
  utils::str(x, ...)
}


### Not (yet?) implemented stuff

stopfun <- function(..., value){ stop("object cannot be modified", call. = FALSE) }

#' @export
`[<-.cert` <- stopfun

#' @export
`[<-.key` <- stopfun

#' @export
`[<-.pubkey` <- stopfun

#' @export
`[[<-.cert` <- stopfun

#' @export
`[[<-.key` <- stopfun

#' @export
`[[<-.pubkey` <- stopfun

#' @export
`$<-.cert` <- stopfun

#' @export
`$<-.key` <- stopfun

#' @export
`$<-.pubkey` <- stopfun