Skip to content

Add Domeneshop Context-based credential flow and initial domains command - #14

Closed
Marius Storhaug (MariusStorhaug) wants to merge 4 commits into
mainfrom
context-credentials-setup
Closed

Add Domeneshop Context-based credential flow and initial domains command#14
Marius Storhaug (MariusStorhaug) wants to merge 4 commits into
mainfrom
context-credentials-setup

Conversation

@MariusStorhaug

Copy link
Copy Markdown
Member

Summary

  • add Connect-DomeneshopAccount to store API token/secret in a Domeneshop Context vault
  • add Get-DomeneshopContext plus config helpers to resolve and track the default context
  • add Get-DomeneshopDomain and Invoke-DomeneshopApiRequest to call GET /domains using HTTP Basic Auth from stored credentials
  • add Pester coverage for the new context/auth flow and API request behavior

Why

The module needed a secure credential flow aligned with PSModule patterns and Domeneshop API authentication requirements (basicAuth: token as username, secret as password).

Validation

  • Invoke-Pester -Path .\tests\PSModuleTest.Tests.ps1,./tests/DomeneshopContext.Tests.ps1 -Output Detailed

Store Domeneshop API credentials with Context and add a first authenticated domains command with a shared request helper.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Load function scripts in test runtime and cover credential storage, default context behavior, domain query construction, and basic auth request execution.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLFail ❌
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSReviewUnusedParameter Warning Get-Domene 19 The parameter
shopContex 'ListAvailab
t.ps1 le' has been
declared but
not used.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 47 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 66 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Get-Domene 1 The cmdlet 'G
shopConfig et-Domeneshop
.ps1 Config' does
not have a he
lp comment.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Resolve-Do 1 The cmdlet 'R
meneshopCo esolve-Domene
ntext.ps1 shopContext'
does not have
a help comme
nt.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Set-Domene 1 The cmdlet 'S
shopDefaul et-Domeneshop
tContext.p DefaultContex
s1 t' does not h
ave a help co
mment.
PSUseShouldProcessForStateChangingF Warning Set-Domene 1 Function 'Set
unctions shopDefaul -DomeneshopDe
tContext.p faultContext'
s1 has verb tha
t could chang
e system stat
e. Therefore,
the function
has to suppo
rt 'ShouldPro
cess'.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Invoke-Dom 1 The cmdlet 'I
eneshopApi nvoke-Domenes
Request.ps hopApiRequest
1 ' does not ha
ve a help com
ment.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSAvoidUsingConvertToSecureStringWi Error Connect-Do 33 File 'Connect
thPlainText meneshopAc -DomeneshopAc
count.ps1 count.ps1' us
es ConvertTo-
SecureString
with plaintex
t. This will
expose secure
information.
Encrypted st
andard string
s should be u
sed instead.

Add public cmdlets for domains by ID, DNS CRUD, forwards CRUD, DDNS update, and invoices list/get. Reuse Context-based auth for all requests.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Cover URI/method construction for domains, DNS, forwards, invoices, and DDNS commands using mocked API invocations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLFail ❌
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSAvoidUsingConvertToSecureStringWi Error Connect-Do 33 File 'Connect
thPlainText meneshopAc -DomeneshopAc
count.ps1 count.ps1' us
es ConvertTo-
SecureString
with plaintex
t. This will
expose secure
information.
Encrypted st
andard string
s should be u
sed instead.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSReviewUnusedParameter Warning Get-Domene 19 The parameter
shopContex 'ListAvailab
t.ps1 le' has been
declared but
not used.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSUseShouldProcessForStateChangingF Warning Set-Domene 1 Function 'Set
unctions shopForwar -DomeneshopFo
d.ps1 rward' has ve
rb that could
change syste
m state. Ther
efore, the fu
nction has to
support 'Sho
uldProcess'.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSUseShouldProcessForStateChangingF Warning Update-Dom 1 Function 'Upd
unctions eneshopDdn ate-Domenesho
s.ps1 pDdns' has ve
rb that could
change syste
m state. Ther
efore, the fu
nction has to
support 'Sho
uldProcess'.
PSUseSingularNouns Warning Update-Dom 1 The cmdlet 'U
eneshopDdn pdate-Domenes
s.ps1 hopDdns' uses
a plural nou
n. A singular
noun should
be used inste
ad.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 47 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 66 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 84 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 102 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 121 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 140 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 167 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 202 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
PSAvoidUsingConvertToSecureStringWi Error Domeneshop 224 File 'Domenes
thPlainText Context.Te hopContext.Te
sts.ps1 sts.ps1' uses
ConvertTo-Se
cureString wi
th plaintext.
This will ex
pose secure i
nformation. E
ncrypted stan
dard strings
should be use
d instead.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSUseShouldProcessForStateChangingF Warning Set-Domene 1 Function 'Set
unctions shopDnsRec -DomeneshopDn
ord.ps1 sRecord' has
verb that cou
ld change sys
tem state. Th
erefore, the
function has
to support 'S
houldProcess'
.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Get-Domene 1 The cmdlet 'G
shopConfig et-Domeneshop
.ps1 Config' does
not have a he
lp comment.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Resolve-Do 1 The cmdlet 'R
meneshopCo esolve-Domene
ntext.ps1 shopContext'
does not have
a help comme
nt.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSUseShouldProcessForStateChangingF Warning Set-Domene 1 Function 'Set
unctions shopDefaul -DomeneshopDe
tContext.p faultContext'
s1 has verb tha
t could chang
e system stat
e. Therefore,
the function
has to suppo
rt 'ShouldPro
cess'.
PSProvideCommentHelp Information Set-Domene 1 The cmdlet 'S
shopDefaul et-Domeneshop
tContext.p DefaultContex
s1 t' does not h
ave a help co
mment.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Get-Domene 1 The cmdlet 'G
shopApiBas et-Domeneshop
eUri.ps1 ApiBaseUri' d
oes not have
a help commen
t.
�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Invoke-Dom 1 The cmdlet 'I
eneshopApi nvoke-Domenes
Request.ps hopApiRequest
1 ' does not ha
ve a help com
ment.

@MariusStorhaug

Copy link
Copy Markdown
MemberAuthor

Closing because the exact PR head is contained in release/v1.0.0 and consolidated in draft release PR #16.

@MariusStorhaug
Marius Storhaug (MariusStorhaug) deleted the context-credentials-setup branch July 25, 2026 22:59
Marius Storhaug (MariusStorhaug) added a commit that referenced this pull request Jul 26, 2026
Domeneshop users gain authenticated access to the module's domain, DNS,
forwarding, DDNS, and invoice capabilities through a consolidated
pre-1.0 release candidate.
## New: Domeneshop API capabilities
The module adds Context-based credential handling and commands for
querying domains, managing DNS records and forwards, updating DDNS, and
retrieving invoices. Command safety, validation, focused tests, and
command-group documentation are included in the release candidate.
## New: Guided credential setup
Running `Connect-DomeneshopAccount` without `-Secret` or its `-Key`
alias opens the Domeneshop API settings page and securely prompts for
the secret. If a browser is unavailable, the command warns and continues
to the secure prompt. Explicit string and SecureString inputs remain
supported, and `-WhatIf` does not open the browser, prompt, or change
stored contexts.
## Changed: Release tooling and documentation
The release candidate adopts Process-PSModule v6.1.13, enforces Pester
6.x across every test file, consolidates public command tests into
root-level group suites, migrates the generated documentation site to
Zensical, replaces README placeholders with the standard module landing
page, and links each public command's help to its canonical generated
documentation.
---
<details>
<summary>Technical details</summary>
- Integrated PR #11, PR #13, the preserved pull ref for PR #12, PR #14,
and stacked PR #15 in the requested order; each exact source head is
verified as an ancestor of this branch. All five source PRs are now
closed and their remote branches deleted.
- Resolved the PR #11/PR #13 workflow overlap in favor of PR #13's
Process-PSModule v6.1.4 baseline, then updated the consolidated release
to latest Process-PSModule v6.1.13 at immutable commit
`fb1bdb8fefd243292f779d2a856a38db6fe6daf4`.
- Migrated `.github/mkdocs.yml` to `.github/zensical.toml`, satisfying
v6.1.13's Zensical-only documentation pipeline.
- PR #14 was merged explicitly before PR #15; PR #15's existing ancestry
was retained, so only its four standards-hardening commits were
introduced by the later merge.
- Added an integration commit applying PR #13's exact Pester 6.x
requirement to the command tests introduced by PR #15.
- Uses the Standard test-layout profile: grouped public commands are
covered by root-level `tests/<Group>.Tests.ps1` suites (`Auth`, `Ddns`,
`Dns`, `Domains`, `Forwards`, and `Invoices`), while ungrouped and
cross-cutting suites remain separate at the root. Deterministic layout
coverage verifies every public command has a matching `Describe` block
in its expected suite.
- Added interactive credential setup as a separate micro-commit,
including the exact `https://domene.shop/admin?view=api` launch,
`Read-Host -AsSecureString`, `Key` alias, side-effect-free `-WhatIf`
behavior, and a warning-only browser fallback that preserves secure
prompting.
- Added group-aware canonical links first in all 14 public function help
blocks: `https://psmodule.io/Domeneshop/Functions/<FunctionName>/` for
ungrouped commands and
`https://psmodule.io/Domeneshop/Functions/<Group>/<FunctionName>/` for
grouped commands. Deterministic tests require the exact trailing-slash
route and reject missing, incorrect, or secondary-first links.
- Linked clearly owned private Auth helpers to the published public
commands they support while retaining useful secondary Context links.
- Requires PowerShell 7.6, the latest LTS. The generated module manifest
declares `PowerShellVersion = 7.6` and `CompatiblePSEditions = Core`;
legacy Windows PowerShell compatibility branches are intentionally
excluded.
- Rejects whitespace-only API tokens, DDNS values, DNS filters, domain
filters, forward hosts, and smoke-test names before state changes or URI
construction.
- Addressed generated-document lint, reserved context names, empty
secrets, missing context diagnostics, strict WhatIf mutation boundaries,
portable test paths, output contracts, and automated-review findings
discovered during integration.
- Local validation: 83 Pester tests pass, PSScriptAnalyzer reports zero
findings across `src` and `tests`, and `git diff --check` passes.
- Exact-head Process-PSModule v6.1.13 CI succeeds on `9834688` (run
`30180761797`), including Build-Site and all module-local suites across
Linux, macOS, and Windows.
- PSModule/docs PR #86 and Process-PSModule PR #419 are merged, making
latest-LTS support and ternary allowance effective on their default
branches.
</details>
<details>
<summary>Relevant issues (or links)</summary>
- Fixes#2
- #11
- #12
- #13
- #14
- #15
- PSModule/docs#86
- PSModule/Process-PSModule#419
</details>
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@MariusStorhaug